# Ripple Carry Adder : Working, Types and Its Applications

In digital electronics adding of two-bit binary numbers can be possible by using half adder. And if the input sequence has a three-bit sequence, then the addition process can be completed by using a full adder. But if the numbers of bits are more in the input sequence then the process can be completed by using half adder. Because full adder cannot be able to complete the addition operation. So these drawbacks can be overcome by using “Ripple Carry Adder”. It’s a unique type of logic circuit used for adding the N-bit numbers in digital operations. This article describes an overview of what is ripple-carry-adder and its operation.

## What is Ripple Carry Adder?

A structure of multiple full adders is cascaded in a manner to gives the results of the addition of an n bit binary sequence. This adder includes cascaded full adders in its structure so, the carry will be generated at every full adder stage in a ripple-carry adder circuit. These carry output at each full adder stage is forwarded to its next full adder and there applied as a carry input to it. This process continues up to its last full adder stage. So, each carry output bit is rippled to the next stage of a full adder. By this reason, it is named as “RIPPLE CARRY ADDER”. The most important feature of it is to add the input bit sequences whether the sequence is 4 bit or 5 bit or any.

“One of the most important point to be considered in this carry adder is the final output is known only after the carry outputs are generated by each full adder stage and forwarded to its next stage. So there will be a delay to get the result with using of this carry adder”.

There are various types in ripple-carry adders. They are:

The below diagram represents the 4-bit ripple-carry adder. In this adder, four full adders are connected in cascade. Co is the carry input bit and it is zero always. When this input carry ‘Co’ is applied to the two input sequences A1 A2 A3 A4 and B1 B2 B3 B4 then output represented with S1 S2 S3 S4 and output carry C4.

#### Working of 4-bit Ripple Carry Adder

• Let’s take an example of two input sequences 0101 and 1010. These are representing the A4 A3 A2 A1 and B4 B3 B2 B1.
• As per this adder concept, input carry is 0.
• When Ao & Bo are applied at 1st full adder along with input carry 0.
• Here A1 =1 ; B1=0 ; Cin=0
• Sum (S1) and carry (C1) will be generated as per the Sum and Carry equations of this adder. As per its theory, the output equation for the Sum = A1⊕B1⊕Cin and Carry = A1B1⊕B1Cin⊕CinA1
• As per this equation, for 1st full adder S1 =1 and Carry output i.e., C1=0.
• Same like for next input bits A2 and B2, output S2 = 1 and C2 = 0. Here the important point is the second stage full adder gets input carry i.e., C1 which is the output carry of initial stage full adder.
• Like this will get the final output sequence (S4 S3 S2 S1) = (1 1 1 1) and Output carry C4 = 0
• This is the addition process for 4-bit input sequences when it’s applied to this carry adder.

• It consists of 8 full adders which are connected in cascaded form.
• Each full adder carry output is connected as an input carry to the next stage full adder.
• The input sequences are denoted by (A1 A2 A3 A4 A5 A6 A7 A8) and (B1 B2 B3 B4 B5 B6 B7 B8) and its relevant output sequence is denoted by (S1 S2 S3 S4 S5 S6 S7 S8).
• The addition process in an 8-bit ripple-carry-adder is the same principle which is used in a 4-bit ripple-carry-adder i.e., each bit from two input sequences are going to added along with input carry.
• This will use when the addition of two 8 bit binary digits sequence.

• It consists of 16 full adders which are connected in cascaded form.
• Each full adder carry output is connected as an input carry to the next stage full adder.
• The input sequences are denoted by (A1 ….. A16) and (B1 …… B16) and its relevant output sequence is denoted by (S1 …….. S16).
• The addition process in a 16-bit ripple-carry-adder is the same principle which is used in a 4-bit ripple-carry adder i.e., each bit from two input sequences are going to add along with input carry.
• This will use when the addition of two 16 bit binary digits sequence.

### Ripple Carry Adder Truth Table

Below truth table shows the output values for the possible combinations of all inputs for ripple-carry-adder.

 A1 A2 A3 A4 B4 B3 B2 B1 S4 S3 S2 S1 Carry 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1

### Ripple Carry Adder VHDL Code

VHDL (VHSIC HDL) is hardware description language. It’s a digital design language. The VHDL code for this carry adder is shown below.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

Port ( A : in STD_LOGIC_VECTOR (3 down to 0);
B: in STD_LOGIC_VECTOR (3 down to 0);
Cin : in STD_LOGIC;
S: out STD_LOGIC_VECTOR (3 down to 0);
Cout : out STD_LOGIC);

architecture Behavioural of Ripplecarryadder is — Full Adder VHDL Code Component Declaration
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
S : out STD_LOGIC;
Cout : out STD_LOGIC);
end component;

— Intermediate Carry declaration
Signal c1,c2,c3: STD_LOGIC;

begin

— Port Mapping Full Adder 4 times
FA1: full_adder_vhdl_code port map( A(0), B(0), Cin, S(0), c1);
FA2: full_adder_vhdl_code port map( A(1), B(1), c1, S(1), c2);
FA3: full_adder_vhdl_code port map( A(2), B(2), c2, S(2), c3);
FA4: full_adder_vhdl_code port map( A(3), B(3), c3, S(3), Cout);

end Behavioural;

### Ripple Carry Adder Verilog Code

Verilog code is a hardware description language. It’s used in digital circuits at the RTL stage for designing and verification purpose. The verilog code for this carry adder is shown below.

module ripple_carry_adder(a, b, cin, sum, cout);
input [03:0] a;
input [03:0] b;
input cin;
output [03:0] sum;
output cout;
wire [2:0]c;
endmodule
input a,b,cin;
output sum,cout;
assign sum=(a^b^cin);
assign cout=((a&b)|(b&cin)|(a&cin));

The ripple-carry-adder applications include the following.

• These carry adders are used mostly in addition to n-bit input sequences.
• These carry adders are applicable in the digital signal processing and microprocessors.