Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Write a Verilog code that starts at 0 and increments to 9 on a seven segment PMOD display that uses both PMODA and PMODB

Problem: Write a Verilog code that starts at 0 and increments to 9 on a seven segment PMOD display that uses both PMODA and PMODB on the PYNQ-Z2 FPGA development board. (Zynq7020)
I have been struggling to get the counter to work. I have successfully got each number to display on the seven segment, but I can not get a loop to work. I have added buttons and switches, but they do not make the problem better. Does someone have an idea as to where I can improve my code?
Constraint file:
set_property ALLOW_COMBINATORIAL_LOOPS TRUE [get_nets clk]
## Clock signal 125 MHz
set_property -dict { PACKAGE_PIN H16 IOSTANDARD LVCMOS33}[get_ports {sysclk }]; #IO_L13P_T2_MRCC_35 SCh=SYSCIk
create_clock -add -name sys_clk_pin -period 8.00[get_ports {sysclk }];
## PmodA
set_property -dict { PACKAGE_PIN Y18 IOSTANDARD LVCMOS33}[get_ports {PMODA[0]}]; # IO_II7P_T2_34 SCh=ja_p[1]
set_property -dict { PACKAGE_PIN Y19 IOSTANDARD LVCMOS33}[get_ports {PMODA[1]}]; #IO_L17N_T2_34 SCh=ja_n[1]
set_property -dict { PACKAGE_PIN Y16 IOSTANDARD LVCMOS33}[get_ports {PMODA[2]}]; # IO_I7P_TI_34 SCh=ja_p[2]
set_property -dict { PACKAGE_PIN Y17 IOSTANDARD LVCMOS33}[get_ports { PMODA[3]}]; # IO_L7N_TI_34 SCh=ja_n[2]
## PmodB
set_property -dict { PACKAGE_PIN W14 IOSTANDARD LVCMOS33}[get_ports { PMODB[0]}]; # IO_L8P_T1_34 SCh=jb_p[1]
set_property -dict { PACKAGE_PIN Y14 IOSTANDARD LVCMOS33}[get_ports {PMODB[1]}]; # IO_L8N_T1_34 SCh=jb_n[1]
set_property -dict { PACKAGE_PIN T11 IOSTANDARD LVCMOS33}[get_ports { PMODB[2]}]; # IO_LIP_TO_34 SCh=jb_p[2]
set_property -dict { PACKAGE_PIN T10 IOSTANDARD LVCMOS33}[get_ports {PMODB[3]}]; # IO_IIN_TO_34 SCh=jb_n[2]
Source Code:
module Seven_Segement(
output reg [3:0] PMODB,
output reg [3:0] PMODA
);
reg [7:0] seg_values [0:9];
reg [3:0] counter;
reg clk;
reg [18:0] delay_counter;
initial begin
// Initialize clock to 0
clk =0;
seg_values[0]=8'b11111100; //0
seg_values[1]=8'b01100000; //1
seg_values[2]=8'b11011010; //2
seg_values[3]=8'b11110010; //3
seg_values[4]=8'b01100110; //4
seg_values[5]=8'b10110110; //5
seg_values[6]=8'b10111110; //6
seg_values[7]=8'b11100000; //7
seg_values[8]=8'b11111110; //8
seg_values[9]=8'b11100110; //9
// Set clock frequency to 125 MHz
#10;
// Start the delay counter
delay_counter =0;
end
always #1 clk = ~clk; // Toggle clock every 1 time unit
always @(posedge clk) begin
// Increment the counter
if (delay_counter ==0)
counter = counter +1;
// Reset the counter if it reaches 10
if (counter ==10)
counter =0;
// Increment the delay counter
delay_counter = delay_counter +1;
end
always @* begin
// Assign segment values based on the counter
{PMODA, PMODB}= seg_values[counter];
// Reset the delay counter after 2 seconds (125 MHz clock assumed)
if (delay_counter ==2*125_000_000)
delay_counter =0;
end
endmodule
We are using Vivado Software
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago