intMAN  version 0.2_20130422
ipri_highest.vhd
Go to the documentation of this file.
1 -------------------------------------------------------
2 --! @file
3 --! @brief Highest-priority pending interrupt selector for the intMAN hardware
4 --! @author Josef Strnadel, Brno University of Technology, Faculty of Information Technology
5 --! @email strnadel@fit.vutbr.cz
6 --! @date 2013-04-17
7 -------------------------------------------------------
8 
9 library IEEE;
10 use IEEE.STD_LOGIC_1164.ALL;
11 use IEEE.NUMERIC_STD.ALL;
12 use work.intMAN_package.all;
13 
14 --
15 --
16 --
17 --! Entity of the highest-priority pending interrupt select unit for the intMAN hardware (interface)
18 --
19 entity ipri_highest is
20  port (
21  IPRI_ARR : in t_intpri_arr; --! interrupt priorities
22  IPRI_HIGH: out STD_LOGIC_VECTOR(t_pri_width_range); --! the highest interrupt priority
23  IPRI_ADEC: out STD_LOGIC_VECTOR(t_int_range) --! address dmx output with the highest-priority interrupt selected
24  );
25 end entity ipri_highest;
26 
27 --
28 --
29 --
30 --! Architecture of the highest-priority pending interrupt select unit for the intMAN hardware (inner structure)
31 --
32 architecture arch of ipri_highest is
33 --! highest priority (HPRI) value signal
34 signal SIG_IPRIHIGH: STD_LOGIC_VECTOR(t_pri_width_range);
35 --! HPRI interrupt index signal
36 signal SIG_IPRIPOS: STD_LOGIC_VECTOR(t_int_width_range);
37 --! HPRI interrupt index validity signal
38 signal SIG_IPRIPOSVALID: STD_LOGIC;
39 begin
40  --! Process of searching the highest priority of pending interrupts
41  process(IPRI_ARR) is
42  variable highest_pri : STD_LOGIC_VECTOR(t_pri_width_range); --! highest priority (HPRI) value
43  variable highest_pos : STD_LOGIC_VECTOR(t_int_width_range); --! HPRI interrupt index
44  begin
45  highest_pri := (OTHERS => '1'); --! init to the lowest ('1...1') priority value
46  highest_pos := (OTHERS => '0'); --! reset index
47 
48  for i in t_int_range loop
49  if(IPRI_ARR(i) < highest_pri) then --! new HPRI found
50  highest_pri := IPRI_ARR(i); --! store the HPRI value
51  highest_pos := STD_LOGIC_VECTOR(TO_UNSIGNED(i, INT_WIDTH)); --! store the HPRI interrupt index
52  end if;
53  end loop;
54 
55  SIG_IPRIHIGH <= highest_pri;
56  SIG_IPRIPOS <= highest_pos;
57  end process;
58 
59  --! Process of SIG_IPRIPOSVALID adjustment
60  process(IPRI_ARR) is
61  variable i: integer;
62  variable j: STD_LOGIC;
63  begin
64  j := '0';
65  for i in t_pri_width_range loop
66  j := (j or (not SIG_IPRIHIGH(i))); -- index is valid if there is at least one '0' in the HPRI field
67  end loop;
68  SIG_IPRIPOSVALID <= j;
69  end process;
70 
72 
73  --! Process of constructing the HPRI interrupt select signal
74  process(IPRI_ARR) is
75  variable i: integer;
76  begin
77  i := TO_INTEGER(UNSIGNED(SIG_IPRIPOS));
78 
79  FOR idx IN t_int_range LOOP
80  if(idx = i) then
81  IPRI_ADEC(idx) <= ('1' and SIG_IPRIPOSVALID); --! make select-line active only if the HPRI index is valid
82  else
83  IPRI_ADEC(idx) <= '0';
84  end if;
85  end LOOP;
86  end process;
87 
88 end architecture arch;
© 2013 Josef Strnadel (email, web), Faculty of Information Technology, Brno University of Technology (web)