diff options
Diffstat (limited to 'eater_cpu/eater_computer_tb.sv')
| -rw-r--r-- | eater_cpu/eater_computer_tb.sv | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/eater_cpu/eater_computer_tb.sv b/eater_cpu/eater_computer_tb.sv index 019bcb1..1104c9b 100644 --- a/eater_cpu/eater_computer_tb.sv +++ b/eater_cpu/eater_computer_tb.sv @@ -8,6 +8,7 @@ logic clk_in; eater_computer uut ( .debug_bus(), + .auto_run_in(1'b0), .clk_in(clk_in) ); @@ -24,20 +25,20 @@ initial begin $dumpfile("simpc.vvp"); $dumpvars(); - uut.flags.A_out = 0; - uut.flags.B_out = 0; - uut.flags.INS_out = 0; - uut.flags.ALU_out = 0; - uut.flags.RAM_out = 0; - uut.flags.PC_out = 0; - uut.flags.PC_count = 0; - - uut.flags.A_in = 0; - uut.flags.B_in = 0; - uut.flags.INS_in = 0; - uut.flags.RAM_in = 0; - uut.flags.PC_in = 0; - uut.flags.MAR_in = 0; + uut.manual_flags.A_out = 0; + uut.manual_flags.B_out = 0; + uut.manual_flags.INS_out = 0; + uut.manual_flags.ALU_out = 0; + uut.manual_flags.RAM_out = 0; + uut.manual_flags.PC_out = 0; + uut.manual_flags.PC_count = 0; + + uut.manual_flags.A_in = 0; + uut.manual_flags.B_in = 0; + uut.manual_flags.INS_in = 0; + uut.manual_flags.RAM_in = 0; + uut.manual_flags.PC_in = 0; + uut.manual_flags.MAR_in = 0; clk_in = 0; debug_enable = 0; debug_value = 'z; @@ -52,91 +53,91 @@ initial begin @(negedge clk_in); debug_value = 'h00; - uut.flags.MAR_in = 1; + uut.manual_flags.MAR_in = 1; @(negedge clk_in); - uut.flags.MAR_in = 0; + uut.manual_flags.MAR_in = 0; debug_value = 'h04; - uut.flags.PC_in = 1; + uut.manual_flags.PC_in = 1; @(negedge clk_in); - uut.flags.PC_in = 0; + uut.manual_flags.PC_in = 0; debug_value = 'haa; - uut.flags.A_in = 1; + uut.manual_flags.A_in = 1; @(negedge clk_in); - uut.flags.A_in = 0; + uut.manual_flags.A_in = 0; debug_value = 'hbb; - uut.flags.B_in = 1; + uut.manual_flags.B_in = 1; @(negedge clk_in); - uut.flags.B_in = 0; + uut.manual_flags.B_in = 0; debug_value = 'hcc; - uut.flags.INS_in = 1; + uut.manual_flags.INS_in = 1; @(negedge clk_in); - uut.flags.INS_in = 0; + uut.manual_flags.INS_in = 0; debug_value = 'hdd; - uut.flags.RAM_in = 1; + uut.manual_flags.RAM_in = 1; @(negedge clk_in); - uut.flags.RAM_in = 0; + uut.manual_flags.RAM_in = 0; @(negedge clk_in); debug_enable = 0; debug_value = 'z; @(negedge clk_in); - uut.flags.A_out = 1; + uut.manual_flags.A_out = 1; @(negedge clk_in); assert (uut.bus == 'haa) else $error("Expected 0xaa (from REG A), got 0x%02x on bus", uut.bus); - uut.flags.A_out = 0; - uut.flags.B_out = 1; + uut.manual_flags.A_out = 0; + uut.manual_flags.B_out = 1; @(negedge clk_in); assert (uut.bus == 'hbb) else $error("Expected 0xbb (from REG B), got 0x%02x on bus", uut.bus); - uut.flags.B_out = 0; - uut.flags.INS_out = 1; + uut.manual_flags.B_out = 0; + uut.manual_flags.INS_out = 1; @(negedge clk_in); assert (uut.bus == 'h0c) else $error("Expected 0x0c (from INS), got 0x%02x on bus", uut.bus); // ERROR: TODO: should I expect 'zc or '0c ? - uut.flags.INS_out = 0; + uut.manual_flags.INS_out = 0; @(negedge clk_in); - uut.flags.ALU_out = 1; + uut.manual_flags.ALU_out = 1; @(negedge clk_in); assert (uut.bus == 8'('haa + 'hbb)) else $error("Expected 0x%02x (from ALU), got 0x%02x on bus", 8'('haa + 'hbb), uut.bus); - uut.flags.ALU_out = 0; - uut.flags.PC_out = 1; + uut.manual_flags.ALU_out = 0; + uut.manual_flags.PC_out = 1; @(negedge clk_in); assert (uut.bus == 'h04) else $error("Expected 0x04 (from PC), got 0x%02x on bus", uut.bus); - uut.flags.PC_out = 0; - uut.flags.RAM_out = 1; + uut.manual_flags.PC_out = 0; + uut.manual_flags.RAM_out = 1; @(negedge clk_in); assert (uut.bus == 'hdd) else $error("Expected 0xdd (from RAM), got 0x%02x on bus", uut.bus); - uut.flags.RAM_out = 0; + uut.manual_flags.RAM_out = 0; @(negedge clk_in); debug_enable = 1; debug_value = 'h01; - uut.flags.MAR_in = 1; + uut.manual_flags.MAR_in = 1; @(negedge clk_in); debug_enable = 0; debug_value = 'bz; - uut.flags.MAR_in = 0; - uut.flags.RAM_out = 1; + uut.manual_flags.MAR_in = 0; + uut.manual_flags.RAM_out = 1; @(negedge clk_in); $info("Got 0x%02x from RAM", uut.bus); |
