Complete the code to declare a 4-bit input signal named 'A'.
signal A : std_logic_vector([1] downto 0);
The signal 'A' is declared as a 4-bit vector, so the highest index is 3 (0 to 3).
Complete the code to perform bitwise AND on inputs A and B and assign to output Result.
Result <= A [1] B;The bitwise AND operation in VHDL is done using the keyword 'and'.
Fix the error in the process sensitivity list to include all inputs A, B, and Op.
process([1])
begin
-- ALU operation code
end process;The process must be sensitive to all inputs that affect the output: A, B, and Op.
Fill both blanks to complete the case statement for ALU operations.
case Op is when "00" => Result <= A [1] B; when "01" => Result <= A [2] B; when others => Result <= (others => '0'); end case;
The ALU performs AND when Op is "00" and OR when Op is "01".
Fill all three blanks to complete the ALU output assignment with addition and subtraction.
case Op is when "10" => Result <= std_logic_vector(unsigned(A) [1] unsigned(B)); when "11" => Result <= std_logic_vector(unsigned(A) [2] unsigned(B)); when others => Result <= (others => '0'); end case; -- Note: [3] is used for type conversion.
Use '+' for addition and '-' for subtraction on unsigned types. The 'unsigned' function converts std_logic_vector to unsigned for arithmetic.