1 |
29 |
wfjm |
-- $Id: ibd_iist.vhd 641 2015-02-01 22:12:15Z mueller $
|
2 |
2 |
wfjm |
--
|
3 |
13 |
wfjm |
-- Copyright 2009-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
4 |
2 |
wfjm |
--
|
5 |
|
|
-- This program is free software; you may redistribute and/or modify it under
|
6 |
|
|
-- the terms of the GNU General Public License as published by the Free
|
7 |
|
|
-- Software Foundation, either version 2, or at your option any later version.
|
8 |
|
|
--
|
9 |
|
|
-- This program is distributed in the hope that it will be useful, but
|
10 |
|
|
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
11 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12 |
|
|
-- for complete details.
|
13 |
|
|
--
|
14 |
|
|
------------------------------------------------------------------------------
|
15 |
|
|
-- Module Name: ibd_iist - syn
|
16 |
|
|
-- Description: ibus dev(loc): IIST
|
17 |
|
|
--
|
18 |
|
|
-- Dependencies: -
|
19 |
|
|
-- Test bench: -
|
20 |
|
|
-- Target Devices: generic
|
21 |
29 |
wfjm |
-- Tool versions: ise 8.2-14.7; viv 2014.4; ghdl 0.18-0.31
|
22 |
2 |
wfjm |
--
|
23 |
|
|
-- Synthesized (xst):
|
24 |
|
|
-- Date Rev ise Target flop lutl lutm slic t peri
|
25 |
9 |
wfjm |
-- 2010-10-17 333 12.1 M53d xc3s1000-4 112 510 0 291 s 15.8
|
26 |
|
|
-- 2010-10-17 314 12.1 M53d xc3s1000-4 111 504 0 290 s 15.6
|
27 |
|
|
-- 2009-06-01 223 10.1.03 K39 xc3s1000-4 111 439 0 256 s 9.8
|
28 |
|
|
-- 2009-06-01 221 10.1.03 K39 xc3s1000-4 111 449 0 258 s 13.3
|
29 |
2 |
wfjm |
--
|
30 |
|
|
-- Revision History:
|
31 |
|
|
-- Date Rev Version Comment
|
32 |
13 |
wfjm |
-- 2011-11-18 427 0.8.1 now numeric_std clean
|
33 |
8 |
wfjm |
-- 2010-10-17 333 0.8 use ibus V2 interface
|
34 |
2 |
wfjm |
-- 2009-06-07 224 0.7 send inverted stc_stp; remove pgc_err; honor msk_im
|
35 |
|
|
-- also for dcf_dcf and exc_rte; add iist_mreq and
|
36 |
|
|
-- iist_sreq, boot and lock interfaces
|
37 |
|
|
-- 2009-06-05 223 0.6 level interrupt, parity logic, exc.ui logic
|
38 |
|
|
-- st logic modified (partially tested)
|
39 |
|
|
-- 2009-06-01 221 0.5 Initial version (untested, lock&boot missing)
|
40 |
|
|
------------------------------------------------------------------------------
|
41 |
|
|
|
42 |
|
|
library ieee;
|
43 |
|
|
use ieee.std_logic_1164.all;
|
44 |
13 |
wfjm |
use ieee.numeric_std.all;
|
45 |
2 |
wfjm |
|
46 |
|
|
use work.slvtypes.all;
|
47 |
|
|
use work.iblib.all;
|
48 |
|
|
use work.ibdlib.all;
|
49 |
|
|
|
50 |
|
|
-- ----------------------------------------------------------------------------
|
51 |
|
|
entity ibd_iist is -- ibus dev(loc): IIST
|
52 |
|
|
-- fixed address: 177500
|
53 |
|
|
generic (
|
54 |
|
|
SID : slv2 := "00"); -- self id
|
55 |
|
|
port (
|
56 |
|
|
CLK : in slbit; -- clock
|
57 |
|
|
CE_USEC : in slbit; -- usec pulse
|
58 |
|
|
RESET : in slbit; -- system reset
|
59 |
|
|
BRESET : in slbit; -- ibus reset
|
60 |
|
|
IB_MREQ : in ib_mreq_type; -- ibus request
|
61 |
|
|
IB_SRES : out ib_sres_type; -- ibus response
|
62 |
|
|
EI_REQ : out slbit; -- interrupt request
|
63 |
|
|
EI_ACK : in slbit; -- interrupt acknowledge
|
64 |
|
|
IIST_BUS : in iist_bus_type; -- iist bus (input from all iist's)
|
65 |
|
|
IIST_OUT : out iist_line_type; -- iist output
|
66 |
|
|
IIST_MREQ : out iist_mreq_type; -- iist->cpu requests
|
67 |
|
|
IIST_SRES : in iist_sres_type -- cpu->iist responses
|
68 |
|
|
);
|
69 |
|
|
end ibd_iist;
|
70 |
|
|
|
71 |
|
|
architecture syn of ibd_iist is
|
72 |
|
|
|
73 |
13 |
wfjm |
constant ibaddr_iist : slv16 := slv(to_unsigned(8#177500#,16));
|
74 |
2 |
wfjm |
|
75 |
|
|
constant tdlysnd : natural := 150; -- send delay timer
|
76 |
|
|
|
77 |
|
|
constant ibaddr_acr : slv1 := "0"; -- acr address offset
|
78 |
|
|
constant ibaddr_adr : slv1 := "1"; -- adr address offset
|
79 |
|
|
|
80 |
|
|
constant acr_ibf_clr : integer := 15; -- clear flag
|
81 |
|
|
subtype acr_ibf_sid is integer range 9 downto 8; -- self id
|
82 |
|
|
subtype acr_ibf_ac is integer range 3 downto 0; -- ac code
|
83 |
|
|
|
84 |
|
|
constant ac_pge : slv4 := "0000"; -- 0 program generated enables
|
85 |
|
|
constant ac_pgc : slv4 := "0001"; -- 1 program generated control/status
|
86 |
|
|
constant ac_ste : slv4 := "0010"; -- 2 sanity timer enables
|
87 |
|
|
constant ac_stc : slv4 := "0011"; -- 3 sanity timer control/status
|
88 |
|
|
constant ac_msk : slv4 := "0100"; -- 4 input masks
|
89 |
|
|
constant ac_pgf : slv4 := "0101"; -- 5 program generated flags
|
90 |
|
|
constant ac_stf : slv4 := "0110"; -- 6 sanity timer flags
|
91 |
|
|
constant ac_dcf : slv4 := "0111"; -- 7 disconnect flags
|
92 |
|
|
constant ac_exc : slv4 := "1000"; -- 10 exceptions
|
93 |
|
|
constant ac_mtc : slv4 := "1101"; -- 15 maintenance control
|
94 |
|
|
|
95 |
|
|
subtype pge_ibf_pbe is integer range 11 downto 8; -- pg boot ena
|
96 |
|
|
subtype pge_ibf_pie is integer range 3 downto 0; -- pg int ena
|
97 |
|
|
|
98 |
|
|
constant pgc_ibf_err : integer := 15; -- error
|
99 |
|
|
constant pgc_ibf_grj : integer := 14; -- go reject
|
100 |
|
|
constant pgc_ibf_pgrmr : integer := 13; -- pg req refused
|
101 |
|
|
constant pgc_ibf_strmr : integer := 12; -- st req refused
|
102 |
|
|
constant pgc_ibf_rdy : integer := 11; -- ready flag
|
103 |
|
|
subtype pgc_ibf_sid is integer range 9 downto 8; -- self id
|
104 |
|
|
constant pgc_ibf_ip : integer := 3; -- int pending
|
105 |
|
|
constant pgc_ibf_ie : integer := 2; -- int enable
|
106 |
|
|
constant pgc_ibf_ptp : integer := 1; -- pg parity
|
107 |
|
|
constant pgc_ibf_go : integer := 0; -- go flag
|
108 |
|
|
|
109 |
|
|
subtype ste_ibf_sbe is integer range 11 downto 8; -- st boot enable
|
110 |
|
|
subtype ste_ibf_sie is integer range 3 downto 0; -- st int enable
|
111 |
|
|
|
112 |
|
|
subtype stc_ibf_count is integer range 15 downto 8; -- count
|
113 |
|
|
constant stc_ibf_tmo : integer := 3; -- timeout
|
114 |
|
|
constant stc_ibf_lke : integer := 2; -- lockup enable
|
115 |
|
|
constant stc_ibf_stp : integer := 1; -- st parity
|
116 |
|
|
constant stc_ibf_enb : integer := 0; -- enable
|
117 |
|
|
|
118 |
|
|
subtype msk_ibf_bm is integer range 11 downto 8; -- boot mask
|
119 |
|
|
subtype msk_ibf_im is integer range 3 downto 0; -- int mask
|
120 |
|
|
|
121 |
|
|
subtype pgf_ibf_pbf is integer range 11 downto 8; -- boot flags
|
122 |
|
|
subtype pgf_ibf_pif is integer range 3 downto 0; -- int flags
|
123 |
|
|
|
124 |
|
|
subtype stf_ibf_sbf is integer range 11 downto 8; -- boot flags
|
125 |
|
|
subtype stf_ibf_sif is integer range 3 downto 0; -- int flags
|
126 |
|
|
|
127 |
|
|
subtype dcf_ibf_brk is integer range 11 downto 8; -- break flags
|
128 |
|
|
subtype dcf_ibf_dcf is integer range 3 downto 0; -- disconnect flags
|
129 |
|
|
|
130 |
|
|
subtype exc_ibf_ui is integer range 11 downto 8; -- unexpected int
|
131 |
|
|
subtype exc_ibf_rte is integer range 3 downto 0; -- transm. error
|
132 |
|
|
|
133 |
|
|
constant mtc_ibf_mttp : integer := 11; -- maint. type
|
134 |
|
|
constant mtc_ibf_mfrm : integer := 10; -- maint. frame err
|
135 |
|
|
subtype mtc_ibf_mid is integer range 9 downto 8; -- maint. id
|
136 |
|
|
constant mtc_ibf_dsbt : integer := 3; -- disable boot
|
137 |
|
|
constant mtc_ibf_enmxd : integer := 2; -- enable maint mux
|
138 |
|
|
constant mtc_ibf_enmlp : integer := 1; -- enable maint loop
|
139 |
|
|
constant mtc_ibf_dsdrv : integer := 0; -- disable driver
|
140 |
|
|
|
141 |
|
|
type state_type is (
|
142 |
|
|
s_idle, -- idle state
|
143 |
|
|
s_clear, -- handle acr clr
|
144 |
|
|
s_stsnd, -- handle st transmit
|
145 |
|
|
s_pgsnd -- handle pg transmit
|
146 |
|
|
);
|
147 |
|
|
|
148 |
|
|
type regs_type is record -- state registers
|
149 |
8 |
wfjm |
ibsel : slbit; -- ibus select
|
150 |
2 |
wfjm |
acr_ac : slv4; -- acr: ac
|
151 |
|
|
pge_pbe : slv4; -- pge: pg boot ena
|
152 |
|
|
pge_pie : slv4; -- pge: pg int ena
|
153 |
|
|
pgc_grj : slbit; -- pgc: go reject
|
154 |
|
|
pgc_pgrmr : slbit; -- pgc: pg req refused
|
155 |
|
|
pgc_strmr : slbit; -- pgc: st req refused
|
156 |
|
|
pgc_ie : slbit; -- pgc: int enable
|
157 |
|
|
pgc_ptp : slbit; -- pgc: pg parity
|
158 |
|
|
ste_sbe : slv4; -- ste: st boot enable
|
159 |
|
|
ste_sie : slv4; -- ste: st int enable
|
160 |
|
|
stc_count : slv8; -- stc: count
|
161 |
|
|
stc_tmo : slbit; -- stc: timeout
|
162 |
|
|
stc_lke : slbit; -- stc: lockup enable
|
163 |
|
|
stc_stp : slbit; -- stc: st parity
|
164 |
|
|
stc_enb : slbit; -- stc: enable
|
165 |
|
|
msk_bm : slv4; -- msk: boot mask
|
166 |
|
|
msk_im : slv4; -- msk: int mask
|
167 |
|
|
pgf_pbf : slv4; -- pgf: boot flags
|
168 |
|
|
pgf_pif : slv4; -- pgf: int flags
|
169 |
|
|
stf_sbf : slv4; -- stf: boot flags
|
170 |
|
|
stf_sif : slv4; -- stf: int flags
|
171 |
|
|
dcf_brk : slv4; -- dcf: break flags
|
172 |
|
|
dcf_dcf : slv4; -- dcf: disconnect flags
|
173 |
|
|
exc_ui : slv4; -- exc: unexpected int
|
174 |
|
|
exc_rte : slv4; -- exc: transm. error
|
175 |
|
|
mtc_mttp : slbit; -- mtc: maint. type
|
176 |
|
|
mtc_mfrm : slbit; -- mtc: maint. frame err
|
177 |
|
|
mtc_mid : slv2; -- mtc: maint. id
|
178 |
|
|
mtc_dsbt : slbit; -- mtc: disable boot
|
179 |
|
|
mtc_enmxd : slbit; -- mtc: enable maint mux
|
180 |
|
|
mtc_enmlp : slbit; -- mtc: enable maint loop
|
181 |
|
|
mtc_dsdrv : slbit; -- mtc: disable driver
|
182 |
|
|
state : state_type; -- state
|
183 |
|
|
req_clear : slbit; -- request clear
|
184 |
|
|
req_stsnd : slbit; -- request sanity timer transmit
|
185 |
|
|
req_pgsnd : slbit; -- request prog. gen. transmit
|
186 |
|
|
tcnt256 : slv8; -- usec clock divider for st clock
|
187 |
|
|
tcntsnd : slv8; -- timer for transmit delay
|
188 |
|
|
req_lock : slbit; -- cpu lock request
|
189 |
|
|
req_boot : slbit; -- cpu boot request
|
190 |
|
|
end record regs_type;
|
191 |
|
|
|
192 |
|
|
constant regs_init : regs_type := (
|
193 |
8 |
wfjm |
'0', -- ibsel
|
194 |
2 |
wfjm |
"0000", -- acr_ac
|
195 |
|
|
"0000","0000", -- pge_pbe, pge_pie
|
196 |
|
|
'0', -- pgc_grj
|
197 |
|
|
'0','0', -- pgc_pgrmr, pgc_strmr
|
198 |
|
|
'0','0', -- pgc_ie, pgc_ptp
|
199 |
|
|
"0000","0000", -- ste_sbe, ste_sie
|
200 |
|
|
(others=>'0'), -- stc_count
|
201 |
|
|
'0','0', -- stc_tmo, stc_lke
|
202 |
|
|
'0','0', -- stc_stp, stc_enb
|
203 |
|
|
"0000","0000", -- msk_bm, msk_im
|
204 |
|
|
"0000","0000", -- pgf_pbf, pgf_pif
|
205 |
|
|
"0000","0000", -- stf_sbf, stf_sif
|
206 |
|
|
"0000","0000", -- dcf_brk, dcf_dcf
|
207 |
|
|
"0000","0000", -- exc_ui, exc_rte
|
208 |
|
|
'0','0', -- mtc_mttp, mtc_mfrm
|
209 |
|
|
"00", -- mtc_mid
|
210 |
|
|
'0','0', -- mtc_dsbt, mtc_enmxd
|
211 |
|
|
'0','0', -- mtc_enmlp, mtc_dsdrv
|
212 |
|
|
s_idle, -- state
|
213 |
|
|
'0', -- req_clear
|
214 |
|
|
'0','0', -- req_stsnd, req_pgsnd
|
215 |
|
|
(others=>'0'), -- tcnt256
|
216 |
|
|
(others=>'0'), -- tcntsnd
|
217 |
|
|
'0','0' -- req_lock, req_boot
|
218 |
|
|
);
|
219 |
|
|
|
220 |
|
|
signal R_REGS : regs_type := regs_init;
|
221 |
|
|
signal N_REGS : regs_type := regs_init;
|
222 |
|
|
|
223 |
|
|
begin
|
224 |
|
|
|
225 |
|
|
proc_regs: process (CLK)
|
226 |
|
|
begin
|
227 |
13 |
wfjm |
if rising_edge(CLK) then
|
228 |
2 |
wfjm |
if BRESET = '1' or -- BRESET is 1 for system and ibus reset
|
229 |
|
|
R_REGS.req_clear='1' then
|
230 |
|
|
R_REGS <= regs_init; --
|
231 |
|
|
if RESET = '0' then -- if RESET=0 we do just an ibus reset
|
232 |
|
|
R_REGS.pgf_pbf <= N_REGS.pgf_pbf; -- don't reset pg boot flags
|
233 |
|
|
R_REGS.stf_sbf <= N_REGS.stf_sbf; -- don't reset st boot flags
|
234 |
|
|
R_REGS.tcnt256 <= N_REGS.tcnt256; -- don't reset st clock divider
|
235 |
|
|
end if;
|
236 |
8 |
wfjm |
else
|
237 |
2 |
wfjm |
R_REGS <= N_REGS;
|
238 |
|
|
end if;
|
239 |
|
|
end if;
|
240 |
|
|
end process proc_regs;
|
241 |
|
|
|
242 |
|
|
proc_next : process (R_REGS, CE_USEC, IB_MREQ, EI_ACK, EI_ACK,
|
243 |
|
|
IIST_BUS(0), IIST_BUS(1), IIST_BUS(2), IIST_BUS(3),
|
244 |
|
|
IIST_SRES)
|
245 |
|
|
variable r : regs_type := regs_init;
|
246 |
|
|
variable n : regs_type := regs_init;
|
247 |
8 |
wfjm |
variable ibhold : slbit := '0';
|
248 |
2 |
wfjm |
variable idout : slv16 := (others=>'0');
|
249 |
8 |
wfjm |
variable ibreq : slbit := '0';
|
250 |
2 |
wfjm |
variable ibrd : slbit := '0';
|
251 |
|
|
variable ibw0 : slbit := '0';
|
252 |
|
|
variable ibw1 : slbit := '0';
|
253 |
|
|
variable int_or : slbit := '0';
|
254 |
|
|
variable tcnt256_end : slbit := '0';
|
255 |
|
|
variable tcntsnd_end : slbit := '0';
|
256 |
|
|
variable eff_id : slv2 := "00";
|
257 |
|
|
variable eff_bus : iist_bus_type := iist_bus_init;
|
258 |
|
|
variable par_err : slbit := '0';
|
259 |
|
|
variable act_ibit : slbit := '0';
|
260 |
|
|
variable act_bbit : slbit := '0';
|
261 |
|
|
variable iout : iist_line_type := iist_line_init;
|
262 |
|
|
begin
|
263 |
|
|
|
264 |
|
|
r := R_REGS;
|
265 |
|
|
n := R_REGS;
|
266 |
|
|
|
267 |
8 |
wfjm |
ibhold := '0';
|
268 |
2 |
wfjm |
idout := (others=>'0');
|
269 |
8 |
wfjm |
ibreq := IB_MREQ.re or IB_MREQ.we;
|
270 |
|
|
ibrd := IB_MREQ.re;
|
271 |
2 |
wfjm |
ibw0 := IB_MREQ.we and IB_MREQ.be0;
|
272 |
|
|
ibw1 := IB_MREQ.we and IB_MREQ.be1;
|
273 |
|
|
|
274 |
|
|
int_or := r.pgc_grj or r.pgc_pgrmr or r.pgc_strmr;
|
275 |
|
|
for i in r.dcf_dcf'range loop
|
276 |
|
|
int_or := int_or or r.dcf_dcf(i) or
|
277 |
|
|
r.exc_rte(i) or
|
278 |
|
|
r.pgf_pif(i) or
|
279 |
|
|
r.stf_sif(i);
|
280 |
|
|
end loop; -- i
|
281 |
|
|
|
282 |
|
|
tcnt256_end := '0';
|
283 |
|
|
if CE_USEC='1' and r.stc_enb='1'then -- if st enabled on every usec
|
284 |
13 |
wfjm |
n.tcnt256 := slv(unsigned(r.tcnt256) + 1); -- advance 8 bit counter
|
285 |
2 |
wfjm |
if unsigned(r.tcnt256) = 255 then -- if wrap
|
286 |
|
|
tcnt256_end := '1'; -- signal 256 usec passed
|
287 |
|
|
end if;
|
288 |
|
|
end if;
|
289 |
|
|
|
290 |
|
|
tcntsnd_end := '0';
|
291 |
13 |
wfjm |
n.tcntsnd := slv(unsigned(r.tcntsnd) + 1); -- advance send timer counter
|
292 |
2 |
wfjm |
if unsigned(r.tcntsnd) = tdlysnd-1 then -- if delay time reached
|
293 |
|
|
tcntsnd_end := '1'; -- signal end
|
294 |
|
|
end if;
|
295 |
|
|
|
296 |
|
|
eff_id := SID; -- effective self-id, normally SID
|
297 |
|
|
if r.mtc_enmxd = '1' then -- if maint. mux enabled
|
298 |
|
|
eff_id := r.mtc_mid; -- use maint. id
|
299 |
|
|
end if;
|
300 |
|
|
|
301 |
|
|
eff_bus := IIST_BUS;
|
302 |
|
|
|
303 |
|
|
par_err := '0';
|
304 |
|
|
act_ibit := '0';
|
305 |
|
|
act_bbit := '0';
|
306 |
|
|
iout := iist_line_init; -- default state of out line
|
307 |
|
|
|
308 |
|
|
-- ibus address decoder
|
309 |
8 |
wfjm |
n.ibsel := '0';
|
310 |
|
|
if IB_MREQ.aval='1' and
|
311 |
2 |
wfjm |
IB_MREQ.addr(12 downto 2)=ibaddr_iist(12 downto 2) then
|
312 |
8 |
wfjm |
n.ibsel := '1';
|
313 |
2 |
wfjm |
end if;
|
314 |
|
|
|
315 |
|
|
-- internal state machine
|
316 |
|
|
case r.state is
|
317 |
|
|
when s_idle => -- idle state
|
318 |
|
|
n.tcntsnd := (others=>'0'); -- keep send delay timer zero
|
319 |
|
|
if r.req_stsnd = '1' then -- sanity timer request pending
|
320 |
|
|
n.state := s_stsnd;
|
321 |
|
|
elsif r.req_pgsnd = '1' then -- prog. gen. request pending
|
322 |
|
|
n.state := s_pgsnd;
|
323 |
|
|
end if;
|
324 |
|
|
|
325 |
|
|
when s_clear => -- handle acr clr
|
326 |
8 |
wfjm |
ibhold := r.ibsel; -- keep req pending if selected
|
327 |
2 |
wfjm |
-- r.req_clear is set when in this state and cause a reset in prog_regs
|
328 |
|
|
-- --> n.req_clear := '0';
|
329 |
|
|
-- --> n.state := s_idle;
|
330 |
|
|
|
331 |
|
|
when s_stsnd => -- handle st transmit
|
332 |
|
|
if tcntsnd_end = '1' then -- send delay expired
|
333 |
|
|
n.req_stsnd := '0'; -- clear st transmit request
|
334 |
|
|
iout.req := '1'; -- do transmit
|
335 |
|
|
iout.stf := '1'; -- signal type = st
|
336 |
|
|
iout.imask := r.ste_sie; -- int enables
|
337 |
|
|
iout.bmask := r.ste_sbe; -- boot enables
|
338 |
|
|
iout.par := not r.stc_stp; -- send parity (odd incl. stf!)
|
339 |
|
|
iout.frm := '0'; -- frame always ok
|
340 |
|
|
n.state := s_idle;
|
341 |
|
|
end if;
|
342 |
|
|
|
343 |
|
|
when s_pgsnd => -- handle pg transmit
|
344 |
|
|
if tcntsnd_end = '1' then -- send delay expired
|
345 |
|
|
n.req_pgsnd := '0'; -- clear pg transmit request
|
346 |
|
|
iout.req := '1'; -- do transmit
|
347 |
|
|
iout.stf := '0'; -- signal type = pg
|
348 |
|
|
iout.imask := r.pge_pie; -- int enables
|
349 |
|
|
iout.bmask := r.pge_pbe; -- boot enables
|
350 |
|
|
iout.par := r.pgc_ptp; -- send parity
|
351 |
|
|
iout.frm := '0'; -- frame always ok
|
352 |
|
|
n.state := s_idle;
|
353 |
|
|
end if;
|
354 |
|
|
|
355 |
|
|
when others => null;
|
356 |
|
|
end case;
|
357 |
|
|
|
358 |
|
|
if r.mtc_enmxd = '1' then -- if maintenance mux enabled
|
359 |
|
|
iout.stf := r.mtc_mttp; -- force type from mtc_mttp
|
360 |
|
|
iout.frm := r.mtc_mfrm; -- force frame from mtc_mfrm
|
361 |
|
|
end if;
|
362 |
|
|
|
363 |
|
|
-- ibus transactions
|
364 |
8 |
wfjm |
if r.ibsel = '1' and ibhold='0' then
|
365 |
2 |
wfjm |
|
366 |
|
|
if IB_MREQ.addr(1 downto 1) = "0" then -- ACR -- access control reg -----
|
367 |
|
|
|
368 |
|
|
idout(acr_ibf_sid) := SID;
|
369 |
|
|
idout(acr_ibf_ac) := r.acr_ac;
|
370 |
|
|
|
371 |
|
|
if ibw1 = '1' then
|
372 |
|
|
if IB_MREQ.din(acr_ibf_clr) = '1' then
|
373 |
|
|
n.req_clear := '1';
|
374 |
|
|
n.state := s_clear;
|
375 |
|
|
end if;
|
376 |
|
|
end if;
|
377 |
|
|
if ibw0 = '1' then
|
378 |
|
|
n.acr_ac := IB_MREQ.din(acr_ibf_ac);
|
379 |
|
|
end if;
|
380 |
|
|
|
381 |
|
|
else -- ADR -- access data reg --------
|
382 |
|
|
case r.acr_ac is
|
383 |
|
|
|
384 |
|
|
when ac_pge => -- PGE -- program gen enables --------
|
385 |
|
|
|
386 |
|
|
idout(pge_ibf_pbe) := r.pge_pbe;
|
387 |
|
|
idout(pge_ibf_pie) := r.pge_pie;
|
388 |
|
|
|
389 |
|
|
if IB_MREQ.we = '1' then
|
390 |
|
|
|
391 |
|
|
if r.req_pgsnd = '0' then -- no pg transmit pending
|
392 |
|
|
if ibw1 = '1' then
|
393 |
|
|
n.pge_pbe := IB_MREQ.din(pge_ibf_pbe);
|
394 |
|
|
end if;
|
395 |
|
|
if ibw0 = '1' then
|
396 |
|
|
n.pge_pie := IB_MREQ.din(pge_ibf_pie);
|
397 |
|
|
end if;
|
398 |
|
|
else -- if collision with pg transmit
|
399 |
|
|
n.pgc_pgrmr := '1'; -- set pge refused flag
|
400 |
|
|
end if;
|
401 |
|
|
|
402 |
|
|
end if;
|
403 |
|
|
|
404 |
|
|
when ac_pgc => -- PGC -- program gen control/status -
|
405 |
|
|
|
406 |
|
|
idout(pgc_ibf_err) := r.pgc_grj or r.pgc_pgrmr or r.pgc_strmr;
|
407 |
|
|
idout(pgc_ibf_grj) := r.pgc_grj;
|
408 |
|
|
idout(pgc_ibf_pgrmr) := r.pgc_pgrmr;
|
409 |
|
|
idout(pgc_ibf_strmr) := r.pgc_strmr;
|
410 |
|
|
idout(pgc_ibf_rdy) := not r.req_pgsnd;
|
411 |
|
|
idout(pgc_ibf_sid) := eff_id;
|
412 |
|
|
idout(pgc_ibf_ip) := int_or;
|
413 |
|
|
idout(pgc_ibf_ie) := r.pgc_ie;
|
414 |
|
|
idout(pgc_ibf_ptp) := r.pgc_ptp;
|
415 |
|
|
|
416 |
|
|
if ibw1 = '1' then
|
417 |
|
|
if IB_MREQ.din(pgc_ibf_err) = '1' then -- '1' written into ERR
|
418 |
|
|
n.pgc_grj := '0'; -- clears GRJ
|
419 |
|
|
n.pgc_pgrmr := '0'; -- clears PGRMR
|
420 |
|
|
n.pgc_strmr := '0'; -- clears STRMR
|
421 |
|
|
end if;
|
422 |
|
|
end if;
|
423 |
|
|
if ibw0 = '1' then
|
424 |
|
|
n.pgc_ie := IB_MREQ.din(pgc_ibf_ie);
|
425 |
|
|
n.pgc_ptp := IB_MREQ.din(pgc_ibf_ptp);
|
426 |
|
|
if IB_MREQ.din(pgc_ibf_go) = '1' then -- GO bit set
|
427 |
|
|
if r.req_pgsnd = '0' then -- if ready (no pgsnd pend)
|
428 |
|
|
n.req_pgsnd := '1'; -- request pgsnd
|
429 |
|
|
else -- if not ready
|
430 |
|
|
n.pgc_grj := '1'; -- set go reject flag
|
431 |
|
|
end if;
|
432 |
|
|
end if;
|
433 |
|
|
end if;
|
434 |
|
|
|
435 |
|
|
when ac_ste => -- STE -- sanity timer enables -------
|
436 |
|
|
|
437 |
|
|
idout(ste_ibf_sbe) := r.ste_sbe;
|
438 |
|
|
idout(ste_ibf_sie) := r.ste_sie;
|
439 |
|
|
|
440 |
|
|
if IB_MREQ.we = '1' then
|
441 |
|
|
|
442 |
|
|
if r.req_stsnd = '0' then -- no st transmit pending
|
443 |
|
|
if ibw1 = '1' then
|
444 |
|
|
n.ste_sbe := IB_MREQ.din(ste_ibf_sbe);
|
445 |
|
|
end if;
|
446 |
|
|
if ibw0 = '1' then
|
447 |
|
|
n.ste_sie := IB_MREQ.din(ste_ibf_sie);
|
448 |
|
|
end if;
|
449 |
|
|
|
450 |
|
|
else -- if collision with st transmit
|
451 |
|
|
n.pgc_strmr := '1'; -- set ste refused flag
|
452 |
|
|
end if;
|
453 |
|
|
|
454 |
|
|
end if;
|
455 |
|
|
|
456 |
|
|
when ac_stc => -- STC -- sanity timer control/status
|
457 |
|
|
|
458 |
|
|
idout(stc_ibf_count) := r.stc_count;
|
459 |
|
|
idout(stc_ibf_tmo) := r.stc_tmo;
|
460 |
|
|
idout(stc_ibf_lke) := r.stc_lke;
|
461 |
|
|
idout(stc_ibf_stp) := r.stc_stp;
|
462 |
|
|
idout(stc_ibf_enb) := r.stc_enb;
|
463 |
|
|
|
464 |
|
|
if ibw1 = '1' then
|
465 |
|
|
n.stc_count := IB_MREQ.din(stc_ibf_count); -- reset st count
|
466 |
|
|
n.tcnt256 := (others=>'0'); -- reset usec count
|
467 |
|
|
end if;
|
468 |
|
|
if ibw0 = '1' then
|
469 |
|
|
if IB_MREQ.din(stc_ibf_tmo) = '1' then -- 1 written into TMO
|
470 |
|
|
n.stc_tmo := '0';
|
471 |
|
|
end if;
|
472 |
|
|
n.stc_lke := IB_MREQ.din(stc_ibf_lke);
|
473 |
|
|
n.stc_stp := IB_MREQ.din(stc_ibf_stp);
|
474 |
|
|
n.stc_enb := IB_MREQ.din(stc_ibf_enb);
|
475 |
|
|
end if;
|
476 |
|
|
|
477 |
|
|
when ac_msk => -- MSK -- input masks ----------------
|
478 |
|
|
|
479 |
|
|
idout(msk_ibf_bm) := r.msk_bm;
|
480 |
|
|
idout(msk_ibf_im) := r.msk_im;
|
481 |
|
|
|
482 |
|
|
if ibw1 = '1' then
|
483 |
|
|
n.msk_bm := IB_MREQ.din(msk_ibf_bm);
|
484 |
|
|
end if;
|
485 |
|
|
if ibw0 = '1' then
|
486 |
|
|
n.msk_im := IB_MREQ.din(msk_ibf_im);
|
487 |
|
|
end if;
|
488 |
|
|
|
489 |
|
|
when ac_pgf => -- PGF -- program generated flags ----
|
490 |
|
|
|
491 |
|
|
idout(pgf_ibf_pbf) := r.pgf_pbf;
|
492 |
|
|
idout(pgf_ibf_pif) := r.pgf_pif;
|
493 |
|
|
|
494 |
|
|
if ibw1 = '1' then
|
495 |
|
|
n.pgf_pbf := r.pgf_pbf and not IB_MREQ.din(pgf_ibf_pbf);
|
496 |
|
|
end if;
|
497 |
|
|
if ibw0 = '1' then
|
498 |
|
|
n.pgf_pif := r.pgf_pif and not IB_MREQ.din(pgf_ibf_pif);
|
499 |
|
|
end if;
|
500 |
|
|
|
501 |
|
|
when ac_stf => -- STF -- sanity timer flags ---------
|
502 |
|
|
|
503 |
|
|
idout(stf_ibf_sbf) := r.stf_sbf;
|
504 |
|
|
idout(stf_ibf_sif) := r.stf_sif;
|
505 |
|
|
|
506 |
|
|
if ibw1 = '1' then
|
507 |
|
|
n.stf_sbf := r.stf_sbf and not IB_MREQ.din(stf_ibf_sbf);
|
508 |
|
|
end if;
|
509 |
|
|
if ibw0 = '1' then
|
510 |
|
|
n.stf_sif := r.stf_sif and not IB_MREQ.din(stf_ibf_sif);
|
511 |
|
|
end if;
|
512 |
|
|
|
513 |
|
|
when ac_dcf => -- DCE -- disconnect flags -----------
|
514 |
|
|
|
515 |
|
|
idout(dcf_ibf_brk) := r.dcf_brk;
|
516 |
|
|
idout(dcf_ibf_dcf) := r.dcf_dcf;
|
517 |
|
|
|
518 |
|
|
if ibw0 = '1' then
|
519 |
|
|
n.dcf_dcf := r.dcf_dcf and not IB_MREQ.din(dcf_ibf_dcf);
|
520 |
|
|
end if;
|
521 |
|
|
|
522 |
|
|
when ac_exc => -- EXC -- exceptions -----------------
|
523 |
|
|
|
524 |
|
|
idout(exc_ibf_ui) := r.exc_ui;
|
525 |
|
|
idout(exc_ibf_rte) := r.exc_rte;
|
526 |
|
|
|
527 |
|
|
if ibw1 = '1' then
|
528 |
|
|
n.exc_ui := r.exc_ui and not IB_MREQ.din(exc_ibf_ui);
|
529 |
|
|
end if;
|
530 |
|
|
if ibw0 = '1' then
|
531 |
|
|
n.exc_rte := r.exc_rte and not IB_MREQ.din(exc_ibf_rte);
|
532 |
|
|
end if;
|
533 |
|
|
|
534 |
|
|
when ac_mtc => -- MTC -- maintenance control --------
|
535 |
|
|
|
536 |
|
|
idout(mtc_ibf_mttp) := r.mtc_mttp;
|
537 |
|
|
idout(mtc_ibf_mfrm) := r.mtc_mfrm;
|
538 |
|
|
idout(mtc_ibf_mid) := r.mtc_mid;
|
539 |
|
|
idout(mtc_ibf_dsbt) := r.mtc_dsbt;
|
540 |
|
|
idout(mtc_ibf_enmxd) := r.mtc_enmxd;
|
541 |
|
|
idout(mtc_ibf_enmlp) := r.mtc_enmlp;
|
542 |
|
|
idout(mtc_ibf_dsdrv) := r.mtc_dsdrv;
|
543 |
|
|
|
544 |
|
|
if ibw1 = '1' then
|
545 |
|
|
n.mtc_mttp := IB_MREQ.din(mtc_ibf_mttp);
|
546 |
|
|
n.mtc_mfrm := IB_MREQ.din(mtc_ibf_mfrm);
|
547 |
|
|
n.mtc_mid := IB_MREQ.din(mtc_ibf_mid);
|
548 |
|
|
end if;
|
549 |
|
|
if ibw0 = '1' then
|
550 |
|
|
n.mtc_dsbt := IB_MREQ.din(mtc_ibf_dsbt);
|
551 |
|
|
n.mtc_enmxd := IB_MREQ.din(mtc_ibf_enmxd);
|
552 |
|
|
n.mtc_enmlp := IB_MREQ.din(mtc_ibf_enmlp);
|
553 |
|
|
n.mtc_dsdrv := IB_MREQ.din(mtc_ibf_dsdrv);
|
554 |
|
|
end if;
|
555 |
|
|
|
556 |
|
|
when others => -- access to undefined AC code -------
|
557 |
|
|
null;
|
558 |
|
|
|
559 |
|
|
end case;
|
560 |
|
|
|
561 |
|
|
if unsigned(r.acr_ac) <= unsigned(ac_exc) then -- if ac 0,..,10
|
562 |
8 |
wfjm |
if IB_MREQ.rmw = '0' then -- if not 1st part of rmw
|
563 |
13 |
wfjm |
n.acr_ac := slv(unsigned(r.acr_ac) + 1); -- autoincrement
|
564 |
2 |
wfjm |
end if;
|
565 |
|
|
end if;
|
566 |
|
|
|
567 |
|
|
end if;
|
568 |
|
|
|
569 |
|
|
end if;
|
570 |
|
|
|
571 |
|
|
-- sanity timer
|
572 |
|
|
|
573 |
|
|
if tcnt256_end = '1' then -- if 256 usec expired (and enabled)
|
574 |
13 |
wfjm |
n.stc_count := slv(unsigned(r.stc_count) - 1);
|
575 |
2 |
wfjm |
if unsigned(r.stc_count) = 0 then -- if sanity timer expired
|
576 |
|
|
n.stc_tmo := '1'; -- set timeout flag
|
577 |
|
|
n.req_stsnd := '1'; -- request st transmit
|
578 |
|
|
if r.stc_lke = '1' then -- if lockup enabled
|
579 |
|
|
n.req_lock := '1'; -- request lockup
|
580 |
|
|
end if;
|
581 |
|
|
end if;
|
582 |
|
|
end if;
|
583 |
|
|
|
584 |
|
|
-- process iist bus inputs
|
585 |
|
|
|
586 |
|
|
if r.mtc_enmlp = '1' then -- if mainentance loop
|
587 |
|
|
for i in eff_bus'range loop
|
588 |
|
|
eff_bus(i) := iout; -- local signal on all input ports
|
589 |
|
|
eff_bus(i).dcf := '0'; -- all ports considered connected
|
590 |
|
|
end loop; -- i
|
591 |
|
|
end if;
|
592 |
|
|
|
593 |
|
|
for i in eff_bus'range loop
|
594 |
|
|
|
595 |
|
|
par_err := eff_bus(i).stf xor
|
596 |
|
|
eff_bus(i).imask(0) xor eff_bus(i).imask(1) xor
|
597 |
|
|
eff_bus(i).imask(2) xor eff_bus(i).imask(3) xor
|
598 |
|
|
eff_bus(i).bmask(0) xor eff_bus(i).bmask(1) xor
|
599 |
|
|
eff_bus(i).bmask(2) xor eff_bus(i).bmask(3) xor
|
600 |
|
|
not eff_bus(i).par;
|
601 |
|
|
|
602 |
13 |
wfjm |
act_ibit := eff_bus(i).imask(to_integer(unsigned(eff_id)));
|
603 |
|
|
act_bbit := eff_bus(i).bmask(to_integer(unsigned(eff_id)));
|
604 |
2 |
wfjm |
|
605 |
|
|
n.dcf_brk(i) := eff_bus(i).dcf; -- trace dcf state in brk
|
606 |
|
|
|
607 |
|
|
if eff_bus(i).dcf = '1' then -- if disconnected
|
608 |
|
|
if r.msk_im(i) = '0' then -- if not disabled
|
609 |
|
|
n.dcf_dcf(i) := '1'; -- set dcf flag
|
610 |
|
|
end if;
|
611 |
|
|
|
612 |
|
|
else -- if connected
|
613 |
|
|
if eff_bus(i).req = '1' then -- request received ?
|
614 |
|
|
if eff_bus(i).frm='1' or -- frame error seen ?
|
615 |
|
|
par_err='1' then -- parity error seen ?
|
616 |
|
|
if r.msk_im(i) = '0' then -- if not disabled
|
617 |
|
|
n.exc_rte(i) := '1'; -- set rte flag
|
618 |
|
|
end if;
|
619 |
|
|
|
620 |
|
|
else -- here if valid request seen
|
621 |
|
|
if act_ibit = '1' then -- interrupt request
|
622 |
|
|
if r.msk_im(i) = '1' then -- if disabled
|
623 |
|
|
n.exc_ui(i) := '1'; -- set ui flag
|
624 |
|
|
else -- if enabled
|
625 |
|
|
n.req_lock := '0'; -- release lock
|
626 |
|
|
if eff_bus(i).stf = '0' then -- and pg request
|
627 |
|
|
n.pgf_pif(i) := '1'; -- set pif flag
|
628 |
|
|
else -- and st request
|
629 |
|
|
n.stf_sif(i) := '1'; -- set sif flag
|
630 |
|
|
end if;
|
631 |
|
|
end if;
|
632 |
|
|
end if; -- act_ibit='1'
|
633 |
|
|
|
634 |
|
|
if act_bbit = '1' then -- boot request
|
635 |
|
|
if r.msk_bm(i) = '1' then -- if msk disabled
|
636 |
|
|
n.exc_ui(i) := '1'; -- set ui flag
|
637 |
|
|
else -- if msk enabled
|
638 |
|
|
if r.mtc_dsbt = '0' then -- if mtc enabled
|
639 |
|
|
n.req_lock := '0'; -- release lock
|
640 |
|
|
n.req_boot := '1'; -- request boot
|
641 |
|
|
end if;
|
642 |
|
|
if eff_bus(i).stf = '0' then -- and pg request
|
643 |
|
|
n.pgf_pbf(i) := '1'; -- set pbf flag
|
644 |
|
|
else -- and st request
|
645 |
|
|
n.stf_sbf(i) := '1'; -- set sbf flag
|
646 |
|
|
end if;
|
647 |
|
|
end if;
|
648 |
|
|
end if; -- act_bbit='1'
|
649 |
|
|
|
650 |
|
|
end if;
|
651 |
|
|
|
652 |
|
|
end if;
|
653 |
|
|
end if;
|
654 |
|
|
end loop;
|
655 |
|
|
|
656 |
|
|
-- process cpu->iist responses
|
657 |
|
|
if IIST_SRES.ack_lock = '1' then
|
658 |
|
|
n.req_lock := '0';
|
659 |
|
|
end if;
|
660 |
|
|
if IIST_SRES.ack_boot = '1' then
|
661 |
|
|
n.req_boot := '0';
|
662 |
|
|
end if;
|
663 |
|
|
|
664 |
|
|
N_REGS <= n;
|
665 |
|
|
|
666 |
|
|
IB_SRES.dout <= idout;
|
667 |
8 |
wfjm |
IB_SRES.ack <= r.ibsel and ibreq;
|
668 |
|
|
IB_SRES.busy <= ibhold and ibreq;
|
669 |
2 |
wfjm |
|
670 |
|
|
EI_REQ <= r.pgc_ie and int_or;
|
671 |
|
|
|
672 |
|
|
if r.mtc_dsdrv = '1' then -- if driver disconnected
|
673 |
|
|
iout.dcf := '1'; -- set dcf flag
|
674 |
|
|
iout.req := '0'; -- suppress requests
|
675 |
|
|
end if;
|
676 |
|
|
IIST_OUT <= iout; -- and finally send it out...
|
677 |
|
|
|
678 |
|
|
IIST_MREQ.lock <= r.req_lock;
|
679 |
|
|
IIST_MREQ.boot <= r.req_boot;
|
680 |
|
|
|
681 |
|
|
end process proc_next;
|
682 |
|
|
|
683 |
|
|
|
684 |
|
|
end syn;
|