Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4. use ieee.std_logic_arith.all;
  5.  
  6. --
  7. -- Vanjsko sucelje prilagodjeno nazivima tipki plocice ULX2S.
  8. -- Za rad na plocici ULX2S, umjesto btn_center koristite btn_f1.
  9. --
  10.  
  11. entity datapath is
  12. generic (
  13. C_data_width: integer := 4
  14. );
  15. port (
  16. btn_left, btn_right, btn_center, btn_up, btn_down: in std_logic;
  17. sw: in std_logic_vector(3 downto 0);
  18. clk_25m: in std_logic;
  19. led: out std_logic_vector(7 downto 0)
  20. );
  21. end datapath;
  22. --AddrA=Strahomir,AddrB=Ratomir,AddrW=Strahomir,ALUOp=Stanislava,Clk=Vlado,A=x,B=y,Z=z,W=j,Bmux=Dunav
  23. architecture x of datapath is
  24. signal Strahomir, Ratomir: std_logic_vector(1 downto 0);
  25. signal Stanislava: std_logic_vector(2 downto 0);
  26. signal Vlado: std_logic;
  27. signal x, y, z, j, Dunav: std_logic_vector((C_data_width - 1) downto 0);
  28.  
  29. begin
  30.  
  31. I_regfile: entity reg_file
  32. generic map (
  33. C_data_width => C_data_width
  34. )
  35. port map (
  36. AddrA => Strahomir, AddrB => Ratomir, AddrW => Strahomir,
  37. WE => '1', Clk => Vlado,
  38. A => x, B => y, W => j
  39. );
  40.  
  41. I_upravljac: entity upravljac
  42. port map (
  43. Clk_key => btn_up,
  44. AddrA_key => btn_left,
  45. AddrB_key => btn_right,
  46. ALUOp_key => btn_down,
  47. clk_25m => clk_25m,
  48. AddrA => Strahomir,
  49. AddrB => Ratomir,
  50. ALUOp => Stanislava,
  51. Clk => Vlado
  52. );
  53.  
  54. led(7 downto 4) <=Strahomir & Ratomir when btn_center = '0' else x;
  55. led(3 downto 0) <= Vlado & Stanislava when btn_center = '0' else y;
  56.  
  57. ALU: entity alu
  58. port map(
  59. ALU_A => x,
  60. ALU_B => y,
  61. ALU_Z => z,
  62. ALUOp => Stanislava
  63. );
  64.  
  65. with Ratomir select
  66. Dunav <=
  67. sw when "00",
  68. y when others;
  69. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement