WIP on PPU io registers

This commit is contained in:
2023-10-02 22:47:32 +01:00
parent 7cec002e1a
commit 118f6b41b8
2 changed files with 77 additions and 16 deletions

View File

@@ -39,6 +39,12 @@ cart cart_inst (
.data_io (gb_cart_data)
);
`ifdef SVA_ENABLE
`include "sva_common.svh"
`SVA_DEF_CLK(clk);
`SVA_DEF_NRESET(nreset);
logic instr_valid;
logic instr_undef;
logic halted;
@@ -51,6 +57,7 @@ logic [ 7:0] last_write_value;
logic vram_sel;
logic hiram_sel;
logic ppu_sel;
assign halted = gb_inst.cpu_inst.ctrl_inst.halted_r;
assign instr_valid = gb_inst.cpu_inst.instr_valid;
@@ -61,6 +68,7 @@ assign we = gb_inst.cpu_we;
assign vram_sel = gb_inst.vram_sel;
assign hiram_sel = gb_inst.hiram_sel;
assign ppu_sel = gb_inst.ppu_inst.sva_ppu_sel;
always_ff @(posedge clk or negedge nreset) begin
if (!nreset)
@@ -79,19 +87,14 @@ always_ff @(posedge clk or negedge nreset) begin
end
end
// SVA code here
`include "sva_common.svh"
`SVA_DEF_CLK(clk);
`SVA_DEF_NRESET(nreset);
`SVA_ASSERT_PROP_FATAL(undefined_opcode_pushed,
halted |-> !instr_undef,
$sformatf("PC: 0x%X | Undefined opcode pushed: 0x%X (0x%X, 0x%X)", current_pc, current_opcode[0], current_opcode[1], current_opcode[2])
);
logic selected_memory_implemented;
assign selected_memory_implemented = hiram_sel | vram_sel;
assign selected_memory_implemented = hiram_sel | vram_sel | ppu_sel;
`SVA_ASSERT_PROP(write_to_unimplemented_memory,
we |-> selected_memory_implemented,
@@ -99,4 +102,5 @@ assign selected_memory_implemented = hiram_sel | vram_sel;
current_pc, last_write_address, last_write_value)
);
`endif /* SVA_ENABLE */
endmodule : tb_top