Advertisement
madegoff

Arm

May 15th, 2023 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4.  
  5. library work;
  6. use work.ArmTypes.INSTRUCTION_ID_WIDTH;
  7. use work.ArmTypes.VCR_RESET;
  8.  
  9. entity ArmInstructionAddressRegister is
  10. port(
  11. IAR_CLK : in std_logic;
  12. IAR_RST : in std_logic;
  13. IAR_INC : in std_logic;
  14. IAR_LOAD : in std_logic;
  15. IAR_REVOKE : in std_logic;
  16. IAR_UPDATE_HB : in std_logic;
  17. --------------------------------------------------------------------------------
  18. -- INSTRUCTION_ID_WIDTH ist ein globaler Konfigurationsparameter
  19. -- zur Einstellung der Breite der Instruktions-IDs und damit der Tiefe
  20. -- der verteilten Puffer. Eine Breite von 3 Bit genuegt fuer die
  21. -- fuenfstufige Pipeline definitiv.
  22. --------------------------------------------------------------------------------
  23. IAR_HISTORY_ID : in std_logic_vector(INSTRUCTION_ID_WIDTH-1 downto 0);
  24. IAR_ADDR_IN : in std_logic_vector(31 downto 2);
  25. IAR_ADDR_OUT : out std_logic_vector(31 downto 2);
  26. IAR_NEXT_ADDR_OUT : out std_logic_vector(31 downto 2)
  27. );
  28.  
  29. end entity ArmInstructionAddressRegister;
  30.  
  31. architecture behave of ArmInstructionAddressRegister is
  32.  
  33. component ArmRamBuffer
  34. generic(
  35. ARB_ADDR_WIDTH : natural range 1 to 4 := 3;
  36. ARB_DATA_WIDTH : natural range 1 to 64 := 32
  37. );
  38. port(
  39. ARB_CLK : in std_logic;
  40. ARB_WRITE_EN : in std_logic;
  41. ARB_ADDR : in std_logic_vector(ARB_ADDR_WIDTH-1 downto 0);
  42. ARB_DATA_IN : in std_logic_vector(ARB_DATA_WIDTH-1 downto 0);
  43. ARB_DATA_OUT : out std_logic_vector(ARB_DATA_WIDTH-1 downto 0)
  44. );
  45. end component ArmRamBuffer;
  46.  
  47. signal mux1_out : std_logic_vector(31 downto 2);
  48. signal mux2_out : std_logic_vector(31 downto 2);
  49. signal register_out : std_logic_vector(31 downto 2);
  50. signal buffer_out : std_logic_vector(31 downto 2);
  51.  
  52. begin
  53. register0 : process(IAR_CLK) is
  54. begin
  55. if (rising_edge(IAR_CLK)) then
  56. if (IAR_RST) then
  57. register_out <= (others => '0');
  58. else
  59. register_out <= mux2_out;
  60. end if;
  61. end if;
  62. end process;
  63.  
  64. with IAR_LOAD select --zweiter MUX
  65. mux2_out <= IAR_ADDR_IN when '1',
  66. mux1_out when '0';
  67. with IAR_INC select --erster MUX
  68. mux1_out <= std_logic_vector(4 + unsigned(register_out)) when '1',
  69. register_out when '0';
  70. with IAR_REVOKE select --dritter MUX
  71. IAR_NEXT_ADDR_OUT <= buffer_out when '1',
  72. std_logic_vector(4 + unsigned(register_out)) when '0';
  73.  
  74. IAR_ADDR_OUT <= register_out;
  75.  
  76. IAR_HISTORY_BUFFER: ArmRamBuffer
  77. generic map(
  78. ARB_ADDR_WIDTH => INSTRUCTION_ID_WIDTH,
  79. ARB_DATA_WIDTH => 30
  80. )
  81. port map(
  82. ARB_CLK => IAR_CLK,
  83. ARB_WRITE_EN => IAR_UPDATE_HB,
  84. ARB_ADDR => IAR_HISTORY_ID,
  85. ARB_DATA_IN => register_out,
  86. ARB_DATA_OUT => buffer_out
  87. );
  88.  
  89.  
  90.  
  91. end architecture behave;
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement