All checks were successful
ci/woodpecker/push/test-workflow Pipeline was successful
The audio output is still messed up, but this commit gets everything as ready as it can get. Fixed up all the testbenches and added state machines for everything
63 lines
1.6 KiB
Systemverilog
63 lines
1.6 KiB
Systemverilog
/****
|
|
* seconds_display_tb.sv - testbench for the seconds_display module.
|
|
*
|
|
* @author: Waylon Cude, Dilanthi Prentice
|
|
* @date: 6/12/2025
|
|
*
|
|
* */
|
|
|
|
`timescale 1ns / 1ps
|
|
module seconds_display_tb;
|
|
int errors = 0;
|
|
logic [5:0] seconds;
|
|
wire [6:0] display_tens;
|
|
wire [6:0] display_ones;
|
|
|
|
logic [6:0] expected_tens;
|
|
logic [6:0] expected_ones;
|
|
|
|
sixty_display Dut(.number(seconds),.*);
|
|
initial begin
|
|
$display("Testing seconds_display");
|
|
for (seconds=0; seconds<60; seconds++) begin
|
|
expected_ones = encode_number(seconds % 10);
|
|
expected_tens = encode_number(seconds /10);
|
|
#1
|
|
if (display_ones !== expected_ones) begin
|
|
errors++;
|
|
$error("Failed ones test case, seconds = %d, displayed = %b, expected = %b",
|
|
seconds,
|
|
display_ones,
|
|
expected_ones);
|
|
end
|
|
else
|
|
if (display_tens !== expected_tens) begin
|
|
errors++;
|
|
$error("Failed tens test case, seconds = %d, displayed = %b, expected = %b",
|
|
seconds,
|
|
display_tens,
|
|
expected_tens);
|
|
end
|
|
end
|
|
|
|
if (errors == 0)
|
|
$display("All tests passing");
|
|
end
|
|
|
|
endmodule
|
|
|
|
function automatic logic [6:0] encode_number(logic [5:0] num);
|
|
case (num)
|
|
0: return 7'b1111110;
|
|
1: return 7'b0000110;
|
|
2: return 7'b1101101;
|
|
3: return 7'b1111001;
|
|
4: return 7'b0110011;
|
|
5: return 7'b1011011;
|
|
6: return 7'b1011111;
|
|
7: return 7'b1110000;
|
|
8: return 7'b1111111;
|
|
9: return 7'b1111011;
|
|
endcase
|
|
endfunction
|