Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

library IEEE; use IEEE.STD _ LOGIC _ 1 1 6 4 . ALL; use IEEE.STD _ LOGIC _ ARITH.ALL; use IEEE.STD _ LOGIC _ UNSIGNED.ALL;

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ALU is
port (
A, B : in std_logic_vector(7 downto 0);
Opcode : in std_logic_vector(3 downto 0);
cin : in std_logic;
Y : out std_logic_vector(7 downto 0)
);
end ALU;
architecture Behavioral of ALU is
begin
process(A, B, Opcode, cin)
begin
case Opcode is
when "0000"=> Y <= A;
when "0001"=> Y <= A +1;
when "0010"=> Y <= A -1;
when "0011"=> Y <= B;
when "0100"=> Y <= B +1;
when "0101"=> Y <= B -1;
when "0110"=> Y <= A + B;
when "0111"=> Y <= A + B + cin;
when "1000"=> Y <= not A;
when "1001"=> Y <= not B;
when "1010"=> Y <= A and B;
when "1011"=> Y <= A or B;
when "1100"=> Y <= A nand B;
when "1101"=> Y <= A nor B;
when "1110"=> Y <= A xor B;
when "1111"=> Y <= A xnor B;
when others => Y <=(others =>'0');
end case;
end process;
end Behavioral;
structural vhdl description

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

8.10 Explain several common types of training for special purposes.

Answered: 1 week ago