R
Rishi Dhupar
Guest
Hi,
Trying to implement an ALU, everything but the subtractor is working.
I cannot get the borrow out of the subtractor to work. I believe I did
it correctly. Here is my entity and a little sniplet of code for the
subtractor.
Thanks for the help.
RishiD
entity hw3 is
Port ( A : in std_logic_vector(3 downto 0);
B : in std_logic_vector(3 downto 0);
S : in std_logic_vector(2 downto 0);
F : out std_logic_vector(3 downto 0);
Flag : out std_logic);
end hw3;
architecture Behavioral of hw3 is
signal TempF : std_logic_vector(4 downto 0);
signal twoCompB : std_logic_vector(3 downto 0);
begin
twoCompB <= not (B) + 1;
....
TempF <= ('0' & A) + (twoCompB(3) & twoCompB);
....
F <= TempF(3 downto 0);
Flag <= TempF(4);
end Behavioral;
Trying to implement an ALU, everything but the subtractor is working.
I cannot get the borrow out of the subtractor to work. I believe I did
it correctly. Here is my entity and a little sniplet of code for the
subtractor.
Thanks for the help.
RishiD
entity hw3 is
Port ( A : in std_logic_vector(3 downto 0);
B : in std_logic_vector(3 downto 0);
S : in std_logic_vector(2 downto 0);
F : out std_logic_vector(3 downto 0);
Flag : out std_logic);
end hw3;
architecture Behavioral of hw3 is
signal TempF : std_logic_vector(4 downto 0);
signal twoCompB : std_logic_vector(3 downto 0);
begin
twoCompB <= not (B) + 1;
....
TempF <= ('0' & A) + (twoCompB(3) & twoCompB);
....
F <= TempF(3 downto 0);
Flag <= TempF(4);
end Behavioral;