Vhdl Code For Arithmetic And Logic Unit

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Vhdl Code For Arithmetic And Logic Unit as PDF for free.

More details

  • Words: 125
  • Pages: 4
VHDL CODE FOR ARITHMETIC AND LOGIC UNIT

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 (3 downto 0); s : in STD_LOGIC_VECTOR (2 downto 0); y : out STD_LOGIC_VECTOR (3 downto 0)); end alu; architecture Behavioral of alu is signal arith,logic:std_logic_vector(3 downto 0); begin

with s(1 downto 0) select arith<= a when "00", a+b when "01", not b when "10", a+1 when others;

with s(1 downto 0) select logic<= not a when "00", not b when "01", a or b when "10", a and b when others;

with s(2) select y<= arith when '0', logic when others; end Behavioral;

(a)

(b) FIG5.2 SCHEMATIC DIAGRAM FOR ARITHMETIC AND LOGIC UNIT

FIG5.3 WAVEFORM FOR ARITHMETIC AND LOGIC UNIT

Related Documents