From 34a98edc6482a97cace2160bccfed37c52b087e1 Mon Sep 17 00:00:00 2001 From: Eugene Lozovoy Date: Thu, 4 Jan 2024 11:54:04 +0300 Subject: [PATCH] allow nmi call when divmmc's mapram in use --- fpga/rtl/divmmc.sv | 6 +++--- fpga/rtl/magic.sv | 4 ++-- fpga/rtl/top.sv | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fpga/rtl/divmmc.sv b/fpga/rtl/divmmc.sv index 3efead8..0c736f6 100755 --- a/fpga/rtl/divmmc.sv +++ b/fpga/rtl/divmmc.sv @@ -24,7 +24,7 @@ module divmmc( output reg [3:0] page, output map, - output automap, + output reg mapram, output ram, output ramwr_mask, output cpuwait @@ -65,10 +65,10 @@ always @(posedge clk28 or negedge rst_n) begin end // #3Dxx entrypoint is critical for timings, so we're arming 'map' signal as soon as possible -assign automap = automap0 || (bus.m1 && bus.memreq && !mask_hooks && en_hooks && en && !rammap && bus.a[15:8] == 8'h3D); +wire automap = automap0 || (bus.m1 && bus.memreq && !mask_hooks && en_hooks && en && !rammap && bus.a[15:8] == 8'h3D); -reg conmem, mapram; +reg conmem; wire port_e3_cs = en && bus.ioreq && bus.a[7:0] == 8'hE3; wire port_e7_cs = en && bus.ioreq && bus.a[7:0] == 8'hE7; wire port_eb_cs = en && bus.ioreq && bus.a[7:0] == 8'hEB; diff --git a/fpga/rtl/magic.sv b/fpga/rtl/magic.sv index ddbead4..2a1b716 100755 --- a/fpga/rtl/magic.sv +++ b/fpga/rtl/magic.sv @@ -13,7 +13,7 @@ module magic( input magic_button, input pause_button, - input div_automap, + input div_paged, output reg magic_mode, output magic_map, @@ -107,7 +107,7 @@ always @(posedge clk28 or negedge rst_n) begin end reg config_rd; -wire [7:0] config_data = {4'b0000, div_automap, 1'b1, pause_button, magic_button}; +wire [7:0] config_data = {4'b0000, div_paged, 1'b1, pause_button, magic_button}; always @(posedge clk28 or negedge rst_n) begin if (!rst_n) config_rd <= 0; diff --git a/fpga/rtl/top.sv b/fpga/rtl/top.sv index c7b4268..a4f67da 100755 --- a/fpga/rtl/top.sv +++ b/fpga/rtl/top.sv @@ -220,7 +220,8 @@ cpu cpu0( /* MAGIC */ -wire div_automap; +wire div_map; +wire div_mapram; wire [7:0] magic_dout; wire magic_dout_active; wire magic_mode, magic_map; @@ -242,7 +243,7 @@ magic magic0( .magic_button(ps2_key_magic), .pause_button(ps2_key_pause), - .div_automap(div_automap), + .div_paged(div_map && !div_mapram), .magic_mode(magic_mode), .magic_map(magic_map), @@ -372,7 +373,7 @@ mixer mixer0( /* DIVMMC */ -wire div_map, div_ram, div_ramwr_mask, div_dout_active; +wire div_ram, div_ramwr_mask, div_dout_active; wire [7:0] div_dout; wire [3:0] div_page; wire sd_mosi0; @@ -401,7 +402,7 @@ divmmc divmmc0( .page(div_page), .map(div_map), - .automap(div_automap), + .mapram(div_mapram), .ram(div_ram), .ramwr_mask(div_ramwr_mask) );