Verilog Code For Serial Adder Subtractor Unit

This VHDL program is a structural description of the interactive Four Bit Adder-Subtractor on teahlab.com. The program shows every gate in the circuit and the interconnections between the gates.The circuit under verification, here the 4 Bit Adder-Subtractor, is imported into the test bench ARCHITECTURE as a component. The VHDL Code for full-adder circuit adds three one-bit binary numbers (A B Cin) and outputs two one-bit binary numbers, a sum (S) and a carry (Cout). Truth Table describes the functionality of full adder. Sum(S) output is High when odd number of inputs are High. 8 Bit Serial Adder Vhdl Code ->>->>->> 1 / 4.

Active3 years, 7 months ago
$begingroup$

I am trying to write the test bench part but I don't know how to do it. Basically, I want to test out 0x10 or 5x5. I don't if what I have is right.

here's a pic to give you some idea of what i am trying to build. it is not this exact one.

VerilogVerilog code for serial adder subtractor units

Here is the full adder:

Here is the multiplier:

Here is my test bench:

CharleBarkely123CharleBarkely123
$endgroup$

1 Answer

$begingroup$

I do not understand why in a 4 bit x 4 bit multiplier you are taking 4 inputs that also of 8 bit, what are they representing. If it is a combinational logic multiplier it should have been:

Purnendu KumarPurnendu Kumar
$endgroup$

Not the answer you're looking for? Browse other questions tagged verilogxilinxhdladdermultiplier or ask your own question.

Prerequisite – Full adder, Full Subtractor

Parallel Adder –
A single full adder performs the addition of two one bit numbers and an input carry. But a Parallel Adder is a digital circuit capable of finding the arithmetic sum of two binary numbers that is greater than one bit in length by operating on corresponding pairs of bits in parallel. It consists of full adders connected in a chain where the output carry from each full adder is connected to the carry input of the next higher order full adder in the chain. A n bit parallel adder requires n full adders to perform the operation. So for the two-bit number, two adders are needed while for four bit number, four adders are needed and so on. Parallel adders normally incorporate carry lookahead logic to ensure that carry propagation between subsequent stages of addition does not limit addition speed.

Working of parallel Adder –

  1. As shown in the figure, firstly the full adder FA1 adds A1 and B1 along with the carry C1 to generate the sum S1 (the first bit of the output sum) and the carry C2 which is connected to the next adder in chain.
  2. Next, the full adder FA2 uses this carry bit C2 to add with the input bits A2 and B2 to generate the sum S2(the second bit of the output sum) and the carry C3 which is again further connected to the next adder in chain and so on.
  3. The process continues till the last full adder FAn uses the carry bit Cn to add with its input An and Bn to generate the last bit of the output along last carry bit Cout.

Parallel Subtractor –

A Parallel Subtractor is a digital circuit capable of finding the arithmetic difference of two binary numbers that is greater than one bit in length by operating on corresponding pairs of bits in parallel. The parallel subtractor can be designed in several ways including combination of half and full subtractors, all full subtractors or all full adders with subtrahend complement input.

Working of Parallel Subtractor –

  1. As shown in the figure, the parallel binary subtractor is formed by combination of all full adders with subtrahend complement input.
  2. This operation considers that the addition of minuend along with the 2’s complement of the subtrahend is equal to their subtraction.
  3. Firstly the 1’s complement of B is obtained by the NOT gate and 1 can be added through the carry to find out the 2’s complement of B. This is further added to A to carry out the arithmetic subtraction.
  4. The process continues till the last full adder FAn uses the carry bit Cn to add with its input An and 2’s complement of Bn to generate the last bit of the output along last carry bit Cout.

Advantages of parallel Adder/Subtractor –

  1. The parallel adder/subtractor performs the addition operation faster as compared to serial adder/subtractor.
  2. Time required for addition does not depend on the number of bits.
  3. The output is in parallel form i.e all the bits are added/subtracted at the same time.
  4. It is less costly.

Disadvantages of parallel Adder/Subtractor –

  1. Each adder has to wait for the carry which is to be generated from the previous adder in chain.
  2. The propagation delay( delay associated with the travelling of carry bit) is found to increase with the increase in the number of bits to be added.

Reference –Adder – Wikipedia


Recommended Posts:

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the 'Improve Article' button below.


Verilog Code For Serial Adder Subtractor United