Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  4. use IEEE.NUMERIC_STD.ALL;
  5. entity ALU is
  6. port(Clock : in std_logic;
  7. A,B : in unsigned(7 downto 0);
  8. student id : in unsigned(3 downto 0);
  9. OP : in unsigned(15 downto);
  10. Neg: out std_logic;
  11. R1: out unsigned(3 downto 0);
  12. R2: out unsigned(3 downto 0));
  13. end ALU;
  14.  
  15. architecture calculation of ALU is
  16. signal Reg1,Reg2,Result : unsigned(7 downto 0) :=(others => '0');
  17. signal Reg4 : unsigned (0 to 7);
  18. begin
  19. Reg1 <= A;
  20. Reg2 <= B;
  21. process(Clk, OP)
  22. begin
  23. if(rising_edge(Clock))THEN
  24. case OP is
  25. WHEN "0000000000000001" =>
  26. WHEN "0000000000000010" =>
  27. WHEN "0000000000000100" =>
  28. WHEN "0000000000001000" =>
  29. WHEN "0000000000010000" =>
  30. WHEN "0000000000100000" =>
  31. WHEN "0000000001000000" =>
  32. WHEN "0000000010000000" =>
  33. WHEN "0000000100000000" =>
  34. WHEN OTHERS =>
  35. end case;
  36. end if;
  37. end process;
  38. R1 <= Result(3 downto 0);
  39. R2 <= Result(7 downto 4);
  40. end calculation;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement