summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-11-12 19:05:07 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2016-11-12 19:07:27 (GMT)
commit73b0e7ea6bf3b731a6300d7bd0df4183f3471376 (patch)
tree4bb0ab8dff72a29abf60f360a35fb10268a681fd
parenteabfba9996f77f63e3934725ac67f169d2ac8038 (diff)
downloadabc80-73b0e7ea6bf3b731a6300d7bd0df4183f3471376.zip
abc80-73b0e7ea6bf3b731a6300d7bd0df4183f3471376.tar.gz
abc80-73b0e7ea6bf3b731a6300d7bd0df4183f3471376.tar.bz2
abc80-73b0e7ea6bf3b731a6300d7bd0df4183f3471376.tar.xz
Avoid latch in video_width; allow flipping sw9 at runtime
Avoid latching video_width. Also track sw[9] and allow it to set the video_width at runtime by flipping the switch (it may or may not change the width based on previous state.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--abc80.v13
1 files changed, 11 insertions, 2 deletions
diff --git a/abc80.v b/abc80.v
index d79c66d..b730a63 100644
--- a/abc80.v
+++ b/abc80.v
@@ -1080,16 +1080,25 @@ module abc80 (
.strobe ( key1_strobe )
);
+ reg video_width_sw_q;
+
always @(negedge rst_n or posedge cpu_clk)
begin
if ( ~rst_n )
- video_width <= ~sw[9]; // Set SW9 to go to 40 column after reset
+ begin
+ video_width <= 1'b0;
+ video_width_sw_q <= 1'b0;
+ end
else
begin
+ video_width_sw_q <= ~sw[9];
+
if ( ~abc_in_n[3] )
video_width <= 1'b0;
else if ( ~abc_in_n[4] )
video_width <= 1'b1;
+ else if ( ~sw[9] ^ video_width_sw_q )
+ video_width <= ~sw[9];
else if ( key1_strobe & key1_debounced )
video_width <= ~video_width;
end
@@ -1196,7 +1205,7 @@ module abc80 (
wire intio_sel; // Selected for access via I/O ports
reg [7:0] intio_do; // Data out from MMU I/O ports
reg intio_sel_q;
- reg abc_out_7_q;
+ reg abc_out_7_q;
reg turbo_set;
reg nmi_dis;