w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tb_rlink_tba.vhd
Go to the documentation of this file.
1-- $Id: tb_rlink_tba.vhd 1203 2019-08-19 21:41:03Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2007-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: tb_rlink_tba - sim
7-- Description: Test bench for rbus devices via rlink_tba
8--
9-- Dependencies: simlib/simclk
10-- simlib/simclkcnt
11-- genlib/tb/clkdivce_tb
12-- rlink_tba
13-- rlink_core
14-- rbtba_aif [UUT]
15-- rlink_mon
16-- rb_mon
17--
18-- To test: generic, any rbtba_aif target
19--
20-- Target Devices: generic
21-- Tool versions: xst 8.2-14.7; viv 2016.2-2019.1; ghdl 0.18-0.36
22--
23-- Revision History:
24-- Date Rev Version Comment
25-- 2019-08-17 1203 4.0.2 fix for ghdl V0.36 -Whide warnings
26-- 2016-09-10 806 4.0.1 use clkdivce_tb
27-- 2014-12-20 616 4.0.1 add dcnt check (with -n=) and .ndef
28-- 2014-09-21 595 4.0 now full rlink v4 iface, 4 bit STAT
29-- 2014-08-15 583 3.5 rb_mreq addr now 16 bit
30-- 2011-12-23 444 3.2 use new simclk/simclkcnt
31-- 2011-11-22 432 3.1.1 now numeric_std clean
32-- 2010-12-29 351 3.1 use rbtba_aif now, support _ssim level again
33-- 2010-12-28 350 3.0.3 list cmd address, list send data for wreg/init
34-- 2010-12-27 349 3.0.2 suppress D CHECK message for all masked rreg/rblk
35-- 2010-12-25 348 3.0.1 drop RL_FLUSH support, add RL_MONI for rlink_core
36-- 2010-12-24 347 3.0 rm tb_rritba->tb_rlink_tba, CP_*->RL_*;rbus v3 port
37-- 2010-06-07 302 2.5 use sop/eop framing instead of soc+chaining
38-- 2010-06-05 301 2.1.3 rename _rpmon -> _rbmon, .rpmon -> .rbmon
39-- 2010-06-03 299 2.1.2 use sv_ prefix for shared variables
40-- 2010-05-02 287 2.1.1 ren CE_XSEC->CE_INT,RP_STAT->RB_STAT,AP_LAM->RB_LAM
41-- drop RP_IINT signal from interfaces
42-- 2010-04-03 274 2.1 add CP_FLUSH for rri_core
43-- 2008-08-24 162 2.0 with new rb_mreq/rb_sres interface
44-- 2008-03-24 129 1.1.4 CLK_CYCLE now 31 bits
45-- 2008-03-02 121 1.1.3 default .sdef now checks for errors, ignore
46-- status bits and the attn flag.
47-- 2008-01-20 112 1.1.2 rename clkgen->clkdivce
48-- 2007-12-23 105 1.1.1 add .dbas[io] (allows to set base for data values)
49-- 2007-11-24 98 1.1 add RP_IINT support
50-- 2007-10-26 92 1.0.2 use DONE timestamp at end of execution
51-- 2007-10-12 88 1.0.1 avoid ieee.std_logic_unsigned, use cast to unsigned
52-- 2007-09-09 81 1.0 Initial version
53------------------------------------------------------------------------------
54
55library ieee;
56use ieee.std_logic_1164.all;
57use ieee.numeric_std.all;
58use ieee.std_logic_textio.all;
59use std.textio.all;
60
61use work.slvtypes.all;
62use work.genlib.all;
63use work.comlib.all;
64use work.rblib.all;
65use work.rlinklib.all;
66use work.rlinktblib.all;
67use work.simlib.all;
68
69entity tb_rlink_tba is
70end tb_rlink_tba;
71
72architecture sim of tb_rlink_tba is
73
74 signal CLK : slbit := '0';
75 signal CE_MSEC : slbit := '0';
76 signal RESET : slbit := '0';
77 signal TBA_CNTL : rlink_tba_cntl_type := rlink_tba_cntl_init;
78 signal TBA_DI : slv16 := (others=>'0');
79 signal TBA_STAT : rlink_tba_stat_type := rlink_tba_stat_init;
80 signal TBA_DO : slv16 := (others=>'0');
81 signal RL_DI : slv9 := (others=>'0');
82 signal RL_ENA : slbit := '0';
83 signal RL_BUSY : slbit := '0';
84 signal RL_DO : slv9 := (others=>'0');
85 signal RL_VAL : slbit := '0';
86 signal RL_HOLD : slbit := '0';
87 signal RL_MONI : rl_moni_type := rl_moni_init;
88
89 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
90 signal RB_SRES : rb_sres_type := rb_sres_init;
91 signal RB_LAM : slv16 := (others=>'0');
92 signal RB_STAT : slv4 := (others=>'0');
93
94 signal RB_MREQ_aval : slbit := '0';
95 signal RB_MREQ_re : slbit := '0';
96 signal RB_MREQ_we : slbit := '0';
97 signal RB_MREQ_initt: slbit := '0';
98 signal RB_MREQ_addr : slv16 := (others=>'0');
99 signal RB_MREQ_din : slv16 := (others=>'0');
100 signal RB_SRES_ack : slbit := '0';
101 signal RB_SRES_busy : slbit := '0';
102 signal RB_SRES_err : slbit := '0';
103 signal RB_SRES_dout : slv16 := (others=>'0');
104
105 signal RLMON_EN : slbit := '0';
106 signal RBMON_EN : slbit := '0';
107
108 signal N_CMD_CODE : string(1 to 4) := (others=>' ');
109 signal N_CMD_ADDR : slv16 := (others=>'0');
110 signal N_CMD_DATA : slv16 := (others=>'0');
111 signal N_CHK_DATA : boolean := false;
112 signal N_REF_DATA : slv16 := (others=>'0');
113 signal N_MSK_DATA : slv16 := (others=>'0');
114 signal N_CHK_DONE : boolean := false;
115 signal N_REF_DONE : slv16 := (others=>'0');
116 signal N_CHK_STAT : boolean := false;
117 signal N_REF_STAT : slv8 := (others=>'0');
118 signal N_MSK_STAT : slv8 := (others=>'0');
119
120 signal R_CMD_CODE : string(1 to 4) := (others=>' ');
121 signal R_CMD_ADDR : slv16 := (others=>'0');
122 signal R_CMD_DATA : slv16 := (others=>'0');
123 signal R_CHK_DATA : boolean := false;
124 signal R_REF_DATA : slv16 := (others=>'0');
125 signal R_MSK_DATA : slv16 := (others=>'0');
126 signal R_CHK_DONE : boolean := false;
127 signal R_REF_DONE : slv16 := (others=>'0');
128 signal R_CHK_STAT : boolean := false;
129 signal R_REF_STAT : slv8 := (others=>'0');
130 signal R_MSK_STAT : slv8 := (others=>'0');
131
132 signal CLK_STOP : slbit := '0';
133 signal CLK_CYCLE : integer := 0;
134
135 shared variable sv_dbasi : integer := 2;
136 shared variable sv_dbaso : integer := 2;
137
138 constant clock_period : Delay_length := 20 ns;
139 constant clock_offset : Delay_length := 200 ns;
140 constant setup_time : Delay_length := 5 ns;
141 constant c2out_time : Delay_length := 10 ns;
142
143begin
144
145 CLKGEN : simclk
146 generic map (
149 port map (
150 CLK => CLK,
152 );
153
154 CLKCNT : simclkcnt port map (CLK => CLK, CLK_CYCLE => CLK_CYCLE);
155
156 CLKDIV : entity work.clkdivce_tb
157 generic map (
158 CDUWIDTH => 6,
159 USECDIV => 4,
160 MSECDIV => 5)
161 port map (
162 CLK => CLK,
163 CE_USEC => open,
165 );
166
167 TBA : rlink_tba
168 port map (
169 CLK => CLK,
170 RESET => RESET,
171 CNTL => TBA_CNTL,
172 DI => TBA_DI,
173 STAT => TBA_STAT,
174 DO => TBA_DO,
175 RL_DI => RL_DI,
176 RL_ENA => RL_ENA,
177 RL_BUSY => RL_BUSY,
178 RL_DO => RL_DO,
179 RL_VAL => RL_VAL,
181 );
182
183 RLINK : rlink_core
184 generic map (
185 BTOWIDTH => 6,
186 RTAWIDTH => 12,
187 SYSID => (others=>'0'))
188 port map (
189 CLK => CLK,
190 CE_INT => CE_MSEC,
191 RESET => RESET,
192 RL_DI => RL_DI,
193 RL_ENA => RL_ENA,
194 RL_BUSY => RL_BUSY,
195 RL_DO => RL_DO,
196 RL_VAL => RL_VAL,
197 RL_HOLD => RL_HOLD,
198 RL_MONI => RL_MONI,
199 RB_MREQ => RB_MREQ,
200 RB_SRES => RB_SRES,
201 RB_LAM => RB_LAM,
203 );
204
205 RB_MREQ_aval <= RB_MREQ.aval;
206 RB_MREQ_re <= RB_MREQ.re;
207 RB_MREQ_we <= RB_MREQ.we;
208 RB_MREQ_initt<= RB_MREQ.init;
209 RB_MREQ_addr <= RB_MREQ.addr;
210 RB_MREQ_din <= RB_MREQ.din;
211
212 RB_SRES.ack <= RB_SRES_ack;
213 RB_SRES.busy <= RB_SRES_busy;
214 RB_SRES.err <= RB_SRES_err;
215 RB_SRES.dout <= RB_SRES_dout;
216
217 UUT : rbtba_aif
218 port map (
219 CLK => CLK,
220 RESET => RESET,
221 RB_MREQ_aval => RB_MREQ_aval,
222 RB_MREQ_re => RB_MREQ_re,
223 RB_MREQ_we => RB_MREQ_we,
224 RB_MREQ_initt=> RB_MREQ_initt,
225 RB_MREQ_addr => RB_MREQ_addr,
226 RB_MREQ_din => RB_MREQ_din,
227 RB_SRES_ack => RB_SRES_ack,
228 RB_SRES_busy => RB_SRES_busy,
229 RB_SRES_err => RB_SRES_err,
230 RB_SRES_dout => RB_SRES_dout,
231 RB_LAM => RB_LAM,
232 RB_STAT => RB_STAT
233 );
234
235 RLMON : rlink_mon
236 generic map (
237 DWIDTH => RL_DI'length)
238 port map (
239 CLK => CLK,
241 ENA => RLMON_EN,
242 RL_DI => RL_DI,
243 RL_ENA => RL_ENA,
244 RL_BUSY => RL_BUSY,
245 RL_DO => RL_DO,
246 RL_VAL => RL_VAL,
248 );
249
250 RBMON : rb_mon
251 port map (
252 CLK => CLK,
254 ENA => RBMON_EN,
255 RB_MREQ => RB_MREQ,
256 RB_SRES => RB_SRES,
257 RB_LAM => RB_LAM,
259 );
260
261 proc_stim: process
262 file fstim : text open read_mode is "tb_rlink_tba_stim";
263 variable iline : line;
264 variable oline : line;
265 variable ok : boolean;
266 variable dname : string(1 to 6) := (others=>' ');
267 variable idelta : integer := 0;
268 variable ien : slbit := '0';
269 variable iaddr : slv16 := (others=>'0');
270 variable idata : slv16 := (others=>'0');
271 variable bcnt : integer := 0;
272 variable ccnt : integer := 0;
273 variable cmax : integer := 32;
274 variable nwait : integer := 0;
275 variable amnemo : string(1 to 6) := (others=>' ');
276 variable newline : boolean := true;
277 variable chk_data : boolean := false;
278 variable ref_data : slv16 := (others=>'0');
279 variable msk_data : slv16 := (others=>'0');
280 variable chk_stat : boolean := false;
281 variable ref_stat : slv8 := (others=>'0');
282 variable msk_stat : slv8 := (others=>'0');
283 variable chk_sdef : boolean := true;
284 variable ref_sdef : slv8 := (others=>'0');
285 variable msk_sdef : slv8 := "11111000"; -- ignore status bits and attn
286 variable chk_ndef : boolean := true;
287
288 type amrec_type is record
289 name : string(1 to 6);
290 addr : slv16;
291 end record;
292 constant amrec_init: amrec_type := ((others=>' '),
293 (others=>'0'));
294
295 constant amtbl_size: integer := 256;
296 type amtbl_type is array(1 to amtbl_size) of amrec_type;
297
298 variable amtbl_defs : integer := 0;
299 variable amtbl : amtbl_type := (others=>amrec_init);
300
301 procedure get_addr(L: inout line;
302 addr: out slv16) is
303 variable ichar : character := ' ';
304 variable name : string(1 to 6) := (others=>' ');
305 variable lok : boolean := false;
306 variable liaddr : slv16 := (others=>'0');
307 variable iaddr_or : slv16 := (others=>'0');
308 begin
309
310 readwhite(L);
311
312 readoptchar(L, '.', lok);
313 if lok then
314 readword_ea(L, name);
315 for i in 1 to amtbl_defs loop
316 if amtbl(i).name = name then
317 liaddr := amtbl(i).addr;
318 readoptchar(L, '|', lok);
319 if lok then
320 readgen_ea(L, iaddr_or);
321 for j in iaddr_or'range loop
322 if iaddr_or(j) = '1' then
323 liaddr(j) := '1';
324 end if;
325 end loop;
326 end if;
327 addr := liaddr;
328 return;
329 end if;
330 end loop;
331 report "address mnemonic not defined: " & name
332 severity failure;
333 end if;
334
335 readgen_ea(L, addr);
336
337 end procedure get_addr;
338
339 procedure cmd_waitdone is
340 variable lnwait : integer := 0;
341 begin
342 lnwait := 0;
343 while TBA_STAT.busy='1' loop
344 lnwait := lnwait + 1;
345 assert lnwait<2000 report "assert(lnwait<2000)" severity failure;
346 wait for clock_period;
347 end loop;
348 end procedure cmd_waitdone;
349
350 procedure setup_check_n (
351 pbcnt : in integer)
352 is
353 variable chk_done : boolean := false;
354 variable ref_done : slv16 := (others=>'0');
355 begin
356 readtagval_ea(iline, "n", chk_done, ref_done, 10);
357 if chk_done then
358 N_CHK_DONE <= chk_done;
359 N_REF_DONE <= ref_done;
360 else
361 N_CHK_DONE <= chk_ndef;
362 N_REF_DONE <= slv(to_unsigned(pbcnt,16));
363 end if;
364 end procedure setup_check_n;
365
366 procedure setup_check_d is
367 variable lchk_data : boolean := false;
368 variable lref_data : slv16 := (others=>'0');
369 variable lmsk_data : slv16 := (others=>'0');
370 begin
371 readtagval2_ea(iline, "d", lchk_data, lref_data, lmsk_data, sv_dbasi);
372 N_CHK_DATA <= lchk_data;
373 N_REF_DATA <= lref_data;
374 N_MSK_DATA <= lmsk_data;
375 end procedure setup_check_d;
376
377 procedure setup_check_s is
378 variable lchk_stat : boolean := false;
379 variable lref_stat : slv8 := (others=>'0');
380 variable lmsk_stat : slv8 := (others=>'0');
381 begin
382 readtagval2_ea(iline, "s", lchk_stat, lref_stat, lmsk_stat);
383 if lchk_stat then
384 N_CHK_STAT <= lchk_stat;
385 N_REF_STAT <= lref_stat;
386 N_MSK_STAT <= lmsk_stat;
387 else
388 N_CHK_STAT <= chk_sdef;
389 N_REF_STAT <= ref_sdef;
390 N_MSK_STAT <= msk_sdef;
391 end if;
392 end procedure setup_check_s;
393
394 procedure cmd_start (
395 pcmd : in slv3;
396 paddr : in slv16 := (others=>'0');
397 pdata : in slv16 := (others=>'0');
398 pbcnt : in integer := 1) is
399 begin
400 TBA_CNTL <= rlink_tba_cntl_init;
401 TBA_CNTL.cmd <= pcmd;
402 TBA_CNTl.addr <= paddr;
403 TBA_CNTL.cnt <= slv(to_unsigned(pbcnt,16));
404 TBA_DI <= pdata;
405
406 ccnt := ccnt + 1;
407 if ccnt >= cmax then
408 ccnt := 0;
409 TBA_CNTL.eop <= '1';
410 end if;
411
412 TBA_CNTL.ena <= '1';
413 wait for clock_period;
414 TBA_CNTL.ena <= '0';
415 TBA_CNTL.eop <= '0';
416
417 end procedure cmd_start;
418
419 begin
420
421 wait for clock_offset - setup_time;
422
423 file_loop: while not endfile(fstim) loop
424
425 readline (fstim, iline);
426
427 if TBA_STAT.ack = '1' and -- if ack cycle
428 iline'length>0 then -- and non empty line
429 if iline(1) = 'C' then -- and leading 'C'
430 wait for clock_period; -- wait cycle to ensure that comment
431 -- comes after moni response
432 end if;
433 end if;
434
435 readcomment(iline, ok);
436 next file_loop when ok;
437
438 readword(iline, dname, ok);
439 if ok then
440
441 N_CMD_CODE <= " ";
442 N_CHK_DATA <= false;
443 N_CHK_DONE <= false;
444 N_CHK_STAT <= false;
445
446 case dname is
447 when ".mode " => -- .mode
448 readword_ea(iline, dname);
449 assert dname="rri "
450 report "assert .mode == rri" severity failure;
451
452 when ".rlmon" => -- .rlmon
453 read_ea(iline, ien);
454 RLMON_EN <= ien;
455 wait for 2*clock_period; -- wait for monitor to start
456
457 when ".rbmon" => -- .rbmon
458 read_ea(iline, ien);
459 RBMON_EN <= ien;
460 wait for 2*clock_period; -- wait for monitor to start
461
462 when ".sdef " => -- .sdef , set default for status chk
463 readtagval2_ea(iline, "s", chk_sdef, ref_sdef, msk_sdef);
464
465 when ".ndef " => -- .ndef , enable/disable done chk
466 read_ea(iline, idata(0));
467 chk_ndef := idata(0) = '1';
468
469 when ".amclr" => -- .amclr , clear addr mnemo table
470 amtbl_defs := 0;
471 amtbl := (others=>amrec_init);
472
473 when ".amdef" => -- .amdef , define addr mnemo table
474 assert amtbl_defs<amtbl_size
475 report "assert(amtbl_defs<amtbl_size): too many .amdef's"
476 severity failure;
477 readword_ea(iline, amnemo);
478 readgen_ea(iline, iaddr);
479 amtbl_defs := amtbl_defs + 1;
480 amtbl(amtbl_defs).name := amnemo;
481 amtbl(amtbl_defs).addr := iaddr;
482
483 when ".dbasi" => -- .dbasi
484 read_ea(iline, idelta);
485 assert idelta=2 or idelta=8 or idelta=16
486 report "assert(dbasi = 2,8, or 16)"
487 severity failure;
488 sv_dbasi := idelta;
489
490 when ".dbaso" => -- .dbaso
491 read_ea(iline, idelta);
492 assert idelta=2 or idelta=8 or idelta=16
493 report "assert(dbaso = 2,8, or 16)"
494 severity failure;
495 sv_dbaso := idelta;
496
497 when ".cmax " => -- .cmax
498 readint_ea(iline, cmax, 1, 32);
499
500 when ".reset" => -- .reset
501 write(oline, string'(".reset"));
502 writeline(output, oline);
503 RESET <= '1';
504 wait for clock_period;
505 RESET <= '0';
506 wait for 9*clock_period;
507
508 when ".wait " => -- .wait
509 read_ea(iline, idelta);
510 wait for idelta*clock_period;
511
512 when ".wtlam" => -- .wtlam
513 read_ea(iline, idelta);
514 nwait := 0;
515 loop
516 if TBA_STAT.ano='1' or nwait>=idelta then
517 writetimestamp(oline, CLK_CYCLE, ": .wtlam" & " nwait=");
518 write(oline, nwait, left);
519 if TBA_STAT.ano = '0' then
520 write(oline, string'(" FAIL TIMEOUT"));
521 end if;
522 writeline(output, oline);
523 exit;
524 end if;
525 nwait := nwait + 1;
526 wait for clock_period;
527 end loop;
528
529 when ".eop " => -- .eop
530 TBA_CNTL <= rlink_tba_cntl_init;
531 TBA_CNTL.eop <= '1';
532 wait for clock_period;
533 TBA_CNTL.eop <= '0';
534 wait for clock_period; -- wait (or rlink_tba will hang...)
535 ccnt := 0;
536
537 when "rreg " => -- rreg
538 N_CMD_CODE <= dname(N_CMD_CODE'range);
539 get_addr(iline, iaddr);
540 N_CMD_ADDR <= iaddr;
541 N_CMD_DATA <= (others=>'Z');
542 setup_check_d;
543 setup_check_s;
544 cmd_start(pcmd=>c_rlink_cmd_rreg, paddr=>iaddr);
545 cmd_waitdone;
546
547 when "rblk " => -- rblk
548 N_CMD_CODE <= dname(N_CMD_CODE'range);
549 get_addr(iline, iaddr);
550 N_CMD_ADDR <= iaddr;
551 N_CMD_DATA <= (others=>'Z');
552 read_ea(iline, bcnt);
553 assert bcnt>0 report "assert(bcnt>0)" severity failure;
554 setup_check_n(bcnt);
555 setup_check_s;
556 cmd_start(pcmd=>c_rlink_cmd_rblk, paddr=>iaddr, pbcnt=>bcnt);
557
558 testempty_ea(iline);
559 newline := true;
560 for i in 1 to bcnt loop
561 while TBA_STAT.bwe='0' loop
562 wait for clock_period;
563 end loop;
564
565 if newline then
566 rblk_line: loop
567 readline (fstim, iline);
568 readcomment(iline, ok);
569 exit rblk_line when not ok;
570 end loop;
571 end if;
572 readtagval2_ea(iline, "d", chk_data, ref_data, msk_data,sv_dbasi);
573 N_CHK_DATA <= chk_data;
574 N_REF_DATA <= ref_data;
575 N_MSK_DATA <= msk_data;
576 testempty(iline, newline);
577 wait for clock_period;
578 end loop;
579 N_CHK_DATA <= false;
580 cmd_waitdone;
581
582 when "wreg " => -- wreg
583 N_CMD_CODE <= dname(N_CMD_CODE'range);
584 get_addr(iline, iaddr);
585 N_CMD_ADDR <= iaddr;
586 readgen_ea(iline, idata, sv_dbasi);
587 N_CMD_DATA <= idata;
588 setup_check_s;
589 cmd_start(pcmd=>c_rlink_cmd_wreg, paddr=>iaddr, pdata=>idata);
590 cmd_waitdone;
591
592 when "wblk " => -- wblk
593 N_CMD_CODE <= dname(N_CMD_CODE'range);
594 get_addr(iline, iaddr);
595 N_CMD_ADDR <= iaddr;
596 N_CMD_DATA <= (others=>'Z');
597 read_ea(iline, bcnt);
598 assert bcnt>0 report "assert(bcnt>0)" severity failure;
599 setup_check_n(bcnt);
600 setup_check_s;
601 cmd_start(pcmd=>c_rlink_cmd_wblk, paddr=>iaddr, pbcnt=>bcnt);
602
603 testempty_ea(iline);
604 newline := true;
605 for i in 1 to bcnt loop
606 while TBA_STAT.bre='0' loop
607 wait for clock_period;
608 end loop;
609 if newline then
610 wblk_line: loop
611 readline (fstim, iline);
612 readcomment(iline, ok);
613 exit wblk_line when not ok;
614 end loop;
615 end if;
616 readgen_ea(iline, idata, sv_dbasi);
617 TBA_DI <= idata;
618 testempty(iline, newline);
619 wait for clock_period;
620 end loop;
621 cmd_waitdone;
622
623 when "labo " => -- labo
624 N_CMD_CODE <= dname(N_CMD_CODE'range);
625 N_CMD_ADDR <= (others=>'0');
626 N_CMD_DATA <= (others=>'Z');
627 setup_check_d;
628 setup_check_s;
629 cmd_start(pcmd=>c_rlink_cmd_labo);
630 cmd_waitdone;
631
632 when "attn " => -- attn
633 N_CMD_CODE <= dname(N_CMD_CODE'range);
634 N_CMD_ADDR <= (others=>'0');
635 N_CMD_DATA <= (others=>'Z');
636 setup_check_d;
637 setup_check_s;
638 cmd_start(pcmd=>c_rlink_cmd_attn);
639 cmd_waitdone;
640
641 when "init " => -- init
642 N_CMD_CODE <= dname(N_CMD_CODE'range);
643 get_addr(iline, iaddr);
644 N_CMD_ADDR <= iaddr;
645 readgen_ea(iline, idata, sv_dbasi);
646 N_CMD_DATA <= idata;
647 setup_check_s;
648 cmd_start(pcmd=>c_rlink_cmd_init, paddr=>iaddr, pdata=>idata);
649 cmd_waitdone;
650
651 when others => -- bad command
652 write(oline, string'("?? unknown command: "));
653 write(oline, dname);
654 writeline(output, oline);
655 report "aborting" severity failure;
656 end case;
657
658 else
659 report "failed to find command" severity failure;
660
661 end if;
662
663 testempty_ea(iline);
664
665 end loop; -- file_loop:
666
667 wait for 4*clock_period;
668 CLK_STOP <= '1';
669
670 writetimestamp(oline, CLK_CYCLE, ": DONE ");
671 writeline(output, oline);
672
673 wait; -- suspend proc_stim forever
674 -- clock is stopped, sim will end
675
676 end process proc_stim;
677
678 proc_moni: process
679 variable oline : line;
680 variable chk_ok : boolean := true;
681 begin
682
683 loop
684 wait until rising_edge(CLK);
696
697 if TBA_STAT.bwe = '1' then
698 writetimestamp(oline, CLK_CYCLE, ": rblk ");
699 writehex(oline, R_CMD_ADDR, right, 4);
700 write(oline, string'(" bwe=1 "));
701 writegen(oline, TBA_DO, right, base=>sv_dbaso);
702 if N_CHK_DATA then
703 if N_MSK_DATA /= "1111111111111111" then -- not all masked off
704 write(oline, string'(" .D.-CHECK"));
705 else
706 write(oline, string'(" ...-CHECK"));
707 end if;
708 if unsigned((TBA_DO xor N_REF_DATA) and (not N_MSK_DATA)) /= 0 then
709 write(oline, string'(" FAIL d="));
710 writegen(oline, N_REF_DATA, base=>sv_dbaso);
711 if unsigned(N_MSK_DATA) /= 0 then
712 write(oline, string'(","));
713 writegen(oline, N_MSK_DATA, base=>sv_dbaso);
714 end if;
715 else
716 write(oline, string'(" OK"));
717 end if;
718 end if;
719 writeline(output, oline);
720 end if;
721
722 if TBA_STAT.ack = '1' then
723 writetimestamp(oline, CLK_CYCLE, ": ");
724 write(oline, R_CMD_CODE);
725 writehex(oline, R_CMD_ADDR, right, 5);
726 write(oline, string'(" "));
727 write(oline, TBA_STAT.err, right, 1);
728 write(oline, TBA_STAT.stat, right, 9);
729 write(oline, string'(" "));
730 if R_CMD_CODE="wreg" or R_CMD_CODE="init" then
731 writegen(oline, R_CMD_DATA, right, base=>sv_dbaso);
732 else
733 writegen(oline, TBA_DO, right, base=>sv_dbaso);
734 end if;
735 if R_CHK_DATA or R_CHK_DONE or R_CHK_STAT then
736 chk_ok := true;
737 write(oline, string'(" "));
738 if R_CHK_DONE then
739 write(oline, string'("N"));
740 else
741 write(oline, string'("."));
742 end if;
743 if R_CHK_DATA and R_MSK_DATA/="1111111111111111" then
744 write(oline, string'("D"));
745 else
746 write(oline, string'("."));
747 end if;
748 if R_CHK_STAT and R_MSK_STAT/="11111111" then
749 write(oline, string'("S"));
750 else
751 write(oline, string'("."));
752 end if;
753 write(oline, string'("-CHECK"));
754 if R_CHK_DONE then
755 if TBA_STAT.dcnt /= R_REF_DONE then
756 chk_ok := false;
757 write(oline, string'(" FAIL n="));
758 write(oline, to_integer(unsigned(R_REF_DONE)));
759 end if;
760 end if;
761 if R_CHK_DATA then
762 if unsigned((TBA_DO xor R_REF_DATA) and (not R_MSK_DATA)) /= 0 then
763 chk_ok := false;
764 write(oline, string'(" FAIL d="));
765 writegen(oline, R_REF_DATA, base=>sv_dbaso);
766 if unsigned(R_MSK_DATA) /= 0 then
767 write(oline, string'(","));
768 writegen(oline, R_MSK_DATA, base=>sv_dbaso);
769 end if;
770 end if;
771 end if;
772 if R_CHK_STAT then
773 if unsigned((TBA_STAT.stat xor R_REF_STAT) and
774 (not R_MSK_STAT)) /= 0 then
775 chk_ok := false;
776 write(oline, string'(" FAIL s="));
777 write(oline, R_REF_STAT);
778 if unsigned(R_MSK_STAT) /= 0 then
779 write(oline, string'(","));
780 write(oline, R_MSK_STAT);
781 end if;
782 end if;
783 end if;
784 if chk_ok then
785 write(oline, string'(" OK"));
786 end if;
787 end if;
788 writeline(output, oline);
789
790 end if;
791
792 if TBA_STAT.ano = '1' then
793 writetimestamp(oline, CLK_CYCLE, ": ---- attn notify ---- ");
794 write(oline, TBA_STAT.apat, right, 16);
795 writeline(output, oline);
796 end if;
797
798 end loop;
799
800 end process proc_moni;
801
802end sim;
out CE_MSEC slbit
Definition: clkdivce_tb.vhd:33
USECDIV positive := 50
Definition: clkdivce_tb.vhd:27
CDUWIDTH positive := 6
Definition: clkdivce_tb.vhd:26
out CE_USEC slbit
Definition: clkdivce_tb.vhd:31
MSECDIV positive := 1000
Definition: clkdivce_tb.vhd:28
in CLK slbit
Definition: clkdivce_tb.vhd:30
in CLK slbit
Definition: rb_mon.vhd:48
in RB_MREQ rb_mreq_type
Definition: rb_mon.vhd:51
in CLK_CYCLE integer := 0
Definition: rb_mon.vhd:49
in ENA slbit := '1'
Definition: rb_mon.vhd:50
in RB_STAT slv4
Definition: rb_mon.vhd:55
in RB_LAM slv16 :=( others => '0')
Definition: rb_mon.vhd:53
in RB_SRES rb_sres_type
Definition: rb_mon.vhd:52
Definition: rblib.vhd:32
out CLK slbit
Definition: simclk.vhd:33
OFFSET Delay_length := 200 ns
Definition: simclk.vhd:31
in CLK_STOP slbit := '0'
Definition: simclk.vhd:35
PERIOD Delay_length := 20 ns
Definition: simclk.vhd:30
out CLK_CYCLE integer
Definition: simclkcnt.vhd:29
in CLK slbit
Definition: simclkcnt.vhd:27
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic_vector( 8 downto 0) slv9
Definition: slvtypes.vhd:41
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