Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ULA com 4 bits de entrada e 5 bits de saida, opcode com 6 operacoes
- -- Autores: Joao Vitor e Marcos Meira
- -- Data 28/07/2017
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- use IEEE.STD_LOGIC_UNSIGNED.ALL;
- entity ula_display is
- Port ( NUM1: in STD_LOGIC_VECTOR (3 downto 0); --
- NUM2: in STD_LOGIC_VECTOR (3 downto 0); -- 4-bit number
- op_code: in STD_LOGIC_VECTOR (2 downto 0);
- saida: out STD_LOGIC_VECTOR (4 downto 0)); -- 5 bit result
- end ula_display;
- architecture behavioral of ula_display is
- sig_saida: std_LOGIC_VECTOR (4 downto 0);
- sig_decod0, sig_decod1: std_LOGIC_VECTOR (3 downto 0);
- begin
- process (op_code, NUM1, NUM2)
- begin
- case op_code is
- when "000" => sig_saida <= ('0' & NUM1) + ('0' & NUM2);
- when "001" => sig_saida <= ('0' & NUM1) - ('0' & NUM2);
- when "010" => sig_saida <= ('0' & NUM1) and ('0' & NUM2);
- when "011" => sig_saida <= ('0' & NUM1) or ('0' & NUM2);
- when "100" => sig_saida <= ('0' & NUM1) xor ('0' & NUM2);
- when "101" => sig_saida <= ('0' & NUM1) xnor ('0' & NUM2);
- when others => sig_saida <= "00000";
- end case;
- end process;
- if sig_saida >= 10 then
- sig_decod0 <= "0000";
- end behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement