w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
ibdr_rl11.vhd
Go to the documentation of this file.
1-- $Id: ibdr_rl11.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2014-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: ibdr_rl11 - syn
7-- Description: ibus dev(rem): RL11
8--
9-- Dependencies: ram_1swar_gen
10-- Test bench: -
11-- Target Devices: generic
12-- Tool versions: ise 14.7; viv 2014.4-2016.1; ghdl 0.31-0.33
13--
14-- Synthesized (xst):
15-- Date Rev ise Target flop lutl lutm slic t peri
16-- 2015-02-28 653 14.7 131013 xc6slx16-2 80 197 12 80 s 7.9
17-- 2014-06-15 562 14.7 131013 xc6slx16-2 81 199 13 78 s 8.0
18--
19-- Revision History:
20-- Date Rev Version Comment
21-- 2016-05-22 767 1.0.2 don't init N_REGS (vivado fix for fsm inference)
22-- 2015-03-04 655 1.0.1 seek: ignore da(6:5), don't check for 0 anymore
23-- 2015-02-28 653 1.0 Initial verison
24-- 2014-06-09 561 0.1 First draft
25------------------------------------------------------------------------------
26
27library ieee;
28use ieee.std_logic_1164.all;
29use ieee.numeric_std.all;
30
31use work.slvtypes.all;
32use work.memlib.all;
33use work.iblib.all;
34
35-- ----------------------------------------------------------------------------
36entity ibdr_rl11 is -- ibus dev(rem): RL11
37 -- fixed address: 174400
38 port (
39 CLK : in slbit; -- clock
40 CE_MSEC : in slbit; -- msec pulse
41 BRESET : in slbit; -- ibus reset
42 RB_LAM : out slbit; -- remote attention
43 IB_MREQ : in ib_mreq_type; -- ibus request
44 IB_SRES : out ib_sres_type; -- ibus response
45 EI_REQ : out slbit; -- interrupt request
46 EI_ACK : in slbit -- interrupt acknowledge
47 );
48end ibdr_rl11;
49
50architecture syn of ibdr_rl11 is
51
52 constant ibaddr_rl11 : slv16 := slv(to_unsigned(8#174400#,16));
53
54 constant ibaddr_rlcs : slv2 := "00"; -- rlcs address offset
55 constant ibaddr_rlba : slv2 := "01"; -- rlba address offset
56 constant ibaddr_rlda : slv2 := "10"; -- rlda address offset
57 constant ibaddr_rlmp : slv2 := "11"; -- rlmp address offset
58
59 -- usage of 16x16 memory bank
60 -- 0 0000 unused (but mirrors rlcs)
61 -- 1 0001 rlba
62 -- 2 0010 unused (but mirrors rlda)
63 -- 3 0011 rlmp (1st value)
64 -- 4 0100 rlmp (3rd value after gs; the crc)
65 -- 5 0101 unused
66 -- 6 0110 unused
67 -- 7 0111 unused (target for bad mprem states)
68 -- 11: 8 10-- sta(ds) (drive status)
69 -- 15:12 11-- pos(ds) (drive disk address)
70 constant imem_cs : slv4 := "0000"; -- unused
71 constant imem_ba : slv4 := "0001";
72 constant imem_da : slv4 := "0010"; -- unused
73 constant imem_mp : slv4 := "0011";
74 constant imem_crc : slv4 := "0100";
75 constant imem_bad : slv4 := "0111"; -- target for bad mprem states
76 constant imem_sta : slv4 := "1000";
77 constant imem_pos : slv4 := "1100";
78
79 subtype imf_typ is integer range 3 downto 2;
80 subtype imf_ds is integer range 1 downto 0;
81
82 constant rlcs_ibf_err : integer := 15;
83 constant rlcs_ibf_de : integer := 14;
84 subtype rlcs_ibf_e is integer range 13 downto 10;
85 subtype rlcs_ibf_ds is integer range 9 downto 8;
86 constant rlcs_ibf_crdy : integer := 7;
87 constant rlcs_ibf_ie : integer := 6;
88 subtype rlcs_ibf_bae is integer range 5 downto 4;
89 subtype rlcs_ibf_func is integer range 3 downto 1;
90 constant rlcs_ibf_drdy : integer := 0;
91
92 constant func_noop : slv3 := "000"; -- func: noop
93 constant func_wchk : slv3 := "001"; -- func: write check
94 constant func_gs : slv3 := "010"; -- func: get status
95 constant func_seek : slv3 := "011"; -- func: seek
96 constant func_rhdr : slv3 := "100"; -- func: read header
97 constant func_write : slv3 := "101"; -- func: write data
98 constant func_read : slv3 := "110"; -- func: read data
99 constant func_rnhc : slv3 := "111"; -- func: read data without header check
100
101 constant e_ok : slv4 := "0000"; -- e code: ok
102 constant e_incomp : slv4 := "0001"; -- e code: operation incomplete
103
104 -- defs for rem access of rlcs; func codes
105 constant rfunc_wcs : slv3 := "001"; -- rem func: write cs (err,de,e,drdy)
106 constant rfunc_wmp : slv3 := "010"; -- rem func: write mprem or mploc
107
108 -- rlcs usage or rem func=wmp
109 subtype rlcs_ibf_mprem is integer range 15 downto 11;
110 subtype rlcs_ibf_mploc is integer range 10 downto 8;
111 constant rlcs_ibf_ena_mprem : integer := 5;
112 constant rlcs_ibf_ena_mploc : integer := 4;
113
114 subtype rlda_ibf_seek_df is integer range 15 downto 7;
115 constant rlda_ibf_seek_hs : integer := 4;
116 constant rlda_ibf_seek_dir : integer := 2;
117 constant rlda_msk_seek : slv16 := "0000000000001011";
118 constant rlda_val_seek : slv16 := "0000000000000001";
119
120 constant rlda_ibf_gs_rst : integer := 3;
121 constant rlda_msk_gs : slv16 := "0000000011110111";
122 constant rlda_val_gs : slv16 := "0000000000000011";
123
124 constant sta_ibf_wde : integer := 15; -- Write data error - always 0
125 constant sta_ibf_che : integer := 14; -- Current head error - always 0
126 constant sta_ibf_wl : integer := 13; -- Write lock - used
127 constant sta_ibf_sto : integer := 12; -- Seek time out - used
128 constant sta_ibf_spe : integer := 11; -- Spin error - used
129 constant sta_ibf_wge : integer := 10; -- Write gate error - used
130 constant sta_ibf_vce : integer := 9; -- Volume check - used
131 constant sta_ibf_dse : integer := 8; -- Drive select error - used
132 constant sta_ibf_dt : integer := 7; -- Drive type - used
133 constant sta_ibf_hs : integer := 6; -- Head select - used
134 constant sta_ibf_co : integer := 5; -- Cover open - used
135 constant sta_ibf_ho : integer := 4; -- Heads out - used
136 constant sta_ibf_bh : integer := 3; -- Brush home - always 1
137 subtype sta_ibf_st is integer range 2 downto 0; -- Drive state
138
139 constant st_load : slv3 := "000"; -- st: Load(ing) cartidge - used
140 constant st_spin : slv3 := "001"; -- st: Spin(ing) up - !unused!
141 constant st_brush : slv3 := "010"; -- st: Brush(ing) cycle - !unused!
142 constant st_hload : slv3 := "011"; -- st: Load(ing) heads - !unused!
143 constant st_seek : slv3 := "100"; -- st: Seek(ing) - may be used
144 constant st_lock : slv3 := "101"; -- st: Lock(ed) on - used
145 constant st_unl : slv3 := "110"; -- st: Unload(ing) heads - !unused!
146 constant st_down : slv3 := "111"; -- st: Spin(ing) down - !unused!
147 -- only two mayor drive states are used
148 -- on: st=lock; ho=1; co=0; ( file connected in backend)
149 -- off: st=load; ho=0; co=1; (no file connected in backend)
150
151 subtype pos_ibf_ca is integer range 15 downto 7;
152 constant pos_ibf_hs : integer := 6;
153 subtype pos_ibf_sa is integer range 5 downto 0;
154
155 constant mploc_mp : slv3 := "000"; -- return imem(mp)
156 constant mploc_sta : slv3 := "001"; -- return sta(ds)
157 constant mploc_pos : slv3 := "010"; -- return pos(ds)
158 constant mploc_zero : slv3 := "011"; -- return 0
159 constant mploc_crc : slv3 := "100"; -- return imem(crc)
160
161 constant mprem_f_map : integer := 4; -- mprem map enable
162 subtype mprem_f_addr is integer range 3 downto 0;
163 constant mprem_f_seq : integer := 3; -- mprem seq enable
164 subtype mprem_f_state is integer range 2 downto 0;
165 constant mprem_mapseq : slv2 := "11"; -- enable map + seq
166 constant mprem_s_mp : slv3 := "000"; -- access imem(mp)
167 constant mprem_s_sta : slv3 := "001"; -- access sta(ds)
168 constant mprem_s_pos : slv3 := "010"; -- access pos(ds)
169 constant mprem_init : slv5 := "10000"; -- enable map,fix, show mp
170
171 constant ca_max_rl01 : slv9 := "011111111"; -- max cylinder for RL01 (255)
172 constant ca_max_rl02 : slv9 := "111111111"; -- max cylinder for RL02 (511)
173
174 type state_type is (
175 s_idle, -- idle: handle ibus
176 s_csread, -- csread: handle cs read
177 s_gs_rpos, -- gs_rpos: read pos(ds)
178 s_gs_sta, -- gs_sta: handle status
179 s_seek_rsta, -- seek_rsta: read sta(ds)
180 s_seek_rpos, -- seek_rpos: read pos(ds)
181 s_seek_clip, -- seek_clip: clip new ca
182 s_seek_wpos, -- seek_wpos: write pos(ds)
183 s_init -- init: handle init
184 );
185
186 type regs_type is record -- state registers
187 ibsel : slbit; -- ibus select
188 state : state_type; -- state
189 iaddr : slv4; -- init addr counter
190 cserr : slbit; -- rlcs: composite error
191 csde : slbit; -- rlcs: drive error
192 cse : slv4; -- rlcs: error
193 csds : slv2; -- rlcs: drive select
194 cscrdy : slbit; -- rlcs: controller ready
195 csie : slbit; -- rlcs: interrupt enable
196 csbae : slv2; -- rlcs: bus address extenstion
197 csfunc : slv3; -- rlcs: function code
198 csdrdy : slbit; -- rlcs: drive ready
199 da : slv16; -- rlda shadow reg
200 gshs : slbit; -- gs: pos(ds)(hs) (head select)
201 seekdt : slbit; -- seek: drive type: 0=RL01, 1=RL02
202 seekcan: slv10; -- seek: cylinder address, new
203 seekcac: slv9; -- seek: cylinder address, clipped
204 ireq : slbit; -- interrupt request flag
205 mploc : slv3; -- mp loc state
206 mprem : slv5; -- mp rem state
207 crdone : slbit; -- control reset done since last fdone
208 end record regs_type;
209
210 constant regs_init : regs_type := (
211 '0', -- ibsel
212 s_init, -- state
213 imem_ba, -- iaddr
214 '0','0', -- cserr,csde
215 (others=>'0'), -- cse
216 (others=>'0'), -- csds
217 '1','0', -- cscrdy, csie
218 (others=>'0'), -- csbae
219 (others=>'0'), -- csfunc
220 '0', -- csdrdy
221 (others=>'0'), -- da
222 '0', -- gshs
223 '0', -- seekdt
224 (others=>'0'), -- seekcan
225 (others=>'0'), -- seekcac
226 '0', -- ireq
227 mploc_mp, -- mploc
228 mprem_init, -- mprem
229 '1' -- crdone
230 );
231
233 signal N_REGS : regs_type; -- don't init (vivado fix for fsm infer)
234
235 signal MEM_1_WE : slbit := '0';
236 signal MEM_0_WE : slbit := '0';
237 signal MEM_ADDR : slv4 := (others=>'0');
238 signal MEM_DIN : slv16 := (others=>'0');
239 signal MEM_DOUT : slv16 := (others=>'0');
240
241begin
242
243 MEM_1 : ram_1swar_gen
244 generic map (
245 AWIDTH => 4,
246 DWIDTH => 8)
247 port map (
248 CLK => CLK,
249 WE => MEM_1_WE,
250 ADDR => MEM_ADDR,
251 DI => MEM_DIN(ibf_byte1),
252 DO => MEM_DOUT(ibf_byte1));
253
254 MEM_0 : ram_1swar_gen
255 generic map (
256 AWIDTH => 4,
257 DWIDTH => 8)
258 port map (
259 CLK => CLK,
260 WE => MEM_0_WE,
261 ADDR => MEM_ADDR,
262 DI => MEM_DIN(ibf_byte0),
263 DO => MEM_DOUT(ibf_byte0));
264
265 proc_regs: process (CLK)
266 begin
267 if rising_edge(CLK) then
268 if BRESET='1' then
269 R_REGS <= regs_init;
270 else
271 R_REGS <= N_REGS;
272 end if;
273 end if;
274 end process proc_regs;
275
276 proc_next : process (R_REGS, IB_MREQ, MEM_DOUT, EI_ACK)
277 variable r : regs_type := regs_init;
278 variable n : regs_type := regs_init;
279 variable ibhold : slbit := '0';
280 variable idout : slv16 := (others=>'0');
281 variable ibrem : slbit := '0';
282 variable ibreq : slbit := '0';
283 variable ibrd : slbit := '0';
284 variable ibw0 : slbit := '0';
285 variable ibw1 : slbit := '0';
286 variable ibwrem : slbit := '0';
287 variable ilam : slbit := '0';
288 variable iei_req : slbit := '0';
289
290 variable imem_we0 : slbit := '0';
291 variable imem_we1 : slbit := '0';
292 variable imem_addr : slv4 := (others=>'0');
293 variable imem_din : slv16 := (others=>'0');
294 begin
295
296 r := R_REGS;
297 n := R_REGS;
298
299 ibhold := '0';
300 idout := (others=>'0');
301 ibrem := IB_MREQ.racc;
302 ibreq := IB_MREQ.re or IB_MREQ.we;
303 ibrd := IB_MREQ.re;
304 ibw0 := IB_MREQ.we and IB_MREQ.be0;
305 ibw1 := IB_MREQ.we and IB_MREQ.be1;
306 ibwrem := IB_MREQ.we and ibrem;
307 ilam := '0';
308 iei_req := '0';
309
310 imem_we0 := '0';
311 imem_we1 := '0';
312 imem_addr := "00" & IB_MREQ.addr(2 downto 1);
313 imem_din := IB_MREQ.din;
314
315 -- ibus address decoder
316 n.ibsel := '0';
317 if IB_MREQ.aval = '1' and
318 IB_MREQ.addr(12 downto 3)=ibaddr_rl11(12 downto 3) then
319 n.ibsel := '1';
320 end if;
321
322 -- internal state machine
323 case r.state is
324 when s_idle => -- idle: handle ibus -----------------
325
326 if r.ibsel='1' then -- selected
327 idout := MEM_DOUT;
328 imem_we0 := ibw0;
329 imem_we1 := ibw1;
330
331 case IB_MREQ.addr(2 downto 1) is
332
333 when ibaddr_rlcs => -- RLCS - control register -------
334 imem_we0 := '0'; -- MEM not used for rlcs
335 imem_we1 := '0';
336 imem_addr := imem_sta(imf_typ) & r.csds; -- get sta(ds)
337
338 -- determine DRDY
339 n.csdrdy := '1';
340 if MEM_DOUT(sta_ibf_st) /= st_lock or -- drive not on and locked
341 MEM_DOUT(sta_ibf_vce) = '1' then -- or volume check
342 -- ??? also CRDY=0 here ???
343 n.csdrdy := '0';
344 end if;
345
346 -- determine DE and ERR
347 n.cserr := '0';
348 if MEM_DOUT(sta_ibf_st) = st_load or -- drive off
349 MEM_DOUT(sta_ibf_vce) = '1' then -- or volume check
350 n.csde := '1';
351 n.cserr := '1';
352 end if;
353 if r.csde = '1' or r.cse /= e_ok then
354 n.cserr := '1';
355 end if;
356
357 if ibrd = '1' then -- cs read
358 ibhold := '1';
359 n.state := s_csread;
360
361 elsif IB_MREQ.we = '1' then -- cs write
362
363 if ibrem = '0' then -- loc write access
364
365 if IB_MREQ.be1 = '1' then
366 if r.cscrdy = '1' then -- freeze csds when busy
367 n.csds := IB_MREQ.din(rlcs_ibf_ds);
368 end if;
369 end if;
370
371 if IB_MREQ.be0 = '1' then
372 n.csie := IB_MREQ.din(rlcs_ibf_ie);
373 n.csbae := IB_MREQ.din(rlcs_ibf_bae);
374
375 if r.cscrdy = '1' then -- controller ready
376
377 n.csfunc := IB_MREQ.din(rlcs_ibf_func); -- latch func
378 if IB_MREQ.din(rlcs_ibf_crdy) = '1' then -- no crdy clr
379 if IB_MREQ.din(rlcs_ibf_ie) = '1' and r.csie = '0' then
380 n.ireq := '1';
381 end if;
382 else -- crdy clr --> handle func
383
384 n.cserr := '0'; -- clear errors
385 n.csde := '0';
386 n.cse := "0000";
387
388 case IB_MREQ.din(rlcs_ibf_func) is
389 when func_noop => -- noop -------
390 n.ireq := r.csie; -- interrupt
391
392 when func_gs => -- get status -
393 if (r.da and rlda_msk_gs) /= rlda_val_gs then
394 n.cserr := '1';
395 n.cse := e_incomp;
396 n.ireq := IB_MREQ.din(rlcs_ibf_ie);
397 else
398 ibhold := '1';
399 n.state := s_gs_rpos;
400 end if;
401
402 when func_seek => -- seek -------
403 if (r.da and rlda_msk_seek) /= rlda_val_seek then
404 n.cserr := '1';
405 n.cse := e_incomp;
406 n.ireq := IB_MREQ.din(rlcs_ibf_ie);
407 else
408 ibhold := '1';
409 n.state := s_seek_rsta;
410 end if;
411
412 when others => -- all other funcs
413 n.cscrdy := '0'; -- signal cntl busy
414 ilam := '1'; -- issue lam
415 end case;
416
417 end if; -- else IB_MREQ.din(rlcs_ibf_crdy) = '1'
418 end if; -- r.cscrdy = '1'
419 end if; -- IB_MREQ.be0 = '1'
420
421 else -- rem write access
422 case IB_MREQ.din(rlcs_ibf_func) is
423
424 when rfunc_wcs =>
425 n.csde := IB_MREQ.din(rlcs_ibf_de);
426 n.cse := IB_MREQ.din(rlcs_ibf_e);
427 n.cscrdy := IB_MREQ.din(rlcs_ibf_crdy);
428 n.csbae := IB_MREQ.din(rlcs_ibf_bae);
429 if r.cscrdy = '0' and IB_MREQ.din(rlcs_ibf_crdy) = '1' then
430 n.ireq := r.csie;
431 end if;
432
433 when rfunc_wmp =>
434 if IB_MREQ.din(rlcs_ibf_ena_mprem) = '1' then
435 n.mprem := IB_MREQ.din(rlcs_ibf_mprem);
436 end if;
437 if IB_MREQ.din(rlcs_ibf_ena_mploc) = '1' then
438 n.mploc := IB_MREQ.din(rlcs_ibf_mploc);
439 end if;
440
441 when others => null;
442 end case;
443
444 end if;
445 end if;
446
447 when ibaddr_rlba => -- RLBA - bus address register ---
448 imem_din(0) := '0'; -- lsb forced 0
449 null;
450
451 when ibaddr_rlda => -- RLDA - disk address register --
452 if ibw1 = '1' then
453 n.da(15 downto 8) := IB_MREQ.din(15 downto 8);
454 end if;
455 if ibw0 = '1' then
456 n.da( 7 downto 0) := IB_MREQ.din( 7 downto 0);
457 end if;
458
459 when ibaddr_rlmp => -- RLMP - multipurpose register --
460
461 if ibrem = '0' then -- loc access
462 if ibrd = '1' then -- loc mp read
463 case r.mploc is
464 when mploc_mp => -- return imem(mp)
465 null;
466 when mploc_sta => -- return sta(ds)
467 imem_addr := imem_sta(imf_typ) & r.csds;
468 when mploc_pos => -- return pos(ds)
469 imem_addr := imem_pos(imf_typ) & r.csds;
470 n.mploc := mploc_zero;
471 when mploc_zero => -- return 0
472 idout := (others => '0');
473 n.mploc := mploc_crc;
474 when mploc_crc => -- return imem(crc)
475 imem_addr := imem_crc;
476 when others => null;
477 end case;
478 elsif IB_MREQ.we = '1' then -- loc mp write
479 n.mploc := mploc_mp; -- use main mp reg in future
480 end if;
481
482 else -- rem access
483 if r.mprem(mprem_f_map) = '0' then -- map off - fixed addr
484 imem_addr := r.mprem(mprem_f_addr);
485 else -- sequence
486 case r.mprem(mprem_f_state) is
487 when mprem_s_mp => -- mp {used as wc}
488 imem_addr := imem_mp;
489 if r.mprem(mprem_f_seq) = '1' then -- ??? check re&we !!!
490 n.mprem := mprem_mapseq & mprem_s_sta;
491 end if;
492 when mprem_s_sta => -- sta(ds)
493 imem_addr := imem_sta(imf_typ) & r.csds;
494 if r.mprem(mprem_f_seq) = '1' then -- ??? check re&we !!!
495 n.mprem := mprem_mapseq & mprem_s_pos;
496 end if;
497 when mprem_s_pos => -- pos(ds)
498 imem_addr := imem_pos(imf_typ) & r.csds;
499 when others => -- bad state
500 imem_addr := imem_bad;
501
502 end case;
503 end if;
504 end if;
505
506 when others => null;
507
508 end case;
509
510 end if;
511
512 when s_csread => -- csread: handle cs read -----------
513 idout(rlcs_ibf_err) := r.cserr;
514 idout(rlcs_ibf_de) := r.csde;
515 idout(rlcs_ibf_e) := r.cse;
516 idout(rlcs_ibf_ds) := r.csds;
517 idout(rlcs_ibf_crdy) := r.cscrdy;
518 idout(rlcs_ibf_ie) := r.csie;
519 idout(rlcs_ibf_bae) := r.csbae;
520 idout(rlcs_ibf_func) := r.csfunc;
521 idout(rlcs_ibf_drdy) := r.csdrdy;
522 n.state := s_idle;
523
524 when s_gs_rpos => -- gs_rpos: read pos(ds) -----------
525 imem_addr := imem_pos(imf_typ) & r.csds; -- get pos(ds)
526 n.gshs := MEM_DOUT(pos_ibf_hs); -- get hs bit
527 ibhold := r.ibsel;
528 n.state := s_gs_sta;
529
530 when s_gs_sta => -- gs_sta: handle status -----------
531 imem_addr := imem_sta(imf_typ) & r.csds; -- get sta(ds)
532 imem_we0 := '1'; -- always update
533 imem_we1 := '1';
534 imem_din := MEM_DOUT;
535 imem_din(sta_ibf_hs) := r.gshs;
536 if r.da(rlda_ibf_gs_rst) = '1' then -- if RST set
537 imem_din(sta_ibf_wde) := '0'; -- clear error bits
538 imem_din(sta_ibf_che) := '0';
539 imem_din(sta_ibf_sto) := '0';
540 imem_din(sta_ibf_spe) := '0';
541 imem_din(sta_ibf_wge) := '0';
542 imem_din(sta_ibf_vce) := '0';
543 imem_din(sta_ibf_dse) := '0';
544 end if;
545 n.mploc := mploc_sta; -- use sta(ds) as mp
546 n.ireq := r.csie; -- interrupt
547 n.state := s_idle;
548
549 when s_seek_rsta => -- seek_rsta: read sta(ds) -----------
550 imem_addr := imem_sta(imf_typ) & r.csds; -- get sta(ds)
551 n.seekdt := MEM_DOUT(sta_ibf_dt);
552 imem_din := MEM_DOUT;
553 if MEM_DOUT(sta_ibf_st) /= st_lock then -- drive off
554 imem_we0 := '1'; -- update sta
555 imem_we1 := '1';
556 imem_din(sta_ibf_sto) := '1'; -- set STO (seek time out)
557 n.cse := e_incomp;
558 n.ireq := r.csie; -- interrupt
559 n.state := s_idle;
560 else -- drive on
561 ibhold := r.ibsel;
562 n.state := s_seek_rpos;
563 end if;
564
565 when s_seek_rpos => -- seek_rpos: read pos(ds) -----------
566 imem_addr := imem_pos(imf_typ) & r.csds; -- get pos(ds)
567 if r.da(rlda_ibf_seek_dir) = '1' then
568 n.seekcan := slv(unsigned('0' & MEM_DOUT(pos_ibf_ca)) +
569 unsigned('0' & r.da(rlda_ibf_seek_df)) );
570 else
571 n.seekcan := slv(unsigned('0' & MEM_DOUT(pos_ibf_ca)) -
572 unsigned('0' & r.da(rlda_ibf_seek_df)) );
573 end if;
574 ibhold := r.ibsel;
575 n.state := s_seek_clip;
576
577 when s_seek_clip => -- seek_clip: clip new ca ------------
578 n.seekcac := r.seekcan(8 downto 0);
579 -- new ca overflowed ? for RL02 (9) and for RL01 (9:8) must be "00"
580 if r.seekcan(9) = '1' or
581 (r.seekdt = '0' and r.seekcan(8) = '1') then
582 if r.da(rlda_ibf_seek_dir) = '1' then -- outward seek
583 if r.seekdt = '1' then -- is RL02
584 n.seekcac := ca_max_rl02; -- clip to RL02 max ca
585 else -- is RL01
586 n.seekcac := ca_max_rl01; -- clip to RL01 max ca
587 end if;
588 else -- inward seek
589 n.seekcac := "000000000"; -- clip to 0
590 end if;
591 end if;
592 ibhold := r.ibsel;
593 n.state := s_seek_wpos;
594
595 when s_seek_wpos => -- seek_wpos: write pos(ds) ----------
596 imem_addr := imem_pos(imf_typ) & r.csds; -- get pos(ds)
597 imem_we0 := '1';
598 imem_we1 := '1';
599 imem_din := MEM_DOUT;
600 imem_din(pos_ibf_ca) := r.seekcac;
601 imem_din(pos_ibf_hs) := r.da(rlda_ibf_seek_hs);
602 n.ireq := r.csie; -- interrupt
603 n.state := s_idle;
604
605 when s_init => -- init: handle init -----------------
606 ibhold := r.ibsel; -- hold ibus when controller busy
607 imem_addr := r.iaddr;
608 imem_din := (others=>'0');
609 imem_we0 := '1';
610 imem_we1 := '1';
611 if r.iaddr(imf_typ) = imem_sta(imf_typ) then -- if sta(x)
612 imem_din := MEM_DOUT; -- keep state
613 imem_din(sta_ibf_wde) := '0'; -- and clear err
614 imem_din(sta_ibf_che) := '0';
615 imem_din(sta_ibf_sto) := '0';
616 imem_din(sta_ibf_spe) := '0';
617 imem_din(sta_ibf_wge) := '0';
618 imem_din(sta_ibf_vce) := '0';
619 imem_din(sta_ibf_dse) := '0';
620 end if;
621 n.iaddr := slv(unsigned(r.iaddr) + 1);
622 if unsigned(r.iaddr) = unsigned(imem_sta)+3 then -- stop after sta(3)
623 n.state := s_idle;
624 end if;
625
626 when others => null;
627 end case;
628
629 iei_req := r.ireq; -- ??? simplify, use r.ireq directly
630
631 if EI_ACK = '1' or r.csie = '0' then -- interrupt executed or ie disabled
632 n.ireq := '0'; -- cancel request
633 end if;
634
635 N_REGS <= n;
636
637 MEM_0_WE <= imem_we0;
638 MEM_1_WE <= imem_we1;
639 MEM_ADDR <= imem_addr;
640 MEM_DIN <= imem_din;
641
642 IB_SRES.dout <= idout;
643 IB_SRES.ack <= r.ibsel and ibreq;
644 IB_SRES.busy <= ibhold and ibreq;
645
646 RB_LAM <= ilam;
647 EI_REQ <= iei_req;
648
649 end process proc_next;
650
651
652end syn;
integer := 6 pos_ibf_hs
Definition: ibdr_rl11.vhd:152
slv16 := slv( to_unsigned( 8#174400#, 16) ) ibaddr_rl11
Definition: ibdr_rl11.vhd:52
slv3 := "101" st_lock
Definition: ibdr_rl11.vhd:144
slv4 := "0100" imem_crc
Definition: ibdr_rl11.vhd:74
integer := 10 sta_ibf_wge
Definition: ibdr_rl11.vhd:129
slv3 := "000" mprem_s_mp
Definition: ibdr_rl11.vhd:166
slv16 :=( others => '0') MEM_DOUT
Definition: ibdr_rl11.vhd:239
integer range 5 downto 4 rlcs_ibf_bae
Definition: ibdr_rl11.vhd:88
slv3 := "100" mploc_crc
Definition: ibdr_rl11.vhd:159
slv9 := "111111111" ca_max_rl02
Definition: ibdr_rl11.vhd:172
integer range 3 downto 0 mprem_f_addr
Definition: ibdr_rl11.vhd:162
slv2 := "11" mprem_mapseq
Definition: ibdr_rl11.vhd:165
slv3 := "010" st_brush
Definition: ibdr_rl11.vhd:141
integer range 2 downto 0 sta_ibf_st
Definition: ibdr_rl11.vhd:137
integer := 7 rlcs_ibf_crdy
Definition: ibdr_rl11.vhd:86
slv3 := "100" st_seek
Definition: ibdr_rl11.vhd:143
slv16 := "0000000000000011" rlda_val_gs
Definition: ibdr_rl11.vhd:122
integer := 3 rlda_ibf_gs_rst
Definition: ibdr_rl11.vhd:120
integer := 7 sta_ibf_dt
Definition: ibdr_rl11.vhd:132
slv3 := "110" func_read
Definition: ibdr_rl11.vhd:98
integer := 4 rlda_ibf_seek_hs
Definition: ibdr_rl11.vhd:115
integer := 12 sta_ibf_sto
Definition: ibdr_rl11.vhd:127
slv3 := "001" mploc_sta
Definition: ibdr_rl11.vhd:156
slv9 := "011111111" ca_max_rl01
Definition: ibdr_rl11.vhd:171
integer := 6 sta_ibf_hs
Definition: ibdr_rl11.vhd:133
integer range 1 downto 0 imf_ds
Definition: ibdr_rl11.vhd:80
slv3 := "000" func_noop
Definition: ibdr_rl11.vhd:92
slv3 := "111" st_down
Definition: ibdr_rl11.vhd:146
slv16 :=( others => '0') MEM_DIN
Definition: ibdr_rl11.vhd:238
integer := 3 mprem_f_seq
Definition: ibdr_rl11.vhd:163
slv4 := "0010" imem_da
Definition: ibdr_rl11.vhd:72
slv3 := "011" st_hload
Definition: ibdr_rl11.vhd:142
slv4 := "0001" e_incomp
Definition: ibdr_rl11.vhd:102
integer := 6 rlcs_ibf_ie
Definition: ibdr_rl11.vhd:87
slv2 := "00" ibaddr_rlcs
Definition: ibdr_rl11.vhd:54
integer := 14 sta_ibf_che
Definition: ibdr_rl11.vhd:125
integer := 4 rlcs_ibf_ena_mploc
Definition: ibdr_rl11.vhd:112
slv4 := "0000" imem_cs
Definition: ibdr_rl11.vhd:70
slv5 := "10000" mprem_init
Definition: ibdr_rl11.vhd:169
integer range 3 downto 1 rlcs_ibf_func
Definition: ibdr_rl11.vhd:89
slv3 := "010" func_gs
Definition: ibdr_rl11.vhd:94
slv16 := "0000000000000001" rlda_val_seek
Definition: ibdr_rl11.vhd:118
slv3 := "001" st_spin
Definition: ibdr_rl11.vhd:140
integer := 15 rlcs_ibf_err
Definition: ibdr_rl11.vhd:82
slv16 := "0000000000001011" rlda_msk_seek
Definition: ibdr_rl11.vhd:117
slv3 := "000" st_load
Definition: ibdr_rl11.vhd:139
slv4 :=( others => '0') MEM_ADDR
Definition: ibdr_rl11.vhd:237
slv4 := "1100" imem_pos
Definition: ibdr_rl11.vhd:77
integer := 8 sta_ibf_dse
Definition: ibdr_rl11.vhd:131
integer := 2 rlda_ibf_seek_dir
Definition: ibdr_rl11.vhd:116
slv3 := "010" rfunc_wmp
Definition: ibdr_rl11.vhd:106
integer := 5 rlcs_ibf_ena_mprem
Definition: ibdr_rl11.vhd:111
integer := 4 mprem_f_map
Definition: ibdr_rl11.vhd:161
integer := 13 sta_ibf_wl
Definition: ibdr_rl11.vhd:126
slv4 := "0001" imem_ba
Definition: ibdr_rl11.vhd:71
slv3 := "001" mprem_s_sta
Definition: ibdr_rl11.vhd:167
slv16 := "0000000011110111" rlda_msk_gs
Definition: ibdr_rl11.vhd:121
integer range 15 downto 7 pos_ibf_ca
Definition: ibdr_rl11.vhd:151
slv4 := "0011" imem_mp
Definition: ibdr_rl11.vhd:73
slv3 := "011" mploc_zero
Definition: ibdr_rl11.vhd:158
slbit := '0' MEM_0_WE
Definition: ibdr_rl11.vhd:236
slv3 := "100" func_rhdr
Definition: ibdr_rl11.vhd:96
slv2 := "01" ibaddr_rlba
Definition: ibdr_rl11.vhd:55
(s_idle,s_csread,s_gs_rpos,s_gs_sta,s_seek_rsta,s_seek_rpos,s_seek_clip,s_seek_wpos,s_init) state_type
Definition: ibdr_rl11.vhd:174
regs_type := regs_init R_REGS
Definition: ibdr_rl11.vhd:232
integer range 10 downto 8 rlcs_ibf_mploc
Definition: ibdr_rl11.vhd:110
integer := 9 sta_ibf_vce
Definition: ibdr_rl11.vhd:130
integer := 15 sta_ibf_wde
Definition: ibdr_rl11.vhd:124
integer range 3 downto 2 imf_typ
Definition: ibdr_rl11.vhd:79
slv4 := "0111" imem_bad
Definition: ibdr_rl11.vhd:75
slv3 := "011" func_seek
Definition: ibdr_rl11.vhd:95
slv4 := "0000" e_ok
Definition: ibdr_rl11.vhd:101
regs_type :=( '0', s_init, imem_ba, '0', '0',( others => '0'),( others => '0'), '1', '0',( others => '0'),( others => '0'), '0',( others => '0'), '0', '0',( others => '0'),( others => '0'), '0', mploc_mp, mprem_init, '1') regs_init
Definition: ibdr_rl11.vhd:210
integer range 9 downto 8 rlcs_ibf_ds
Definition: ibdr_rl11.vhd:85
integer := 5 sta_ibf_co
Definition: ibdr_rl11.vhd:134
regs_type N_REGS
Definition: ibdr_rl11.vhd:233
integer range 5 downto 0 pos_ibf_sa
Definition: ibdr_rl11.vhd:153
slv3 := "001" rfunc_wcs
Definition: ibdr_rl11.vhd:105
slv3 := "000" mploc_mp
Definition: ibdr_rl11.vhd:155
integer := 4 sta_ibf_ho
Definition: ibdr_rl11.vhd:135
slv3 := "001" func_wchk
Definition: ibdr_rl11.vhd:93
slv3 := "010" mprem_s_pos
Definition: ibdr_rl11.vhd:168
slbit := '0' MEM_1_WE
Definition: ibdr_rl11.vhd:235
slv3 := "111" func_rnhc
Definition: ibdr_rl11.vhd:99
integer := 3 sta_ibf_bh
Definition: ibdr_rl11.vhd:136
integer := 0 rlcs_ibf_drdy
Definition: ibdr_rl11.vhd:90
integer range 13 downto 10 rlcs_ibf_e
Definition: ibdr_rl11.vhd:84
slv3 := "010" mploc_pos
Definition: ibdr_rl11.vhd:157
slv4 := "1000" imem_sta
Definition: ibdr_rl11.vhd:76
integer range 15 downto 11 rlcs_ibf_mprem
Definition: ibdr_rl11.vhd:109
slv3 := "110" st_unl
Definition: ibdr_rl11.vhd:145
slv2 := "10" ibaddr_rlda
Definition: ibdr_rl11.vhd:56
integer := 11 sta_ibf_spe
Definition: ibdr_rl11.vhd:128
integer range 2 downto 0 mprem_f_state
Definition: ibdr_rl11.vhd:164
integer range 15 downto 7 rlda_ibf_seek_df
Definition: ibdr_rl11.vhd:114
integer := 14 rlcs_ibf_de
Definition: ibdr_rl11.vhd:83
slv2 := "11" ibaddr_rlmp
Definition: ibdr_rl11.vhd:57
slv3 := "101" func_write
Definition: ibdr_rl11.vhd:97
out EI_REQ slbit
Definition: ibdr_rl11.vhd:45
in BRESET slbit
Definition: ibdr_rl11.vhd:41
out RB_LAM slbit
Definition: ibdr_rl11.vhd:42
in CLK slbit
Definition: ibdr_rl11.vhd:39
in IB_MREQ ib_mreq_type
Definition: ibdr_rl11.vhd:43
out IB_SRES ib_sres_type
Definition: ibdr_rl11.vhd:44
in EI_ACK slbit
Definition: ibdr_rl11.vhd:47
in CE_MSEC slbit
Definition: ibdr_rl11.vhd:40
Definition: iblib.vhd:33
in ADDR slv( AWIDTH- 1 downto 0)
out DO slv( DWIDTH- 1 downto 0)
AWIDTH positive := 4
in DI slv( DWIDTH- 1 downto 0)
in CLK slbit
in WE slbit
DWIDTH positive := 16
std_logic_vector( 9 downto 0) slv10
Definition: slvtypes.vhd:42
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 4 downto 0) slv5
Definition: slvtypes.vhd:37
std_logic_vector( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic_vector( 8 downto 0) slv9
Definition: slvtypes.vhd:41
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31