w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tst_mig.vhd
Go to the documentation of this file.
1-- $Id: tst_mig.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2018- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: tst_mig - syn
7-- Description: test of mig
8--
9-- Dependencies: -
10--
11-- Test bench: arty/tb/tb_tst_mig_arty (with ddr3 via mig)
12-- nexys4d/tb/tb_tst_mig_n4d (with ddr2 via mig)
13--
14-- Target Devices: generic
15-- Tool versions: viv 2017.2; ghdl 0.34
16--
17-- Revision History:
18-- Date Rev Version Comment
19-- 2018-12-28 1096 1.0 Initial version
20-- 2018-12-23 1092 0.1 First draft
21------------------------------------------------------------------------------
22--
23-- rbus registers:
24--
25-- Addr Bits Name r/w/f Function
26-- 00000 cntl -/-/f Control register
27-- 15:13 cmd 0/w/- commmand code for func=cmd
28-- 12 wren 0/w/- wren option for func=cmd
29-- 11 dwend 0/w/- disable wend for func=cmd,wren
30-- 03:00 func 0/-/f function command
31-- 0000 noop
32-- 0001 rd read memory
33-- 0010 wr write memory
34-- 0011 pat sample rdy pattern
35-- 0100 ref refresh
36-- 0101 cal ZQ cal
37-- 0110 cmd send command to mem
38-- 0111 wren send wren strobe to mem
39-- 00001 stat r/-/- Status register
40-- 06 zqpend r/-/- ZQ cal req pending
41-- 05 refpend r/-/- refresh req pending
42-- 04 rdend r/-/- RD_DATA_END seen
43-- 03 uirst r/-/- reset from ui
44-- 02 caco r/-/- calibration complete
45-- 01 wrdy r/-/- write ready
46-- 00 crdy r/-/- cmd ready
47-- 00010 conf r/-/- Configuration register
48-- 9:05 mawidth r/-/- MAWIDTH
49-- 4:00 mwidth r/-/- MWIDTH
50-- 00011 15:00 mask r/w/- Mask register
51-- 00100 15:00 addrl r/w/- Address register (low part)
52-- 00101 15:00 addrh r/w/- Address register (high part)
53-- 00110 15:00 temp r/-/- Device temperature
54-- 00111 15:00 dvalcnt r/-/- Data valid counter
55-- 01000 15:00 crpat r/-/- Command ready pattern
56-- 01001 15:00 wrpat r/-/- Write ready pattern
57-- 01010 15:00 cwait r/-/- Command wait
58-- 01011 15:00 rwait r/-/- Read wait
59-- 01100 15:00 xwait r/-/- Request wait
60-- 01101 ircnt r/-/- Init/Reset count
61-- 15:08 rstcnt r/-/- reset count
62-- 7:00 inicnt r/-/- init count
63-- 01110 15:00 rsttime r/-/- length of last reset
64-- 01111 15:00 initime r/-/- length of last init
65-- 10xxx datrd[0-7] r/-/- Data read register
66-- 11xxx datwr[0-7] r/w/- Data write register
67
68-- ----------------------------------------------------------------------------
69
70library ieee;
71use ieee.std_logic_1164.all;
72use ieee.numeric_std.all;
73
74use work.slvtypes.all;
75use work.rutil.all;
76use work.memlib.all;
77use work.rblib.all;
78
79-- ----------------------------------------------------------------------------
80
81entity tst_mig is -- tester for mig
82 generic (
83 RB_ADDR : slv16 := slv(to_unsigned(2#0000000000000000#,16));
84 MAWIDTH : natural := 28;
85 MWIDTH : natural := 16);
86 port (
87 CLK : in slbit; -- clock
88 CE_USEC : in slbit; -- usec pulse
89 RESET : in slbit; -- reset
90 RB_MREQ : in rb_mreq_type; -- rbus: request
91 RB_SRES : out rb_sres_type; -- rbus: response
92 RB_STAT : out slv4; -- rbus: status flags
93 RB_LAM : out slbit; -- remote attention
94 APP_ADDR : out slv(MAWIDTH-1 downto 0); -- MIGUI address
95 APP_CMD : out slv3; -- MIGUI command
96 APP_EN : out slbit; -- MIGUI command enable
97 APP_WDF_DATA : out slv(8*MWIDTH-1 downto 0);-- MIGUI write data
98 APP_WDF_END : out slbit; -- MIGUI write end
99 APP_WDF_MASK : out slv(MWIDTH-1 downto 0); -- MIGUI write mask
100 APP_WDF_WREN : out slbit; -- MIGUI write enable
101 APP_RD_DATA : in slv(8*MWIDTH-1 downto 0);-- MIGUI read data
102 APP_RD_DATA_END : in slbit; -- MIGUI read end
103 APP_RD_DATA_VALID : in slbit; -- MIGUI read valid
104 APP_RDY : in slbit; -- MIGUI ready for cmd
105 APP_WDF_RDY : in slbit; -- MIGUI ready for data write
106 APP_SR_REQ : out slbit; -- MIGUI reserved (tie to 0)
107 APP_REF_REQ : out slbit; -- MIGUI refresh request
108 APP_ZQ_REQ : out slbit; -- MIGUI ZQ calibrate request
109 APP_SR_ACTIVE : in slbit; -- MIGUI reserved (ignore)
110 APP_REF_ACK : in slbit; -- MIGUI refresh acknowledge
111 APP_ZQ_ACK : in slbit; -- MIGUI ZQ calibrate acknowledge
112 MIG_UI_CLK_SYNC_RST : in slbit; -- MIGUI reset
113 MIG_INIT_CALIB_COMPLETE : in slbit; -- MIGUI calibration done
114 MIG_DEVICE_TEMP_I : in slv12 -- MIGUI xadc temperature
115 );
116end tst_mig;
117
118architecture syn of tst_mig is
119
120 type state_type is (
121 s_idle, -- s_idle: wait for input
122 s_rdcwait, -- s_rdcwait: read cmd wait
123 s_rdrwait, -- s_rdrwait: read res wait
124 s_wrcwait, -- s_wrcwait: write cmd wait
125 s_cmdwait, -- s_cmdwait: cmd wait
126 s_wrenwait -- s_wrenwait: wren wait
127 );
128
129 type regs_type is record
130 state : state_type; -- state
131 rbsel : slbit; -- rbus select
132 mask : slv16; -- memory mask
133 addr : slv32; -- memory address
134 datrd : slv(127 downto 0); -- memory data read
135 datwr : slv(127 downto 0); -- memory data write
136 dvalcnt : slv16; -- data valid counter
137 crpat : slv16; -- command ready pattern
138 wrpat : slv16; -- write ready pattern
139 cwait : slv16; -- command wait counter
140 rwait : slv16; -- read wait counter
141 xwait : slv16; -- request wait counter
142 rstcnt : slv8; -- reset counter
143 inicnt : slv8; -- init counter
144 rsttime : slv16; -- reset time counter
145 initime : slv16; -- init time counter
146 crsreg : slv15; -- command ready shift register
147 wrsreg : slv15; -- write ready shift register
148 rdend : slbit; -- RD_DATA_END capture
149 refpend : slbit; -- ref req pending
150 zqpend : slbit; -- zq req pending
151 caco_1 : slbit; -- last caco
152 uirst_1 : slbit; -- last uirst
153 end record regs_type;
154
155 constant regs_init : regs_type := (
156 s_idle, -- state
157 '0', -- rbsel
158 (others=>'0'), -- mask
159 (others=>'0'), -- addr
160 (others=>'0'), -- datrd
161 (others=>'0'), -- datwr
162 (others=>'0'), -- dvalcnt
163 (others=>'0'), -- crpat
164 (others=>'0'), -- wrpat
165 (others=>'0'), -- cwait
166 (others=>'0'), -- rwait
167 (others=>'0'), -- xwait
168 (others=>'0'), -- rstcnt
169 (others=>'0'), -- inicnt
170 (others=>'0'), -- rsttime
171 (others=>'0'), -- initime
172 (others=>'0'), -- crsreg
173 (others=>'0'), -- wrsreg
174 '0','0','0', -- rdend,refpend,zqpend
175 '0','0' -- caco_1,uirst_1
176 );
177
179 signal N_REGS : regs_type; -- don't init (vivado fix for fsm infer)
180
181 constant rbaddr_cntl: slv5 := "00000"; -- 0 -/-/f
182 constant rbaddr_stat: slv5 := "00001"; -- 1 r/-/-
183 constant rbaddr_conf: slv5 := "00010"; -- 2 r/-/-
184 constant rbaddr_mask: slv5 := "00011"; -- 3 r/w/-
185 constant rbaddr_addrl: slv5 := "00100"; -- 4 r/w/-
186 constant rbaddr_addrh: slv5 := "00101"; -- 5 r/w/-
187 constant rbaddr_temp: slv5 := "00110"; -- 6 r/-/-
188 constant rbaddr_dvalcnt: slv5 := "00111"; -- 7 r/-/-
189 constant rbaddr_crpat: slv5 := "01000"; -- 8 r/-/-
190 constant rbaddr_wrpat: slv5 := "01001"; -- 9 r/-/-
191 constant rbaddr_cwait: slv5 := "01010"; -- 10 r/-/-
192 constant rbaddr_rwait: slv5 := "01011"; -- 11 r/-/-
193 constant rbaddr_xwait: slv5 := "01100"; -- 12 r/-/-
194 constant rbaddr_ircnt: slv5 := "01101"; -- 13 r/-/-
195 constant rbaddr_rsttime: slv5 := "01110"; -- 14 r/-/-
196 constant rbaddr_initime: slv5 := "01111"; -- 15 r/-/-
197 constant rbaddr_datrd0: slv5 := "10000"; -- 16 r/-/-
198 constant rbaddr_datrd1: slv5 := "10001"; -- 17 r/-/-
199 constant rbaddr_datrd2: slv5 := "10010"; -- 18 r/-/-
200 constant rbaddr_datrd3: slv5 := "10011"; -- 19 r/-/-
201 constant rbaddr_datrd4: slv5 := "10100"; -- 20 r/-/-
202 constant rbaddr_datrd5: slv5 := "10101"; -- 21 r/-/-
203 constant rbaddr_datrd6: slv5 := "10110"; -- 22 r/-/-
204 constant rbaddr_datrd7: slv5 := "10111"; -- 23 r/-/-
205 constant rbaddr_datwr0: slv5 := "11000"; -- 14 r/w/-
206 constant rbaddr_datwr1: slv5 := "11001"; -- 15 r/w/-
207 constant rbaddr_datwr2: slv5 := "11010"; -- 16 r/w/-
208 constant rbaddr_datwr3: slv5 := "11011"; -- 17 r/w/-
209 constant rbaddr_datwr4: slv5 := "11100"; -- 28 r/w/-
210 constant rbaddr_datwr5: slv5 := "11101"; -- 29 r/w/-
211 constant rbaddr_datwr6: slv5 := "11110"; -- 30 r/w/-
212 constant rbaddr_datwr7: slv5 := "11111"; -- 31 r/w/-
213
214 subtype cntl_rbf_cmd is integer range 15 downto 13;
215 constant cntl_rbf_wren : integer := 12;
216 constant cntl_rbf_dwend : integer := 11;
217 subtype cntl_rbf_func is integer range 3 downto 0;
218
219 constant stat_rbf_zqpend : integer := 6;
220 constant stat_rbf_refpend : integer := 5;
221 constant stat_rbf_rdend : integer := 4;
222 constant stat_rbf_uirst : integer := 3;
223 constant stat_rbf_caco : integer := 2;
224 constant stat_rbf_wrdy : integer := 1;
225 constant stat_rbf_crdy : integer := 0;
226
227 subtype conf_rbf_mawidth is integer range 9 downto 5;
228 subtype conf_rbf_mwidth is integer range 4 downto 0;
229
230 subtype ircnt_rbf_rstcnt is integer range 15 downto 8;
231 subtype ircnt_rbf_inicnt is integer range 7 downto 0;
232
233 constant func_noop : slv4 := "0000"; -- func: noop
234 constant func_rd : slv4 := "0001"; -- func: rd read memory
235 constant func_wr : slv4 := "0010"; -- func: wr write memory
236 constant func_pat : slv4 := "0011"; -- func: pat sample rdy pattern
237 constant func_ref : slv4 := "0100"; -- func: ref refresh
238 constant func_cal : slv4 := "0101"; -- func: cal ZQ cal
239 constant func_cmd : slv4 := "0110"; -- func: cmd send command to mem
240 constant func_wren : slv4 := "0111"; -- func: wren send wren strobe to mem
241
242 subtype df_word0 is integer range 15 downto 0;
243 subtype df_word1 is integer range 31 downto 16;
244 subtype df_word2 is integer range 47 downto 32;
245 subtype df_word3 is integer range 63 downto 48;
246 subtype df_word4 is integer range 79 downto 64;
247 subtype df_word5 is integer range 95 downto 80;
248 subtype df_word6 is integer range 111 downto 96;
249 subtype df_word7 is integer range 127 downto 112;
250
251 constant migui_cmd_read : slv3 := "001";
252 constant migui_cmd_write : slv3 := "000";
253
254begin
255
256 assert MAWIDTH <= 32
257 report "assert(MAWIDTH <= 32): unsupported MAWIDTH"
258 severity failure;
259 assert MWIDTH = 8 or MWIDTH = 16
260 report "assert(MWIDTH = 8 or 16): unsupported MWIDTH"
261 severity failure;
262
263 proc_regs: process (CLK)
264 begin
265
266 if rising_edge(CLK) then
267 if RESET = '1' then
268 R_REGS <= regs_init;
269 else
270 R_REGS <= N_REGS;
271 end if;
272 end if;
273
274 end process proc_regs;
275
276 proc_next: process (R_REGS, RB_MREQ, CE_USEC,
281
282 variable r : regs_type := regs_init;
283 variable n : regs_type := regs_init;
284
285 variable irb_ack : slbit := '0';
286 variable irb_busy : slbit := '0';
287 variable irb_err : slbit := '0';
288 variable irb_dout : slv16 := (others=>'0');
289 variable irbena : slbit := '0'; -- re or we -> rbus request
290
291 variable iappcmd : slv3 := (others=>'0');
292 variable iappen : slbit := '0';
293 variable iappwren : slbit := '0';
294 variable iappwend : slbit := '0';
295 variable iappref : slbit := '0';
296 variable iappzq : slbit := '0';
297
298 variable ncrpat : slv16 := (others=>'0');
299 variable nwrpat : slv16 := (others=>'0');
300
301 begin
302
303 r := R_REGS;
304 n := R_REGS;
305
306 irb_ack := '0';
307 irb_busy := '0';
308 irb_err := '0';
309 irb_dout := (others=>'0');
310
311 iappcmd := migui_cmd_read;
312 iappen := '0';
313 iappwren := '0';
314 iappwend := '0';
315 iappref := '0';
316 iappzq := '0';
317 ncrpat := r.crsreg & APP_RDY; -- current ready patterns
318 nwrpat := r.wrsreg & APP_WDF_RDY;
319
320 irbena := RB_MREQ.re or RB_MREQ.we;
321
322 -- rbus address decoder
323 n.rbsel := '0';
324 if RB_MREQ.aval='1' and RB_MREQ.addr(15 downto 5)=RB_ADDR(15 downto 5) then
325 n.rbsel := '1';
326 end if;
327
328 if r.rbsel='1' and irbena='1' then
329 irb_ack := '1'; -- ack all (maybe rejected later)
330 end if;
331
332 case r.state is
333
334 when s_idle => -- s_idle: ---------------------------
335 -- rbus transactions
336 if r.rbsel = '1' then
337
338 case RB_MREQ.addr(4 downto 0) is
339
340 when rbaddr_cntl => -- cntl ---------------
341 if RB_MREQ.we = '1' then
342 case RB_MREQ.din(cntl_rbf_func) is
343 when func_noop => null; -- func: noop -----
344 when func_rd => -- func: rd -------
345 n.rdend := '0';
346 n.cwait := (others=>'0');
347 n.rwait := (others=>'0');
348 irb_busy := '1';
349 n.state := s_rdcwait;
350
351 when func_wr => -- func: wr -------
352 n.cwait := (others=>'0');
353 n.rwait := (others=>'0');
354 irb_busy := '1';
355 n.state := s_wrcwait;
356
357 when func_pat => -- func: pat ------
358 n.crpat := ncrpat;
359 n.wrpat := nwrpat;
360
361 when func_ref => -- func: ref ------
362 n.xwait := (others=>'0');
363 if r.refpend = '0' then
364 n.refpend := '1';
365 iappref := '1';
366 else
367 irb_err := '1';
368 end if;
369
370 when func_cal => -- func: cal ------
371 n.xwait := (others=>'0');
372 if r.zqpend = '0' then
373 n.zqpend := '1';
374 iappzq := '1';
375 else
376 irb_err := '1';
377 end if;
378
379 when func_cmd => -- func: cmd ------
380 n.cwait := (others=>'0');
381 n.rwait := (others=>'0');
382 irb_busy := '1';
383 n.state := s_cmdwait;
384
385 when func_wren => -- func: wren -----
386 n.cwait := (others=>'0');
387 n.rwait := (others=>'0');
388 irb_busy := '1';
389 n.state := s_wrenwait;
390
391 when others => -- <> not yet defined codes
392 irb_err := '1';
393 end case;
394 end if;
395
396 when rbaddr_stat => irb_err := RB_MREQ.we;
397 when rbaddr_conf => irb_err := RB_MREQ.we;
398
399 when rbaddr_mask => -- mask ---------------
400 if RB_MREQ.we = '1' then
401 n.mask := RB_MREQ.din;
402 end if;
403
404 when rbaddr_addrl => -- addrl --------------
405 if RB_MREQ.we = '1' then n.addr(df_word0) := RB_MREQ.din; end if;
406 when rbaddr_addrh => -- addrh --------------
407 if RB_MREQ.we = '1' then n.addr(df_word1) := RB_MREQ.din; end if;
408
409 when rbaddr_temp => irb_err := RB_MREQ.we;
410 when rbaddr_dvalcnt => irb_err := RB_MREQ.we;
411 when rbaddr_crpat => irb_err := RB_MREQ.we;
412 when rbaddr_wrpat => irb_err := RB_MREQ.we;
413 when rbaddr_cwait => irb_err := RB_MREQ.we;
414 when rbaddr_rwait => irb_err := RB_MREQ.we;
415 when rbaddr_xwait => irb_err := RB_MREQ.we;
416 when rbaddr_ircnt => irb_err := RB_MREQ.we;
417 when rbaddr_rsttime => irb_err := RB_MREQ.we;
418 when rbaddr_initime => irb_err := RB_MREQ.we;
419
420 when rbaddr_datrd0|rbaddr_datrd1| -- datrd* ----------------
423 rbaddr_datrd6|rbaddr_datrd7 => irb_err := RB_MREQ.we;
424
425 when rbaddr_datwr0 => -- datwr* ----------------
426 if RB_MREQ.we = '1' then n.datwr(df_word0) := RB_MREQ.din; end if;
427 when rbaddr_datwr1 =>
428 if RB_MREQ.we = '1' then n.datwr(df_word1) := RB_MREQ.din; end if;
429 when rbaddr_datwr2 =>
430 if RB_MREQ.we = '1' then n.datwr(df_word2) := RB_MREQ.din; end if;
431 when rbaddr_datwr3 =>
432 if RB_MREQ.we = '1' then n.datwr(df_word3) := RB_MREQ.din; end if;
433 when rbaddr_datwr4 =>
434 if RB_MREQ.we = '1' then n.datwr(df_word4) := RB_MREQ.din; end if;
435 when rbaddr_datwr5 =>
436 if RB_MREQ.we = '1' then n.datwr(df_word5) := RB_MREQ.din; end if;
437 when rbaddr_datwr6 =>
438 if RB_MREQ.we = '1' then n.datwr(df_word6) := RB_MREQ.din; end if;
439 when rbaddr_datwr7 =>
440 if RB_MREQ.we = '1' then n.datwr(df_word7) := RB_MREQ.din; end if;
441
442 when others => -- <> --------------------
443 irb_ack := '0';
444 end case;
445 end if;
446
447 when s_rdcwait => -- s_rdcwait -------------------------
448 iappcmd := migui_cmd_read; -- setup cmd
449 n.crpat := ncrpat; -- follow RDY patterns
450 n.wrpat := nwrpat;
451 if r.rbsel='0' or irbena='0' then -- rbus cycle abort
452 n.state := s_idle;
453 else
454 if APP_RDY = '1' then
455 iappen := '1';
456 irb_busy := '1';
457 n.state := s_rdrwait;
458 else
459 n.cwait := slv(unsigned(r.cwait) + 1);
460 irb_busy := '1';
461 end if;
462 end if;
463
464 when s_rdrwait => -- s_rdrwait -------------------------
465 n.rwait := slv(unsigned(r.rwait) + 1);
466 if r.rbsel='0' or irbena='0' then -- rbus cycle abort
467 n.state := s_idle;
468 else
469 if APP_RD_DATA_VALID = '1' then
470 n.state := s_idle;
471 else
472 irb_busy := '1';
473 end if;
474 end if;
475
476 when s_wrcwait => -- s_wrcwait -------------------------
477 iappcmd := migui_cmd_write; -- setup cmd
478 n.crpat := ncrpat; -- follow RDY patterns
479 n.wrpat := nwrpat;
480 if r.rbsel='0' or irbena='0' then -- rbus cycle abort
481 n.state := s_idle;
482 else
483 if APP_RDY = '1' and APP_WDF_RDY = '1' then
484 iappen := '1';
485 iappwren := '1';
486 iappwend := '1';
487 n.state := s_idle;
488 else
489 n.cwait := slv(unsigned(r.cwait) + 1);
490 irb_busy := '1';
491 end if;
492 end if;
493
494 when s_cmdwait => -- s_cmdwait -------------------------
495 iappcmd := RB_MREQ.din(cntl_rbf_cmd); -- setup cmd
496 n.crpat := ncrpat; -- follow RDY pattern
497 if r.rbsel='0' or irbena='0' then -- rbus cycle abort
498 n.state := s_idle;
499 else
500 if APP_RDY = '1' then
501 iappen := '1';
502 iappwren := RB_MREQ.din(cntl_rbf_wren);
503 iappwend := RB_MREQ.din(cntl_rbf_wren) and
504 not RB_MREQ.din(cntl_rbf_dwend);
505 n.state := s_idle;
506 else
507 n.cwait := slv(unsigned(r.cwait) + 1);
508 irb_busy := '1';
509 end if;
510 end if;
511
512 when s_wrenwait => -- s_wrenwait ------------------------
513 n.wrpat := nwrpat; -- follow RDY pattern
514 if r.rbsel='0' or irbena='0' then -- rbus cycle abort
515 n.state := s_idle;
516 else
517 if APP_WDF_RDY = '1' then
518 iappwren := '1';
519 iappwend := not RB_MREQ.din(cntl_rbf_dwend);
520 n.state := s_idle;
521 else
522 n.cwait := slv(unsigned(r.cwait) + 1);
523 irb_busy := '1';
524 end if;
525 end if;
526
527 when others => null;
528
529 end case;
530
531
532 -- rbus output driver
533 if r.rbsel = '1' then
534 case RB_MREQ.addr(4 downto 0) is
535
536 when rbaddr_stat =>
537 irb_dout(stat_rbf_zqpend) := r.zqpend;
538 irb_dout(stat_rbf_refpend) := r.refpend;
539 irb_dout(stat_rbf_rdend) := r.rdend;
542 irb_dout(stat_rbf_wrdy) := APP_WDF_RDY;
543 irb_dout(stat_rbf_crdy) := APP_RDY;
544 when rbaddr_conf =>
545 irb_dout(conf_rbf_mawidth) := slv(to_unsigned(MAWIDTH,5));
546 irb_dout(conf_rbf_mwidth) := slv(to_unsigned(MWIDTH,5));
547 when rbaddr_mask => irb_dout := r.mask;
548 when rbaddr_addrl => irb_dout := r.addr(df_word0);
549 when rbaddr_addrh => irb_dout := r.addr(df_word1);
550 when rbaddr_temp =>
551 irb_dout(MIG_DEVICE_TEMP_I'range) := MIG_DEVICE_TEMP_I;
552 when rbaddr_dvalcnt => irb_dout := r.dvalcnt;
553 when rbaddr_crpat => irb_dout := r.crpat;
554 when rbaddr_wrpat => irb_dout := r.wrpat;
555 when rbaddr_cwait => irb_dout := r.cwait;
556 when rbaddr_rwait => irb_dout := r.rwait;
557 when rbaddr_xwait => irb_dout := r.xwait;
558 when rbaddr_ircnt =>
559 irb_dout(ircnt_rbf_rstcnt) := r.rstcnt;
560 irb_dout(ircnt_rbf_inicnt) := r.inicnt;
561 when rbaddr_rsttime => irb_dout := r.rsttime;
562 when rbaddr_initime => irb_dout := r.initime;
563
564 when rbaddr_datrd0 => irb_dout := r.datrd(df_word0);
565 when rbaddr_datrd1 => irb_dout := r.datrd(df_word1);
566 when rbaddr_datrd2 => irb_dout := r.datrd(df_word2);
567 when rbaddr_datrd3 => irb_dout := r.datrd(df_word3);
568 when rbaddr_datrd4 => irb_dout := r.datrd(df_word4);
569 when rbaddr_datrd5 => irb_dout := r.datrd(df_word5);
570 when rbaddr_datrd6 => irb_dout := r.datrd(df_word6);
571 when rbaddr_datrd7 => irb_dout := r.datrd(df_word7);
572
573 when rbaddr_datwr0 => irb_dout := r.datwr(df_word0);
574 when rbaddr_datwr1 => irb_dout := r.datwr(df_word1);
575 when rbaddr_datwr2 => irb_dout := r.datwr(df_word2);
576 when rbaddr_datwr3 => irb_dout := r.datwr(df_word3);
577 when rbaddr_datwr4 => irb_dout := r.datwr(df_word4);
578 when rbaddr_datwr5 => irb_dout := r.datwr(df_word5);
579 when rbaddr_datwr6 => irb_dout := r.datwr(df_word6);
580 when rbaddr_datwr7 => irb_dout := r.datwr(df_word7);
581
582 when others => null;
583 end case;
584 end if;
585
586 -- update ready shift registers
587 n.crsreg := ncrpat(n.crsreg'range);
588 n.wrsreg := nwrpat(n.wrsreg'range);
589
590 -- ready data capture
591 if APP_RD_DATA_VALID = '1' then
592 n.rdend := APP_RD_DATA_END;
593 n.datrd(APP_RD_DATA'range) := APP_RD_DATA;
594 n.dvalcnt := slv(unsigned(r.dvalcnt) + 1);
595 end if;
596
597 -- REF and ZQ handling
598 if r.refpend = '1' or r.zqpend = '1' then
599 n.xwait := slv(unsigned(r.xwait) + 1);
600 end if;
601 if APP_REF_ACK = '1' then -- REF done
602 n.refpend := '0';
603 n.crpat := ncrpat; -- record RDY patterns too
604 n.wrpat := nwrpat;
605 end if;
606 if APP_ZQ_ACK = '1' then -- ZQ done
607 n.zqpend := '0';
608 n.crpat := ncrpat; -- record RDY patterns too
609 n.wrpat := nwrpat;
610 end if;
611
612 -- CACO monitor (length in CE_USEC)
613 n.caco_1 := MIG_INIT_CALIB_COMPLETE;
614 if MIG_INIT_CALIB_COMPLETE = '0' then
615 if r.caco_1 = '1' then
616 n.initime := (others => '0');
617 if r.inicnt /= x"ff" then
618 n.inicnt := slv(unsigned(r.inicnt) + 1);
619 end if;
620 else
621 if r.initime /= x"ffff" then
622 if CE_USEC = '1' then
623 n.initime := slv(unsigned(r.initime) + 1);
624 end if;
625 end if;
626 end if;
627 end if;
628
629 -- UIRST monitor (length in CE_USC)
630 n.uirst_1 := MIG_UI_CLK_SYNC_RST;
631 if MIG_UI_CLK_SYNC_RST = '1' then
632 if r.uirst_1 = '0' then
633 n.rsttime := (others => '0');
634 if r.rstcnt /= x"ff" then
635 n.rstcnt := slv(unsigned(r.rstcnt) + 1);
636 end if;
637 else
638 if r.rsttime /= x"ffff" then
639 if CE_USEC = '1' then
640 n.rsttime := slv(unsigned(r.rsttime) + 1);
641 end if;
642 end if;
643 end if;
644 end if;
645
646 N_REGS <= n;
647
648 RB_SRES <= rb_sres_init;
649 RB_SRES.ack <= irb_ack;
650 RB_SRES.busy <= irb_busy;
651 RB_SRES.err <= irb_err;
652 RB_SRES.dout <= irb_dout;
653
654 RB_LAM <= '0';
655
656 APP_ADDR <= r.addr(APP_ADDR'range);
657 APP_CMD <= iappcmd;
658 APP_EN <= iappen;
659 APP_WDF_DATA <= r.datwr(APP_WDF_DATA'range);
660 APP_WDF_END <= iappwend;
661 APP_WDF_MASK <= r.mask(APP_WDF_MASK'range);
662 APP_WDF_WREN <= iappwren;
663 APP_REF_REQ <= iappref;
664 APP_ZQ_REQ <= iappzq;
665
666 APP_SR_REQ <= '0';
667
668 end process proc_next;
669
670 RB_STAT(3) <= '0';
671 RB_STAT(2) <= '0';
672 RB_STAT(1) <= '0';
673 RB_STAT(0) <= '0';
674
675end syn;
Definition: rblib.vhd:32
Definition: rutil.vhd:19
std_logic_vector( 14 downto 0) slv15
Definition: slvtypes.vhd:47
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
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( 31 downto 0) slv32
Definition: slvtypes.vhd:59
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 slv
Definition: slvtypes.vhd:31
slv5 := "01000" rbaddr_crpat
Definition: tst_mig.vhd:189
slv3 := "001" migui_cmd_read
Definition: tst_mig.vhd:251
slv5 := "00001" rbaddr_stat
Definition: tst_mig.vhd:182
slv5 := "10100" rbaddr_datrd4
Definition: tst_mig.vhd:201
slv5 := "00100" rbaddr_addrl
Definition: tst_mig.vhd:185
integer range 127 downto 112 df_word7
Definition: tst_mig.vhd:249
slv4 := "0010" func_wr
Definition: tst_mig.vhd:235
integer range 31 downto 16 df_word1
Definition: tst_mig.vhd:243
integer := 12 cntl_rbf_wren
Definition: tst_mig.vhd:215
integer range 47 downto 32 df_word2
Definition: tst_mig.vhd:244
slv3 := "000" migui_cmd_write
Definition: tst_mig.vhd:252
slv5 := "00110" rbaddr_temp
Definition: tst_mig.vhd:187
slv5 := "01010" rbaddr_cwait
Definition: tst_mig.vhd:191
slv4 := "0011" func_pat
Definition: tst_mig.vhd:236
slv4 := "0101" func_cal
Definition: tst_mig.vhd:238
slv5 := "01011" rbaddr_rwait
Definition: tst_mig.vhd:192
integer := 1 stat_rbf_wrdy
Definition: tst_mig.vhd:224
slv5 := "10011" rbaddr_datrd3
Definition: tst_mig.vhd:200
slv5 := "10101" rbaddr_datrd5
Definition: tst_mig.vhd:202
integer range 63 downto 48 df_word3
Definition: tst_mig.vhd:245
integer := 6 stat_rbf_zqpend
Definition: tst_mig.vhd:219
slv5 := "10001" rbaddr_datrd1
Definition: tst_mig.vhd:198
slv5 := "01100" rbaddr_xwait
Definition: tst_mig.vhd:193
integer := 4 stat_rbf_rdend
Definition: tst_mig.vhd:221
integer range 79 downto 64 df_word4
Definition: tst_mig.vhd:246
slv5 := "11111" rbaddr_datwr7
Definition: tst_mig.vhd:212
slv5 := "10010" rbaddr_datrd2
Definition: tst_mig.vhd:199
slv5 := "01110" rbaddr_rsttime
Definition: tst_mig.vhd:195
integer range 3 downto 0 cntl_rbf_func
Definition: tst_mig.vhd:217
integer range 4 downto 0 conf_rbf_mwidth
Definition: tst_mig.vhd:228
slv5 := "00011" rbaddr_mask
Definition: tst_mig.vhd:184
slv4 := "0110" func_cmd
Definition: tst_mig.vhd:239
integer range 111 downto 96 df_word6
Definition: tst_mig.vhd:248
slv5 := "10111" rbaddr_datrd7
Definition: tst_mig.vhd:204
integer range 9 downto 5 conf_rbf_mawidth
Definition: tst_mig.vhd:227
slv5 := "01001" rbaddr_wrpat
Definition: tst_mig.vhd:190
slv5 := "01101" rbaddr_ircnt
Definition: tst_mig.vhd:194
integer := 5 stat_rbf_refpend
Definition: tst_mig.vhd:220
slv5 := "10000" rbaddr_datrd0
Definition: tst_mig.vhd:197
regs_type := regs_init R_REGS
Definition: tst_mig.vhd:178
integer range 7 downto 0 ircnt_rbf_inicnt
Definition: tst_mig.vhd:231
integer range 15 downto 0 df_word0
Definition: tst_mig.vhd:242
integer := 3 stat_rbf_uirst
Definition: tst_mig.vhd:222
slv5 := "00010" rbaddr_conf
Definition: tst_mig.vhd:183
slv4 := "0111" func_wren
Definition: tst_mig.vhd:240
integer := 2 stat_rbf_caco
Definition: tst_mig.vhd:223
integer := 0 stat_rbf_crdy
Definition: tst_mig.vhd:225
slv5 := "11110" rbaddr_datwr6
Definition: tst_mig.vhd:211
slv5 := "11100" rbaddr_datwr4
Definition: tst_mig.vhd:209
regs_type N_REGS
Definition: tst_mig.vhd:179
(s_idle,s_rdcwait,s_rdrwait,s_wrcwait,s_cmdwait,s_wrenwait) state_type
Definition: tst_mig.vhd:120
slv5 := "10110" rbaddr_datrd6
Definition: tst_mig.vhd:203
integer range 95 downto 80 df_word5
Definition: tst_mig.vhd:247
integer range 15 downto 13 cntl_rbf_cmd
Definition: tst_mig.vhd:214
slv4 := "0000" func_noop
Definition: tst_mig.vhd:233
slv5 := "11011" rbaddr_datwr3
Definition: tst_mig.vhd:208
slv5 := "11000" rbaddr_datwr0
Definition: tst_mig.vhd:205
slv4 := "0100" func_ref
Definition: tst_mig.vhd:237
slv4 := "0001" func_rd
Definition: tst_mig.vhd:234
slv5 := "11101" rbaddr_datwr5
Definition: tst_mig.vhd:210
slv5 := "00000" rbaddr_cntl
Definition: tst_mig.vhd:181
slv5 := "11010" rbaddr_datwr2
Definition: tst_mig.vhd:207
regs_type :=( s_idle, '0',( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'), '0', '0', '0', '0', '0') regs_init
Definition: tst_mig.vhd:155
integer := 11 cntl_rbf_dwend
Definition: tst_mig.vhd:216
slv5 := "01111" rbaddr_initime
Definition: tst_mig.vhd:196
integer range 15 downto 8 ircnt_rbf_rstcnt
Definition: tst_mig.vhd:230
slv5 := "00111" rbaddr_dvalcnt
Definition: tst_mig.vhd:188
slv5 := "11001" rbaddr_datwr1
Definition: tst_mig.vhd:206
slv5 := "00101" rbaddr_addrh
Definition: tst_mig.vhd:186
out APP_SR_REQ slbit
Definition: tst_mig.vhd:106
in RESET slbit
Definition: tst_mig.vhd:89
MAWIDTH natural := 28
Definition: tst_mig.vhd:84
in CE_USEC slbit
Definition: tst_mig.vhd:88
MWIDTH natural := 16
Definition: tst_mig.vhd:85
in APP_WDF_RDY slbit
Definition: tst_mig.vhd:105
out APP_WDF_MASK slv( MWIDTH- 1 downto 0)
Definition: tst_mig.vhd:99
out RB_LAM slbit
Definition: tst_mig.vhd:93
in APP_RD_DATA_VALID slbit
Definition: tst_mig.vhd:103
out RB_STAT slv4
Definition: tst_mig.vhd:92
in MIG_INIT_CALIB_COMPLETE slbit
Definition: tst_mig.vhd:113
out APP_WDF_END slbit
Definition: tst_mig.vhd:98
in CLK slbit
Definition: tst_mig.vhd:87
in MIG_UI_CLK_SYNC_RST slbit
Definition: tst_mig.vhd:112
RB_ADDR slv16 := slv( to_unsigned( 2#0000000000000000#, 16) )
Definition: tst_mig.vhd:83
in APP_RD_DATA slv( 8* MWIDTH- 1 downto 0)
Definition: tst_mig.vhd:101
in APP_RDY slbit
Definition: tst_mig.vhd:104
in RB_MREQ rb_mreq_type
Definition: tst_mig.vhd:90
in APP_SR_ACTIVE slbit
Definition: tst_mig.vhd:109
out APP_REF_REQ slbit
Definition: tst_mig.vhd:107
out APP_WDF_WREN slbit
Definition: tst_mig.vhd:100
in MIG_DEVICE_TEMP_I slv12
Definition: tst_mig.vhd:115
in APP_RD_DATA_END slbit
Definition: tst_mig.vhd:102
out APP_ZQ_REQ slbit
Definition: tst_mig.vhd:108
out RB_SRES rb_sres_type
Definition: tst_mig.vhd:91
in APP_ZQ_ACK slbit
Definition: tst_mig.vhd:111
out APP_EN slbit
Definition: tst_mig.vhd:96
out APP_WDF_DATA slv( 8* MWIDTH- 1 downto 0)
Definition: tst_mig.vhd:97
out APP_ADDR slv( MAWIDTH- 1 downto 0)
Definition: tst_mig.vhd:94
in APP_REF_ACK slbit
Definition: tst_mig.vhd:110
out APP_CMD slv3
Definition: tst_mig.vhd:95