Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

If you dont mind please type out or paste the code from VHDL programme because t

ID: 2083102 • Letter: I

Question

If you dont mind please type out or paste the code from VHDL programme because the hand writting from the picture upload really hard to see.

Thanks a lot.

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 1

Explanation / 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
SIGNAL opcode : BIT_VECTOR(3 DOWNTO 0);

opcode <= (M, S0, S1);
process(a, b, opcode, cin)
begin
case opcode is
when "000" => F <= a and b;
when "001" => F <= a or b;
when "010" => F <= a xor b;

when "100" =>
F <= (a xor b) xor cin;
cout <= (a and b) xor ((a xor b) and cin);
when "101" =>
F <= (a xor not b) xor cin;
cout <= (a and not b) xor ((a xor not b) and cin);
when "101" => F <= a + cin; // here cin = 1
when "101" => F <= b + cin; // here cin = 1

end case;
end process;
end behavioral;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote