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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [verilog/] [or1200_monitor.v] - Blame information for rev 439

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

Line No. Rev Author Line
1 6 julius
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3 360 julius
////  or1200_monitor                                              ////
4
////                                                              ////
5
////  OR1200 processor monitor module                             ////
6
////                                                              ////
7
//////////////////////////////////////////////////////////////////////
8
////                                                              ////
9 348 julius
//// Copyright (C) 2009, 2010 Authors and OPENCORES.ORG           ////
10 6 julius
////                                                              ////
11
//// This source file may be used and distributed without         ////
12
//// restriction provided that this copyright statement is not    ////
13
//// removed from the file and that any derivative work contains  ////
14
//// the original copyright notice and the associated disclaimer. ////
15
////                                                              ////
16
//// This source file is free software; you can redistribute it   ////
17
//// and/or modify it under the terms of the GNU Lesser General   ////
18
//// Public License as published by the Free Software Foundation; ////
19
//// either version 2.1 of the License, or (at your option) any   ////
20
//// later version.                                               ////
21
////                                                              ////
22
//// This source is distributed in the hope that it will be       ////
23
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
24
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
25
//// PURPOSE.  See the GNU Lesser General Public License for more ////
26
//// details.                                                     ////
27
////                                                              ////
28
//// You should have received a copy of the GNU Lesser General    ////
29
//// Public License along with this source; if not, download it   ////
30
//// from http://www.opencores.org/lgpl.shtml                     ////
31
////                                                              ////
32
//////////////////////////////////////////////////////////////////////
33 67 julius
 
34 55 julius
`include "timescale.v"
35 6 julius
`include "or1200_defines.v"
36 360 julius
`include "orpsoc-testbench-defines.v"
37
`include "test-defines.v"
38 415 julius
 
39 6 julius
//
40 415 julius
// Top of TB
41
//
42
`define TB_TOP orpsoc_testbench
43
 
44
//
45
// Top of DUT
46
//
47
`define DUT_TOP `TB_TOP.dut
48
 
49
//
50 6 julius
// Top of OR1200 inside test bench
51
//
52 415 julius
`define OR1200_TOP `DUT_TOP.or1200_top0
53 360 julius
 
54 397 julius
//
55
// Define to enable lookup file generation
56
//
57
//`define OR1200_MONITOR_LOOKUP
58 360 julius
 
59 6 julius
//
60 397 julius
// Define to enable SPR access log file generation
61 6 julius
//
62 397 julius
//`define OR1200_MONITOR_SPRS
63 6 julius
 
64 348 julius
//
65 397 julius
// Enable logging of state during execution
66 351 julius
//
67 397 julius
//`define OR1200_MONITOR_EXEC_STATE
68
 
69
//
70
// Enable disassembly of instructions in execution state log
71
//
72 360 julius
//`define OR1200_MONITOR_PRINT_DISASSEMBLY
73 351 julius
 
74 397 julius
// Can either individually enable things above, or usually have the scripts
75
// running the simulation pass the PROCESSOR_MONITOR_ENABLE_LOGS define to
76
// enable them all.
77 351 julius
 
78 397 julius
`ifdef PROCESSOR_MONITOR_ENABLE_LOGS
79
 `define OR1200_MONITOR_EXEC_STATE
80
 `define OR1200_MONITOR_SPRS
81
 `define OR1200_MONITOR_LOOKUP
82
`endif
83
 
84 351 julius
//
85 415 julius
// Memory coherence checking (double check instruction in fetch stage against
86
// what is in memory.)
87
//
88
//`define MEM_COHERENCE_CHECK
89
 
90
//
91 348 julius
// Top of OR1200 inside test bench
92
//
93
`define CPU or1200
94
`define CPU_cpu or1200_cpu
95
`define CPU_rf or1200_rf
96
`define CPU_except or1200_except
97
`define CPU_ctrl or1200_ctrl
98
`define CPU_sprs or1200_sprs
99
 
100 6 julius
module or1200_monitor;
101
 
102
   integer fexe;
103
   reg [23:0] ref;
104 397 julius
`ifdef OR1200_MONITOR_SPRS
105 6 julius
   integer    fspr;
106 397 julius
`endif
107 6 julius
   integer    fgeneral;
108 397 julius
`ifdef OR1200_MONITOR_LOOKUP
109 6 julius
   integer    flookup;
110 397 julius
`endif
111 6 julius
   integer    r3;
112
   integer    insns;
113
 
114 348 julius
 
115 6 julius
   //
116
   // Initialization
117
   //
118
   initial begin
119
      ref = 0;
120 397 julius
`ifdef OR1200_MONITOR_EXEC_STATE
121 360 julius
      fexe = $fopen({"../out/",`TEST_NAME_STRING,"-executed.log"});
122 397 julius
`endif
123 6 julius
      $timeformat (-9, 2, " ns", 12);
124 397 julius
`ifdef OR1200_MONITOR_SPRS
125 360 julius
      fspr = $fopen({"../out/",`TEST_NAME_STRING,"-sprs.log"});
126 397 julius
`endif
127 360 julius
      fgeneral = $fopen({"../out/",`TEST_NAME_STRING,"-general.log"});
128 397 julius
`ifdef OR1200_MONITOR_LOOKUP
129 360 julius
      flookup = $fopen({"../out/",`TEST_NAME_STRING,"-lookup.log"});
130 397 julius
`endif
131 6 julius
      insns = 0;
132
 
133
   end
134
 
135
   //
136
   // Get GPR
137
   //
138
   task get_gpr;
139
      input     [4:0]    gpr_no;
140
      output [31:0]      gpr;
141
      integer           j;
142
      begin
143 348 julius
 
144
 `ifdef OR1200_RFRAM_GENERIC
145 6 julius
         for(j = 0; j < 32; j = j + 1) begin
146 348 julius
            gpr[j] = `OR1200_TOP.`CPU_cpu.`CPU_rf.rf_a.mem[gpr_no*32+j];
147 6 julius
         end
148 348 julius
 
149 67 julius
 `else
150 348 julius
         //gpr = `OR1200_TOP.`CPU_cpu.`CPU_rf.rf_a.mem[gpr_no];
151
         gpr = `OR1200_TOP.`CPU_cpu.`CPU_rf.rf_a.get_gpr(gpr_no);
152
 
153
 `endif
154 6 julius
 
155 348 julius
 
156
      end
157
   endtask
158
 
159 6 julius
   //
160
   // Write state of the OR1200 registers into a file
161
   //
162
   // Limitation: only a small subset of register file RAMs
163
   // are supported
164
   //
165
   task display_arch_state;
166
      reg [5:0] i;
167
      reg [31:0] r;
168
      integer    j;
169
      begin
170 397 julius
`ifdef OR1200_MONITOR_EXEC_STATE
171 6 julius
         ref = ref + 1;
172 397 julius
 `ifdef OR1200_MONITOR_LOOKUP
173 6 julius
         $fdisplay(flookup, "Instruction %d: %t", insns, $time);
174 397 julius
 `endif
175 351 julius
         $fwrite(fexe, "\nEXECUTED(%d): %h:  %h", insns,
176
                 `OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc,
177
                 `OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
178
 `ifdef OR1200_MONITOR_PRINT_DISASSEMBLY
179
         $fwrite(fexe,"\t");
180
         // Decode the instruction, print it out
181
         or1200_print_op(`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
182
 `endif
183 6 julius
         for(i = 0; i < 32; i = i + 1) begin
184
            if (i % 4 == 0)
185
              $fdisplay(fexe);
186
            get_gpr(i, r);
187
            $fwrite(fexe, "GPR%d: %h  ", i, r);
188
         end
189
         $fdisplay(fexe);
190 348 julius
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.sr;
191 6 julius
         $fwrite(fexe, "SR   : %h  ", r);
192 348 julius
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.epcr;
193 6 julius
         $fwrite(fexe, "EPCR0: %h  ", r);
194 348 julius
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.eear;
195 6 julius
         $fwrite(fexe, "EEAR0: %h  ", r);
196 348 julius
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.esr;
197 6 julius
         $fdisplay(fexe, "ESR0 : %h", r);
198 397 julius
`endif //  `ifdef OR1200_MONITOR_EXEC_STATE
199 348 julius
`ifdef OR1200_DISPLAY_EXECUTED
200
         ref = ref + 1;
201 397 julius
 `ifdef OR1200_MONITOR_LOOKUP
202 348 julius
         $fdisplay(flookup, "Instruction %d: %t", insns, $time);
203 397 julius
 `endif
204 348 julius
         $fwrite(fexe, "\nEXECUTED(%d): %h:  %h", insns, `OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc, `OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
205 6 julius
`endif
206 348 julius
         insns = insns + 1;
207 6 julius
end
208
   endtask // display_arch_state
209
 
210
   /* Keep a trace buffer of the last lot of instructions and addresses
211
    * "executed",as read from the writeback stage, and cause a $finish if we hit
212
    * an instruction that is invalid, such as all zeros.
213
    * Currently, only breaks on an all zero instruction, but should probably be
214
    * made to break for anything with an X in it too. And of course ideally this
215
    * shouldn't be needed - but is handy if someone changes something and stops
216
    * the test continuing forever.
217
    */
218 49 julius
   integer num_nul_inst;
219
   initial num_nul_inst = 0;
220
 
221 6 julius
   task monitor_for_crash;
222 348 julius
`define OR1200_MONITOR_CRASH_TRACE_SIZE 32
223
      //Trace buffer of 32 instructions
224
      reg [31:0] insn_trace [0:`OR1200_MONITOR_CRASH_TRACE_SIZE-1];
225
      //Trace buffer of the addresses of those instructions
226
      reg [31:0] addr_trace [0:`OR1200_MONITOR_CRASH_TRACE_SIZE-1];
227 6 julius
      integer i;
228
 
229
     begin
230 348 julius
        if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h00000000)
231 49 julius
          num_nul_inst = num_nul_inst + 1;
232 348 julius
        else
233
          num_nul_inst = 0; // Reset it
234 49 julius
 
235
        if (num_nul_inst == 1000) // Sat a loop a bit too long...
236 6 julius
          begin
237 348 julius
             $fdisplay(fgeneral, "ERROR - no instruction at PC %h",
238
                       `OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc);
239
             $fdisplay(fgeneral, "Crash trace: Last %d instructions: ",
240
                       `OR1200_MONITOR_CRASH_TRACE_SIZE);
241 6 julius
 
242
             $fdisplay(fgeneral, "PC\t\tINSTR");
243
             for(i=`OR1200_MONITOR_CRASH_TRACE_SIZE-1;i>=0;i=i-1) begin
244
                $fdisplay(fgeneral, "%h\t%h",addr_trace[i], insn_trace[i]);
245
             end
246
             #100 $finish;
247
          end
248
        else
249
          begin
250
             for(i=`OR1200_MONITOR_CRASH_TRACE_SIZE-1;i>0;i=i-1) begin
251
                insn_trace[i] = insn_trace[i-1];
252
                addr_trace[i] = addr_trace[i-1];
253
             end
254 348 julius
             insn_trace[0] = `OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn;
255
             addr_trace[0] = `OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc;
256 6 julius
          end
257
 
258
     end
259
   endtask // monitor_for_crash
260 348 julius
 
261 6 julius
 
262 348 julius
   //
263
   // Write state of the OR1200 registers into a file; version for exception
264
   //
265
   task display_arch_state_except;
266
      reg [5:0] i;
267
      reg [31:0] r;
268
      integer    j;
269
      begin
270 397 julius
`ifdef OR1200_MONITOR_EXEC_STATE
271 348 julius
         ref = ref + 1;
272 397 julius
 `ifdef OR1200_MONITOR_LOOKUP
273 348 julius
         $fdisplay(flookup, "Instruction %d: %t", insns, $time);
274 397 julius
 `endif
275 348 julius
         $fwrite(fexe, "\nEXECUTED(%d): %h:  %h  (exception)", insns, `OR1200_TOP.`CPU_cpu.`CPU_except.ex_pc, `OR1200_TOP.`CPU_cpu.`CPU_ctrl.ex_insn);
276
         for(i = 0; i < 32; i = i + 1) begin
277
            if (i % 4 == 0)
278
              $fdisplay(fexe);
279
            get_gpr(i, r);
280
            $fwrite(fexe, "GPR%d: %h  ", i, r);
281
         end
282
         $fdisplay(fexe);
283
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.sr;
284
         $fwrite(fexe, "SR   : %h  ", r);
285
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.epcr;
286
         $fwrite(fexe, "EPCR0: %h  ", r);
287
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.eear;
288
         $fwrite(fexe, "EEAR0: %h  ", r);
289
         r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.esr;
290
         $fdisplay(fexe, "ESR0 : %h", r);
291
         insns = insns + 1;
292 397 julius
`endif //  `ifdef OR1200_MONITOR_EXEC_STATE
293 348 julius
`ifdef OR1200_DISPLAY_EXECUTED
294
         ref = ref + 1;
295 397 julius
 `ifdef OR1200_MONITOR_LOOKUP
296 348 julius
         $fdisplay(flookup, "Instruction %d: %t", insns, $time);
297 397 julius
 `endif
298 348 julius
         $fwrite(fexe, "\nEXECUTED(%d): %h:  %h  (exception)", insns,
299
                 `OR1200_TOP.`CPU_cpu.`CPU_except.ex_pc,
300
                 `OR1200_TOP.`CPU_cpu.`CPU_ctrl.ex_insn);
301
         insns = insns + 1;
302
`endif
303
 
304
end
305
   endtask
306
 
307 6 julius
   integer iwb_progress;
308
   reg [31:0] iwb_progress_addr;
309
   //
310
   // WISHBONE bus checker
311
   //
312
   always @(posedge `OR1200_TOP.iwb_clk_i)
313
     if (`OR1200_TOP.iwb_rst_i) begin
314
        iwb_progress = 0;
315
        iwb_progress_addr = `OR1200_TOP.iwb_adr_o;
316
     end
317
     else begin
318
        if (`OR1200_TOP.iwb_cyc_o && (iwb_progress != 2)) begin
319
           iwb_progress = 1;
320
        end
321
        if (`OR1200_TOP.iwb_stb_o) begin
322
           if (iwb_progress >= 1) begin
323
              if (iwb_progress == 1)
324
                iwb_progress_addr = `OR1200_TOP.iwb_adr_o;
325
              iwb_progress = 2;
326
           end
327
           else begin
328
              $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.iwb_stb_o raised without `OR1200_TOP.iwb_cyc_o, at %t\n", $time);
329
              #100 $finish;
330
           end
331
        end
332
        if (`OR1200_TOP.iwb_ack_i & `OR1200_TOP.iwb_err_i) begin
333
           $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.iwb_ack_i and `OR1200_TOP.iwb_err_i raised at the same time, at %t\n", $time);
334
        end
335
        if ((iwb_progress == 2) && (iwb_progress_addr != `OR1200_TOP.iwb_adr_o)) begin
336
           $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.iwb_adr_o changed while waiting for `OR1200_TOP.iwb_err_i/`OR1200_TOP.iwb_ack_i, at %t\n", $time);
337
           #100 $finish;
338
        end
339
        if (`OR1200_TOP.iwb_ack_i | `OR1200_TOP.iwb_err_i)
340
          if (iwb_progress == 2) begin
341
             iwb_progress = 0;
342
             iwb_progress_addr = `OR1200_TOP.iwb_adr_o;
343
          end
344
          else begin
345
             $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.iwb_ack_i/`OR1200_TOP.iwb_err_i raised without `OR1200_TOP.iwb_cyc_i/`OR1200_TOP.iwb_stb_i, at %t\n", $time);
346
             #100 $finish;
347
          end
348
        if ((iwb_progress == 2) && !`OR1200_TOP.iwb_stb_o) begin
349
           $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.iwb_stb_o lowered without `OR1200_TOP.iwb_err_i/`OR1200_TOP.iwb_ack_i, at %t\n", $time);
350 348 julius
           #100 $finish;
351 6 julius
        end
352
     end
353
 
354
   integer dwb_progress;
355
reg [31:0] dwb_progress_addr;
356
//
357
// WISHBONE bus checker
358
//
359
always @(posedge `OR1200_TOP.dwb_clk_i)
360
  if (`OR1200_TOP.dwb_rst_i)
361
    dwb_progress = 0;
362
  else begin
363
     if (`OR1200_TOP.dwb_cyc_o && (dwb_progress != 2))
364
       dwb_progress = 1;
365
     if (`OR1200_TOP.dwb_stb_o)
366
       if (dwb_progress >= 1) begin
367
          if (dwb_progress == 1)
368
            dwb_progress_addr = `OR1200_TOP.dwb_adr_o;
369
          dwb_progress = 2;
370
       end
371
       else begin
372
          $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.dwb_stb_o raised without `OR1200_TOP.dwb_cyc_o, at %t\n", $time);
373
          #100 $finish;
374
       end
375
     if (`OR1200_TOP.dwb_ack_i & `OR1200_TOP.dwb_err_i) begin
376
        $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.dwb_ack_i and `OR1200_TOP.dwb_err_i raised at the same time, at %t\n", $time);
377
     end
378
     if ((dwb_progress == 2) && (dwb_progress_addr != `OR1200_TOP.dwb_adr_o)) begin
379
        $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.dwb_adr_o changed while waiting for `OR1200_TOP.dwb_err_i/`OR1200_TOP.dwb_ack_i, at %t\n", $time);
380
        #100 $finish;
381
     end
382
     if (`OR1200_TOP.dwb_ack_i | `OR1200_TOP.dwb_err_i)
383
       if (dwb_progress == 2) begin
384
          dwb_progress = 0;
385
          dwb_progress_addr = `OR1200_TOP.dwb_adr_o;
386
       end
387
       else begin
388
          $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.dwb_ack_i/`OR1200_TOP.dwb_err_i raised without `OR1200_TOP.dwb_cyc_i/`OR1200_TOP.dwb_stb_i, at %t\n", $time);
389
          #100 $finish;
390
       end
391
     if ((dwb_progress == 2) && !`OR1200_TOP.dwb_stb_o) begin
392
        $fdisplay(fgeneral, "WISHBONE protocol violation: `OR1200_TOP.dwb_stb_o lowered without `OR1200_TOP.dwb_err_i/`OR1200_TOP.dwb_ack_i, at %t\n", $time);
393
        #100 $finish;
394
     end
395
       end
396
 
397
//
398
// Hooks for:
399
// - displaying registers
400
// - end of simulation
401
// - access to SPRs
402
//
403 348 julius
   always @(posedge `OR1200_TOP.`CPU_cpu.`CPU_ctrl.clk)
404
     if (!`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_freeze) begin
405
//      #2;
406
        if (((`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn[31:26] != `OR1200_OR32_NOP)
407
             | !`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn[16])
408
            & !(`OR1200_TOP.`CPU_cpu.`CPU_except.except_flushpipe &
409
                `OR1200_TOP.`CPU_cpu.`CPU_except.ex_dslot))
410 6 julius
          begin
411
             display_arch_state;
412
             monitor_for_crash;
413
          end
414
        else
415 348 julius
          if (`OR1200_TOP.`CPU_cpu.`CPU_except.except_flushpipe)
416 6 julius
            display_arch_state_except;
417 348 julius
        // small hack to stop simulation (l.nop 1):
418
        if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_0001) begin
419 6 julius
           get_gpr(3, r3);
420
           $fdisplay(fgeneral, "%t: l.nop exit (%h)", $time, r3);
421
           $finish;
422
        end
423 348 julius
        // debug if test (l.nop 10)
424
        if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_000a) begin
425 6 julius
           $fdisplay(fgeneral, "%t: l.nop dbg_if_test", $time);
426
        end
427 348 julius
        // simulation reports (l.nop 2)
428
        if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_0002) begin
429 6 julius
           get_gpr(3, r3);
430 348 julius
           $fdisplay(fgeneral, "%t: l.nop report (%h)", $time, r3);
431
        end
432
        // simulation printfs (l.nop 3)
433
        if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_0003) begin
434
           get_gpr(3, r3);
435 6 julius
           $fdisplay(fgeneral, "%t: l.nop printf (%h)", $time, r3);
436
        end
437 348 julius
        if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_0004) begin
438
           // simulation putc (l.nop 4)
439
           get_gpr(3, r3);
440
           $write("%c", r3);
441
           $fdisplay(fgeneral, "%t: l.nop putc (%c)", $time, r3);
442
        end
443 397 julius
`ifdef OR1200_MONITOR_SPRS
444
        if (`OR1200_TOP.`CPU_cpu.`CPU_sprs.spr_we)
445 6 julius
          $fdisplay(fspr, "%t: Write to SPR : [%h] <- %h", $time,
446 397 julius
                    `OR1200_TOP.`CPU_cpu.`CPU_sprs.spr_addr,
447 348 julius
                    `OR1200_TOP.`CPU_cpu.`CPU_sprs.spr_dat_o);
448 397 julius
        if ((|`OR1200_TOP.`CPU_cpu.`CPU_sprs.spr_cs) &
449
            !`OR1200_TOP.`CPU_cpu.`CPU_sprs.spr_we)
450 6 julius
          $fdisplay(fspr, "%t: Read from SPR: [%h] -> %h", $time,
451 348 julius
                    `OR1200_TOP.`CPU_cpu.`CPU_sprs.spr_addr,
452
                    `OR1200_TOP.`CPU_cpu.`CPU_sprs.to_wbmux);
453 397 julius
`endif
454 6 julius
     end
455
 
456 348 julius
 
457 415 julius
`ifdef RAM_WB
458 439 julius
 `define RAM_WB_TOP `DUT_TOP.ram_wb0.ram_wb_b3_0
459 415 julius
   task get_insn_from_wb_ram;
460
      input [31:0] addr;
461
      output [31:0] insn;
462
      begin
463 439 julius
         insn = `RAM_WB_TOP.get_mem(addr);
464 415 julius
      end
465
   endtask // get_insn_from_wb_ram
466
`endif
467
 
468 348 julius
`ifdef VERSATILE_SDRAM
469 415 julius
 `define SDRAM_TOP `TB_TOP.sdram0
470 348 julius
   // Bit selects to define the bank
471
   // 32 MB part with 4 banks
472
 `define SDRAM_BANK_SEL_BITS 24:23
473
 `define SDRAM_WORD_SEL_TOP_BIT 22
474
   // Gets instruction word from correct bank
475
   task get_insn_from_sdram;
476
      input [31:0] addr;
477
      output [31:0] insn;
478
      reg [`SDRAM_WORD_SEL_TOP_BIT-1:0] word_addr;
479
 
480
      begin
481
         word_addr = addr[`SDRAM_WORD_SEL_TOP_BIT:2];
482
         if (addr[`SDRAM_BANK_SEL_BITS] == 2'b00)
483
           begin
484
 
485
              //$display("%t: get_insn_from_sdram bank0, word 0x%h, (%h and %h in SDRAM)", $time, word_addr, `SDRAM_TOP.Bank0[{word_addr,1'b0}], `SDRAM_TOP.Bank0[{word_addr,1'b1}]);         
486
              insn[15:0] = `SDRAM_TOP.Bank0[{word_addr,1'b1}];
487
              insn[31:16] = `SDRAM_TOP.Bank0[{word_addr,1'b0}];
488
           end
489
      end
490
 
491
   endtask // get_insn_from_sdram
492
`endif //  `ifdef VERSATILE_SDRAM
493
 
494
`ifdef XILINX_DDR2
495 415 julius
 `define DDR2_TOP `TB_TOP.gen_cs[0]
496 348 julius
   // Gets instruction word from correct bank
497
   task get_insn_from_xilinx_ddr2;
498
      input [31:0] addr;
499
      output [31:0] insn;
500 415 julius
      reg [16*8-1:0] ddr2_array_line0,ddr2_array_line1,ddr2_array_line2,
501
                     ddr2_array_line3;
502 348 julius
      integer        word_in_line_num;
503
      begin
504 415 julius
        // Get our 4 128-bit chunks (8 half-words in each!! Confused yet?), 
505
        // 16 words total
506 348 julius
         `DDR2_TOP.gen[0].u_mem0.memory_read(addr[28:27],addr[26:13],{addr[12:6],3'd0},ddr2_array_line0);
507
         `DDR2_TOP.gen[1].u_mem0.memory_read(addr[28:27],addr[26:13],{addr[12:6],3'd0},ddr2_array_line1);
508
         `DDR2_TOP.gen[2].u_mem0.memory_read(addr[28:27],addr[26:13],{addr[12:6],3'd0},ddr2_array_line2);
509
         `DDR2_TOP.gen[3].u_mem0.memory_read(addr[28:27],addr[26:13],{addr[12:6],3'd0},ddr2_array_line3);
510
         case (addr[5:2])
511
           4'h0:
512
             begin
513
                insn[15:0] = ddr2_array_line0[15:0];
514
                insn[31:16] = ddr2_array_line1[15:0];
515
             end
516
           4'h1:
517
             begin
518
                insn[15:0] = ddr2_array_line2[15:0];
519
                insn[31:16] = ddr2_array_line3[15:0];
520
             end
521
           4'h2:
522
             begin
523
                insn[15:0] = ddr2_array_line0[31:16];
524
                insn[31:16] = ddr2_array_line1[31:16];
525
             end
526
           4'h3:
527
             begin
528
                insn[15:0] = ddr2_array_line2[31:16];
529
                insn[31:16] = ddr2_array_line3[31:16];
530
             end
531
           4'h4:
532
             begin
533
                insn[15:0] = ddr2_array_line0[47:32];
534
                insn[31:16] = ddr2_array_line1[47:32];
535
             end
536
           4'h5:
537
             begin
538
                insn[15:0] = ddr2_array_line2[47:32];
539
                insn[31:16] = ddr2_array_line3[47:32];
540
             end
541
           4'h6:
542
             begin
543
                insn[15:0] = ddr2_array_line0[63:48];
544
                insn[31:16] = ddr2_array_line1[63:48];
545
             end
546
           4'h7:
547
             begin
548
                insn[15:0] = ddr2_array_line2[63:48];
549
                insn[31:16] = ddr2_array_line3[63:48];
550
             end
551
           4'h8:
552
             begin
553
                insn[15:0] = ddr2_array_line0[79:64];
554
                insn[31:16] = ddr2_array_line1[79:64];
555
             end
556
           4'h9:
557
             begin
558
                insn[15:0] = ddr2_array_line2[79:64];
559
                insn[31:16] = ddr2_array_line3[79:64];
560
             end
561
           4'ha:
562
             begin
563
                insn[15:0] = ddr2_array_line0[95:80];
564
                insn[31:16] = ddr2_array_line1[95:80];
565
             end
566
           4'hb:
567
             begin
568
                insn[15:0] = ddr2_array_line2[95:80];
569
                insn[31:16] = ddr2_array_line3[95:80];
570
             end
571
           4'hc:
572
             begin
573
                insn[15:0] = ddr2_array_line0[111:96];
574
                insn[31:16] = ddr2_array_line1[111:96];
575
             end
576
           4'hd:
577
             begin
578
                insn[15:0] = ddr2_array_line2[111:96];
579
                insn[31:16] = ddr2_array_line3[111:96];
580
             end
581
           4'he:
582
             begin
583
                insn[15:0] = ddr2_array_line0[127:112];
584
                insn[31:16] = ddr2_array_line1[127:112];
585
             end
586
           4'hf:
587
             begin
588
                insn[15:0] = ddr2_array_line2[127:112];
589
                insn[31:16] = ddr2_array_line3[127:112];
590
             end
591
         endcase // case (addr[5:2])
592
      end
593
   endtask // get_insn_from_xilinx_ddr2
594
`endif
595
 
596
 
597
   task get_insn_from_memory;
598
      input [31:0] id_pc;
599
      output [31:0] insn;
600
      begin
601
         // do a decode of which server we should look in
602
         case (id_pc[31:28])
603
`ifdef VERSATILE_SDRAM
604
           4'h0:
605
             get_insn_from_sdram(id_pc, insn);
606
`endif
607
`ifdef XILINX_DDR2
608
           4'h0:
609
             get_insn_from_xilinx_ddr2(id_pc, insn);
610 415 julius
`endif
611
`ifdef RAM_WB
612
           4'h0:
613
             get_insn_from_wb_ram(id_pc, insn);
614
`endif
615 348 julius
           4'hf:
616
             // Flash isn't stored in a memory, it's an FSM so just skip/ignore
617
             insn = `OR1200_TOP.`CPU_cpu.`CPU_ctrl.id_insn;
618
           default:
619
             begin
620
                $fdisplay(fgeneral, "%t: Unknown memory server for address 0x%h", $time,id_pc);
621
                insn = 32'hxxxxxxxx; // Unknown server
622
             end
623
         endcase // case (id_pc[31:28])
624
      end
625
   endtask // get_insn_from_memory
626
 
627
 
628
    reg [31:0] mem_word;
629
   reg [31:0] last_addr = 0;
630
   reg [31:0] last_mem_word;
631
 
632 415 julius
`ifdef MEM_COHERENCE_CHECK
633
 `define MEM_COHERENCE_TRIGGER (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.id_void === 1'b0)
634
 
635 348 julius
`define INSN_TO_CHECK `OR1200_TOP.`CPU_cpu.`CPU_ctrl.id_insn
636
`define PC_TO_CHECK `OR1200_TOP.`CPU_cpu.`CPU_except.id_pc
637
 
638
   // Check instruction in decode stage is what is in the RAM
639
   always @(posedge `OR1200_TOP.`CPU_cpu.`CPU_ctrl.clk)
640
     begin
641 415 julius
        if (`MEM_COHERENCE_TRIGGER)
642 348 julius
          begin
643
             // Check if it's a new PC - will also get triggered if the
644
             // instruction has changed since we last checked it
645
             if ((`PC_TO_CHECK !== last_addr) ||
646
                 (last_mem_word != `INSN_TO_CHECK))
647
               begin
648
                  // Decode stage not void, check instruction
649
                  // get PC
650
                  get_insn_from_memory(`PC_TO_CHECK, mem_word);
651
 
652
                  // Debugging output to prove it's doing something!
653
                  //$display("%t: Checking instruction for address 0x%h - memory had 0x%h, CPU had 0x%h", $time, `PC_TO_CHECK, mem_word, `INSN_TO_CHECK);
654
 
655
                  if (mem_word !== `INSN_TO_CHECK)
656
                    begin
657
                       $fdisplay(fgeneral, "%t: Instruction mismatch for address 0x%h - memory had 0x%h, CPU had 0x%h", $time, `PC_TO_CHECK, mem_word, `INSN_TO_CHECK);
658
                       #20
659
                         $finish;
660
                    end
661
                  last_addr = `PC_TO_CHECK;
662
                  last_mem_word = mem_word;
663
               end // if (`PC_TO_CHECK !== last_addr)
664
          end
665
     end // always @ (posedge `OR1200_TOP.`CPU_cpu.`CPU_ctrl.clk)
666
 
667 415 julius
`endif //  `ifdef MEM_COHERENCE_CHECK
668
 
669 348 julius
 
670 351 julius
   /////////////////////////////////////////////////////////////////////////
671
   // Instruction decode task
672
   /////////////////////////////////////////////////////////////////////////
673 348 julius
 
674 351 julius
 
675
`define OR32_OPCODE_POS 31:26
676
`define OR32_J_BR_IMM_POS 25:0
677
`define OR32_RD_POS 25:21
678
`define OR32_RA_POS 20:16
679
`define OR32_RB_POS 15:11
680
`define OR32_ALU_OP_POS 3:0
681 348 julius
 
682 351 julius
`define OR32_SHROT_OP_POS 7:6
683
`define OR32_SHROTI_IMM_POS 5:0
684
`define OR32_SF_OP 25:21
685
 
686
`define OR32_XSYNC_OP_POS 25:21
687
 
688
 
689
// Switch between outputting to execution file or STD out for instruction
690
// decoding task.
691
//`define PRINT_OP_WRITE $write(
692
`define PRINT_OP_WRITE $fwrite(fexe,
693
 
694
   task or1200_print_op;
695
      input [31:0] insn;
696
 
697
      reg [5:0]    opcode;
698
 
699
      reg [25:0]   j_imm;
700
      reg [25:0]   br_imm;
701
 
702
      reg [4:0]    rD_num, rA_num, rB_num;
703
      reg [31:0]   rA_val, rB_val;
704
      reg [15:0]   imm_16bit;
705
      reg [10:0]   imm_split16bit;
706
 
707
      reg [3:0]    alu_op;
708
      reg [1:0]    shrot_op;
709
 
710
      reg [5:0]    shroti_imm;
711
 
712
    reg [5:0]       sf_op;
713
 
714
    reg [5:0]       xsync_op;
715
 
716
      begin
717
         // Instruction opcode
718
         opcode = insn[`OR32_OPCODE_POS];
719
         // Immediates for jump or branch instructions
720
         j_imm = insn[`OR32_J_BR_IMM_POS];
721
         br_imm = insn[`OR32_J_BR_IMM_POS];
722
         // Register numbers (D, A and B)
723
         rD_num = insn[`OR32_RD_POS];
724
         rA_num = insn[`OR32_RA_POS];
725
         rB_num = insn[`OR32_RB_POS];
726
         // Bottom 16 bits when used as immediates in various instructions
727
         imm_16bit = insn[15:0];
728
         // Bottom 11 bits used as immediates for l.sX instructions
729
 
730
         // Split 16-bit immediate for l.mtspr/l.sX instructions
731
         imm_split16bit = {insn[25:21],insn[10:0]};
732
         // ALU op for ALU instructions
733
         alu_op = insn[`OR32_ALU_OP_POS];
734
         // Shift-rotate op for SHROT ALU instructions
735
         shrot_op = insn[`OR32_SHROT_OP_POS];
736
         shroti_imm = insn[`OR32_SHROTI_IMM_POS];
737
 
738
         // Set flag op
739
         sf_op = insn[`OR32_SF_OP];
740
 
741
         // Xsync/syscall/trap opcode
742
         xsync_op = insn[`OR32_XSYNC_OP_POS];
743
 
744
         case (opcode)
745
           `OR1200_OR32_J:
746
             begin
747
                `PRINT_OP_WRITE"l.j 0x%h", {j_imm,2'b00});
748
             end
749
 
750
           `OR1200_OR32_JAL:
751
             begin
752
                `PRINT_OP_WRITE"l.jal 0x%h", {j_imm,2'b00});
753
             end
754
 
755
           `OR1200_OR32_BNF:
756
             begin
757
                `PRINT_OP_WRITE"l.bnf 0x%h", {br_imm,2'b00});
758
             end
759
 
760
           `OR1200_OR32_BF:
761
             begin
762
                `PRINT_OP_WRITE"l.bf 0x%h", {br_imm,2'b00});
763
             end
764
 
765
           `OR1200_OR32_RFE:
766
             begin
767
                `PRINT_OP_WRITE"l.rfe");
768
             end
769
 
770
           `OR1200_OR32_JR:
771
             begin
772
                `PRINT_OP_WRITE"l.jr r%0d",rB_num);
773
             end
774
 
775
           `OR1200_OR32_JALR:
776
             begin
777
                `PRINT_OP_WRITE"l.jalr r%0d",rB_num);
778
             end
779
 
780
           `OR1200_OR32_LWZ:
781
             begin
782
                `PRINT_OP_WRITE"l.lwz r%0d,0x%0h(r%0d)",rD_num,imm_16bit,rA_num);
783
             end
784
 
785
           `OR1200_OR32_LBZ:
786
             begin
787
                `PRINT_OP_WRITE"l.lbz r%0d,0x%0h(r%0d)",rD_num,imm_16bit,rA_num);
788
             end
789
 
790
           `OR1200_OR32_LBS:
791
             begin
792
                `PRINT_OP_WRITE"l.lbs r%0d,0x%0h(r%0d)",rD_num,imm_16bit,rA_num);
793
             end
794
 
795
           `OR1200_OR32_LHZ:
796
             begin
797
                `PRINT_OP_WRITE"l.lhz r%0d,0x%0h(r%0d)",rD_num,imm_16bit,rA_num);
798
             end
799
 
800
           `OR1200_OR32_LHS:
801
             begin
802
                `PRINT_OP_WRITE"l.lhs r%0d,0x%0h(r%0d)",rD_num,imm_16bit,rA_num);
803
             end
804
 
805
           `OR1200_OR32_SW:
806
             begin
807
                `PRINT_OP_WRITE"l.sw 0x%0h(r%0d),r%0d",imm_split16bit,rA_num,rB_num);
808
             end
809
 
810
           `OR1200_OR32_SB:
811
             begin
812
                `PRINT_OP_WRITE"l.sb 0x%0h(r%0d),r%0d",imm_split16bit,rA_num,rB_num);
813
             end
814
 
815
           `OR1200_OR32_SH:
816
             begin
817
                `PRINT_OP_WRITE"l.sh 0x%0h(r%0d),r%0d",imm_split16bit,rA_num,rB_num);
818
             end
819
 
820
           `OR1200_OR32_MFSPR:
821
             begin
822
                `PRINT_OP_WRITE"l.mfspr r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit,);
823
             end
824
 
825
           `OR1200_OR32_MTSPR:
826
             begin
827
                `PRINT_OP_WRITE"l.mtspr r%0d,r%0d,0x%h",rA_num,rB_num,imm_split16bit);
828
             end
829
 
830
           `OR1200_OR32_MOVHI:
831
             begin
832
                if (!insn[16])
833
                  `PRINT_OP_WRITE"l.movhi r%0d,0x%h",rD_num,imm_16bit);
834
                else
835
                  `PRINT_OP_WRITE"l.macrc r%0d",rD_num);
836
             end
837
 
838
           `OR1200_OR32_ADDI:
839
             begin
840
                `PRINT_OP_WRITE"l.addi r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit);
841
             end
842
 
843
           `OR1200_OR32_ADDIC:
844
             begin
845
                `PRINT_OP_WRITE"l.addic r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit);
846
             end
847
 
848
           `OR1200_OR32_ANDI:
849
             begin
850
                `PRINT_OP_WRITE"l.andi r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit);
851
             end
852
 
853
           `OR1200_OR32_ORI:
854
             begin
855
                `PRINT_OP_WRITE"l.ori r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit);
856
             end
857
 
858
           `OR1200_OR32_XORI:
859
             begin
860
                `PRINT_OP_WRITE"l.xori r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit);
861
             end
862
 
863
           `OR1200_OR32_MULI:
864
             begin
865
                `PRINT_OP_WRITE"l.muli r%0d,r%0d,0x%h",rD_num,rA_num,imm_16bit);
866
             end
867
 
868
           `OR1200_OR32_ALU:
869
             begin
870
                case(alu_op)
871
                  `OR1200_ALUOP_ADD:
872
                    `PRINT_OP_WRITE"l.add ");
873
                  `OR1200_ALUOP_ADDC:
874
                    `PRINT_OP_WRITE"l.addc ");
875
                  `OR1200_ALUOP_SUB:
876
                    `PRINT_OP_WRITE"l.sub ");
877
                  `OR1200_ALUOP_AND:
878
                    `PRINT_OP_WRITE"l.and ");
879
                  `OR1200_ALUOP_OR:
880
                    `PRINT_OP_WRITE"l.or ");
881
                  `OR1200_ALUOP_XOR:
882
                    `PRINT_OP_WRITE"l.xor ");
883
                  `OR1200_ALUOP_MUL:
884
                    `PRINT_OP_WRITE"l.mul ");
885
                  `OR1200_ALUOP_SHROT:
886
                    begin
887
                       case(shrot_op)
888
                         `OR1200_SHROTOP_SLL:
889
                           `PRINT_OP_WRITE"l.sll ");
890
                         `OR1200_SHROTOP_SRL:
891
                           `PRINT_OP_WRITE"l.srl ");
892
                         `OR1200_SHROTOP_SRA:
893
                           `PRINT_OP_WRITE"l.sra ");
894
                         `OR1200_SHROTOP_ROR:
895
                           `PRINT_OP_WRITE"l.ror ");
896
                       endcase // case (shrot_op)
897
                    end
898
                  `OR1200_ALUOP_DIV:
899
                    `PRINT_OP_WRITE"l.div ");
900
                  `OR1200_ALUOP_DIVU:
901
                    `PRINT_OP_WRITE"l.divu ");
902
                  `OR1200_ALUOP_CMOV:
903
                    `PRINT_OP_WRITE"l.cmov ");
904
                endcase // case (alu_op)
905
                `PRINT_OP_WRITE"r%0d,r%0d,r%0d",rD_num,rA_num,rB_num);
906
             end
907
 
908
           `OR1200_OR32_SH_ROTI:
909
             begin
910
                case(shrot_op)
911
                  `OR1200_SHROTOP_SLL:
912
                    `PRINT_OP_WRITE"l.slli ");
913
                  `OR1200_SHROTOP_SRL:
914
                    `PRINT_OP_WRITE"l.srli ");
915
                  `OR1200_SHROTOP_SRA:
916
                    `PRINT_OP_WRITE"l.srai ");
917
                  `OR1200_SHROTOP_ROR:
918
                    `PRINT_OP_WRITE"l.rori ");
919
                endcase // case (shrot_op)
920
                `PRINT_OP_WRITE"r%0d,r%0d,0x%h",rD_num,rA_num,shroti_imm);
921
             end
922
 
923
           `OR1200_OR32_SFXXI:
924
             begin
925
                case(sf_op[2:0])
926
                  `OR1200_COP_SFEQ:
927
                    `PRINT_OP_WRITE"l.sfeqi ");
928
                  `OR1200_COP_SFNE:
929
                    `PRINT_OP_WRITE"l.sfnei ");
930
                  `OR1200_COP_SFGT:
931
                    begin
932
                       if (sf_op[`OR1200_SIGNED_COMPARE])
933
                         `PRINT_OP_WRITE"l.sfgtsi ");
934
                       else
935
                         `PRINT_OP_WRITE"l.sfgtui ");
936
                    end
937
                  `OR1200_COP_SFGE:
938
                    begin
939
                       if (sf_op[`OR1200_SIGNED_COMPARE])
940
                         `PRINT_OP_WRITE"l.sfgesi ");
941
                       else
942
                         `PRINT_OP_WRITE"l.sfgeui ");
943
                    end
944
                  `OR1200_COP_SFLT:
945
                    begin
946
                       if (sf_op[`OR1200_SIGNED_COMPARE])
947
                         `PRINT_OP_WRITE"l.sfltsi ");
948
                       else
949
                         `PRINT_OP_WRITE"l.sfltui ");
950
                    end
951
                  `OR1200_COP_SFLE:
952
                    begin
953
                       if (sf_op[`OR1200_SIGNED_COMPARE])
954
                         `PRINT_OP_WRITE"l.sflesi ");
955
                       else
956
                         `PRINT_OP_WRITE"l.sfleui ");
957
                    end
958
                endcase // case (sf_op[2:0])
959
 
960
                `PRINT_OP_WRITE"r%0d,0x%h",rA_num, imm_16bit);
961
 
962
             end // case: `OR1200_OR32_SFXXI
963
 
964
           `OR1200_OR32_SFXX:
965
             begin
966
                case(sf_op[2:0])
967
                  `OR1200_COP_SFEQ:
968
                    `PRINT_OP_WRITE"l.sfeq ");
969
                  `OR1200_COP_SFNE:
970
                    `PRINT_OP_WRITE"l.sfne ");
971
                  `OR1200_COP_SFGT:
972
                    begin
973
                       if (sf_op[`OR1200_SIGNED_COMPARE])
974
                         `PRINT_OP_WRITE"l.sfgts ");
975
                       else
976
                         `PRINT_OP_WRITE"l.sfgtu ");
977
                    end
978
                  `OR1200_COP_SFGE:
979
                    begin
980
                       if (sf_op[`OR1200_SIGNED_COMPARE])
981
                         `PRINT_OP_WRITE"l.sfges ");
982
                       else
983
                         `PRINT_OP_WRITE"l.sfgeu ");
984
                    end
985
                  `OR1200_COP_SFLT:
986
                    begin
987
                       if (sf_op[`OR1200_SIGNED_COMPARE])
988
                         `PRINT_OP_WRITE"l.sflts ");
989
                       else
990
                         `PRINT_OP_WRITE"l.sfltu ");
991
                    end
992
                  `OR1200_COP_SFLE:
993
                    begin
994
                       if (sf_op[`OR1200_SIGNED_COMPARE])
995
                         `PRINT_OP_WRITE"l.sfles ");
996
                       else
997
                         `PRINT_OP_WRITE"l.sfleu ");
998
                    end
999
 
1000
                endcase // case (sf_op[2:0])
1001
 
1002
                `PRINT_OP_WRITE"r%0d,r%0d",rA_num, rB_num);
1003
 
1004
             end
1005
 
1006
           `OR1200_OR32_MACI:
1007
             begin
1008
                `PRINT_OP_WRITE"l.maci r%0d,0x%h",rA_num,imm_16bit);
1009
             end
1010
 
1011
           `OR1200_OR32_MACMSB:
1012
             begin
1013
                if(insn[3:0] == 4'h1)
1014
                  `PRINT_OP_WRITE"l.mac ");
1015
                else if(insn[3:0] == 4'h2)
1016
                  `PRINT_OP_WRITE"l.msb ");
1017
 
1018
                `PRINT_OP_WRITE"r%0d,r%0d",rA_num,rB_num);
1019
             end
1020
 
1021
           `OR1200_OR32_NOP:
1022
             begin
1023
                `PRINT_OP_WRITE"l.nop 0x%0h",imm_16bit);
1024
             end
1025
 
1026
           `OR1200_OR32_XSYNC:
1027
             begin
1028
                case (xsync_op)
1029
                  5'd0:
1030
                    `PRINT_OP_WRITE"l.sys 0x%h",imm_16bit);
1031
                  5'd8:
1032
                    `PRINT_OP_WRITE"l.trap 0x%h",imm_16bit);
1033
                  5'd16:
1034
                    `PRINT_OP_WRITE"l.msync");
1035
                  5'd20:
1036
                    `PRINT_OP_WRITE"l.psync");
1037
                  5'd24:
1038
                    `PRINT_OP_WRITE"l.csync");
1039
                  default:
1040
                    begin
1041
                       $display("%t: Instruction with opcode 0x%h has bad specific type information: 0x%h",$time,opcode,insn);
1042
                       `PRINT_OP_WRITE"%t: Instruction with opcode 0x%h has has bad specific type information: 0x%h",$time,opcode,insn);
1043
                    end
1044
                endcase // case (xsync_op)
1045
             end
1046
 
1047
           default:
1048
             begin
1049
                $display("%t: Unknown opcode 0x%h",$time,opcode);
1050
                `PRINT_OP_WRITE"%t: Unknown opcode 0x%h",$time,opcode);
1051
             end
1052
 
1053
         endcase // case (opcode)
1054
 
1055
      end
1056
   endtask // or1200_print_op
1057
 
1058
 
1059
 
1060 6 julius
endmodule

powered by: WebSVN 2.1.0

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