Design an ALU circuit that will use the instructions listed in Table 1 on the S
ID: 1716310 • Letter: D
Question
Design an ALU circuit that will use the instructions listed in Table 1 on the S bus. The input numbers A and B are signed, 4-bit values (A[3] and B[3] are the sign bits). Note that only the arithmetic operations (+, -, *) are signed and the multiplication operation has an 8-bit product. The ALU must be implemented using Verilog code within the Xilinx WebPack IDE.
S(3:0) 0001 0010 Subtraction (signed) 0100 Multiplication (signed) (AxB)[7:4 (A x B)[3:0] 1000 1100 1010 1001 Operation Addition (signed A + B Shift right Shift left Rotate right Rotate left A -->B-bits A B-bits AExplanation / Answer
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
library UNISIM;
Port ( CLOCK : in STD_LOGIC;
DIRECTION : in STD_LOGIC;
COUNT_OUT : out STD_LOGIC_VECTOR (3 downto 0));
end counter;
architecture Behavioral of counter is
signal count_int : std_logic_vector(3 downto 0) := "0000";
begin
process (CLOCK)
begin
if CLOCK='1' and CLOCK'event then
if DIRECTION='1' then
count_int <= count_int + 1;
else
count_int <= count_int - 1;
end if;
end if;
end process;
COUNT_OUT <= count_int;
end Behavioral;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.