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

Subversion Repositories w11

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

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

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

powered by: WebSVN 2.1.0

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