If you dont mind please write it out in MS-Word. Its really hard to see in hand
ID: 2083100 • Letter: I
Question
If you dont mind please write it out in MS-Word. Its really hard to see in hand writting in picture upload.
Thank you so much.
Best regard.
The ALU has 3 control inputs: Mfor mode selection, S1, S0, for operation selection, in input CO. It also has two 4-bit numbers A and B, and 4-bit result and 1-bit carry-out output. A block diagram with all inputs and outputs are shownin Figure 4.1 Carry in Co Carry out Cout Data in A 3:0 Data in B13:0 4-bit ALU Data output F[3:0] operation S1 select S0 Mode select M Figure 4.1 Input output of ALU The logic result is sent to the LEDs and the arithmetic result is sent to 7-segmetn display. The detailed functions of the ALU are described in the following table Control Inputs Operation M (CO Si SO 0 0 AND x 1 OR 0 EXOR 1 0 0 0 Addition 1 0 Subtraction 0 Increment Aby 1 1 1 1 1 Increment B by 1Explanation / Answer
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
entity alu_slice is
Port ( a : in std_logic_vector (3 downto 0);
b : in std_logic_vector (3 downto 0);
M: in std_logic;
S0, S1 : in std_logic;
F : out std_logic_vector (3 downto 0);
cin : in std_logic;
cout : out std_logic);
end alu_slice;
architecture Behavioural of alu_slice is
begin
process (a, b, cin, S0, S1, M)
variable temp : std_logic_vector (4 downto 0) ;
variable Yf : std_logic_vector (3 downto 0) ;
variable cf : std_logic ;
begin
cout <= '0';
temp := "00000";
if (m = '0') then
if (S0 = '0' and S1 = '0') then
Yf := a and b;
elsif (S0 = '0' and S1 = '1') then
Yf := a or b;
elsif (S0 = '1' and S1 = '0') then
Yf := a xor b;
end if;
elsif (m = '1') then
if (S0 = '0' and S1 = '0') then
temp := ('0' & a) + ('0' & b);
Yf := temp(3 downto 0);
cf := temp(4);
cout <= cf;
elsif (S0 = '0' and S1 = '1') then
temp := ('0' & a) - ('0' & b);
Yf := temp(3 downto 0);
cf := temp(4);
cout <= cf;
elsif (S0 = '1' and S1 = '0') then
temp := a + cin;
Yf := temp(3 downto 0);
cf := temp(4);
cout <= cf;
elsif (S0 = '1' and S1 = '1') then
temp := ('0' & b) + cin;
Yf := temp(3 downto 0);
cf := temp(4);
cout <= cf;
end if;
end if;
F <= Yf;
end process;
end Behavioural;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.