OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.5/] [rtl/] [w11a/] [tb/] [tb_pdp11_core.vhd] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wfjm
-- $Id: tb_pdp11_core.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2006-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    tb_pdp11_core - sim
16
-- Description:    Test bench for pdp11_core
17
--
18
-- Dependencies:   simlib/simclk
19
--                 tbd_pdp11_core [UUT]
20
--                 pdp11_intmap
21
--
22
-- To test:        pdp11_core
23
--
24
-- Target Devices: generic
25
-- Tool versions:  ghdl 0.18-0.29; ISim 11.3
26
--
27
-- Verified (with tb_pdp11_core_stim.dat):
28
-- Date         Rev  Code  ghdl  ise          Target     Comment
29
-- 2010-06-20   308  -     0.29  -            -          u:ok
30
-- 2009-11-22   252  -     0.26  -            -          u:ok
31
-- 2007-12-30   107  -     0.25  -            -          u:ok
32
-- 2007-10-26    92  _tsim 0.26  8.1.03 I27   xc3s1000   c:fail -> blog_ghdl
33
-- 2007-10-26    92  _tsim 0.26  9.2.02 J39   xc3s1000   d:ok (full tsim!)
34
-- 2007-10-26    92  _tsim 0.26  9.1    J30   xc3s1000   d:ok (full tsim!)
35
-- 2007-10-26    92  _tsim 0.26  8.2.03 I34   xc3s1000   d:ok (full tsim!)
36
-- 2007-10-26    92  _fsim 0.26  8.2.03 I34   xc3s1000   d:ok
37
-- 2007-10-26    92  _ssim 0.26  8.2.03 I34   xc3s1000   d:ok
38
-- 2007-10-08    88  _ssim 0.18  8.2.03 I34   xc3s1000   d:ok
39
-- 2007-10-08    88  _ssim 0.18  9.1    J30   xc3s1000   d:ok
40
-- 2007-10-08    88  _ssim 0.18  9.2.02 J39   xc3s1000   d:ok
41
-- 2007-10-07    88  _ssim 0.26  8.1.03 I27   xc3s1000   c:ok
42
-- 2007-10-07    88  _ssim 0.26  8.1    I24   xc3s1000   c:fail -> blog_webpack
43
-- 2007-10-07    88  -     0.26  -            -          c:ok
44
--
45
-- Revision History: 
46
-- Date         Rev Version  Comment
47
-- 2010-06-20   308   1.2.2  add wibrb, ribr, wibr commands for ibr accesses
48
-- 2010-06-20   307   1.2.1  add CP_ADDR_racc, CP_ADDR_be to tbd interface
49
-- 2010-06-13   305   1.2    add CP_CNTL_rnum and CP_ADDR_...;  emulate old
50
--                           'sta' behaviour with new 'stapc' command; rename
51
--                           lal,lah -> wal,wah and implement locally; new
52
--                           output format with cpfunc name
53
-- 2010-06-05   301   1.1.14 renamed .rpmon -> .rbmon
54
-- 2010-04-24   281   1.1.13 use direct instatiation for tbd_
55
-- 2009-11-28   253   1.1.12 add hack for ISim 11.3
56
-- 2009-05-10   214   1.1.11 add .scntl command (set/clear SB_CNTL bits)
57
-- 2008-08-29   163   1.1.10 allow, but ignore, the wtlam command
58
-- 2008-05-03   143   1.1.9  rename _cpursta->_cpurust
59
-- 2008-04-27   140   1.1.8  use cpursta interface, remove cpufail
60
-- 2008-04-19   137   1.1.7  use SB_CLKCYCLE now
61
-- 2008-03-24   129   1.1.6  CLK_CYCLE now 31 bits
62
-- 2008-03-02   121   1.1.5  redo sta,cont,wtgo commands; sta,cont now wait for
63
--                           command completion, wtgo waits for CPU to halt.
64
--                           added .cerr,.merr directive, check cmd(m)err state
65
--                           added .sdef as ignored directive
66
-- 2008-02-24   119   1.1.4  added lah,rps,wps command
67
-- 2008-01-26   114   1.1.3  add handling of d=val,msk
68
-- 2008-01-06   111   1.1.2  remove .eireq, EI's now handled in tbd_pdp11_core
69
-- 2007-10-26    92   1.0.2  use DONE timestamp at end of execution
70
-- 2007-10-12    88   1.0.1  avoid ieee.std_logic_unsigned, use cast to unsigned
71
-- 2007-09-02    79   1.0    Initial version 
72
------------------------------------------------------------------------------
73
 
74
library ieee;
75
use ieee.std_logic_1164.all;
76
use ieee.std_logic_arith.all;
77
use ieee.std_logic_textio.all;
78
use std.textio.all;
79
 
80
use work.slvtypes.all;
81
use work.simlib.all;
82
use work.simbus.all;
83
use work.pdp11_sim.all;
84
use work.pdp11.all;
85
 
86
entity tb_pdp11_core is
87
end tb_pdp11_core;
88
 
89
architecture sim of tb_pdp11_core is
90
 
91
  signal CLK : slbit := '0';
92
  signal RESET : slbit := '0';
93
  signal UNUSEDSIGNAL : slbit := '0';   -- FIXME: hack to make ISim 11.3 happy
94
  signal CP_CNTL_req  : slbit := '0';
95
  signal CP_CNTL_func : slv5 := (others=>'0');
96
  signal CP_CNTL_rnum : slv3 := (others=>'0');
97
  signal CP_ADDR_addr : slv22_1 := (others=>'0');
98
  signal CP_ADDR_racc : slbit := '0';
99
  signal CP_ADDR_be   : slv2  := "11";
100
  signal CP_ADDR_ena_22bit : slbit := '0';
101
  signal CP_ADDR_ena_ubmap : slbit := '0';
102
  signal CP_DIN : slv16 := (others=>'0');
103
  signal CP_STAT_cmdbusy : slbit := '0';
104
  signal CP_STAT_cmdack : slbit := '0';
105
  signal CP_STAT_cmderr : slbit := '0';
106
  signal CP_STAT_cmdmerr : slbit := '0';
107
  signal CP_STAT_cpugo : slbit := '0';
108
  signal CP_STAT_cpustep : slbit := '0';
109
  signal CP_STAT_cpuhalt : slbit := '0';
110
  signal CP_STAT_cpurust : slv4 := (others=>'0');
111
  signal CP_DOUT : slv16 := (others=>'0');
112
 
113
  signal CLK_STOP : slbit := '0';
114
 
115
  signal R_CHKDAT : slv16 := (others=>'0');
116
  signal R_CHKMSK : slv16 := (others=>'0');
117
  signal R_CHKREQ : slbit := '0';
118
 
119
  signal R_WAITCMD  : slbit := '0';
120
  signal R_WAITSTEP : slbit := '0';
121
  signal R_WAITGO   : slbit := '0';
122
  signal R_WAITOK   : slbit := '0';
123
  signal R_CP_STAT : cp_stat_type := cp_stat_init;
124
  signal R_CP_DOUT : slv16 := (others=>'0');
125
 
126
begin
127
 
128
  SYSCLK : simclk
129
    generic map (
130
      PERIOD => clock_period,
131
      OFFSET => clock_offset)
132
    port map (
133
      CLK => CLK,
134
      CLK_CYCLE => SB_CLKCYCLE,
135
      CLK_STOP  => CLK_STOP
136
    );
137
 
138
  UUT: entity work.tbd_pdp11_core
139
    port map (
140
      CLK             => CLK,
141
      RESET           => RESET,
142
      CP_CNTL_req     => CP_CNTL_req,
143
      CP_CNTL_func    => CP_CNTL_func,
144
      CP_CNTL_rnum    => CP_CNTL_rnum,
145
      CP_ADDR_addr    => CP_ADDR_addr,
146
      CP_ADDR_racc    => CP_ADDR_racc,
147
      CP_ADDR_be      => CP_ADDR_be,
148
      CP_ADDR_ena_22bit => CP_ADDR_ena_22bit,
149
      CP_ADDR_ena_ubmap => CP_ADDR_ena_ubmap,
150
      CP_DIN          => CP_DIN,
151
      CP_STAT_cmdbusy => CP_STAT_cmdbusy,
152
      CP_STAT_cmdack  => CP_STAT_cmdack,
153
      CP_STAT_cmderr  => CP_STAT_cmderr,
154
      CP_STAT_cmdmerr => CP_STAT_cmdmerr,
155
      CP_STAT_cpugo   => CP_STAT_cpugo,
156
      CP_STAT_cpustep => CP_STAT_cpustep,
157
      CP_STAT_cpuhalt => CP_STAT_cpuhalt,
158
      CP_STAT_cpurust => CP_STAT_cpurust,
159
      CP_DOUT         => CP_DOUT
160
    );
161
 
162
  proc_stim: process
163
    file ifile : text open read_mode is "tb_pdp11_core_stim";
164
    variable iline  : line;
165
    variable oline  : line;
166
    variable idelta : integer := 0;
167
    variable idummy : integer := 0;
168
    variable dcycle : integer := 0;
169
    variable irqline : integer := 0;
170
    variable ireq  : boolean := false;
171
    variable ifunc : slv5  := (others=>'0');
172
    variable irnum : slv3  := (others=>'0');
173
    variable idin  : slv16 := (others=>'0');
174
    variable imsk  : slv16 := (others=>'1');
175
    variable ichk  : boolean := false;
176
    variable idosta: slbit  := '0';
177
 
178
    variable ok    : boolean;
179
    variable dname : string(1 to 6) := (others=>' ');
180
    variable rind  : integer := 0;
181
    variable nblk  : integer := 0;
182
    variable xmicmd : string(1 to 3) := (others=>' ');
183
    variable iwtstp : boolean := false;
184
    variable iwtgo  : boolean := false;
185
    variable icerr  : integer := 0;
186
    variable imerr  : integer := 0;
187
    variable to_cmd : integer := 50;
188
    variable to_stp : integer := 100;
189
    variable to_go  : integer := 5000;
190
    variable ien    : slbit := '0';
191
    variable ibit   : integer := 0;
192
    variable imemi  : boolean := false;
193
    variable ioff   : slv6 := (others=>'0');
194
    variable idoibr : boolean := false;
195
 
196
    variable r_addr : slv22_1 := (others=>'0');
197
    variable r_ena_22bit : slbit := '0';
198
    variable r_ena_ubmap : slbit := '0';
199
    variable r_ibrbase : slv(c_ibrb_ibf_base) := (others=>'0');
200
    variable r_ibrbe : slv2 := (others=>'0');
201
 
202
 
203
  begin
204
 
205
    SB_CNTL <= (others=>'L');
206
 
207
    wait for clock_offset - setup_time;
208
 
209
    RESET <= '1';
210
    wait for clock_period;
211
 
212
    RESET <= '0';
213
    wait for 9*clock_period;
214
 
215
    file_loop: while not endfile(ifile) loop
216
 
217
      -- this logic is a quick hack to implement the 'stapc' command
218
      if idosta = '0' then
219
        readline (ifile, iline);
220
 
221
        iwtstp := false;
222
        iwtgo  := false;
223
 
224
        if nblk>0 and                     -- outstanding [rw]mi lines ?
225
          iline'length>=3 and            -- and 3 leading blanks
226
          iline(iline'left to iline'left+2)="   " then
227
          nblk := nblk - 1;               -- than fill [rw]mi command in again
228
          iline(iline'left to iline'left+2) := xmicmd;
229
        end if;
230
 
231
        readcomment(iline, ok);
232
        next file_loop when ok;
233
 
234
        readword(iline, dname, ok);
235
 
236
      else
237
        idosta := '0';
238
        dname  := "sta   ";
239
        ok     := true;
240
      end if;
241
 
242
      if ok then
243
 
244
        case dname is
245
          when "rsp   " => dname := "rr6   ";   -- rsp -> rr6
246
          when "rpc   " => dname := "rr7   ";   -- rpc -> rr7
247
          when "wsp   " => dname := "wr6   ";   -- wsp -> wr6
248
          when "wpc   " => dname := "wr7   ";   -- wpc -> wr7
249
          when others => null;
250
        end case;
251
 
252
        rind := character'pos(dname(3)) - character'pos('0');
253
 
254
        if (dname(1)='r' or dname(1)='w') and  -- check for [rw]r[0-7]
255
           dname(2)='r' and
256
           (rind>=0 and rind<=7) then
257
          dname(3) := '|';                     -- replace with [rw]r|
258
        end if;
259
 
260
        if dname(1) = '.' then
261
          case dname is
262
            when ".mode " =>            -- .mode
263
              readword_ea(iline, dname);
264
              assert dname="pdpcp "
265
                report "assert .mode == pdpcp" severity failure;
266
 
267
            when ".reset" =>            -- .reset
268
              write(oline, string'(".reset"));
269
              writeline(output, oline);
270
              RESET <= '1';
271
              wait for clock_period;
272
 
273
              RESET <= '0';
274
              wait for 9*clock_period;
275
 
276
            when ".wait " =>            -- .wait
277
              read_ea(iline, idelta);
278
              wait for idelta*clock_period;
279
 
280
            when ".tocmd" =>            -- .tocmd
281
              read_ea(iline, idelta);
282
              to_cmd := idelta;
283
 
284
            when ".tostp" =>            -- .tostp
285
              read_ea(iline, idelta);
286
              to_stp := idelta;
287
 
288
            when ".togo " =>            -- .togo
289
              read_ea(iline, idelta);
290
              to_go := idelta;
291
 
292
            when ".sdef " =>            -- .sdef (ignore it)
293
              readempty(iline);
294
 
295
            when ".cerr " =>            -- .cerr
296
              read_ea(iline, icerr);
297
            when ".merr " =>            -- .merr
298
              read_ea(iline, imerr);
299
 
300
            when ".anena" =>            -- .anena (ignore it)
301
              readempty(iline);
302
            when ".cpmon" =>            -- .cpmon (ignore it)
303
              readempty(iline);
304
            when ".rbmon" =>            -- .rbmon (ignore it)
305
              readempty(iline);
306
 
307
            when ".scntl" =>              -- .scntl
308
              read_ea(iline, ibit);
309
              read_ea(iline, ien);
310
              assert (ibit>=SB_CNTL'low and ibit<=SB_CNTL'high)
311
                report "assert bit number in range of SB_CNTL"
312
                severity failure;
313
              if ien = '1' then
314
                SB_CNTL(ibit) <= 'H';
315
              else
316
                SB_CNTL(ibit) <= 'L';
317
              end if;
318
 
319
            when others =>              -- bad directive
320
              write(oline, string'("?? unknown directive: "));
321
              write(oline, dname);
322
              writeline(output, oline);
323
              report "aborting" severity failure;
324
          end case;
325
 
326
          testempty_ea(iline);
327
          next file_loop;
328
 
329
        else
330
 
331
          ireq   := true;
332
          ifunc  := c_cpfunc_noop;
333
          irnum  := "000";
334
          ichk   := false;
335
          idin   := (others=>'0');
336
          imsk   := (others=>'1');
337
          imemi  := false;
338
          idoibr := false;
339
 
340
          case dname is
341
            when "brm   " =>            -- brm
342
              read_ea(iline, nblk);
343
              xmicmd := "rmi";
344
              next file_loop;
345
            when "bwm   " =>            -- bwm
346
              read_ea(iline, nblk);
347
              xmicmd := "wmi";
348
              next file_loop;
349
 
350
            when "rr|   " =>            -- rr[0-7]
351
              ifunc := c_cpfunc_rreg;
352
              irnum := conv_std_logic_vector(rind, 3);
353
              readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
354
 
355
            when "wr|   " =>            -- wr[0-7]
356
              ifunc := c_cpfunc_wreg;
357
              irnum := conv_std_logic_vector(rind, 3);
358
              readoct_ea(iline, idin);
359
 
360
            -- Note: there are no field definitions for wal, wah, wibrb because
361
            --       there is no corresponding cp command. Therefore the
362
            --       rbus field definitions are used here
363
            when "wal   " =>            -- wal
364
              readoct_ea(iline, idin);
365
              r_addr      := (others=>'0'); -- write to al clears ah !!
366
              r_ena_22bit := '0';
367
              r_ena_ubmap := '0';
368
              r_addr(c_al_rbf_addr) := idin(c_al_rbf_addr);
369
              testempty_ea(iline);
370
              next file_loop;
371
 
372
            when "wah   " =>            -- wah
373
              readoct_ea(iline, idin);
374
              r_addr(21 downto 16) := idin(c_ah_rbf_addr);
375
              r_ena_22bit          := idin(c_ah_rbf_ena_22bit);
376
              r_ena_ubmap          := idin(c_ah_rbf_ena_ubmap);
377
              testempty_ea(iline);
378
              next file_loop;
379
 
380
            when "wibrb " =>            -- wibrb
381
              readoct_ea(iline, idin);
382
              r_ibrbase := idin(c_ibrb_ibf_base);
383
              if idin(c_ibrb_ibf_be) /= "00" then
384
                r_ibrbe   := idin(c_ibrb_ibf_be);
385
              else
386
                r_ibrbe   := "11";
387
              end if;
388
              testempty_ea(iline);
389
              next file_loop;
390
 
391
            when "rm    " =>            -- rm
392
              ifunc := c_cpfunc_rmem;
393
              readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
394
            when "rmi   " =>            -- rmi
395
              ifunc := c_cpfunc_rmem;
396
              imemi := true;
397
              readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
398
 
399
            when "wm    " =>            -- wm
400
              ifunc := c_cpfunc_wmem;
401
              readoct_ea(iline, idin);
402
            when "wmi   " =>            -- wmi
403
              ifunc := c_cpfunc_wmem;
404
              imemi := true;
405
              readoct_ea(iline, idin);
406
 
407
            when "ribr  " =>            -- ribr
408
              ifunc  := c_cpfunc_rmem;
409
              idoibr := true;
410
              readoct_ea(iline, ioff);
411
              readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
412
            when "wibr  " =>            -- wibr
413
              ifunc  := c_cpfunc_wmem;
414
              idoibr := true;
415
              readoct_ea(iline, ioff);
416
              readoct_ea(iline, idin);
417
 
418
            when "rps   " =>            -- rps
419
              ifunc := c_cpfunc_rpsw;
420
              readtagval2_ea(iline, "d", ichk, idin, imsk, 8);
421
            when "wps   " =>            -- wps
422
              ifunc := c_cpfunc_wpsw;
423
              readoct_ea(iline, idin);
424
 
425
            -- Note: in old version 'sta addr' was an atomic operation, loading
426
            --       the pc and starting the cpu. Now this is action is two step
427
            --       first a wpc followed by a 'sta'.
428
            when "stapc " =>            -- stapc
429
              ifunc := c_cpfunc_wreg;
430
              irnum := c_gpr_pc;
431
              readoct_ea(iline, idin);
432
              idosta := '1';              -- request 'sta' to be done next
433
 
434
            when "sta   " =>            -- sta
435
              ifunc := c_cpfunc_sta;
436
            when "sto   " =>            -- sto
437
              ifunc := c_cpfunc_sto;
438
            when "cont  " =>            -- cont
439
              ifunc := c_cpfunc_cont;
440
            when "step  " =>            -- step
441
              ifunc := c_cpfunc_step;
442
              iwtstp := true;
443
            when "rst   " =>            -- rst
444
              ifunc := c_cpfunc_rst;
445
 
446
            when "wtgo  " =>            -- wtgo
447
              iwtgo := true;
448
              ireq  := false;             -- no cp request !
449
 
450
            when "wtlam " =>            -- wtlam (ignore it)
451
              readempty(iline);
452
              next file_loop;
453
 
454
            when others =>              -- bad directive
455
              write(oline, string'("?? unknown directive: "));
456
              write(oline, dname);
457
              writeline(output, oline);
458
              report "aborting" severity failure;
459
          end case;
460
 
461
        end if;
462
        testempty_ea(iline);
463
 
464
      end if;
465
 
466
      if idoibr then
467
        CP_ADDR_addr(15 downto 13)    <= "111";
468
        CP_ADDR_addr(c_ibrb_ibf_base) <= r_ibrbase;
469
        CP_ADDR_addr(5 downto 1)      <= ioff(5 downto 1);
470
        CP_ADDR_racc      <= '1';
471
        CP_ADDR_be        <= r_ibrbe;
472
        CP_ADDR_ena_22bit <= '0';
473
        CP_ADDR_ena_ubmap <= '0';
474
      else
475
        CP_ADDR_addr      <= r_addr;
476
        CP_ADDR_racc      <= '0';
477
        CP_ADDR_be        <= "11";
478
        CP_ADDR_ena_22bit <= r_ena_22bit;
479
        CP_ADDR_ena_ubmap <= r_ena_ubmap;
480
      end if;
481
 
482
      if ireq then
483
        CP_CNTL_req  <= '1';
484
        CP_CNTL_func <= ifunc;
485
        CP_CNTL_rnum <= irnum;
486
      end if;
487
 
488
      if ichk then
489
        CP_DIN   <= (others=>'0');
490
        R_CHKDAT <= idin;
491
        R_CHKMSK <= imsk;
492
        R_CHKREQ <= '1';
493
      else
494
        CP_DIN   <= idin;
495
        R_CHKREQ <= '0';
496
      end if;
497
 
498
      R_WAITCMD  <= '0';
499
      R_WAITSTEP <= '0';
500
      R_WAITGO   <= '0';
501
      if iwtgo then
502
        idelta := to_go;
503
        R_WAITGO <= '1';
504
      elsif iwtstp then
505
        idelta := to_stp;
506
        R_WAITSTEP <= '1';
507
      else
508
        idelta := to_cmd;
509
        R_WAITCMD <= '1';
510
      end if;
511
 
512
      wait for clock_period;
513
      CP_CNTL_req <= '0';
514
 
515
      dcycle := 1;
516
      while idelta>0 and R_WAITOK='0' loop
517
        wait for clock_period;
518
        dcycle := dcycle + 1;
519
        idelta := idelta - 1;
520
      end loop;
521
 
522
      if imemi then                    -- rmi or wmi seen ? then inc ar
523
        r_addr := unsigned(r_addr) + 1;
524
      end if;
525
 
526
      write(oline, dcycle, right, 4);
527
      write(oline, string'(" "));
528
      if ireq then
529
        case ifunc is
530
          when c_cpfunc_rreg => write(oline, string'("rreg"));
531
          when c_cpfunc_wreg => write(oline, string'("wreg"));
532
          when c_cpfunc_rpsw => write(oline, string'("rpsw"));
533
          when c_cpfunc_wpsw => write(oline, string'("wpsw"));
534
          when c_cpfunc_rmem =>
535
            if idoibr then
536
              write(oline, string'("ribr"));
537
            else
538
              write(oline, string'("rmem"));
539
            end if;
540
          when c_cpfunc_wmem =>
541
            if idoibr then
542
              write(oline, string'("wibr"));
543
            else
544
              write(oline, string'("wmem"));
545
            end if;
546
          when c_cpfunc_sta  => write(oline, string'("sta "));
547
          when c_cpfunc_sto  => write(oline, string'("sto "));
548
          when c_cpfunc_cont => write(oline, string'("cont"));
549
          when c_cpfunc_step => write(oline, string'("step"));
550
          when c_cpfunc_rst  => write(oline, string'("rst "));
551
          when others =>
552
            write(oline, string'("?"));
553
            writeoct(oline, ifunc, right, 2);
554
            write(oline, string'("?"));
555
        end case;
556
        writeoct(oline, irnum, right, 2);
557
        writeoct(oline, idin, right, 8);
558
      else
559
        write(oline, string'("---- -  ------"));
560
      end if;
561
 
562
      write(oline, R_CP_STAT.cmdbusy, right, 3);
563
      write(oline, R_CP_STAT.cmdack, right, 2);
564
      write(oline, R_CP_STAT.cmderr, right, 2);
565
      write(oline, R_CP_STAT.cmdmerr, right, 2);
566
      writeoct(oline, R_CP_DOUT, right, 8);
567
      write(oline, R_CP_STAT.cpugo, right, 3);
568
      write(oline, R_CP_STAT.cpustep, right, 2);
569
      write(oline, R_CP_STAT.cpuhalt, right, 2);
570
      writeoct(oline, R_CP_STAT.cpurust, right, 3);
571
 
572
      if R_WAITOK = '1' then
573
        if R_CP_STAT.cmderr='1' or icerr=1 then
574
          if    R_CP_STAT.cmderr='1' and icerr=0 then
575
            write(oline, string'("  FAIL CMDERR"));
576
          elsif R_CP_STAT.cmderr='1' and icerr=1 then
577
            write(oline, string'("  CHECK CMDERR SEEN"));
578
          elsif R_CP_STAT.cmderr='0' and icerr=1 then
579
            write(oline, string'("  FAIL CMDERR EXPECTED,MISSED"));
580
          end if;
581
        elsif R_CP_STAT.cmdmerr='1' or imerr=1 then
582
          if    R_CP_STAT.cmdmerr='1' and imerr=0 then
583
            write(oline, string'("  FAIL CMDMERR"));
584
          elsif R_CP_STAT.cmdmerr='1' and imerr=1 then
585
            write(oline, string'("  CHECK CMDMERR SEEN"));
586
          elsif R_CP_STAT.cmdmerr='0' and imerr=1 then
587
            write(oline, string'("  FAIL CMDMERR EXPECTED,MISSED"));
588
          end if;
589
        elsif R_CHKREQ='1' then
590
          if unsigned((R_CP_DOUT xor R_CHKDAT) and (not R_CHKMSK))=0 then
591
            write(oline, string'("  CHECK OK"));
592
          else
593
            write(oline, string'("  CHECK FAILED, d="));
594
            writeoct(oline, R_CHKDAT, right, 7);
595
            if unsigned(R_CHKMSK)/=0 then
596
              write(oline, string'(","));
597
              writeoct(oline, R_CHKMSK, right, 7);
598
            end if;
599
          end if;
600
        end if;
601
 
602
        if iwtgo then
603
          write(oline, string'("  WAIT GO OK  "));
604
        elsif iwtstp then
605
          write(oline, string'("  WAIT STEP OK"));
606
        end if;
607
 
608
      else
609
        write(oline, string'("  WAIT FAILED (will reset)"));
610
        RESET <= '1';
611
        wait for clock_period;
612
 
613
        RESET <= '0';
614
        wait for 9*clock_period;
615
 
616
      end if;
617
      writeline(output, oline);
618
 
619
    end loop;
620
 
621
    wait for 4*clock_period;
622
    CLK_STOP <= '1';
623
 
624
    writetimestamp(oline, SB_CLKCYCLE, ": DONE ");
625
    writeline(output, oline);
626
 
627
    wait;                               -- suspend proc_stim forever
628
                                        -- clock is stopped, sim will end
629
 
630
  end process proc_stim;
631
 
632
  proc_moni: process
633
  begin
634
 
635
    loop
636
      wait until CLK'event and CLK='1';
637
      wait for c2out_time;
638
 
639
      R_WAITOK <= '0';
640
      if R_WAITCMD = '1' then
641
        if CP_STAT_cmdack = '1' then
642
          R_WAITOK <= '1';
643
        end if;
644
      elsif R_WAITGO = '1' then
645
        if CP_STAT_cmdbusy='0' and CP_STAT_cpugo='0' then
646
          R_WAITOK <= '1';
647
        end if;
648
      elsif R_WAITSTEP = '1' then
649
        if CP_STAT_cmdbusy='0' and CP_STAT_cpustep='0' then
650
          R_WAITOK <= '1';
651
        end if;
652
      end if;
653
 
654
      R_CP_STAT.cmdbusy <= CP_STAT_cmdbusy;
655
      R_CP_STAT.cmdack  <= CP_STAT_cmdack;
656
      R_CP_STAT.cmderr  <= CP_STAT_cmderr;
657
      R_CP_STAT.cmdmerr <= CP_STAT_cmdmerr;
658
      R_CP_STAT.cpugo   <= CP_STAT_cpugo;
659
      R_CP_STAT.cpustep <= CP_STAT_cpustep;
660
      R_CP_STAT.cpuhalt <= CP_STAT_cpuhalt;
661
      R_CP_STAT.cpurust <= CP_STAT_cpurust;
662
      R_CP_DOUT <= CP_DOUT;
663
 
664
    end loop;
665
 
666
  end process proc_moni;
667
 
668
end sim;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.