0% found this document useful (0 votes)
11 views

Lab 9

This document describes a lab to design a circuit that circulates a square pattern in a clockwise direction through a four-digit seven-segment LED display. The circuit takes inputs to enable or pause circulation and to specify the direction. The designed circuit is verified on a prototyping board to ensure the circulation rate is slow enough for visual inspection. Code is provided to implement a module that generates the rotating square pattern and a new clock module. The conclusion states knowledge was gained about FPGAs and designing circuits for LED displays.

Uploaded by

Muazam Malik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lab 9

This document describes a lab to design a circuit that circulates a square pattern in a clockwise direction through a four-digit seven-segment LED display. The circuit takes inputs to enable or pause circulation and to specify the direction. The designed circuit is verified on a prototyping board to ensure the circulation rate is slow enough for visual inspection. Code is provided to implement a module that generates the rotating square pattern and a new clock module. The conclusion states knowledge was gained about FPGAs and designing circuits for LED displays.

Uploaded by

Muazam Malik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab title:

In a seven-segment LED display, a square pattern can be created by enabling the


a, b, f, and g segments or the c, d, e, and g segments. We want to design a circuit
that circulates the square patterns in the four-digit seven-segment LED display in
clockwise circulating pattern. The circuit should have an input, en, which enables
or pauses the circulation, and an input, cw, which specifies the direction (i.e.,
clockwise or counterclockwise) of the circulation.Design the circuit and verify its
operation on the prototyping board. Make sure that the circulation rate is slow
enough for visual inspection.

Code:

module main( case (ctrl)


input clk, 0:
input en, begin
output [6:0] sseg, an = 4'b0111;
output [3:0] an, sseg =
output clk_out 7'b0011100;
); end
new_clk one(clk, 1:
clk_out); begin
sq two(clk_out, en, sseg, an = 4'b1011;
an); sseg =
endmodule 7'b0011100;
end
// Rotating square module 2:
module sq( begin
input clk, an = 4'b1101;
input en, sseg =
output reg [6:0] sseg, 7'b0011100;
output reg [3:0] an end
); 3:
reg [3:0] in; begin
reg [3:0] ctrl; an = 4'b1110;
sseg =
always @(posedge clk) 7'b0011100;
begin end
if (en) 4:
begin begin
if (ctrl == 7) an = 4'b1110;
ctrl <= 0; sseg =
else 7'b1100010;
ctrl <= ctrl + 1; end
end 5:
end Begin
an = 4'b1101;
always @* sseg =
begin 7'b1100010;
end

6:
begin
an = 4'b1011;
sseg =
7'b1100010;
end
default:
begin
an = 4'b0111;
sseg =
7'b1100010;
end

endcase

end

endmodule

// New Clock module


module new_clk(
input clk,
output reg clk_out
);
reg [26:0] counter;

always @(posedge clk)


begin
counter <= counter +
1;
if (counter ==
50000000)
begin
clk_out <= ~clk_out;
counter <= 0;

end

end

endmodule
Results:

Conclusion:
From this lab task, we have gotten more knowledge about fpga and sparten-3. We make the code in
which we can see that one square pattern is glowing in a flow.

You might also like