77use ieee.std_logic_1164.
all;
78use ieee.numeric_std.
all;
79use ieee.std_logic_textio.
all;
173 file ifile : text open read_mode is "tb_pdp11core_stim";
174 variable iline : line;
175 variable oline : line;
176 variable idelta : integer := 0;
177 variable idummy : integer := 0;
178 variable dcycle : integer := 0;
179 variable irqline : integer := 0;
180 variable ireq : boolean := false;
181 variable ifunc : slv5 := (others=>'0');
182 variable irnum : slv3 := (others=>'0');
183 variable idin : slv16 := (others=>'0');
184 variable imsk : slv16 := (others=>'1');
185 variable idin3 : slv3 := (others=>'0');
186 variable ichk : boolean := false;
187 variable idosta: slbit := '0';
189 variable ok : boolean;
190 variable dname : string(1 to 6) := (others=>' ');
191 variable rind : integer := 0;
192 variable nblk : integer := 0;
193 variable xmicmd : string(1 to 3) := (others=>' ');
194 variable iwtstp : boolean := false;
195 variable iwtgo : boolean := false;
196 variable icerr : integer := 0;
197 variable imerr : integer := 0;
198 variable to_cmd : integer := 50;
199 variable to_stp : integer := 100;
200 variable to_go : integer := 5000;
201 variable ien : slbit := '0';
202 variable ibit : integer := 0;
203 variable imemi : boolean := false;
204 variable iaddr : slv16 := (others=>'0');
205 variable idoibr : boolean := false;
207 variable r_addr : slv22_1 := (others=>'0');
208 variable r_ena_22bit : slbit := '0';
209 variable r_ena_ubmap : slbit := '0';
210 variable r_membe : slv2 := "11";
211 variable r_membestick : slbit := '0';
215 SB_CNTL <= (others=>'L');
217 wait for clock_offset - setup_time;
220 wait for clock_period;
223 wait for 9*clock_period;
226 write(oline, string'(" # cycles"));
227 writeline(output, oline);
228 write(oline, string'(" | function"));
229 writeline(output, oline);
230 write(oline, string'(" | | register"));
231 writeline(output, oline);
232 write(oline, string'(" | | | input data"));
233 writeline(output, oline);
234 write(oline, string'(" | | | | cmdbusy"));
235 writeline(output, oline);
236 write(oline, string'(" | | | | | cmdack"));
237 writeline(output, oline);
238 write(oline, string'(" | | | | | | cmderr"));
239 writeline(output, oline);
240 write(oline, string'(" | | | | | | | cmdmerr"));
241 writeline(output, oline);
242 write(oline, string'(" | | | | | | | | output data"));
243 writeline(output, oline);
244 write(oline, string'(" | | | | | | | | | cpugo"));
245 writeline(output, oline);
246 write(oline, string'(" | | | | | | | | | |cpustep"));
247 writeline(output, oline);
248 write(oline, string'(" | | | | | | | | | ||cpuwait"));
249 writeline(output, oline);
250 write(oline, string'(" | | | | | | | | | |||cpususp"));
251 writeline(output, oline);
252 write(oline, string'(" | | | | | | | | | ||||suspint"));
253 writeline(output, oline);
254 write(oline, string'(" | | | | | | | | | |||||suspext"));
255 writeline(output, oline);
257 string'(" | | | | | | | | | |||||| cpurust"));
258 writeline(output, oline);
260 string'(" | | | | | | | | | |||||| | Check result"));
261 writeline(output, oline);
263 string'(" | | | | | | | | | |||||| | |"));
264 writeline(output, oline);
266 file_loop: while not endfile(ifile) loop
270 readline (ifile, iline);
277 iline(iline'left to iline'left+2)=" " then
279 iline(iline'left to iline'left+2) := xmicmd;
282 readcomment(iline, ok);
283 next file_loop when ok;
285 readword(iline, dname, ok);
296 when "rsp " => dname := "rr6 ";
297 when "rpc " => dname := "rr7 ";
298 when "wsp " => dname := "wr6 ";
299 when "wpc " => dname := "wr7 ";
303 rind := character'pos(dname(3)) - character'pos('0');
305 if (dname(1)='r' or dname(1)='w') and
307 (rind>=0 and rind<=7) then
311 if dname(1) = '.' then
314 readword_ea(iline, dname);
315 assert dname="pdpcp "
316 report "assert .mode == pdpcp" severity failure;
319 write(oline, string'(".reset"));
320 writeline(output, oline);
322 wait for clock_period;
325 wait for 9*clock_period;
328 read_ea(iline, idelta);
329 wait for idelta*clock_period;
332 read_ea(iline, idelta);
336 read_ea(iline, idelta);
340 read_ea(iline, idelta);
347 read_ea(iline, icerr);
349 read_ea(iline, imerr);
359 read_ea(iline, ibit);
361 assert (ibit>=SB_CNTL'low and ibit<=SB_CNTL'high)
362 report "assert bit number in range of SB_CNTL"
365 SB_CNTL(ibit) <= 'H';
367 SB_CNTL(ibit) <= 'L';
371 write(oline, string'("-E: unknown directive: "));
373 writeline(output, oline);
374 report "aborting" severity failure;
383 ifunc := c_cpfunc_noop;
386 idin := (others=>'0');
387 imsk := (others=>'1');
393 read_ea(iline, nblk);
397 read_ea(iline, nblk);
402 ifunc := c_cpfunc_rreg;
403 irnum := slv(to_unsigned(rind, 3));
404 readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
407 ifunc := c_cpfunc_wreg;
408 irnum := slv(to_unsigned(rind, 3));
409 readoct_ea(iline, idin);
415 readoct_ea(iline, idin);
416 r_addr := (others=>'0');
419 r_addr(c_al_rbf_addr) := idin(c_al_rbf_addr);
424 readoct_ea(iline, idin);
425 r_addr(21 downto 16) := idin(c_ah_rbf_addr);
426 r_ena_22bit := idin(c_ah_rbf_ena_22bit);
427 r_ena_ubmap := idin(c_ah_rbf_ena_ubmap);
432 read_ea(iline, idin3);
433 r_membestick := idin3(c_membe_rbf_stick);
434 r_membe := idin3(c_membe_rbf_be);
439 ifunc := c_cpfunc_rmem;
440 readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
442 ifunc := c_cpfunc_rmem;
444 readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
447 ifunc := c_cpfunc_wmem;
448 readoct_ea(iline, idin);
450 ifunc := c_cpfunc_wmem;
452 readoct_ea(iline, idin);
455 ifunc := c_cpfunc_rmem;
457 readoct_ea(iline, iaddr);
458 readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
460 ifunc := c_cpfunc_wmem;
462 readoct_ea(iline, iaddr);
463 readoct_ea(iline, idin);
466 ifunc := c_cpfunc_rpsw;
467 readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
469 ifunc := c_cpfunc_wpsw;
470 readoct_ea(iline, idin);
476 ifunc := c_cpfunc_wreg;
478 readoct_ea(iline, idin);
482 ifunc := c_cpfunc_start;
484 ifunc := c_cpfunc_stop;
486 ifunc := c_cpfunc_step;
489 ifunc := c_cpfunc_creset;
491 ifunc := c_cpfunc_breset;
493 ifunc := c_cpfunc_suspend;
495 ifunc := c_cpfunc_resume;
506 write(oline, string'("-E: unknown directive: "));
508 writeline(output, oline);
509 report "aborting" severity failure;
562 wait for clock_period;
566 while idelta>0 and R_WAITOK='0' loop
567 wait for clock_period;
568 dcycle := dcycle + 1;
569 idelta := idelta - 1;
573 r_addr := slv(unsigned(r_addr) + 1);
576 if ifunc = c_cpfunc_wmem and
577 r_membestick = '0' then
581 write(oline, dcycle, right, 4);
582 write(oline, string'(" "));
585 when c_cpfunc_rreg => write(oline, string'("rreg"));
586 when c_cpfunc_wreg => write(oline, string'("wreg"));
587 when c_cpfunc_rpsw => write(oline, string'("rpsw"));
588 when c_cpfunc_wpsw => write(oline, string'("wpsw"));
589 when c_cpfunc_rmem =>
591 write(oline, string'("ribr"));
593 write(oline, string'("rmem"));
595 when c_cpfunc_wmem =>
597 write(oline, string'("wibr"));
599 write(oline, string'("wmem"));
601 when c_cpfunc_start => write(oline, string'("sta "));
602 when c_cpfunc_stop => write(oline, string'("sto "));
603 when c_cpfunc_step => write(oline, string'("step"));
604 when c_cpfunc_creset => write(oline, string'("cres"));
605 when c_cpfunc_breset => write(oline, string'("bres"));
606 when c_cpfunc_suspend => write(oline, string'("susp"));
607 when c_cpfunc_resume => write(oline, string'("resu"));
609 write(oline, string'("?"));
610 writeoct(oline, ifunc, right, 2);
611 write(oline, string'("?"));
613 writeoct(oline, irnum, right, 2);
614 writeoct(oline, idin, right, 8);
616 write(oline, string'("---- - ------"));
619 write(oline, R_CP_STAT.cmdbusy, right, 3);
620 write(oline, R_CP_STAT.cmdack, right, 2);
621 write(oline, R_CP_STAT.cmderr, right, 2);
622 write(oline, R_CP_STAT.cmdmerr, right, 2);
625 write(oline, R_CP_STAT.cpustep, right, 1);
626 write(oline, R_CP_STAT.cpuwait, right, 1);
627 write(oline, R_CP_STAT.cpususp, right, 1);
628 write(oline, R_CP_STAT.suspint, right, 1);
629 write(oline, R_CP_STAT.suspext, right, 1);
630 writeoct(oline, R_CP_STAT.cpurust, right, 3);
635 write(oline, string'(" FAIL CMDERR"));
636 elsif R_CP_STAT.cmderr='1' and icerr=1 then
637 write(oline, string'(" CHECK CMDERR SEEN"));
638 elsif R_CP_STAT.cmderr='0' and icerr=1 then
639 write(oline, string'(" FAIL CMDERR EXPECTED,MISSED"));
641 elsif R_CP_STAT.cmdmerr='1' or imerr=1 then
642 if R_CP_STAT.cmdmerr='1' and imerr=0 then
643 write(oline, string'(" FAIL CMDMERR"));
644 elsif R_CP_STAT.cmdmerr='1' and imerr=1 then
645 write(oline, string'(" CHECK CMDMERR SEEN"));
646 elsif R_CP_STAT.cmdmerr='0' and imerr=1 then
647 write(oline, string'(" FAIL CMDMERR EXPECTED,MISSED"));
651 write(oline, string'(" CHECK OK"));
653 write(oline, string'(" CHECK FAILED, d="));
654 writeoct(oline, R_CHKDAT, right, 7);
656 write(oline, string'(","));
657 writeoct(oline, R_CHKMSK, right, 7);
663 write(oline, string'(" WAIT GO OK "));
665 write(oline, string'(" WAIT STEP OK"));
669 write(oline, string'(" WAIT FAILED (will reset)"));
671 wait for clock_period;
674 wait for 9*clock_period;
677 writeline(output, oline);
681 wait for 4*clock_period;
684 writetimestamp(oline, CLK_CYCLE, ": DONE ");
685 writeline(output, oline);
690 end process proc_stim;
696 wait until rising_edge(CLK);
729 end process proc_moni;
OFFSET Delay_length := 200 ns
PERIOD Delay_length := 20 ns
std_logic_vector( 21 downto 1) slv22_1
std_logic_vector( 3 downto 0) slv4
std_logic_vector( 4 downto 0) slv5
std_logic_vector( 2 downto 0) slv3
std_logic_vector( 15 downto 0) slv16
std_logic_vector( 1 downto 0) slv2
slbit := '0' CP_STAT_suspint
slv16 :=( others => '0') R_CHKMSK
slbit := '0' CP_STAT_suspext
slv16 :=( others => '0') R_CP_DOUT
slbit := '0' CP_ADDR_ena_22bit
slbit := '0' CP_STAT_cmdack
slbit := '0' CP_ADDR_racc
slv16 :=( others => '0') R_CHKDAT
slv16 :=( others => '0') CP_DOUT
slbit := '0' CP_STAT_cpususp
slbit := '0' UNUSEDSIGNAL
slv16 :=( others => '0') CP_DIN
slbit := '0' CP_ADDR_ena_ubmap
slbit := '0' CP_STAT_cmderr
slbit := '0' CP_STAT_cmdmerr
slbit := '0' CP_STAT_cmdbusy
slv5 :=( others => '0') CP_CNTL_func
slv3 :=( others => '0') CP_CNTL_rnum
slv22_1 :=( others => '0') CP_ADDR_addr
slbit := '0' CP_STAT_cpugo
cp_stat_type := cp_stat_init R_CP_STAT
slbit := '0' CP_STAT_cpuwait
slv4 :=( others => '0') CP_STAT_cpurust
slbit := '0' CP_STAT_cpustep
out CP_STAT_cmdbusy slbit
out CP_STAT_suspint slbit
in CP_ADDR_ena_22bit slbit
out CP_STAT_cpuwait slbit
out CP_STAT_suspext slbit
out CP_STAT_cmdmerr slbit
out CP_STAT_cpususp slbit
out CP_STAT_cpustep slbit
in CP_ADDR_ena_ubmap slbit