Add a several cycle "dead zone" to 7-segment decoder segment select lines to more accurately emulate real hardware

master
Timothy Pearson 6 years ago
parent 9db454faca
commit eb6afe10e6

@ -144,12 +144,27 @@ module remote_access(
reg [17:0] digit_blanker_3 = 0; reg [17:0] digit_blanker_3 = 0;
reg [17:0] digit_blanker_4 = 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;
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;
reg [3:0] led_digit_select_latch_prev;
always @(negedge clk_div_by_eight) begin always @(negedge clk_div_by_eight) begin
led_segment_bus_latch = led_segment_bus; led_segment_bus_latch <= led_segment_bus_latch_4;
led_digit_select_latch = led_digit_select; 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 if (led_digit_select_latch[0] == 1) begin
digit_blanker_1 = digit_blanker_1 + 1; digit_blanker_1 = digit_blanker_1 + 1;
@ -167,24 +182,48 @@ module remote_access(
digit_blanker_4 = digit_blanker_4 + 1; digit_blanker_4 = digit_blanker_4 + 1;
end end
if (led_digit_select_latch[0] == 0) begin 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; led_display_bytes[0] = led_segment_bus_latch;
digit_blanker_1 = 0; 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 end
if (led_digit_select_latch[1] == 0) begin 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; led_display_bytes[1] = led_segment_bus_latch;
digit_blanker_2 = 0; 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 end
if (led_digit_select_latch[2] == 0) begin 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; led_display_bytes[2] = led_segment_bus_latch;
digit_blanker_3 = 0; 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 end
if (led_digit_select_latch[3] == 0) begin 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; led_display_bytes[3] = led_segment_bus_latch;
digit_blanker_4 = 0; 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 end
if (digit_blanker_1 > 128000) begin if (digit_blanker_1 > 128000) begin

Loading…
Cancel
Save