summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineering.com>2019-04-28 22:24:30 -0500
committerTimothy Pearson <tpearson@raptorengineering.com>2019-04-28 22:24:30 -0500
commiteb6afe10e66825d9275a9b752b40e95cbf6ec830 (patch)
tree1c4eb64fea9165e0288a4eb0e5d35826eb225aff
parent9db454facad4e36dae8315b5366642fcaf1ec10b (diff)
downloadulab-eb6afe10e66825d9275a9b752b40e95cbf6ec830.tar.gz
ulab-eb6afe10e66825d9275a9b752b40e95cbf6ec830.zip
Add a several cycle "dead zone" to 7-segment decoder segment select lines to more accurately emulate real hardware
-rw-r--r--fpga/serial/common/remote_access.v71
1 files changed, 55 insertions, 16 deletions
diff --git a/fpga/serial/common/remote_access.v b/fpga/serial/common/remote_access.v
index b7f0592..6d14ed4 100644
--- a/fpga/serial/common/remote_access.v
+++ b/fpga/serial/common/remote_access.v
@@ -144,12 +144,27 @@ module remote_access(
reg [17:0] digit_blanker_3 = 0;
reg [17:0] digit_blanker_4 = 0;
+ reg [3:0] digit_activity_counter_1 = 0;
+ reg [3:0] digit_activity_counter_2 = 0;
+ reg [3:0] digit_activity_counter_3 = 0;
+ reg [3:0] digit_activity_counter_4 = 0;
+
reg [7:0] led_segment_bus_latch;
+ reg [7:0] led_segment_bus_latch_1;
+ reg [7:0] led_segment_bus_latch_2;
+ reg [7:0] led_segment_bus_latch_3;
+ reg [7:0] led_segment_bus_latch_4;
reg [3:0] led_digit_select_latch;
+ reg [3:0] led_digit_select_latch_prev;
always @(negedge clk_div_by_eight) begin
- led_segment_bus_latch = led_segment_bus;
- led_digit_select_latch = led_digit_select;
+ led_segment_bus_latch <= led_segment_bus_latch_4;
+ led_segment_bus_latch_4 <= led_segment_bus_latch_3;
+ led_segment_bus_latch_3 <= led_segment_bus_latch_2;
+ led_segment_bus_latch_2 <= led_segment_bus_latch_1;
+ led_segment_bus_latch_1 <= led_segment_bus;
+ led_digit_select_latch <= led_digit_select;
+ led_digit_select_latch_prev <= led_digit_select_latch;
if (led_digit_select_latch[0] == 1) begin
digit_blanker_1 = digit_blanker_1 + 1;
@@ -167,24 +182,48 @@ module remote_access(
digit_blanker_4 = digit_blanker_4 + 1;
end
- if (led_digit_select_latch[0] == 0) begin
- led_display_bytes[0] = led_segment_bus_latch;
- digit_blanker_1 = 0;
+ if ((led_digit_select_latch[0] == 0) && (led_digit_select_latch_prev[0] == 0)) begin
+ if (digit_activity_counter_1 > 6) begin
+ led_display_bytes[0] = led_segment_bus_latch;
+ digit_blanker_1 = 0;
+ end else begin
+ digit_activity_counter_1 <= digit_activity_counter_1 + 1;
+ end
+ end else begin
+ digit_activity_counter_1 <= 0;
end
-
- if (led_digit_select_latch[1] == 0) begin
- led_display_bytes[1] = led_segment_bus_latch;
- digit_blanker_2 = 0;
+
+ if ((led_digit_select_latch[1] == 0) && (led_digit_select_latch_prev[1] == 0)) begin
+ if (digit_activity_counter_2 > 6) begin
+ led_display_bytes[1] = led_segment_bus_latch;
+ digit_blanker_2 = 0;
+ end else begin
+ digit_activity_counter_2 <= digit_activity_counter_2 + 1;
+ end
+ end else begin
+ digit_activity_counter_2 <= 0;
end
- if (led_digit_select_latch[2] == 0) begin
- led_display_bytes[2] = led_segment_bus_latch;
- digit_blanker_3 = 0;
+ if ((led_digit_select_latch[2] == 0) && (led_digit_select_latch_prev[2] == 0)) begin
+ if (digit_activity_counter_3 > 6) begin
+ led_display_bytes[2] = led_segment_bus_latch;
+ digit_blanker_3 = 0;
+ end else begin
+ digit_activity_counter_3 <= digit_activity_counter_3 + 1;
+ end
+ end else begin
+ digit_activity_counter_3 <= 0;
end
-
- if (led_digit_select_latch[3] == 0) begin
- led_display_bytes[3] = led_segment_bus_latch;
- digit_blanker_4 = 0;
+
+ if ((led_digit_select_latch[3] == 0) && (led_digit_select_latch_prev[3] == 0)) begin
+ if (digit_activity_counter_4 > 6) begin
+ led_display_bytes[3] = led_segment_bus_latch;
+ digit_blanker_4 = 0;
+ end else begin
+ digit_activity_counter_4 <= digit_activity_counter_4 + 1;
+ end
+ end else begin
+ digit_activity_counter_4 <= 0;
end
if (digit_blanker_1 > 128000) begin