Full Subtractor Design using Logical Gates (VHDL Code)-
Program-
-------------------------------------------------------------------------------
--
-- Title : full_subtractor
-- Design : vhdl_test
-- Author : Naresh Singh Dobal
-- Company : nsd
--
-------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity full_subtractor is
port(
a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
difference : out STD_LOGIC;
borrow : out STD_LOGIC
);
end full_subtractor;
architecture full_subtractor_arc of full_subtractor is
begin
difference <= a xor b xor c;
borrow <= ((not a) and b) or
(b and c) or
(c and (not a));
end full_subtractor_arc;
Output Waveform : Full Subtractor |
Program-
-------------------------------------------------------------------------------
--
-- Title : full_subtractor
-- Design : vhdl_test
-- Author : Naresh Singh Dobal
-- Company : nsd
--
-------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity full_subtractor is
port(
a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
difference : out STD_LOGIC;
borrow : out STD_LOGIC
);
end full_subtractor;
architecture full_subtractor_arc of full_subtractor is
begin
difference <= a xor b xor c;
borrow <= ((not a) and b) or
(b and c) or
(c and (not a));
end full_subtractor_arc;
please can you write with 2 inputs
ReplyDeleteif we write 2 input it act like full subtractor
ReplyDeletetheir must be 4 inout bits if we will draw the diagram
ReplyDelete