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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [rtl/] [w11a/] [tb/] [tb_pdp11core.vhd] - Blame information for rev 9

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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