1 |
2 |
ash_riple |
library ieee;
|
2 |
|
|
use ieee.std_logic_1164.all;
|
3 |
|
|
use ieee.std_logic_arith.all;
|
4 |
|
|
use ieee.std_logic_unsigned.all;
|
5 |
|
|
|
6 |
|
|
entity up_monitor is
|
7 |
|
|
port (
|
8 |
|
|
up_clk : in std_logic;
|
9 |
|
|
up_wbe : in std_logic;
|
10 |
|
|
up_csn : in std_logic;
|
11 |
|
|
up_addr : in std_logic_vector(15 downto 2);
|
12 |
|
|
up_data_io : in std_logic_vector(31 downto 0)
|
13 |
|
|
);
|
14 |
|
|
end up_monitor;
|
15 |
|
|
|
16 |
|
|
architecture synth of up_monitor is
|
17 |
|
|
|
18 |
|
|
component virtual_jtag_adda_fifo is
|
19 |
|
|
generic(
|
20 |
|
|
data_width : integer;
|
21 |
|
|
fifo_depth : integer;
|
22 |
|
|
addr_width : integer;
|
23 |
|
|
al_full_val : integer;
|
24 |
|
|
al_empt_val : integer
|
25 |
|
|
);
|
26 |
|
|
port(
|
27 |
|
|
clk : in std_logic;
|
28 |
|
|
wr_en : in std_logic;
|
29 |
|
|
data_in : in std_logic_vector(data_width-1 downto 0)
|
30 |
|
|
);
|
31 |
|
|
end component virtual_jtag_adda_fifo;
|
32 |
|
|
|
33 |
|
|
signal up_csn_d1, up_csn_d2, up_csn_d3, up_csn_d4 : std_logic;
|
34 |
|
|
signal up_csn_neg_pulse : std_logic;
|
35 |
|
|
signal up_bus_content : std_logic_vector(47 downto 0);
|
36 |
|
|
|
37 |
|
|
type addr_array is array (15 downto 0) of std_logic_vector (31 downto 0);
|
38 |
|
|
|
39 |
|
|
component virtual_jtag_addr_mask is
|
40 |
|
|
generic(
|
41 |
|
|
addr_width : integer;
|
42 |
|
|
mask_index : integer;
|
43 |
|
|
mask_num : integer
|
44 |
|
|
);
|
45 |
|
|
port(
|
46 |
|
|
mask_out0 : out std_logic_vector (31 downto 0);
|
47 |
|
|
mask_out1 : out std_logic_vector (31 downto 0);
|
48 |
|
|
mask_out2 : out std_logic_vector (31 downto 0);
|
49 |
|
|
mask_out3 : out std_logic_vector (31 downto 0);
|
50 |
|
|
mask_out4 : out std_logic_vector (31 downto 0);
|
51 |
|
|
mask_out5 : out std_logic_vector (31 downto 0);
|
52 |
|
|
mask_out6 : out std_logic_vector (31 downto 0);
|
53 |
|
|
mask_out7 : out std_logic_vector (31 downto 0);
|
54 |
|
|
mask_out8 : out std_logic_vector (31 downto 0);
|
55 |
|
|
mask_out9 : out std_logic_vector (31 downto 0);
|
56 |
|
|
mask_out10 : out std_logic_vector (31 downto 0);
|
57 |
|
|
mask_out11 : out std_logic_vector (31 downto 0);
|
58 |
|
|
mask_out12 : out std_logic_vector (31 downto 0);
|
59 |
|
|
mask_out13 : out std_logic_vector (31 downto 0);
|
60 |
|
|
mask_out14 : out std_logic_vector (31 downto 0);
|
61 |
|
|
mask_out15 : out std_logic_vector (31 downto 0)
|
62 |
|
|
);
|
63 |
|
|
end component virtual_jtag_addr_mask;
|
64 |
|
|
|
65 |
|
|
signal addr_mask : addr_array;
|
66 |
|
|
signal addr_mask_ok : std_logic;
|
67 |
|
|
|
68 |
|
|
component virtual_jtag_adda_trig is
|
69 |
|
|
generic(
|
70 |
|
|
trig_width : integer
|
71 |
|
|
);
|
72 |
|
|
port(
|
73 |
|
|
trig_out : out std_logic_vector(trig_width-1 downto 0)
|
74 |
|
|
);
|
75 |
|
|
end component virtual_jtag_adda_trig;
|
76 |
|
|
|
77 |
|
|
signal trig_condition : std_logic_vector(49 downto 0);
|
78 |
|
|
alias trig_en : std_logic is trig_condition(49);
|
79 |
|
|
alias trig_set : std_logic is trig_condition(48);
|
80 |
|
|
alias trig_addr : std_logic_vector(15 downto 0) is trig_condition(47 downto 32);
|
81 |
|
|
alias trig_data : std_logic_vector(31 downto 0) is trig_condition(31 downto 0);
|
82 |
|
|
signal trig_condition_ok : std_logic;
|
83 |
|
|
|
84 |
|
|
begin
|
85 |
|
|
|
86 |
|
|
process (up_clk)
|
87 |
|
|
begin
|
88 |
|
|
if (up_clk'event and up_clk='1') then
|
89 |
|
|
up_csn_d1 <= up_csn or up_wbe;
|
90 |
|
|
up_csn_d2 <= up_csn_d1;
|
91 |
|
|
up_csn_d3 <= up_csn_d2;
|
92 |
|
|
up_csn_d4 <= up_csn_d3;
|
93 |
|
|
end if;
|
94 |
|
|
end process;
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
process (up_clk)
|
98 |
|
|
begin
|
99 |
|
|
if (up_clk'event and up_clk='1') then
|
100 |
|
|
if (( (up_addr(15 downto 2)<=addr_mask(0)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(0)(15 downto 2)) or
|
101 |
|
|
(up_addr(15 downto 2)<=addr_mask(1)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(1)(15 downto 2)) or
|
102 |
|
|
(up_addr(15 downto 2)<=addr_mask(2)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(2)(15 downto 2)) or
|
103 |
|
|
(up_addr(15 downto 2)<=addr_mask(3)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(3)(15 downto 2)) or
|
104 |
|
|
(up_addr(15 downto 2)<=addr_mask(4)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(4)(15 downto 2)) or
|
105 |
|
|
(up_addr(15 downto 2)<=addr_mask(5)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(5)(15 downto 2)) or
|
106 |
|
|
(up_addr(15 downto 2)<=addr_mask(6)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(6)(15 downto 2)) or
|
107 |
|
|
(up_addr(15 downto 2)<=addr_mask(7)(31 downto 18) and up_addr(15 downto 2)>=addr_mask(7)(15 downto 2))
|
108 |
|
|
) --inclusive address set
|
109 |
|
|
and
|
110 |
|
|
( (up_addr(15 downto 2)>addr_mask(8) (31 downto 18) or up_addr(15 downto 2)<addr_mask(8) (15 downto 2)) and
|
111 |
|
|
(up_addr(15 downto 2)>addr_mask(9) (31 downto 18) or up_addr(15 downto 2)<addr_mask(9) (15 downto 2)) and
|
112 |
|
|
(up_addr(15 downto 2)>addr_mask(10)(31 downto 18) or up_addr(15 downto 2)<addr_mask(10)(15 downto 2)) and
|
113 |
|
|
(up_addr(15 downto 2)>addr_mask(11)(31 downto 18) or up_addr(15 downto 2)<addr_mask(11)(15 downto 2)) and
|
114 |
|
|
(up_addr(15 downto 2)>addr_mask(12)(31 downto 18) or up_addr(15 downto 2)<addr_mask(12)(15 downto 2)) and
|
115 |
|
|
(up_addr(15 downto 2)>addr_mask(13)(31 downto 18) or up_addr(15 downto 2)<addr_mask(13)(15 downto 2)) and
|
116 |
|
|
(up_addr(15 downto 2)>addr_mask(14)(31 downto 18) or up_addr(15 downto 2)<addr_mask(14)(15 downto 2)) and
|
117 |
|
|
(up_addr(15 downto 2)>addr_mask(15)(31 downto 18) or up_addr(15 downto 2)<addr_mask(15)(15 downto 2))
|
118 |
|
|
) --exclusive address set
|
119 |
|
|
) then
|
120 |
|
|
addr_mask_ok <= '1';
|
121 |
|
|
else
|
122 |
|
|
addr_mask_ok <= '0';
|
123 |
|
|
end if;
|
124 |
|
|
end if;
|
125 |
|
|
end process;
|
126 |
|
|
|
127 |
|
|
process (up_clk)
|
128 |
|
|
begin
|
129 |
|
|
if (up_clk'event and up_clk='1') then
|
130 |
|
|
if (trig_en='0') then
|
131 |
|
|
trig_condition_ok <= '1';
|
132 |
|
|
elsif (trig_set='0') then
|
133 |
|
|
trig_condition_ok <= '0';
|
134 |
|
|
elsif (up_csn_d1='0' and up_csn_d2='1') then
|
135 |
|
|
if (trig_addr(15 downto 2)=up_addr(15 downto 2) and trig_data=up_data_io) then
|
136 |
|
|
trig_condition_ok <= '1';
|
137 |
|
|
end if;
|
138 |
|
|
end if;
|
139 |
|
|
end if;
|
140 |
|
|
end process;
|
141 |
|
|
|
142 |
|
|
up_csn_neg_pulse <= (not up_csn_d3) and up_csn_d4 and addr_mask_ok and trig_condition_ok;
|
143 |
|
|
up_bus_content <= up_addr(15 downto 2) & "00" & up_data_io(31 downto 0);
|
144 |
|
|
|
145 |
|
|
u_virtual_jtag_adda_fifo : virtual_jtag_adda_fifo
|
146 |
|
|
generic map
|
147 |
|
|
(
|
148 |
|
|
data_width => 48,
|
149 |
|
|
fifo_depth => 512,
|
150 |
|
|
addr_width => 9,
|
151 |
|
|
al_full_val => 511,
|
152 |
|
|
al_empt_val => 0
|
153 |
|
|
)
|
154 |
|
|
port map
|
155 |
|
|
(
|
156 |
|
|
clk => up_clk,
|
157 |
|
|
wr_en => up_csn_neg_pulse,
|
158 |
|
|
data_in => up_bus_content
|
159 |
|
|
);
|
160 |
|
|
|
161 |
|
|
u_virtual_jtag_addr_mask : virtual_jtag_addr_mask
|
162 |
|
|
generic map
|
163 |
|
|
(
|
164 |
|
|
addr_width => 32,
|
165 |
|
|
mask_index => 4,
|
166 |
|
|
mask_num => 16
|
167 |
|
|
)
|
168 |
|
|
port map
|
169 |
|
|
(
|
170 |
|
|
mask_out0 => addr_mask(0),
|
171 |
|
|
mask_out1 => addr_mask(1),
|
172 |
|
|
mask_out2 => addr_mask(2),
|
173 |
|
|
mask_out3 => addr_mask(3),
|
174 |
|
|
mask_out4 => addr_mask(4),
|
175 |
|
|
mask_out5 => addr_mask(5),
|
176 |
|
|
mask_out6 => addr_mask(6),
|
177 |
|
|
mask_out7 => addr_mask(7),
|
178 |
|
|
mask_out8 => addr_mask(8),
|
179 |
|
|
mask_out9 => addr_mask(9),
|
180 |
|
|
mask_out10 => addr_mask(10),
|
181 |
|
|
mask_out11 => addr_mask(11),
|
182 |
|
|
mask_out12 => addr_mask(12),
|
183 |
|
|
mask_out13 => addr_mask(13),
|
184 |
|
|
mask_out14 => addr_mask(14),
|
185 |
|
|
mask_out15 => addr_mask(15)
|
186 |
|
|
);
|
187 |
|
|
|
188 |
|
|
u_virtual_jtag_adda_trig : virtual_jtag_adda_trig
|
189 |
|
|
generic map
|
190 |
|
|
(
|
191 |
|
|
trig_width => 50
|
192 |
|
|
)
|
193 |
|
|
port map
|
194 |
|
|
(
|
195 |
|
|
trig_out => trig_condition
|
196 |
|
|
);
|
197 |
|
|
|
198 |
|
|
end synth;
|