EXP1
EXP1
EXP1
EXPERIMENT -1
RIPPLE CARRY ADDER
VERIFICATION:
AIM: To perform the Ripple Carry Adder experiment using Quartus Prime with
the ModelSim simulation tool and the hardware 5CSXFC6D6F31C6 (Cyclone
V SoC FPGA)
Sailesh S 22BEC1177
Page 2 of 5
CODE:
module RIPPLE_CARRY(a, b, cin, sum, cout, seg1, seg2);
input [3:0] a, b;
input cin;
output wire [3:0] sum;
output cout;
output [6:0] seg1, seg2;
Sailesh S 22BEC1177
Page 3 of 5
xor(s1, a, b);
xor(sum, s1, cin);
and(c1, a, b);
and(c2, b, cin);
and(c3, a, cin);
or(cout, c1, c2, c3);
endmodule
always @(bcd)
begin
case (bcd)
4'b0000 : seg = 7'b0000001;
4'b0001 : seg = 7'b1001111;
4'b0010 : seg = 7'b0010010;
4'b0011 : seg = 7'b0000110;
4'b0100 : seg = 7'b1001100;
4'b0101 : seg = 7'b0100100;
4'b0110 : seg = 7'b0100000;
4'b0111 : seg = 7'b0001111;
4'b1000 : seg = 7'b0000000;
4'b1001 : seg = 7'b0000100;
default : seg = 7'b1111111;
endcase
Sailesh S 22BEC1177
Page 4 of 5
end
endmodule
OUTPUT:
A=3 B=3 C=0 A+B+C=06
Sailesh S 22BEC1177
Page 5 of 5
Sailesh S 22BEC1177