Add reset input to memory mapper

Upon reset the memory mapper is automatically disabled, but the mappings
are not cleared.
This commit is contained in:
Byron Lathi
2022-04-07 10:35:16 -05:00
parent a15dde0e89
commit be497ecaa9
2 changed files with 14 additions and 8 deletions

View File

@@ -7,6 +7,7 @@
module memory_mapper(
input clk,
input rst,
input rw,
input cs,
@@ -29,6 +30,9 @@ logic MM;
always_ff @(posedge clk) begin
if (rst) begin
MM <= '0;
end else begin
if (MM_cs & ~rw) begin // can't read MM but do you really need too?
MM = |data_in;
end
@@ -39,6 +43,7 @@ always_ff @(posedge clk) begin
data_out <= RAM[RS];
end
end
end
always_comb begin

View File

@@ -94,6 +94,7 @@ assign mm_address = {mm_MO, cpu_addr[11:0]};
memory_mapper memory_mapper(
.clk(clk),
.rst(rst),
.rw(cpu_rwb),
.cs(mm_cs1),
.MM_cs(mm_cs2),