Advertisement
madegoff

ArmLdmStmNextAddress

Jun 18th, 2023 (edited)
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.40 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. --  16-Bit-Register zur Steuerung der Auswahl des naechsten Registers
  3. --  bei der Ausfuehrung von STM/LDM-Instruktionen. Das Register wird
  4. --  mit der Bitmaske der Instruktion geladen. Ein Prioritaetsencoder
  5. --  (Modul ArmPriorityVectorFilter) bestimmt das Bit mit der hochsten
  6. --  Prioritaet. Zu diesem Bit wird eine 4-Bit-Registeradresse erzeugt und
  7. --  das Bit im Register geloescht. Bis zum Laden eines neuen Datums wird
  8. --  mit jedem Takt ein Bit geloescht bis das Register leer ist.
  9. --------------------------------------------------------------------------------
  10. --  Datum:      ??.??.2013
  11. --  Version:    ?.??
  12. --------------------------------------------------------------------------------
  13. library ieee;
  14. use ieee.std_logic_1164.all;
  15.  
  16. entity ArmLdmStmNextAddress is
  17.     port(
  18.         SYS_RST         : in std_logic;
  19.         SYS_CLK         : in std_logic;
  20.         LNA_LOAD_REGLIST    : in std_logic;
  21.         LNA_HOLD_VALUE      : in std_logic;
  22.         LNA_REGLIST         : in std_logic_vector(15 downto 0);
  23.         LNA_ADDRESS         : out std_logic_vector(3 downto 0);
  24.         LNA_CURRENT_REGLIST_REG : out std_logic_vector(15 downto 0)
  25.         );
  26. end entity ArmLdmStmNextAddress;
  27.  
  28. architecture behave of ArmLdmStmNextAddress is
  29.  
  30. signal intern_reg : std_logic_vector(15 downto 0); 111101111101011
  31. signal priotiry_bit : std_logic_vector(15 downto 0);
  32. variable priority_bit_int : integer;
  33.  
  34.     component ArmPriorityVectorFilter
  35.         port(
  36.             PVF_VECTOR_UNFILTERED   : in std_logic_vector(15 downto 0);
  37.             PVF_VECTOR_FILTERED : out std_logic_vector(15 downto 0)
  38.         );
  39.     end component ArmPriorityVectorFilter;
  40.  
  41. begin
  42.     CURRENT_REGLIST_FILTER : ArmPriorityVectorFilter
  43.         port map(
  44.             PVF_VECTOR_UNFILTERED   => LNA_REGLIST,
  45.             PVF_VECTOR_FILTERED => priotiry_bit, 0000100000000
  46.         );
  47.  
  48.     process(SYS_CLK)
  49.     begin
  50.         if (rising_edge(SYS_CLK)) then
  51.             if (SYS_RST = '1') then intern_reg <= others <= '0';
  52.             end if;
  53.             if (LNA_LOAD_REGLIST) then
  54.                 intern_reg <= LNA_REGLIST;
  55.             else -- also wenn nicht geladen wird
  56.                 if (HOLD_VALUE = '0') then -- das bit mit dem hoeschsten prio auf 0 setzen; mit der naechsten steigenden flanke??
  57.                         priority_bit_int <= log2(to_integer(unsigned(priority_bit)));
  58.                         intern_reg(priority_bit_int) <= '0';
  59.                 end if;
  60.             end if;
  61.             LNA_ADDRESS <= to_unsigned(priority_bit_int);
  62.             LNA_CURRENT_REGLIST_REG <= intern_reg;
  63.         end if;
  64.     end process;
  65.  
  66. end architecture behave;
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement