Full Subtractor and Half Subtractor
FULL SUBTRACTOR
Full subtractor is a combinational circuit that perform subtraction of three input bits namely minuend bit A, subtrahend bit B, and borrow in C. The full subtractor generates two output bits: the difference D and borrow out BOUT.
use IEEE.STD_LOGIC_1164.ALL;
- entity full subtractor is
- Port ( A : in STD_LOGIC;
- B : in STD_LOGIC;
- C : in STD_LOGIC;
- diff : out STD_LOGIC;
- borrow : out STD_LOGIC);
- end full subtractor ;
- architecture behavioral of full subtractor _is
- begin
- diff <= A XOR B XOR C ;
- borrow <= (A AND B) OR (B AND (not C) OR (A AND (not C));
- end behavioral;
Half subtractor :
The half subtractor is a combinational circuit that is used to subtracts two bits. It has two inputs, the minuend A and subtrahend B and two outputs the difference D and borrow out BOUT. The borrow out is set when the subtractor needs to borrow from the next digit in a multi-digit subtraction. That is, BOUT = 1 when A < B. We know that, A and B are bits, BOUT = 1 When A= 0 and B=1.
LOGIC DIAGRAM FOR HALF SUBTRACTOR
LOGIC DIAGRAM FOR HALF SUBTRACTOR |
TRUTH TABLE FOR HALF SUBTRACTOR
use IEEE.STD_LOGIC_1164.ALL;
- entity Half subtractor is
- Port ( A : in STD_LOGIC;
- B : in STD_LOGIC;
- diff : out STD_LOGIC;
- borrow : out STD_LOGIC);
- end Half subtractor ;
- architecture behavioral of Half subtractor _is
- begin
- diff <= A XOR B ;
- borrow <= A AND(not B);
- end behavioral;
Good things
ReplyDelete