Browse files

lm32: fix test bench

If simulation run with caches disabled, the test bench will throw errors.
Fix this.

Signed-off-by: Michael Walle <michael@walle.cc>
  • Loading branch information...
1 parent 945c7ed commit 25d87a3e7836983652b25e152f510e2ab330cfa8 @mwalle committed Nov 12, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 cores/lm32/test/tb_lm32.v
View
10 cores/lm32/test/tb_lm32.v
@@ -195,16 +195,26 @@ initial begin
end else
trace_enabled = 0;
end
+`ifdef CFG_ICACHE_ENABLED
assign icache_ready = lm32.cpu.instruction_unit.icache.state != 1;
+`else
+assign icache_ready = `TRUE;
+`endif
+`ifdef CFG_DCACHE_ENABLED
assign dcache_ready = lm32.cpu.load_store_unit.dcache.state != 1;
+`else
+assign dcache_ready = `TRUE;
+`endif
always @(posedge sys_clk) begin
// wait until icache and dcache init is done
if(!trace_started && icache_ready && dcache_ready)
trace_started = 1;
if(trace_enabled && trace_started) begin
$fwrite(tracefd, "%-d ", cycle);
+`ifdef CFG_ICACHE_ENABLED
$fwrite(tracefd, "%x ", {lm32.cpu.instruction_unit.pc_a, 2'b00});
$fwrite(tracefd, "%1d ", lm32.cpu.valid_a);
+`endif
$fwrite(tracefd, "%x ", {lm32.cpu.instruction_unit.pc_f, 2'b00});
$fwrite(tracefd, "%1d ", lm32.cpu.kill_f);
$fwrite(tracefd, "%1d ", lm32.cpu.valid_f);

0 comments on commit 25d87a3

Please sign in to comment.