w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
ibdr_dz11.vhd
Go to the documentation of this file.
1-- $Id: ibdr_dz11.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: ibdr_dz11 - syn
7-- Description: ibus dev(rem): DZ11
8--
9-- Dependencies: fifo_simple_dram
10-- ib_rlim_slv
11-- Test bench: xxdp: zdzaj0
12-- Target Devices: generic
13-- Tool versions: ise 8.2-14.7; 2017.2; ghdl 0.35
14--
15-- Revision History:
16-- Date Rev Version Comment
17-- 2019-05-19 1150 1.0 Initial version
18-- 2019-05-01 1144 0.1 First draft
19------------------------------------------------------------------------------
20
21library ieee;
22use ieee.std_logic_1164.all;
23use ieee.numeric_std.all;
24
25use work.slvtypes.all;
26use work.memlib.all;
27use work.iblib.all;
28
29-- ----------------------------------------------------------------------------
30entity ibdr_dz11 is -- ibus dev(rem): DZ11
31 -- fixed address: 160100
32 generic (
33 IB_ADDR : slv16 := slv(to_unsigned(8#160100#,16));
34 AWIDTH : natural := 5); -- fifo address width
35 port (
36 CLK : in slbit; -- clock
37 RESET : in slbit; -- system reset
38 BRESET : in slbit; -- ibus reset
39 RLIM_CEV : in slv8; -- clock enable vector
40 RB_LAM : out slbit; -- remote attention
41 IB_MREQ : in ib_mreq_type; -- ibus request
42 IB_SRES : out ib_sres_type; -- ibus response
43 EI_REQ_RX : out slbit; -- interrupt request, receiver
44 EI_REQ_TX : out slbit; -- interrupt request, transmitter
45 EI_ACK_RX : in slbit; -- interrupt acknowledge, receiver
46 EI_ACK_TX : in slbit -- interrupt acknowledge, transmitter
47 );
48end ibdr_dz11;
49
50architecture syn of ibdr_dz11 is
51
52 -- loc view register naming, offsets and bit definitions
53 constant ibaddr_csr : slv2 := "00"; -- csr address offset
54 constant ibaddr_rbuf_lpr : slv2 := "01"; -- rbuf/lpr address offset
55 constant ibaddr_tcr : slv2 := "10"; -- tcr address offset
56 constant ibaddr_msr_tdr : slv2 := "11"; -- msr/tdr address offset
57
58 constant csr_ibf_trdy : integer := 15;
59 constant csr_ibf_tie : integer := 14;
60 constant csr_ibf_sa : integer := 13;
61 constant csr_ibf_sae : integer := 12;
62 subtype csr_ibf_tline is integer range 10 downto 8;
63 constant csr_ibf_rdone : integer := 7;
64 constant csr_ibf_rie : integer := 6;
65 constant csr_ibf_mse : integer := 5;
66 constant csr_ibf_clr : integer := 4;
67 constant csr_ibf_maint : integer := 3;
68
69 constant rbuf_ibf_val : integer := 15;
70 constant rbuf_ibf_ferr : integer := 13;
71 subtype rbuf_ibf_line is integer range 10 downto 8;
72 subtype rbuf_ibf_data is integer range 7 downto 0;
73
74 constant lpr_ibf_rxon : integer := 12;
75 subtype lpr_ibf_line is integer range 2 downto 0;
76
77 subtype tcr_ibf_dtr is integer range 15 downto 8;
78 subtype tcr_ibf_lena is integer range 7 downto 0;
79
80 subtype msr_ibf_co is integer range 15 downto 8;
81 subtype msr_ibf_ring is integer range 7 downto 0;
82
83 subtype tdr_ibf_brk is integer range 15 downto 8;
84 subtype tdr_ibf_tbuf is integer range 7 downto 0;
85
86 -- rem view register naming, offsets and bit definitions
87 constant ibaddr_cntl : slv2 := "00"; -- cntl address offset
88 constant ibaddr_stat : slv2 := "01"; -- stat address offset
89 constant ibaddr_fuse : slv2 := "10"; -- fuse address offset
90 constant ibaddr_fdat : slv2 := "11"; -- fdat address offset
91
92 -- rem-r view
93 subtype cntl_ibf_awdth is integer range 10 downto 8;
94 subtype cntl_ibf_ssel is integer range 4 downto 3; -- also wr
95 constant cntl_ibf_sam: integer := 7; -- also wr
96 constant cntl_ibf_mse : integer := 2;
97 constant cntl_ibf_maint : integer := 1;
98 -- rem-w view
99 subtype cntl_ibf_data is integer range 15 downto 8;
100 subtype cntl_ibf_rrlim is integer range 14 downto 12;
101 subtype cntl_ibf_trlim is integer range 10 downto 8;
102 constant cntl_ibf_rclr : integer := 6;
103 constant cntl_ibf_tclr : integer := 5;
104 -- cntl_ibf_ssel is integer range 4 downto 3;
105 subtype cntl_ibf_func is integer range 2 downto 0;
106
107 constant func_noop : slv3 := "000"; -- func: noop
108 constant func_sco : slv3 := "001"; -- func: set CO
109 constant func_sring : slv3 := "010"; -- func: set RING
110 constant func_srlim : slv3 := "011"; -- func: set RLIM
111
112 constant ssel_dtle : slv2 := "00"; -- ssel: get DTR and LENA
113 constant ssel_brrx : slv2 := "01"; -- ssel: get BRK and RXON
114 constant ssel_cori : slv2 := "10"; -- ssel: get CO and RING
115 constant ssel_rlcn : slv2 := "11"; -- ssel: get RLIM and CNTL
116
117 constant cal_dtr : slv3 := "000"; -- cal: DTR
118 constant cal_brk : slv3 := "001"; -- cal: BRK
119 constant cal_rxon : slv3 := "010"; -- cal: RXON
120 constant cal_csr : slv3 := "011"; -- cal: CSR
121
122 subtype sdlle_ibf_dtr is integer range 15 downto 8;
123 subtype sdlle_ibf_lena is integer range 7 downto 0;
124 subtype sbrrx_ibf_brk is integer range 15 downto 8;
125 subtype sbrrx_ibf_rxon is integer range 7 downto 0;
126 subtype scori_ibf_co is integer range 15 downto 8;
127 subtype scori_ibf_ring is integer range 7 downto 0;
128 subtype srlcn_ibf_rrlim is integer range 14 downto 12;
129 subtype srlcn_ibf_trlim is integer range 10 downto 8;
130 constant srlcn_ibf_rir : integer := 7;
131 constant srlcn_ibf_tir : integer := 6;
132 constant srlcn_ibf_mse : integer := 5;
133 constant srlcn_ibf_maint: integer := 3;
134
135 subtype fuse_ibf_rsize is integer range AWIDTH-1+8 downto 8;
136 subtype fuse_ibf_tsize is integer range AWIDTH-1 downto 0;
137
138 constant fdat_ibf_val : integer := 15;
139 constant fdat_ibf_last : integer := 14;
140 constant fdat_ibf_ferr : integer := 13;
141 constant fdat_ibf_cal : integer := 11;
142 subtype fdat_ibf_line is integer range 10 downto 8;
143 subtype fdat_ibf_data is integer range 7 downto 0;
144
145 constant fbuf_ibf_cal : integer := 12;
146 constant fbuf_ibf_ferr : integer := 11;
147 subtype fbuf_ibf_line is integer range 10 downto 8;
148 subtype fbuf_ibf_data is integer range 7 downto 0;
149
150 type regs_type is record -- state registers
151 ibsel : slbit; -- ibus select
152 ssel : slv2; -- rcsr: status select
153 rrlim : slv3; -- rcsr: receiver rate limit
154 trlim : slv3; -- rcsr: transmitter rate limit
155 dtr : slv8; -- line state: dtr
156 lena : slv8; -- line state: lena
157 brk : slv8; -- line state: brk
158 rxon : slv8; -- line state: rxon
159 co : slv8; -- line state: co
160 ring : slv8; -- line state: ring
161 trdy : slbit; -- csr: transmitter ready
162 tie : slbit; -- csr: transmitter ie
163 sa : slbit; -- csr: silo alarm
164 sae : slbit; -- csr: silo alarm enable
165 tline : slv3; -- csr: transmit line
166 rdone : slbit; -- csr: receiver done
167 rie : slbit; -- csr: receiver ie
168 mse : slbit; -- csr: master scan enable
169 clr : slbit; -- csr: clear
170 maint : slbit; -- csr: maintenance mode
171 sam : slbit; -- sae monitor
172 lcnt : slv3; -- line counter
173 scnt : slv5; -- silo counter
174 qdtr : slbit; -- queue DTR alert
175 qbrk : slbit; -- queue BRK alert
176 qrxon : slbit; -- queue RXON alert
177 qcsr : slbit; -- queue CSR alert
178 qclr : slbit; -- queue CLR alert
179 rintreq : slbit; -- rx interrupt request
180 tintreq : slbit; -- tx interrupt request
181 end record regs_type;
182
183 constant regs_init : regs_type := (
184 '0', -- ibsel
185 "00","000","000", -- ssel,rrlim,trlim
186 (others=>'0'), -- dtr
187 (others=>'0'), -- lena
188 (others=>'0'), -- brk
189 (others=>'0'), -- rxon
190 (others=>'0'), -- co
191 (others=>'0'), -- ring
192 '0','0','0','0', -- trdy,tie,sa,sae
193 "000", -- tline
194 '0','0','0','0','0', -- rdone,rie,mse,clr,maint
195 '0', -- sam
196 (others=>'0'), -- lcnt
197 (others=>'0'), -- scnt
198 '0','0','0','0','0', -- qdtr,qbrk,qrxon,qcsr,qclr
199 '0','0' -- rintreq,tintreq
200 );
201
202 constant c_fuse1 : slv(AWIDTH-1 downto 0) := slv(to_unsigned(1,AWIDTH));
203
206
207 signal RBUF_CE : slbit := '0';
208 signal RBUF_WE : slbit := '0';
209 signal RBUF_DI : slv12 := (others=>'0');
210 signal RBUF_DO : slv12 := (others=>'0');
211 signal RBUF_RESET : slbit := '0';
212 signal RBUF_EMPTY : slbit := '0';
213 signal RBUF_FULL : slbit := '0';
214 signal RBUF_FUSE : slv(AWIDTH-1 downto 0) := (others=>'0');
215
216 signal TBUF_CE : slbit := '0';
217 signal TBUF_WE : slbit := '0';
218 signal TBUF_DI : slv13 := (others=>'0');
219 signal TBUF_DO : slv13 := (others=>'0');
220 signal TBUF_RESET : slbit := '0';
221 signal TBUF_EMPTY : slbit := '0';
222 signal TBUF_FULL : slbit := '0';
223 signal TBUF_FUSE : slv(AWIDTH-1 downto 0) := (others=>'0');
224
225 signal RRLIM_START : slbit := '0';
226 signal RRLIM_BUSY : slbit := '0';
227 signal TRLIM_START : slbit := '0';
228 signal TRLIM_BUSY : slbit := '0';
229
230 pure function toint (val : slv3) return integer is
231 begin
232 return to_integer(unsigned(val));
233 end function toint;
234
235begin
236 assert AWIDTH>=5 and AWIDTH<=7
237 report "assert(AWIDTH>=5 and AWIDTH<=7): unsupported AWIDTH"
238 severity failure;
239
240 RBUF : fifo_simple_dram
241 generic map (
242 AWIDTH => AWIDTH,
243 DWIDTH => 12) -- FER+LINE(3)+BUF(8)
244 port map (
245 CLK => CLK,
246 RESET => RBUF_RESET,
247 CE => RBUF_CE,
248 WE => RBUF_WE,
249 DI => RBUF_DI,
250 DO => RBUF_DO,
251 EMPTY => RBUF_EMPTY,
252 FULL => RBUF_FULL,
253 SIZE => RBUF_FUSE
254 );
255
256 TBUF : fifo_simple_dram
257 generic map (
258 AWIDTH => AWIDTH,
259 DWIDTH => 13) -- CAL+FER+LINE(3)+BUF(8)
260 port map (
261 CLK => CLK,
262 RESET => TBUF_RESET,
263 CE => TBUF_CE,
264 WE => TBUF_WE,
265 DI => TBUF_DI,
266 DO => TBUF_DO,
267 EMPTY => TBUF_EMPTY,
268 FULL => TBUF_FULL,
269 SIZE => TBUF_FUSE
270 );
271
272 RRLIM : ib_rlim_slv
273 port map (
274 CLK => CLK,
275 RESET => RESET,
277 SEL => R_REGS.rrlim,
279 STOP => BRESET,
280 DONE => open,
282 );
283
284 TRLIM : ib_rlim_slv
285 port map (
286 CLK => CLK,
287 RESET => RESET,
289 SEL => R_REGS.trlim,
291 STOP => BRESET,
292 DONE => open,
294 );
295
296 proc_regs: process (CLK)
297 begin
298 if rising_edge(CLK) then
299 if BRESET='1' or R_REGS.clr='1' then
300 R_REGS <= regs_init;
301 if RESET = '0' then -- if RESET=0 we do just an ibus reset
302 R_REGS.ssel <= N_REGS.ssel; -- keep SSEL field
303 R_REGS.rrlim <= N_REGS.rrlim; -- keep RRLIM field
304 R_REGS.trlim <= N_REGS.trlim; -- keep TRLIM field
305 R_REGS.qclr <= N_REGS.qclr; -- keep clr cal request
306 R_REGS.dtr <= N_REGS.dtr; -- keep DTR (model cntl)
307 R_REGS.co <= N_REGS.co; -- keep CO (model cntl)
308 R_REGS.ring <= N_REGS.ring; -- keep RING (model cntl)
309 end if;
310 else
311 R_REGS <= N_REGS;
312 end if;
313 end if;
314 end process proc_regs;
315
316 proc_next : process (R_REGS, IB_MREQ, EI_ACK_RX, EI_ACK_TX, RESET,
319 variable r : regs_type := regs_init;
320 variable n : regs_type := regs_init;
321 variable idout : slv16 := (others=>'0');
322 variable ibreq : slbit := '0';
323 variable iback : slbit := '0';
324 variable ibrd : slbit := '0';
325 variable ibwr : slbit := '0';
326 variable ibw0 : slbit := '0';
327 variable ibw1 : slbit := '0';
328 variable ilam : slbit := '0';
329 variable irbufdi : slv12 := (others=>'0');
330 variable irbufce : slbit := '0';
331 variable irbufwe : slbit := '0';
332 variable irbufrst : slbit := '0';
333 variable irrlimsta : slbit := '0';
334 variable itbufdi : slv13 := (others=>'0');
335 variable itbufce : slbit := '0';
336 variable itbufwe : slbit := '0';
337 variable itbufrst : slbit := '0';
338 variable itrlimsta : slbit := '0';
339 variable ixbuffull : slbit := '0';
340 variable iscntclr : slbit := '0';
341 begin
342
343 r := R_REGS;
344 n := R_REGS;
345
346 idout := (others=>'0');
347 ibreq := IB_MREQ.re or IB_MREQ.we;
348 iback := r.ibsel and ibreq;
349 ibrd := IB_MREQ.re;
350 ibwr := IB_MREQ.we;
351 ibw0 := IB_MREQ.we and IB_MREQ.be0;
352 ibw1 := IB_MREQ.we and IB_MREQ.be1;
353 ilam := '0';
354 irbufdi := (others=>'0');
355 irbufce := '0';
356 irbufwe := '0';
357 irbufrst := RESET and not r.mse;
358 irrlimsta := '0';
359 itbufdi := (others=>'0');
360 itbufce := '0';
361 itbufwe := '0';
362 itbufrst := RESET;
363 itrlimsta := '0';
364 iscntclr := not r.mse;
365
366 -- setup for rbuf writes
367 if r.maint = '0' then -- not in maint mode (rem fifo write)
368 irbufdi(fbuf_ibf_ferr) := IB_MREQ.din(fdat_ibf_ferr);
369 irbufdi(fbuf_ibf_line) := IB_MREQ.din(fdat_ibf_line);
370 irbufdi(fbuf_ibf_data) := IB_MREQ.din(fdat_ibf_data);
371 else -- in maint mode (loc tbuf write)
372 irbufdi(fbuf_ibf_ferr) := '0'; -- brk ignored on maint mode
373 irbufdi(fbuf_ibf_line) := r.tline;
374 irbufdi(fbuf_ibf_data) := IB_MREQ.din(tdr_ibf_tbuf);
375 end if;
376
377 -- ibus address decoder
378 n.ibsel := '0';
379 if IB_MREQ.aval='1' and
380 IB_MREQ.addr(12 downto 3)=IB_ADDR(12 downto 3) then
381 n.ibsel := '1';
382 end if;
383
384 -- ibus transactions
385 if r.ibsel = '1' then -- ibus selected ---------------------
386
387 -- setup for tbuf writes generated from ibus accesses
388 itbufdi(fbuf_ibf_ferr) := r.brk(toint(r.tline));
389 itbufdi(fbuf_ibf_line) := r.tline;
390 itbufdi(fbuf_ibf_data) := IB_MREQ.din(tdr_ibf_tbuf);
391
392 if IB_MREQ.racc = '1' then -- rri view: rem side access -------
393
394 case IB_MREQ.addr(2 downto 1) is
395
396 when ibaddr_cntl => -- CNTL -- control --------------
397 idout(cntl_ibf_awdth) := slv(to_unsigned(AWIDTH,3));
398 idout(cntl_ibf_sam) := r.sam;
399 idout(cntl_ibf_ssel) := r.ssel;
400 idout(cntl_ibf_mse) := r.mse;
401 idout(cntl_ibf_maint) := r.maint;
402 if ibwr = '1' then
403 if IB_MREQ.din(cntl_ibf_sam) = '1' then
404 n.sam := '0';
405 end if;
406 if IB_MREQ.din(cntl_ibf_rclr) = '1' then
407 irbufrst := '1';
408 end if;
409 if IB_MREQ.din(cntl_ibf_tclr) = '1' then
410 itbufrst := '1';
411 end if;
412 n.ssel := IB_MREQ.din(cntl_ibf_ssel);
413 case IB_MREQ.din(cntl_ibf_func) is -- handle cntl.func ------
414 when func_sco => -- func: set CO ------
415 n.co := IB_MREQ.din(cntl_ibf_data);
416 when func_sring => -- func: set RING ----
417 n.ring := IB_MREQ.din(cntl_ibf_data);
418 when func_srlim => -- func: set RLIM ----
419 n.rrlim := IB_MREQ.din(cntl_ibf_rrlim);
420 n.trlim := IB_MREQ.din(cntl_ibf_trlim);
421 when others => null;
422 end case;
423 end if;
424
425 when ibaddr_stat => -- STAT -- status ---------------
426 case r.ssel is
427 when ssel_dtle => -- ssel: get DTR and LENA
428 idout(sdlle_ibf_dtr) := r.dtr;
429 idout(sdlle_ibf_lena) := r.lena;
430 when ssel_brrx => -- ssel: get BRK and RXON
431 idout(sbrrx_ibf_brk) := r.brk;
432 idout(sbrrx_ibf_rxon) := r.rxon;
433 when ssel_cori => -- ssel: get CO and RING
434 idout(scori_ibf_co) := r.co;
435 idout(scori_ibf_ring) := r.ring;
436 when ssel_rlcn => -- ssel: get CNTL and RLIM
437 idout(srlcn_ibf_rrlim) := r.rrlim;
438 idout(srlcn_ibf_trlim) := r.trlim;
439 idout(srlcn_ibf_rir) := r.rintreq;
440 idout(srlcn_ibf_tir) := r.tintreq;
441 idout(srlcn_ibf_mse) := r.mse;
442 idout(srlcn_ibf_maint) := r.maint;
443 when others => null;
444 end case;
445 if ibrd = '1' then -- advance ssel on read
446 n.ssel := slv(unsigned(r.ssel) + 1);
447 end if;
448 if ibwr = '1' then -- stat is read-only
449 iback := '0';
450 end if;
451
452 when ibaddr_fuse => -- FUSE -- fifo usage -----------
453 idout(fuse_ibf_rsize) := RBUF_FUSE;
454 idout(fuse_ibf_tsize) := TBUF_FUSE;
455
456 when ibaddr_fdat => -- FDAT -- fifo read/write ------
457 idout(fdat_ibf_val) := not TBUF_EMPTY;
458 if TBUF_FUSE = c_fuse1 then
459 idout(fdat_ibf_last) := '1';
460 end if;
465 if ibrd = '1' then -- fifo read
466 if TBUF_EMPTY = '0' then -- fifo not empty
467 itbufce := '1'; -- read from fifo
468 itbufwe := '0';
469 else -- read from empty fifo
470 iback := '0'; -- signal nak
471 end if;
472 end if;
473 if ibwr = '1' then -- fifo write
474 if RBUF_FULL = '0' then -- fifo not full
475 if r.mse='1' and r.maint='0' then -- running and not in maint
476 if r.rxon(toint(IB_MREQ.din(fdat_ibf_line))) = '1' then
477 irbufce := '1'; -- write to fifo
478 irbufwe := '1'; -- with default irbufdi
479 else
480 -- usually the backend is woken up to send more data by an
481 -- attn send when the last RBUF value is read. When all
482 -- data is dropped that never happens. So send an attn
483 -- when a value is dropped and the RBUF is empty.
484 if RBUF_EMPTY = '0' then -- for drop on empty fifo
485 ilam := '1'; -- ask for more data
486 end if;
487 end if;
488 end if;
489 else -- write to full fifo
490 iback := '0'; -- signal nak
491 end if;
492 end if;
493
494 when others => null;
495 end case; -- IB_MREQ.addr
496
497 else -- cpu view: loc side access -------
498 case IB_MREQ.addr(2 downto 1) is
499
500 when ibaddr_csr => -- CSR -- control/status -------
501 idout(csr_ibf_trdy) := r.trdy;
502 idout(csr_ibf_tie) := r.tie;
503 idout(csr_ibf_sa) := r.sa;
504 idout(csr_ibf_sae) := r.sae;
505 idout(csr_ibf_tline) := r.tline;
506 idout(csr_ibf_rdone) := r.rdone;
507 idout(csr_ibf_rie) := r.rie;
508 idout(csr_ibf_mse) := r.mse;
509 idout(csr_ibf_clr) := r.clr;
510 idout(csr_ibf_maint) := r.maint;
511 if ibw1 = '1' then
512 n.tie := IB_MREQ.din(csr_ibf_tie);
513 if IB_MREQ.din(csr_ibf_tie) = '1' then
514 if r.tie='0' and r.trdy='1' then -- tie 0->1 and trdy
515 n.rintreq := '1'; -- request interrupt
516 end if;
517 else
518 n.tintreq := '0';
519 end if;
520 n.sae := IB_MREQ.din(csr_ibf_sae);
521 if IB_MREQ.din(csr_ibf_sae) = '1' then
522 n.sam := '1';
523 end if;
524 end if;
525 if ibw0 = '1' then
526 n.rie := IB_MREQ.din(csr_ibf_rie);
527 if IB_MREQ.din(csr_ibf_rie) = '1' then
528 if r.rie='0' and -- rie 0->1
529 ((r.sae='0' and r.rdone='1') or -- and no silo and rdone
530 (r.sae='1' and r.sa='1')) -- or silo and alarm
531 then
532 n.rintreq := '1';
533 end if;
534 else
535 n.rintreq := '0';
536 end if;
537 n.mse := IB_MREQ.din(csr_ibf_mse);
538 if IB_MREQ.din(csr_ibf_mse) = '0' then -- mse clear
539 n.rdone := '0';
540 n.trdy := '0';
541 end if;
542 if r.mse /= IB_MREQ.din(csr_ibf_mse) then -- mse change
543 n.qcsr := '1';
544 end if;
545 if IB_MREQ.din(csr_ibf_clr) = '1' then -- clr set ?
546 n.clr := '1'; -- request clr
547 n.qclr := '1'; -- queue clr cal
548 end if;
549 n.maint := IB_MREQ.din(csr_ibf_maint);
550 if r.maint /= IB_MREQ.din(csr_ibf_maint) then -- maint change
551 n.qcsr := '1';
552 end if;
553 end if;
554
555 when ibaddr_rbuf_lpr => -- RBUF/LPR ---------------------
556 idout(rbuf_ibf_val) := r.rdone;
560 if ibrd = '1' then -- RBUF read
561 if r.rdone = '1' then
562 irbufce := '1'; -- read next value from fifo
563 irbufwe := '0';
564 if RBUF_FUSE=c_fuse1 and r.maint='0' then -- last val ?
565 ilam := '1'; -- rri lam
566 end if;
567 n.rdone := '0'; -- clear rdone
568 n.sa := '0'; -- clear silo alarm
569 n.rintreq := '0'; -- clear interrupt
570 iscntclr := '1'; -- clear silo count
571 end if;
572 end if;
573 if ibwr = '1' then -- LPR write
574 n.rxon(toint(IB_MREQ.din(lpr_ibf_line))) :=
576 if r.rxon(toint(IB_MREQ.din(lpr_ibf_line))) /=
577 IB_MREQ.din(lpr_ibf_rxon) then -- if changed
578 n.qrxon := '1'; -- queue rxon cal
579 end if;
580 end if;
581
582 when ibaddr_tcr => -- TCR -- transmit control ---
583 idout(tcr_ibf_dtr) := r.dtr;
584 idout(tcr_ibf_lena) := r.lena;
585 if ibw1 = '1' then -- DTR written
586 n.dtr := IB_MREQ.din(tcr_ibf_dtr);
587 if r.dtr /= IB_MREQ.din(tcr_ibf_dtr) then -- if changed
588 n.qdtr := '1'; -- queue dtr cal
589 end if;
590 end if;
591 if ibw0 = '1' then -- LENA written
592 n.lena := IB_MREQ.din(tcr_ibf_lena);
593 -- check if ready and active line is disabled
594 if r.trdy = '1' and
595 IB_MREQ.din(tcr_ibf_lena)(toint(r.tline)) = '0' then
596 n.trdy := '0'; -- clear ready
597 n.tintreq := '0'; -- clear interrupt
598 end if;
599 end if;
600
601 when ibaddr_msr_tdr => -- MSR/TDR ----------------------
602 idout(msr_ibf_co) := r.co;
603 idout(msr_ibf_ring) := r.ring;
604 if ibw1 = '1' then -- BRK written
605 n.brk := IB_MREQ.din(tdr_ibf_brk);
606 if r.brk /= IB_MREQ.din(tdr_ibf_brk) then -- if changed
607 n.qbrk := '1'; -- queue brk cal
608 end if;
609 end if;
610 if ibw0 = '1' then -- TBUF written
611 if r.trdy = '1' then -- ignore buf write when rdy=0
612 n.trdy := '0'; -- clear ready
613 n.tintreq := '0'; -- clear interrupt
614 if r.maint = '0' then -- not in maint mode
615 if TBUF_FULL = '0' then -- fifo not full
616 itbufce := '1'; -- write to fifo
617 itbufwe := '1'; -- with default itbufdi
618 end if;
619 else -- in maint mode
620 if RBUF_FULL = '0' then -- fifo not full
621 if r.rxon(toint(r.tline)) = '1' then -- line enabled ?
622 irbufce := '1'; -- write to fifo
623 irbufwe := '1'; -- with default irbufdi
624 end if;
625 end if;
626 end if;
627 end if;
628 end if;
629
630 when others => null;
631 end case; -- IB_MREQ.addr
632 end if; -- IB_MREQ.racc
633
634 -- silo counter logic
635 if iscntclr = '1' then
636 n.scnt := (others=>'0');
637 elsif irbufwe = '1' then
638 if r.scnt(4) = '0' then
639 n.scnt := slv(unsigned(r.scnt) + 1);
640 end if;
641 end if;
642
643 else -- ibus not selected -----------------
644 -- handle rx done, timer and interrupt
645 if r.sae = '0' then -- silo alarm disabled
646 if RBUF_EMPTY='0' and RRLIM_BUSY='0' then -- not empty and not busy ?
647 if r.rdone = '0' then -- rdone not set ?
648 n.rdone := '1'; -- set rdone
649 irrlimsta := '1'; -- start timer
650 if r.rie = '1' then -- rx irupt enabled ?
651 n.rintreq := '1'; -- request rx irupt
652 end if;
653 end if;
654 end if;
655
656 else -- silo alarm enabled
657 if RBUF_EMPTY = '0' then -- not empty ?
658 if r.rdone = '0' then -- rdone not set ?
659 n.rdone := '1'; -- set rdone
660 if r.scnt(4)='1' and RRLIM_BUSY='0' then -- silo16 and not busy ?
661 if r.sa = '0' then -- sa not set ?
662 n.sa := '1'; -- set sa
663 irrlimsta := '1'; -- start timer
664 if r.rie = '1' then -- rx irupt enabled ?
665 n.rintreq := '1'; -- request rx irupt
666 end if;
667 end if;
668 end if;
669 end if;
670 end if;
671
672 end if; -- else r.sae='0'
673
674 -- handle tx ready, tline, timer and interrupt
675 if r.maint = '0' then
676 ixbuffull := TBUF_FULL;
677 else
678 ixbuffull := RBUF_FULL;
679 end if;
680
681 if ixbuffull='0' and TRLIM_BUSY='0' then -- not full and not busy ?
682 if (r.qdtr or r.qbrk or r.qrxon or r.qcsr) = '0' then -- no cal queued
683 if r.mse = '1' and r.trdy = '0' then -- searching ?
684 if r.lena(toint(r.lcnt)) = '1' then -- line found
685 n.tline := r.lcnt; -- remember line
686 n.trdy := '1'; -- set ready
687 itrlimsta := '1'; -- start timer
688 if r.tie='1' then
689 n.tintreq := '1'; -- request interrupt
690 end if;
691 end if;
692 -- incrementing lcnt here ensures that the start point for the next
693 -- search (n.lcnt) is the line one past the current winner (r.lcnt).
694 n.lcnt := slv(unsigned(r.lcnt) + 1); -- go for next line
695 end if;
696 end if;
697 end if;
698
699 -- handle queue change alerts
700 if TBUF_FULL = '0' then -- fifo space available ?
701 itbufdi(fbuf_ibf_cal) := '1';
702 if r.qdtr = '1' then -- cal DTR pending
703 n.qdtr := '0';
704 itbufdi(fbuf_ibf_line) := cal_dtr;
705 itbufdi(fbuf_ibf_data) := r.dtr;
706 itbufce := '1';
707 itbufwe := '1';
708 elsif r.qbrk = '1' then -- cal BRK pending
709 n.qbrk := '0';
710 itbufdi(fbuf_ibf_line) := cal_brk;
711 itbufdi(fbuf_ibf_data) := r.brk;
712 itbufce := '1';
713 itbufwe := '1';
714 elsif r.qrxon = '1' then -- cal RXON pending
715 n.qrxon := '0';
716 itbufdi(fbuf_ibf_line) := cal_rxon;
717 itbufdi(fbuf_ibf_data) := r.rxon;
718 itbufce := '1';
719 itbufwe := '1';
720 elsif r.qcsr='1' or r.qclr='1' then -- cal CSR pending
721 n.qcsr := '0';
722 n.qclr := '0';
723 itbufdi(fbuf_ibf_line) := cal_csr;
724 itbufdi(fbuf_ibf_data) := (others=>'0');
725 itbufdi(csr_ibf_mse) := r.mse;
726 itbufdi(csr_ibf_clr) := r.qclr;
727 itbufdi(csr_ibf_maint) := r.maint;
728 itbufce := '1';
729 itbufwe := '1';
730 end if;
731 end if;
732 end if; -- else r.ibsel='1'
733
734 if itbufce='1' and itbufwe='1' then -- write to tx fifo
735 if TBUF_EMPTY='1' then -- first write to empty tx fifo
736 ilam := '1'; -- request attention
737 end if;
738 end if;
739
740 -- other state changes
741
742 if EI_ACK_RX = '1' then
743 n.rintreq := '0';
744 end if;
745 if EI_ACK_TX = '1' then
746 n.tintreq := '0';
747 end if;
748
749 N_REGS <= n;
750
751 RBUF_RESET <= irbufrst;
752 RBUF_CE <= irbufce;
753 RBUF_WE <= irbufwe;
754 RBUF_DI <= irbufdi;
755 RRLIM_START <= irrlimsta;
756
757 TBUF_RESET <= itbufrst;
758 TBUF_CE <= itbufce;
759 TBUF_WE <= itbufwe;
760 TBUF_DI <= itbufdi;
761 TRLIM_START <= itrlimsta;
762
763 IB_SRES.dout <= idout;
764 IB_SRES.ack <= iback;
765 IB_SRES.busy <= '0';
766
767 RB_LAM <= ilam;
768 EI_REQ_RX <= r.rintreq;
769 EI_REQ_TX <= r.tintreq;
770
771 end process proc_next;
772
773end syn;
out DO slv( DWIDTH- 1 downto 0)
in DI slv( DWIDTH- 1 downto 0)
AWIDTH positive := 6
out SIZE slv( AWIDTH- 1 downto 0)
DWIDTH positive := 16
in STOP slbit
Definition: ib_rlim_slv.vhd:46
in RESET slbit
Definition: ib_rlim_slv.vhd:42
out BUSY slbit
Definition: ib_rlim_slv.vhd:49
out DONE slbit
Definition: ib_rlim_slv.vhd:47
in CLK slbit
Definition: ib_rlim_slv.vhd:41
in SEL slv3
Definition: ib_rlim_slv.vhd:44
in RLIM_CEV slv8
Definition: ib_rlim_slv.vhd:43
in START slbit
Definition: ib_rlim_slv.vhd:45
slv3 := "011" cal_csr
Definition: ibdr_dz11.vhd:120
integer range 10 downto 8 cntl_ibf_trlim
Definition: ibdr_dz11.vhd:101
slv( AWIDTH- 1 downto 0) :=( others => '0') RBUF_FUSE
Definition: ibdr_dz11.vhd:214
integer := 15 csr_ibf_trdy
Definition: ibdr_dz11.vhd:58
integer range 10 downto 8 fdat_ibf_line
Definition: ibdr_dz11.vhd:142
integer range 7 downto 0 fbuf_ibf_data
Definition: ibdr_dz11.vhd:148
ib_rlim_slv trlimtrlim
Definition: ibdr_dz11.vhd:294
slv2 := "10" ssel_cori
Definition: ibdr_dz11.vhd:114
integer range AWIDTH- 1 downto 0 fuse_ibf_tsize
Definition: ibdr_dz11.vhd:136
integer := 14 csr_ibf_tie
Definition: ibdr_dz11.vhd:59
slbit := '0' RBUF_WE
Definition: ibdr_dz11.vhd:208
integer range 10 downto 8 srlcn_ibf_trlim
Definition: ibdr_dz11.vhd:129
integer := 15 rbuf_ibf_val
Definition: ibdr_dz11.vhd:69
slv3 := "000" func_noop
Definition: ibdr_dz11.vhd:107
integer := 7 srlcn_ibf_rir
Definition: ibdr_dz11.vhd:130
regs_type :=( '0', "00", "000", "000",( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'), '0', '0', '0', '0', "000", '0', '0', '0', '0', '0', '0',( others => '0'),( others => '0'), '0', '0', '0', '0', '0', '0', '0') regs_init
Definition: ibdr_dz11.vhd:183
slbit := '0' TRLIM_BUSY
Definition: ibdr_dz11.vhd:228
integer range 10 downto 8 fbuf_ibf_line
Definition: ibdr_dz11.vhd:147
slbit := '0' RBUF_FULL
Definition: ibdr_dz11.vhd:213
integer := 13 fdat_ibf_ferr
Definition: ibdr_dz11.vhd:140
integer range 14 downto 12 cntl_ibf_rrlim
Definition: ibdr_dz11.vhd:100
ib_rlim_slv rrlimrrlim
Definition: ibdr_dz11.vhd:282
slv( AWIDTH- 1 downto 0) := slv( to_unsigned( 1, AWIDTH) ) c_fuse1
Definition: ibdr_dz11.vhd:202
integer := 12 csr_ibf_sae
Definition: ibdr_dz11.vhd:61
slv2 := "10" ibaddr_tcr
Definition: ibdr_dz11.vhd:55
slv2 := "11" ibaddr_msr_tdr
Definition: ibdr_dz11.vhd:56
integer range 14 downto 12 srlcn_ibf_rrlim
Definition: ibdr_dz11.vhd:128
slv12 :=( others => '0') RBUF_DI
Definition: ibdr_dz11.vhd:209
integer range 4 downto 3 cntl_ibf_ssel
Definition: ibdr_dz11.vhd:94
slv13 :=( others => '0') TBUF_DO
Definition: ibdr_dz11.vhd:219
slv3 := "010" cal_rxon
Definition: ibdr_dz11.vhd:119
regs_type := regs_init N_REGS
Definition: ibdr_dz11.vhd:205
integer range 15 downto 8 msr_ibf_co
Definition: ibdr_dz11.vhd:80
slv3 := "000" cal_dtr
Definition: ibdr_dz11.vhd:117
slbit := '0' TBUF_WE
Definition: ibdr_dz11.vhd:217
integer range 7 downto 0 msr_ibf_ring
Definition: ibdr_dz11.vhd:81
slv13 :=( others => '0') TBUF_DI
Definition: ibdr_dz11.vhd:218
integer range 15 downto 8 tcr_ibf_dtr
Definition: ibdr_dz11.vhd:77
integer := 3 csr_ibf_maint
Definition: ibdr_dz11.vhd:67
slbit := '0' TRLIM_START
Definition: ibdr_dz11.vhd:227
integer range 10 downto 8 rbuf_ibf_line
Definition: ibdr_dz11.vhd:71
integer := 12 lpr_ibf_rxon
Definition: ibdr_dz11.vhd:74
integer := 7 cntl_ibf_sam
Definition: ibdr_dz11.vhd:95
slbit := '0' TBUF_CE
Definition: ibdr_dz11.vhd:216
slbit := '0' RBUF_EMPTY
Definition: ibdr_dz11.vhd:212
integer := 7 csr_ibf_rdone
Definition: ibdr_dz11.vhd:63
integer range 7 downto 0 rbuf_ibf_data
Definition: ibdr_dz11.vhd:72
integer := 6 csr_ibf_rie
Definition: ibdr_dz11.vhd:64
slv2 := "00" ssel_dtle
Definition: ibdr_dz11.vhd:112
integer := 5 csr_ibf_mse
Definition: ibdr_dz11.vhd:65
integer range 10 downto 8 cntl_ibf_awdth
Definition: ibdr_dz11.vhd:93
integer := 6 srlcn_ibf_tir
Definition: ibdr_dz11.vhd:131
integer := 14 fdat_ibf_last
Definition: ibdr_dz11.vhd:139
integer range 7 downto 0 tdr_ibf_tbuf
Definition: ibdr_dz11.vhd:84
slv2 := "10" ibaddr_fuse
Definition: ibdr_dz11.vhd:89
integer range 15 downto 8 scori_ibf_co
Definition: ibdr_dz11.vhd:126
slbit := '0' RRLIM_BUSY
Definition: ibdr_dz11.vhd:226
integer := 5 cntl_ibf_tclr
Definition: ibdr_dz11.vhd:103
integer := 5 srlcn_ibf_mse
Definition: ibdr_dz11.vhd:132
integer range 7 downto 0 scori_ibf_ring
Definition: ibdr_dz11.vhd:127
slv2 := "00" ibaddr_csr
Definition: ibdr_dz11.vhd:53
slbit := '0' RRLIM_START
Definition: ibdr_dz11.vhd:225
regs_type := regs_init R_REGS
Definition: ibdr_dz11.vhd:204
integer := 3 srlcn_ibf_maint
Definition: ibdr_dz11.vhd:133
integer := 6 cntl_ibf_rclr
Definition: ibdr_dz11.vhd:102
slv2 := "01" ibaddr_stat
Definition: ibdr_dz11.vhd:88
integer range 15 downto 8 cntl_ibf_data
Definition: ibdr_dz11.vhd:99
integer range 15 downto 8 sdlle_ibf_dtr
Definition: ibdr_dz11.vhd:122
slv2 := "01" ibaddr_rbuf_lpr
Definition: ibdr_dz11.vhd:54
integer range 2 downto 0 cntl_ibf_func
Definition: ibdr_dz11.vhd:105
slbit := '0' TBUF_EMPTY
Definition: ibdr_dz11.vhd:221
slv2 := "00" ibaddr_cntl
Definition: ibdr_dz11.vhd:87
slv3 := "001" cal_brk
Definition: ibdr_dz11.vhd:118
integer := 13 csr_ibf_sa
Definition: ibdr_dz11.vhd:60
integer range 7 downto 0 sbrrx_ibf_rxon
Definition: ibdr_dz11.vhd:125
integer := 11 fbuf_ibf_ferr
Definition: ibdr_dz11.vhd:146
slbit := '0' RBUF_RESET
Definition: ibdr_dz11.vhd:211
integer range 10 downto 8 csr_ibf_tline
Definition: ibdr_dz11.vhd:62
integer range 15 downto 8 tdr_ibf_brk
Definition: ibdr_dz11.vhd:83
slv3 := "011" func_srlim
Definition: ibdr_dz11.vhd:110
integer range AWIDTH- 1+ 8 downto 8 fuse_ibf_rsize
Definition: ibdr_dz11.vhd:135
slv2 := "01" ssel_brrx
Definition: ibdr_dz11.vhd:113
slv12 :=( others => '0') RBUF_DO
Definition: ibdr_dz11.vhd:210
integer range 7 downto 0 tcr_ibf_lena
Definition: ibdr_dz11.vhd:78
slbit := '0' TBUF_RESET
Definition: ibdr_dz11.vhd:220
integer := 12 fbuf_ibf_cal
Definition: ibdr_dz11.vhd:145
integer := 2 cntl_ibf_mse
Definition: ibdr_dz11.vhd:96
slv2 := "11" ssel_rlcn
Definition: ibdr_dz11.vhd:115
slbit := '0' TBUF_FULL
Definition: ibdr_dz11.vhd:222
integer range 7 downto 0 fdat_ibf_data
Definition: ibdr_dz11.vhd:143
integer := 11 fdat_ibf_cal
Definition: ibdr_dz11.vhd:141
integer := 4 csr_ibf_clr
Definition: ibdr_dz11.vhd:66
integer := 1 cntl_ibf_maint
Definition: ibdr_dz11.vhd:97
slbit := '0' RBUF_CE
Definition: ibdr_dz11.vhd:207
slv( AWIDTH- 1 downto 0) :=( others => '0') TBUF_FUSE
Definition: ibdr_dz11.vhd:223
integer range 15 downto 8 sbrrx_ibf_brk
Definition: ibdr_dz11.vhd:124
slv3 := "001" func_sco
Definition: ibdr_dz11.vhd:108
integer := 13 rbuf_ibf_ferr
Definition: ibdr_dz11.vhd:70
integer range 2 downto 0 lpr_ibf_line
Definition: ibdr_dz11.vhd:75
integer range 7 downto 0 sdlle_ibf_lena
Definition: ibdr_dz11.vhd:123
slv3 := "010" func_sring
Definition: ibdr_dz11.vhd:109
slv2 := "11" ibaddr_fdat
Definition: ibdr_dz11.vhd:90
integer := 15 fdat_ibf_val
Definition: ibdr_dz11.vhd:138
in RESET slbit
Definition: ibdr_dz11.vhd:37
AWIDTH natural := 5
Definition: ibdr_dz11.vhd:34
in EI_ACK_TX slbit
Definition: ibdr_dz11.vhd:47
in EI_ACK_RX slbit
Definition: ibdr_dz11.vhd:45
in BRESET slbit
Definition: ibdr_dz11.vhd:38
IB_ADDR slv16 := slv( to_unsigned( 8#160100#, 16) )
Definition: ibdr_dz11.vhd:33
out RB_LAM slbit
Definition: ibdr_dz11.vhd:40
in CLK slbit
Definition: ibdr_dz11.vhd:36
out EI_REQ_RX slbit
Definition: ibdr_dz11.vhd:43
in IB_MREQ ib_mreq_type
Definition: ibdr_dz11.vhd:41
out IB_SRES ib_sres_type
Definition: ibdr_dz11.vhd:42
in RLIM_CEV slv8
Definition: ibdr_dz11.vhd:39
out EI_REQ_TX slbit
Definition: ibdr_dz11.vhd:44
Definition: iblib.vhd:33
std_logic_vector( 12 downto 0) slv13
Definition: slvtypes.vhd:45
std_logic_vector( 4 downto 0) slv5
Definition: slvtypes.vhd:37
std_logic_vector( 11 downto 0) slv12
Definition: slvtypes.vhd:44
std_logic_vector( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31