From 8b1cb65b6fb47bd5be61044ddca9dee756aa2090 Mon Sep 17 00:00:00 2001 From: Artem Kashkanov Date: Wed, 2 Oct 2024 22:20:11 +0300 Subject: [PATCH] Fix DRAM view issue --- vhdl/DekatronPC/DekatronPC.sv | 9 +++++---- vhdl/Emulator/MS6205.sv | 11 ++++++++--- vhdl/Emulator/io_key_display_block.sv | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/vhdl/DekatronPC/DekatronPC.sv b/vhdl/DekatronPC/DekatronPC.sv index 38e2bb2..c7bff81 100644 --- a/vhdl/DekatronPC/DekatronPC.sv +++ b/vhdl/DekatronPC/DekatronPC.sv @@ -91,6 +91,7 @@ wire [AP_RAM_BIN_BW-1:0] ApAddressBin; reg [AP_RAM_BIN_BW-1:0] ApAddressBin_Setup; wire [AP_RAM_BIN_BW-1:0] ApAddressBin_Cnt; + reg ApRamRdy; assign ApAddressBin = (ApRamRdy) ? ApAddressBin_Cnt : ApAddressBin_Setup; @@ -120,10 +121,10 @@ always @(posedge Clk, negedge Rst_n) begin ApAddressBin_Setup <= AP_RAM_ROWS_NUM - 1; end else begin if (~ApRamRdy) begin - if (ApAddressBin_Setup != 0) begin - ApAddressBin_Setup <= ApAddressBin_Setup - 1; - end else begin + if (ApAddressBin_Setup == 0) begin ApRamRdy <= 1; + end else begin + ApAddressBin_Setup <= ApAddressBin_Setup - 1; end end end @@ -143,7 +144,7 @@ RAM #( .Address1(ApAddress1Bin), .Out1(ApData1), `endif - .WE(ApRamWE), + .WE(ApRamWE | ~ApRamRdy), .CS(ApRamCS) ); diff --git a/vhdl/Emulator/MS6205.sv b/vhdl/Emulator/MS6205.sv index b054f6e..a0d2abb 100644 --- a/vhdl/Emulator/MS6205.sv +++ b/vhdl/Emulator/MS6205.sv @@ -19,7 +19,10 @@ module MS6205( input wire ready, input wire [39:0] keysCurrentState, /* verilator lint_on UNUSEDSIGNAL */ - output wire marker, + output wire marker, + + input wire tx_switch_view_i, //if 1 enable automatic switch on MS6205 + input wire [2:0] DPC_State ); @@ -100,7 +103,9 @@ always @(negedge Clock_1us, negedge Rst_n) begin if (tx_vld) begin stdioRam[stdioAddr] <= tx_data; stdioAddr <= stdioAddr + 1; - tx_view_req <= 1'b1; + if (tx_switch_view_i) begin + tx_view_req <= 1'b1; + end end if (ms6205_currentView == MS6205_CIO) begin tx_view_req <= 1'b0; @@ -177,7 +182,7 @@ always_ff @(negedge Clock_1ms, negedge Rst_n) begin stdioData <= {4'b0, apAddress1[7:4]} + 8'h30; end (4): begin - stdioData <= {4'b0, ms6205Pos[7:4]} + 8'h30; + stdioData <= {3'b0, ms6205Pos[7:4], 1'b0} + 8'h30; end (5): begin stdioData <= ":"; diff --git a/vhdl/Emulator/io_key_display_block.sv b/vhdl/Emulator/io_key_display_block.sv index 0e40f23..55f1730 100644 --- a/vhdl/Emulator/io_key_display_block.sv +++ b/vhdl/Emulator/io_key_display_block.sv @@ -205,6 +205,7 @@ MS6205 ms6205( .marker(ms6205_marker_en), .ready(ms6205_ready), .DPC_State(DPC_currentState), + .tx_switch_view_i(1'b0), .keysCurrentState(keyboard_keysCurrentState) );