Experiment 2
Experiment 2
Experiment 2
AIM: To design, Design a BCD to Seven segment circuit using Verilog and result is display
it on FPGA seven segment display.
Tools used:
1. Vivado tool
2. Vivado Simulator
3. EDGE ARTIX7
Logic Diagram:
Program:
always @(bcd)
begin
0 :seg = 7'b0000001;
1 :seg = 7'b1001111;
2 :seg = 7'b0010010;
3 :seg = 7'b0000110;
4 :seg = 7'b1001100;
5 :seg = 7'b0100100;
6 :seg = 7'b0100000;
7 :seg = 7'b0001111;
8 :seg = 7'b0000000;
9 :seg = 7'b0000100;
//switch off 7 segment character when the bcd digit is not a decimal number.
endcase
end
endmodule
module bin2bcd(
);
always @* begin
end
endmodule
module seg_display(
input clk,
);
// We need to switch between the digits as fast as possible...we will use 1 KHz clk
always@(posedge clk)
always@(*)
count_next = count_reg + 1;
always@(*)
begin
case(count_reg [17:16])
2'b00:
begin
case(digit_1)
endcase
anode = 4'b1110;
end
2'b01:
begin
case(digit_2)
endcase
anode = 4'b1101;
end
// default:
//begin
// anode = 8'b11111111;
//end
endcase
end
endmodule
Test bench module
module bcd_seven_segment_tb;
//Apply inputs
initial
begin
bcd=4'b0011; #20
bcd=4'b0111;#20
bcd=4'b1001;#20
bcd=4'b0100;#20
bcd=4'b0111;
end
endmodule
constraint file
Result:
The BCD to seven segment circuit is designed using Verilog HDL. Simulation and FPGA
implementation is performed using Vivado tool. Functional verification of the design is performed
using a Verilog HDL test bench.