Half Subtractor and Full Subtractor VHDL Simulation Code
Half Subtractor and Full Subtractor VHDL Simulation Code
the code.
Introduction:
To develop code for half subtractor and full subtractor. Simulate the code in the
software.
Material required:
2. Print = 1.
Description:
1. Theory
2. Algorithm
3. Description
Theory:
The Half-Adder is a basic building block of adding two numbers as two inputs and
produce out two outputs. The adder is used to perform OR operation of two single bit
binary numbers.
ALGORITHM:
3. Describe functionality.
DESCRIPTION:
The augent and addent bits are two input states, and ‘carry’ and ‘sum ‘are two output
Half-subtractor circuit
TRUTH TABLE
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
Library ieee;
use ieee.std_logic_1164.all;
entity half_sub is
end half_sub;
begin
end sub_arch;
Full-Subtractor
The Half Subtractor is used to subtract only two numbers. To overcome this problem, a
full subtractor was designed. The full subtractor is used to subtract three 1-bit numbers
A, B, and C, which are minuend, subtrahend, and borrow, respectively. The full
subtractor has three input states and two output states i.e., diff and borrow.
Full-Subtractor circuit:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity full_sub is
end full_sub;
begin
end data;
TRUTH TABLE
VHDL program to build half and full-subtractor circuits. Verify the output waveform
of program (digital circuit) with the truth tables for the half and full-subtractor circuits.
Half-subtractor Output
Full-subtractor Output
Questions with answers:
three bits, namely A (minuend), B (subtrahend), and Bin (borrow-in) . It accepts three
inputs.
Ans: Difference = A ⊕ B
Borrow = A’ B
Ans: D = A ⊕ B ⊕ Bin