From da7d026d0679d1f3dcaa134256194fa1afdd5f8c Mon Sep 17 00:00:00 2001 From: Waylon Cude Date: Sat, 17 May 2025 12:40:20 -0700 Subject: [PATCH 1/2] Add testbench for the seconds display NOTE: This doesn't actually compile yet, but it should once changes to the seconds display are pushed --- verification/seconds_display_tb.sv | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 verification/seconds_display_tb.sv diff --git a/verification/seconds_display_tb.sv b/verification/seconds_display_tb.sv new file mode 100644 index 0000000..1a5e687 --- /dev/null +++ b/verification/seconds_display_tb.sv @@ -0,0 +1,51 @@ +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; + +seconds_display Dut(.*); +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++; + $display("Failed ones test case, displayed = %b, expected = %b", + display_ones, + expected_ones); + end + else + if (display_tens !== expected_tens) begin + errors++; + $display("Failed tens test case, displayed = %b, expected = %b", + 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 From 2fde75a3309fefbda31473e8fcad787735b5ace7 Mon Sep 17 00:00:00 2001 From: Waylon Cude Date: Mon, 19 May 2025 15:21:53 -0700 Subject: [PATCH 2/2] Added a in-progress top file Some of this stuff should get split out into 7-segment logic probably, having logic in the top file seems like a bad call --- Nexys-A7-100T-Master.xdc | 40 ++++++++++---------- SDVD.xpr | 20 ++++++++-- design/display_anode_driver.sv | 11 ++++++ design/low_freq_clock_gen.sv | 45 +++++++++++++++++++++++ design/nexys_a7_top.sv | 67 ++++++++++++++++++++++++++++++++++ design/playback_controller.sv | 7 +++- design/sdvd_defs.sv | 7 ++++ 7 files changed, 172 insertions(+), 25 deletions(-) create mode 100644 design/display_anode_driver.sv create mode 100644 design/low_freq_clock_gen.sv create mode 100644 design/nexys_a7_top.sv create mode 100644 design/sdvd_defs.sv diff --git a/Nexys-A7-100T-Master.xdc b/Nexys-A7-100T-Master.xdc index afd0916..5003bed 100644 --- a/Nexys-A7-100T-Master.xdc +++ b/Nexys-A7-100T-Master.xdc @@ -5,8 +5,8 @@ ## Note: As the Nexys 4 DDR was rebranded to the Nexys A7 with no substantial changes, this XDC file will also work for the Nexys 4 DDR. ## Clock signal -#set_property -dict { PACKAGE_PIN E3 IOSTANDARD LVCMOS33 } [get_ports { CLK100MHZ }]; #IO_L12P_T1_MRCC_35 Sch=clk100mhz -#create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports {CLK100MHZ}]; +set_property -dict { PACKAGE_PIN E3 IOSTANDARD LVCMOS33 } [get_ports { CLK100MHZ }]; #IO_L12P_T1_MRCC_35 Sch=clk100mhz +create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports {CLK100MHZ}]; ##Switches @@ -54,31 +54,31 @@ #set_property -dict { PACKAGE_PIN N16 IOSTANDARD LVCMOS33 } [get_ports { LED17_R }]; #IO_L11N_T1_SRCC_14 Sch=led17_r ##7 segment display -#set_property -dict { PACKAGE_PIN T10 IOSTANDARD LVCMOS33 } [get_ports { CA }]; #IO_L24N_T3_A00_D16_14 Sch=ca -#set_property -dict { PACKAGE_PIN R10 IOSTANDARD LVCMOS33 } [get_ports { CB }]; #IO_25_14 Sch=cb -#set_property -dict { PACKAGE_PIN K16 IOSTANDARD LVCMOS33 } [get_ports { CC }]; #IO_25_15 Sch=cc -#set_property -dict { PACKAGE_PIN K13 IOSTANDARD LVCMOS33 } [get_ports { CD }]; #IO_L17P_T2_A26_15 Sch=cd -#set_property -dict { PACKAGE_PIN P15 IOSTANDARD LVCMOS33 } [get_ports { CE }]; #IO_L13P_T2_MRCC_14 Sch=ce -#set_property -dict { PACKAGE_PIN T11 IOSTANDARD LVCMOS33 } [get_ports { CF }]; #IO_L19P_T3_A10_D26_14 Sch=cf -#set_property -dict { PACKAGE_PIN L18 IOSTANDARD LVCMOS33 } [get_ports { CG }]; #IO_L4P_T0_D04_14 Sch=cg +set_property -dict { PACKAGE_PIN T10 IOSTANDARD LVCMOS33 } [get_ports { CA }]; #IO_L24N_T3_A00_D16_14 Sch=ca +set_property -dict { PACKAGE_PIN R10 IOSTANDARD LVCMOS33 } [get_ports { CB }]; #IO_25_14 Sch=cb +set_property -dict { PACKAGE_PIN K16 IOSTANDARD LVCMOS33 } [get_ports { CC }]; #IO_25_15 Sch=cc +set_property -dict { PACKAGE_PIN K13 IOSTANDARD LVCMOS33 } [get_ports { CD }]; #IO_L17P_T2_A26_15 Sch=cd +set_property -dict { PACKAGE_PIN P15 IOSTANDARD LVCMOS33 } [get_ports { CE }]; #IO_L13P_T2_MRCC_14 Sch=ce +set_property -dict { PACKAGE_PIN T11 IOSTANDARD LVCMOS33 } [get_ports { CF }]; #IO_L19P_T3_A10_D26_14 Sch=cf +set_property -dict { PACKAGE_PIN L18 IOSTANDARD LVCMOS33 } [get_ports { CG }]; #IO_L4P_T0_D04_14 Sch=cg #set_property -dict { PACKAGE_PIN H15 IOSTANDARD LVCMOS33 } [get_ports { DP }]; #IO_L19N_T3_A21_VREF_15 Sch=dp -#set_property -dict { PACKAGE_PIN J17 IOSTANDARD LVCMOS33 } [get_ports { AN[0] }]; #IO_L23P_T3_FOE_B_15 Sch=an[0] -#set_property -dict { PACKAGE_PIN J18 IOSTANDARD LVCMOS33 } [get_ports { AN[1] }]; #IO_L23N_T3_FWE_B_15 Sch=an[1] -#set_property -dict { PACKAGE_PIN T9 IOSTANDARD LVCMOS33 } [get_ports { AN[2] }]; #IO_L24P_T3_A01_D17_14 Sch=an[2] -#set_property -dict { PACKAGE_PIN J14 IOSTANDARD LVCMOS33 } [get_ports { AN[3] }]; #IO_L19P_T3_A22_15 Sch=an[3] -#set_property -dict { PACKAGE_PIN P14 IOSTANDARD LVCMOS33 } [get_ports { AN[4] }]; #IO_L8N_T1_D12_14 Sch=an[4] -#set_property -dict { PACKAGE_PIN T14 IOSTANDARD LVCMOS33 } [get_ports { AN[5] }]; #IO_L14P_T2_SRCC_14 Sch=an[5] -#set_property -dict { PACKAGE_PIN K2 IOSTANDARD LVCMOS33 } [get_ports { AN[6] }]; #IO_L23P_T3_35 Sch=an[6] -#set_property -dict { PACKAGE_PIN U13 IOSTANDARD LVCMOS33 } [get_ports { AN[7] }]; #IO_L23N_T3_A02_D18_14 Sch=an[7] +set_property -dict { PACKAGE_PIN J17 IOSTANDARD LVCMOS33 } [get_ports { AN[0] }]; #IO_L23P_T3_FOE_B_15 Sch=an[0] +set_property -dict { PACKAGE_PIN J18 IOSTANDARD LVCMOS33 } [get_ports { AN[1] }]; #IO_L23N_T3_FWE_B_15 Sch=an[1] +set_property -dict { PACKAGE_PIN T9 IOSTANDARD LVCMOS33 } [get_ports { AN[2] }]; #IO_L24P_T3_A01_D17_14 Sch=an[2] +set_property -dict { PACKAGE_PIN J14 IOSTANDARD LVCMOS33 } [get_ports { AN[3] }]; #IO_L19P_T3_A22_15 Sch=an[3] +set_property -dict { PACKAGE_PIN P14 IOSTANDARD LVCMOS33 } [get_ports { AN[4] }]; #IO_L8N_T1_D12_14 Sch=an[4] +set_property -dict { PACKAGE_PIN T14 IOSTANDARD LVCMOS33 } [get_ports { AN[5] }]; #IO_L14P_T2_SRCC_14 Sch=an[5] +set_property -dict { PACKAGE_PIN K2 IOSTANDARD LVCMOS33 } [get_ports { AN[6] }]; #IO_L23P_T3_35 Sch=an[6] +set_property -dict { PACKAGE_PIN U13 IOSTANDARD LVCMOS33 } [get_ports { AN[7] }]; #IO_L23N_T3_A02_D18_14 Sch=an[7] ##CPU Reset Button -#set_property -dict { PACKAGE_PIN C12 IOSTANDARD LVCMOS33 } [get_ports { CPU_RESETN }]; #IO_L3P_T0_DQS_AD1P_15 Sch=cpu_resetn +set_property -dict { PACKAGE_PIN C12 IOSTANDARD LVCMOS33 } [get_ports { CPU_RESETN }]; #IO_L3P_T0_DQS_AD1P_15 Sch=cpu_resetn ##Buttons -#set_property -dict { PACKAGE_PIN N17 IOSTANDARD LVCMOS33 } [get_ports { BTNC }]; #IO_L9P_T1_DQS_14 Sch=btnc +set_property -dict { PACKAGE_PIN N17 IOSTANDARD LVCMOS33 } [get_ports { BTNC }]; #IO_L9P_T1_DQS_14 Sch=btnc #set_property -dict { PACKAGE_PIN M18 IOSTANDARD LVCMOS33 } [get_ports { BTNU }]; #IO_L4N_T0_D05_14 Sch=btnu #set_property -dict { PACKAGE_PIN P17 IOSTANDARD LVCMOS33 } [get_ports { BTNL }]; #IO_L12P_T1_MRCC_14 Sch=btnl -#set_property -dict { PACKAGE_PIN M17 IOSTANDARD LVCMOS33 } [get_ports { BTNR }]; #IO_L10N_T1_D15_14 Sch=btnr +set_property -dict { PACKAGE_PIN M17 IOSTANDARD LVCMOS33 } [get_ports { BTNR }]; #IO_L10N_T1_D15_14 Sch=btnr #set_property -dict { PACKAGE_PIN P18 IOSTANDARD LVCMOS33 } [get_ports { BTND }]; #IO_L9N_T1_DQS_D13_14 Sch=btnd diff --git a/SDVD.xpr b/SDVD.xpr index 0573c12..b371300 100644 --- a/SDVD.xpr +++ b/SDVD.xpr @@ -48,6 +48,7 @@