w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
pdp11_vmbox.vhd
Go to the documentation of this file.
1-- $Id: pdp11_vmbox.vhd 1349 2023-01-11 14:52:42Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2006-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: pdp11_vmbox - syn
7-- Description: pdp11: virtual memory
8--
9-- Dependencies: pdp11_mmu
10-- pdp11_ubmap
11-- ibus/ib_sres_or_4
12-- ibus/ib_sres_or_2
13-- ibus/ib_sel
14--
15-- Test bench: tb/tb_pdp11_core (implicit)
16-- Target Devices: generic
17-- Tool versions: ise 8.2-14.7; viv 2014.4-2022.1; ghdl 0.18-2.0.0
18--
19-- Revision History:
20-- Date Rev Version Comment
21-- 2022-01-11 1349 1.6.11 use err_ser to indicate fatal stack error
22-- 2022-12-17 1331 1.6.10 BUGFIX: request mmu trap also on ib accesses
23-- 2022-11-21 1320 1.6.9 rename some rsv->ser; remove obsolete trap_done;
24-- 2022-11-18 1317 1.6.8 BUGFIX: correct red/yellow zone boundary
25-- 2019-06-22 1170 1.6.7 support membe for em cacc access
26-- 2016-05-22 767 1.6.6 don't init N_REGS (vivado fix for fsm inference)
27-- 2015-07-03 697 1.6.5 much wider DM_STAT_VM
28-- 2015-04-04 662 1.6.4 atowidth now 6 (was 5) to support ibdr_rprm reset
29-- 2011-11-18 427 1.6.3 now numeric_std clean
30-- 2010-10-23 335 1.6.2 add r.paddr_iopage, use ib_sel
31-- 2010-10-22 334 1.6.1 deassert ibus be's at end-cycle; fix rmw logic
32-- 2010-10-17 333 1.6 implement ibus V2 interface
33-- 2010-06-27 310 1.5 redo ibus driver logic, now ibus driven from flops
34-- 2010-06-20 307 1.4.2 rename cpacc to cacc in vm_cntl_type, mmu_cntl_type
35-- 2010-06-18 306 1.4.1 for cpacc: set cacc in ib_mreq, forward racc,be
36-- from CP_ADDR; now all ibr handling via vmbox
37-- 2010-06-13 305 1.4 rename CPADDR -> CP_ADDR
38-- 2009-06-01 221 1.3.8 add dip signal in ib_mreq (set in s_ib)
39-- 2009-05-30 220 1.3.7 final removal of snoopers (were already commented)
40-- 2009-05-01 211 1.3.6 BUGFIX: add 177776 stack protect (SCCE)
41-- 2008-08-22 161 1.3.5 rename pdp11_ibres_ -> ib_sres_, ubf_ -> ibf_
42-- 2008-04-25 138 1.3.4 add BRESET port, clear stklim with BRESET
43-- 2008-04-20 137 1.3.3 add DM_STAT_VM port
44-- 2008-03-19 127 1.3.2 ignore ack state when waiting on a busy IB in s_ib
45-- 2008-03-02 121 1.3.1 remove snoopers
46-- 2008-02-24 119 1.3 revamp paddr generation; add _ubmap
47-- 2008-02-23 118 1.2.1 use sys_conf_mem_losize
48-- 2008-02-17 117 1.2 use em_(mreq|sres) interface for external memory
49-- 2008-01-26 114 1.1.4 rename 'ubus' to 'ib' (proper name of intbus now)
50-- 2008-01-05 110 1.1.3 update snooper.
51-- rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
52-- 2008-01-01 109 1.1.2 Use IB_SRES_(CPU|EXT); use r./n. coding style, move
53-- all status into regs_type. add intbus HOLD support.
54-- 2007-12-30 108 1.1.1 use ubf_byte[01]
55-- 2007-12-30 107 1.1 Use IB_MREQ/IB_SRES interface now; remove DMA port
56-- 2007-09-16 83 1.0.2 Use ram_1swsr_wfirst_gen, not ram_2swsr_wfirst_gen
57-- 2nd port was unused, connected ADDR caused slow net
58-- 2007-06-14 56 1.0.1 Use slvtypes.all
59-- 2007-05-12 26 1.0 Initial version
60------------------------------------------------------------------------------
61
62library ieee;
63use ieee.std_logic_1164.all;
64use ieee.numeric_std.all;
65
66use work.slvtypes.all;
67use work.iblib.all;
68use work.pdp11.all;
69use work.sys_conf.all;
70
71-- ----------------------------------------------------------------------------
72
73entity pdp11_vmbox is -- virtual memory
74 port (
75 CLK : in slbit; -- clock
76 GRESET : in slbit; -- general reset
77 CRESET : in slbit; -- cpu reset
78 BRESET : in slbit; -- bus reset
79 CP_ADDR : in cp_addr_type; -- console port address
80 VM_CNTL : in vm_cntl_type; -- vm control port
81 VM_ADDR : in slv16; -- vm address
82 VM_DIN : in slv16; -- vm data in
83 VM_STAT : out vm_stat_type; -- vm status port
84 VM_DOUT : out slv16; -- vm data out
85 EM_MREQ : out em_mreq_type; -- external memory: request
86 EM_SRES : in em_sres_type; -- external memory: response
87 MMU_MONI : in mmu_moni_type; -- mmu monitor port
88 IB_MREQ_M : out ib_mreq_type; -- ibus request (master)
89 IB_SRES_CPU : in ib_sres_type; -- ibus response (CPU registers)
90 IB_SRES_EXT : in ib_sres_type; -- ibus response (external devices)
91 DM_STAT_VM : out dm_stat_vm_type -- debug and monitor status
92 );
93end pdp11_vmbox;
94
95architecture syn of pdp11_vmbox is
96
97 constant ibaddr_slim : slv16 := slv(to_unsigned(8#177774#,16));
98 constant atowidth : natural := 6; -- size of access timeout counter
99 -- ! rbus tout must be > ibus tout !
100 -- ! ensure all BTOWIDTH > atowidth !
101
102 type state_type is (
103 s_idle, -- s_idle: wait for vm_cntl request
104 s_mem_w, -- s_mem_w: check mmu, wait for memory
105 s_ib_w, -- s_ib_w: wait for ibus
106 s_ib_wend, -- s_ib_wend: ibus write completion
107 s_ib_rend, -- s_ib_rend: ibus read completion
108 s_idle_mw_ib, -- s_idle_mw_ib: wait macc write (ibus)
109 s_idle_mw_mem, -- s_idle_mw_mem: wait macc write (mem)
110 s_mem_mw_w, -- s_mem_mw_w: wait for memory (macc)
111 s_fail, -- s_fail: vmbox fatal error catcher
112 s_errrsv, -- s_errrsv: red stack violation
113 s_errib -- s_errib: ibus error handler
114 );
115
116 type regs_type is record -- state registers
117 state : state_type; -- state
118 wacc : slbit; -- write access
119 macc : slbit; -- modify access (r-m-w sequence)
120 cacc : slbit; -- console access
121 bytop : slbit; -- byte operation
122 kstack : slbit; -- access through kernel stack
123 ysv : slbit; -- yellow stack violation detected
124 vaok : slbit; -- virtual address valid (from MMU)
125 trap_mmu : slbit; -- mmu trap requested
126 mdin : slv16; -- data input (memory order)
127 paddr : slv22; -- physical address register
128 paddr_iopage : slv9; -- iopage base (upper 9 bits of paddr)
129 atocnt : slv(atowidth-1 downto 0); -- access timeout counter
130 ibre : slbit; -- ibus re signal
131 ibwe : slbit; -- ibus we signal
132 ibbe : slv2; -- ibus be0,be1 signals
133 ibrmw : slbit; -- ibus rmw signal
134 ibcacc : slbit; -- ibus cacc signal
135 ibracc : slbit; -- ibus racc signal
136 ibdout : slv16; -- ibus dout register
137 end record regs_type;
138
139 constant atocnt_init : slv(atowidth-1 downto 0) := (others=>'1');
140 constant regs_init : regs_type := (
141 s_idle, -- state
142 '0','0','0','0', -- wacc,macc,cacc,bytop
143 '0','0','0','0', -- kstack,ysv,vaok,trap_mmu
144 (others=>'0'), -- mdin
145 (others=>'0'), -- paddr
146 (others=>'0'), -- paddr_iopage
147 atocnt_init, -- atocnt
148 '0','0',"00", -- ibre,ibwe,ibbe
149 '0','0','0', -- ibrmw,ibcacc,ibracc
150 (others=>'0') -- ibdout
151 );
152
154 signal N_REGS : regs_type; -- don't init (vivado fix for fsm infer)
155
156 signal R_SLIM : slv8 := (others=>'0'); -- stack limit register
157
158 signal MMU_CNTL : mmu_cntl_type := mmu_cntl_init;
159 signal MMU_STAT : mmu_stat_type := mmu_stat_init;
160 signal PADDRH : slv16 := (others=>'0');
161
162 signal IBSEL_SLIM :slbit := '0'; -- select stack limit reg
163 signal IB_SRES_SLIM : ib_sres_type := ib_sres_init;
164 signal IB_SRES_MMU : ib_sres_type := ib_sres_init;
165 signal IB_SRES_UBMAP : ib_sres_type := ib_sres_init;
166
167 signal UBMAP_MREQ : slbit := '0';
168 signal UBMAP_ADDR_PM : slv22_1 := (others=>'0');
169
170 signal VM_STAT_L : vm_stat_type := vm_stat_init; -- vm status (local)
171 signal VM_DOUT_L : slv16 := (others=>'0'); -- vm data out (local)
172
173 signal IB_MREQ : ib_mreq_type := ib_mreq_init; -- ibus request (local)
174 signal IB_SRES : ib_sres_type := ib_sres_init; -- ibus response (local)
175 signal IB_SRES_INT : ib_sres_type := ib_sres_init; -- ibus response (cpu)
176
177 signal EM_MREQ_L : em_mreq_type := em_mreq_init; -- ext mem: request (local)
178
179begin
180
181 MMU : pdp11_mmu
182 port map (
183 CLK => CLK,
184 CRESET => CRESET,
185 BRESET => BRESET,
186 CNTL => MMU_CNTL,
187 VADDR => VM_ADDR,
188 MONI => MMU_MONI,
189 STAT => MMU_STAT,
190 PADDRH => PADDRH,
191 IB_MREQ => IB_MREQ,
193 );
194
195 UBMAP : pdp11_ubmap
196 port map (
197 CLK => CLK,
198 MREQ => UBMAP_MREQ,
199 ADDR_UB => CP_ADDR.addr(17 downto 1),
201 IB_MREQ => IB_MREQ,
203 );
204
205 SRES_OR_INT : ib_sres_or_4
206 port map (
212 );
213
214 SRES_OR_ALL : ib_sres_or_2
215 port map (
219 );
220
221 SEL : ib_sel
222 generic map (
224 port map (
225 CLK => CLK,
226 IB_MREQ => IB_MREQ,
227 SEL => IBSEL_SLIM
228 );
229
230 proc_ibres : process (IBSEL_SLIM, IB_MREQ, R_SLIM)
231 variable idout : slv16 := (others=>'0');
232 begin
233 idout := (others=>'0');
234 if IBSEL_SLIM = '1' then
235 idout(ibf_byte1) := R_SLIM;
236 end if;
237 IB_SRES_SLIM.dout <= idout;
238 IB_SRES_SLIM.ack <= IBSEL_SLIM and (IB_MREQ.re or IB_MREQ.we); -- ack all
239 IB_SRES_SLIM.busy <= '0';
240 end process proc_ibres;
241
242 proc_slim: process (CLK)
243 begin
244 if rising_edge(CLK) then
245 if BRESET = '1' then
246 R_SLIM <= (others=>'0');
247 elsif IBSEL_SLIM='1' and IB_MREQ.we='1' then
248 if IB_MREQ.be1 = '1' then
249 R_SLIM <= IB_MREQ.din(ibf_byte1);
250 end if;
251 end if;
252 end if;
253 end process proc_slim;
254
255 proc_regs: process (CLK)
256 begin
257 if rising_edge(CLK) then
258 if GRESET = '1' then
259 R_REGS <= regs_init;
260 else
261 R_REGS <= N_REGS;
262 end if;
263 end if;
264 end process proc_regs;
265
266 proc_next: process (R_REGS, R_SLIM, CP_ADDR, VM_CNTL, VM_DIN, VM_ADDR,
269
270 variable r : regs_type := regs_init;
271 variable n : regs_type := regs_init;
272
273 variable ivm_stat : vm_stat_type := vm_stat_init;
274 variable ivm_dout : slv16 := (others=>'0');
275 variable iem_mreq : em_mreq_type := em_mreq_init;
276 variable immu_cntl : mmu_cntl_type := mmu_cntl_init;
277
278 variable ipaddr : slv22 := (others=>'0');
279 variable ipaddr_iopage : slv9 := (others=>'0');
280
281 variable iib_aval : slbit := '0';
282
283 variable ato_go : slbit := '0';
284 variable ato_end : slbit := '0';
285
286 variable is_stackyellow : slbit := '1'; -- VM_ADDR in yellow stack zone
287 variable is_stackred : slbit := '1'; -- VM_ADDR in red stack zone
288
289 variable iubmap_mreq : slbit := '0';
290 variable paddr_mmu : slbit := '0';
291 variable paddr_sel : slv2 := "00";
292 constant c_paddr_sel_vmaddr: slv2 := "00";
293 constant c_paddr_sel_rpaddr: slv2 := "01";
294 constant c_paddr_sel_cacc: slv2 := "10";
295 constant c_paddr_sel_ubmap: slv2 := "11";
296
297
298 begin
299
300 r := R_REGS;
301 n := R_REGS;
302
303 n.state := s_fail;
304
305 ivm_stat := vm_stat_init;
306 ivm_dout := EM_SRES.dout;
307 immu_cntl := mmu_cntl_init;
308
309 iib_aval := '0';
310
311 iem_mreq := em_mreq_init;
312 iem_mreq.din := VM_DIN;
313
314 if VM_CNTL.cacc = '1' then -- if cacc access
315 iem_mreq.be := CP_ADDR.be; -- use membe setup
316 elsif VM_CNTL.bytop = '0' then -- if word access
317 iem_mreq.be := "11"; -- both be's
318 else
319 if VM_ADDR(0) = '0' then -- if low byte
320 iem_mreq.be := "01";
321 else -- if high byte
322 iem_mreq.be := "10";
323 iem_mreq.din(ibf_byte1) := VM_DIN(ibf_byte0);
324 end if;
325 end if;
326
327 iubmap_mreq :='0';
328
329 paddr_mmu := '1'; -- ipaddr selector, used in s_idle
330 -- and overwritten in s_idle_mw_mem
331 paddr_sel := "00";
332 if MMU_STAT.ena_mmu='0' or VM_CNTL.cacc='1' then
333 paddr_mmu := '0';
334 paddr_sel := c_paddr_sel_vmaddr;
335 if VM_CNTL.cacc = '1' then
336 if CP_ADDR.ena_ubmap='1' and MMU_STAT.ena_ubmap='1' then
337 paddr_sel := c_paddr_sel_ubmap;
338 else
339 paddr_sel := c_paddr_sel_cacc;
340 end if;
341 end if;
342 end if;
343
344 -- the iopage base is determined based on mmu regs and request type
345 -- r.paddr_iopage is updated during s_idle. This way the iopage base
346 -- address is determined in parallel to paddr and latched at end of s_idle.
347 -- Note: is VM_CNTL.cacc here, the status in s_idle is relevant !
348
349 ipaddr_iopage := "111111111"; -- iopage match pattern (for 22 bit)
350 if VM_CNTL.cacc = '1' then
351 if CP_ADDR.ena_22bit = '0' then
352 ipaddr_iopage := "000000111"; -- 16 bit cacc
353 end if;
354 else
355 if MMU_STAT.ena_mmu = '0' then
356 ipaddr_iopage := "000000111"; -- 16 bit mode
357 else
358 if MMU_STAT.ena_22bit = '0' then
359 ipaddr_iopage := "000011111"; -- 18 bit mode
360 end if;
361 end if;
362 end if;
363
364 ato_go := '0'; -- default: keep access timeout in reset
365 ato_end := '0';
366 if unsigned(r.atocnt) = 0 then -- if access timeout count at zero
367 ato_end := '1'; -- signal expiration
368 end if;
369
370 is_stackyellow := '0';
371 is_stackred := '0';
372 if unsigned(VM_ADDR(15 downto 8)) <= unsigned(R_SLIM) then
373 if unsigned(VM_ADDR(15 downto 8)) = unsigned(R_SLIM) and
374 unsigned(VM_ADDR(7 downto 5)) = 7 then
375 is_stackyellow := '1';
376 else
377 is_stackred := '1';
378 end if;
379 end if;
380
381 if VM_ADDR(15 downto 1) = "111111111111111" then -- PSW protection
382 is_stackred := '1';
383 end if;
384
385 immu_cntl.wacc := VM_CNTL.wacc;
386 immu_cntl.macc := VM_CNTL.macc;
387 immu_cntl.cacc := VM_CNTL.cacc;
388 immu_cntl.dspace := VM_CNTL.dspace;
389 immu_cntl.mode := VM_CNTL.mode;
390
391 case r.state is
392 when s_idle => -- s_idle: wait for vm_cntl request --
393 n.state := s_idle;
394 iubmap_mreq := '1'; -- activate ubmap always in s_idle
395
396 if VM_CNTL.req = '1' then
397 n.wacc := VM_CNTL.wacc;
398 n.macc := VM_CNTL.macc;
399 n.cacc := VM_CNTL.cacc;
400 n.bytop := VM_CNTL.bytop;
401 n.kstack := VM_CNTL.kstack;
402 n.ysv := '0';
403 n.vaok := MMU_STAT.vaok;
404 n.trap_mmu := MMU_STAT.trap;
405 n.mdin := iem_mreq.din;
406 -- n.paddr assignment handled separately in 'if state=s_idle' at the
407 -- end.
408
409 immu_cntl.req := '1';
410
411 if VM_CNTL.wacc='1' and VM_CNTL.macc='1' then
412 n.state := s_fail;
413
414 elsif VM_CNTL.kstack='1' and VM_CNTL.vecser='0' and
415 is_stackred='1' then
416 n.state := s_errrsv;
417
418 else
419 iem_mreq.req := '1';
420 iem_mreq.we := VM_CNTL.wacc;
421 if VM_CNTL.kstack='1' and VM_CNTL.vecser='0' then
422 n.ysv := is_stackyellow;
423 end if;
424 n.state := s_mem_w;
425 end if;
426 end if;
427
428 when s_mem_w => -- s_mem_w: check mmu, wait for memory
429
430 if r.bytop='0' and r.paddr(0)='1' then -- odd address ?
431 ivm_stat.err := '1';
432 ivm_stat.err_odd := '1';
433 ivm_stat.err_ser := r.kstack; -- escalate to ser if kstack
434 iem_mreq.cancel := '1'; -- cancel pending mem request
435 n.state := s_idle;
436
437 elsif r.vaok = '0' then -- MMU abort ?
438 ivm_stat.err := '1';
439 ivm_stat.err_mmu := '1';
440 ivm_stat.err_ser := r.kstack; -- escalate to ser if kstack
441 iem_mreq.cancel := '1'; -- cancel pending mem request
442 n.state := s_idle;
443
444 else
445 if r.paddr(21 downto 13) = r.paddr_iopage then
446 -- I/O page decoded
447 iem_mreq.cancel := '1'; -- cancel pending mem request
448 iib_aval := '1'; -- declare ibus addr valid
449 n.ibre := not r.wacc;
450 n.ibwe := r.wacc;
451 n.ibcacc := r.cacc;
452 n.ibracc := r.cacc and CP_ADDR.racc;
453 n.ibbe := "11";
454 if r.cacc = '1' then -- console access ?
455 n.ibbe := CP_ADDR.be;
456 else -- cpu access ?
457 if r.bytop = '1' then
458 if r.paddr(0) = '0' then
459 n.ibbe(1) := '0';
460 else
461 n.ibbe(0) := '0';
462 end if;
463 end if;
464 end if;
465 n.ibrmw := r.macc;
466 n.state := s_ib_w;
467
468 else
469 if unsigned(r.paddr(21 downto 6)) > sys_conf_mem_losize then
470 ivm_stat.err := '1';
471 ivm_stat.err_nxm := '1';
472 ivm_stat.err_ser := r.kstack; -- escalate to ser if kstack
473 iem_mreq.cancel := '1'; -- cancel pending mem request
474 n.state := s_idle;
475
476 else
477
478 if EM_SRES.ack_r='1' or EM_SRES.ack_w='1' then
479 ivm_stat.ack := '1';
480 if r.macc='1' and r.wacc='0' then
481 n.state := s_idle_mw_mem;
482 else
483 n.state := s_idle;
484 end if;
485 else
486 n.state := s_mem_w; -- keep waiting
487 end if;
488
489 end if;
490 end if;
491 end if;
492
493 when s_ib_w => -- s_ib_w: wait for ibus -------------
494 ato_go := '1'; -- activate timeout counter
495
496 iib_aval := '1'; -- declare ibus addr valid
497
498 n.ibre := '0'; -- end cycle, unless busy seen
499 n.ibwe := '0';
500 n.ibrmw := '0';
501 n.ibbe := "00";
502 n.ibcacc := '0';
503 n.ibracc := '0';
504
505 if IB_SRES.ack='1' and IB_SRES.busy='0' then -- ibus cycle finished
506 if r.wacc = '1' then
507 n.state := s_ib_wend;
508 else
509 if r.macc = '1' then -- if first part of rmw
510 n.ibrmw := r.macc; -- keep rmw
511 n.ibbe := r.ibbe; -- keep be's
512 n.ibcacc := r.ibcacc;
513 n.ibracc := r.ibracc;
514 end if;
515 n.ibdout := IB_SRES.dout;
516 n.state := s_ib_rend;
517 end if;
518 elsif IB_SRES.busy='1' and ato_end='0' then
519 n.ibre := r.ibre; -- continue ibus cycle
520 n.ibwe := r.ibwe;
521 n.ibrmw := r.ibrmw;
522 n.ibbe := r.ibbe;
523 n.ibcacc := r.ibcacc;
524 n.ibracc := r.ibracc;
525 n.state := s_ib_w;
526 else
527 n.state := s_errib;
528 end if;
529
530 when s_ib_wend => -- s_ib_wend: ibus write completion --
531 ivm_stat.ack := '1';
532 n.state := s_idle;
533
534 when s_ib_rend => -- s_ib_rend: ibus read completion ---
535 ivm_stat.ack := '1';
536 ivm_dout := r.ibdout;
537 if r.macc='1' then -- first part of read-mod-write
538 iib_aval := '1'; -- keep ibus addr valid
539 n.state := s_idle_mw_ib;
540 else
541 n.state := s_idle;
542 end if;
543
544 when s_idle_mw_ib => -- s_idle_mw_ib: wait macc write (ibus)
545 n.state := s_idle_mw_ib;
546 iib_aval := '1'; -- keep ibus addr valid
547 if r.ibbe = "10" then
548 iem_mreq.din(ibf_byte1) := VM_DIN(ibf_byte0);
549 end if;
550 if VM_CNTL.req = '1' then
551 n.wacc := VM_CNTL.wacc;
552 n.macc := VM_CNTL.macc;
553 n.mdin := iem_mreq.din;
554 if VM_CNTL.wacc='0' or VM_CNTL.macc='0' then
555 n.state := s_fail;
556 else
557 n.ibwe := '1'; -- Note: all other ibus drivers
558 -- already set in 1st part
559 n.state := s_ib_w;
560 end if;
561 end if;
562
563 when s_idle_mw_mem => -- s_idle_mw_mem: wait macc write (mem)
564 n.state := s_idle_mw_mem;
565
566 paddr_mmu := '0';
567 paddr_sel := c_paddr_sel_rpaddr;
568
569 if VM_CNTL.bytop = '0' then -- if word access
570 iem_mreq.be := "11"; -- both be's
571 else
572 if r.paddr(0) = '0' then -- if low byte
573 iem_mreq.be := "01";
574 else -- if high byte
575 iem_mreq.be := "10";
576 iem_mreq.din(ibf_byte1) := VM_DIN(ibf_byte0);
577 end if;
578 end if;
579
580 if VM_CNTL.req = '1' then
581 n.wacc := VM_CNTL.wacc;
582 n.macc := VM_CNTL.macc;
583 n.bytop := VM_CNTL.bytop;
584 n.mdin := iem_mreq.din;
585
586 if VM_CNTL.wacc='0' or VM_CNTL.macc='0' then
587 n.state := s_fail;
588 else
589 iem_mreq.req := '1';
590 iem_mreq.we := '1';
591 n.state := s_mem_mw_w;
592 end if;
593 end if;
594
595 when s_mem_mw_w => -- s_mem_mw_w: wait for memory (macc)
596 if EM_SRES.ack_w = '1' then
597 ivm_stat.ack := '1';
598 n.state := s_idle;
599 else
600 n.state := s_mem_mw_w; -- keep waiting
601 end if;
602
603 when s_fail => -- s_fail: vmbox fatal error catcher
604 ivm_stat.fail := '1';
605 n.state := s_idle;
606
607 when s_errrsv => -- s_errrsv: red stack violation -----
608 ivm_stat.err := '1';
609 ivm_stat.err_rsv := '1';
610 ivm_stat.err_ser := '1'; -- an rsv is always a ser
611 n.state := s_idle;
612
613 when s_errib => -- s_errib: ibus error handler -------
614 ivm_stat.err := '1';
615 ivm_stat.err_iobto := '1';
616 ivm_stat.err_ser := r.kstack; -- escalate to ser if kstack
617 n.state := s_idle;
618
619 when others => null;
620 end case;
621
622 if r.bytop='1' and r.paddr(0)='1' then
623 ivm_dout(ibf_byte0) := ivm_dout(ibf_byte1);
624 end if;
625
626 if ato_go = '0' then -- handle access timeout counter
627 n.atocnt := atocnt_init; -- if ato_go=0, keep in reset
628 else
629 n.atocnt := slv(unsigned(r.atocnt) - 1);-- otherwise count down
630 end if;
631
632 ipaddr := (others=>'0');
633 if paddr_mmu = '1' then
634 ipaddr( 5 downto 0) := VM_ADDR(5 downto 0);
635 ipaddr(21 downto 6) := PADDRH;
636 if MMU_STAT.ena_22bit = '0' then
637 ipaddr(21 downto 18) := (others=>'0');
638 end if;
639 else
640 case paddr_sel is
641 when c_paddr_sel_vmaddr =>
642 ipaddr(15 downto 0) := VM_ADDR(15 downto 0);
643 when c_paddr_sel_rpaddr =>
644 ipaddr := r.paddr;
645 when c_paddr_sel_cacc =>
646 ipaddr := CP_ADDR.addr & '0';
647 if CP_ADDR.ena_22bit = '0' then
648 ipaddr(21 downto 16) := (others=>'0');
649 end if;
650 when c_paddr_sel_ubmap =>
651 ipaddr := UBMAP_ADDR_PM & '0';
652 when others => null;
653 end case;
654 end if;
655
656 if r.state = s_idle then
657 n.paddr := ipaddr;
658 n.paddr_iopage := ipaddr_iopage;
659 end if;
660
661 ivm_stat.trap_ysv := r.ysv; -- request ysv trap if condition seen
662 ivm_stat.trap_mmu := r.trap_mmu; -- forward mmu trap request
663
664 iem_mreq.addr := ipaddr(21 downto 1);
665
666 N_REGS <= n;
667
668 UBMAP_MREQ <= iubmap_mreq;
669
670 IB_MREQ.aval <= iib_aval;
671 IB_MREQ.re <= r.ibre;
672 IB_MREQ.we <= r.ibwe;
673 IB_MREQ.be0 <= r.ibbe(0);
674 IB_MREQ.be1 <= r.ibbe(1);
675 IB_MREQ.rmw <= r.ibrmw;
676 IB_MREQ.cacc <= r.ibcacc;
677 IB_MREQ.racc <= r.ibracc;
678 IB_MREQ.addr <= r.paddr(12 downto 1);
679 IB_MREQ.din <= r.mdin;
680
681 VM_STAT_L <= ivm_stat;
682 VM_DOUT_L <= ivm_dout;
683 MMU_CNTL <= immu_cntl;
684
685 EM_MREQ_L <= iem_mreq;
686
687 end process proc_next;
688
691 IB_MREQ_M <= IB_MREQ; -- external drive master port
693
694 DM_STAT_VM.vmcntl <= VM_CNTL;
695 DM_STAT_VM.vmaddr <= VM_ADDR;
696 DM_STAT_VM.vmdin <= VM_DIN;
697 DM_STAT_VM.vmstat <= VM_STAT_L;
698 DM_STAT_VM.vmdout <= VM_DOUT_L;
699 DM_STAT_VM.ibmreq <= IB_MREQ;
700 DM_STAT_VM.ibsres <= IB_SRES;
701 DM_STAT_VM.emmreq <= EM_MREQ_L;
702 DM_STAT_VM.emsres <= EM_SRES;
703
704end syn;
out SEL slbit
Definition: ib_sel.vhd:35
IB_ADDR slv16
Definition: ib_sel.vhd:29
in CLK slbit
Definition: ib_sel.vhd:32
in IB_MREQ ib_mreq_type
Definition: ib_sel.vhd:33
in IB_SRES_2 ib_sres_type := ib_sres_init
out IB_SRES_OR ib_sres_type
in IB_SRES_1 ib_sres_type
in IB_SRES_2 ib_sres_type := ib_sres_init
in IB_SRES_3 ib_sres_type := ib_sres_init
out IB_SRES_OR ib_sres_type
in IB_SRES_4 ib_sres_type := ib_sres_init
in IB_SRES_1 ib_sres_type
Definition: iblib.vhd:33
out PADDRH slv16
Definition: pdp11_mmu.vhd:66
in VADDR slv16
Definition: pdp11_mmu.vhd:63
in BRESET slbit
Definition: pdp11_mmu.vhd:61
out STAT mmu_stat_type
Definition: pdp11_mmu.vhd:65
in MONI mmu_moni_type
Definition: pdp11_mmu.vhd:64
in CLK slbit
Definition: pdp11_mmu.vhd:59
in CRESET slbit
Definition: pdp11_mmu.vhd:60
in IB_MREQ ib_mreq_type
Definition: pdp11_mmu.vhd:67
in CNTL mmu_cntl_type
Definition: pdp11_mmu.vhd:62
out IB_SRES ib_sres_type
Definition: pdp11_mmu.vhd:69
out ADDR_PM slv22_1
Definition: pdp11_ubmap.vhd:40
in CLK slbit
Definition: pdp11_ubmap.vhd:37
in ADDR_UB slv18_1
Definition: pdp11_ubmap.vhd:39
in MREQ slbit
Definition: pdp11_ubmap.vhd:38
in IB_MREQ ib_mreq_type
Definition: pdp11_ubmap.vhd:41
out IB_SRES ib_sres_type
Definition: pdp11_ubmap.vhd:43
slbit := '0' IBSEL_SLIM
slv16 := slv( to_unsigned( 8#177774#, 16) ) ibaddr_slim
Definition: pdp11_vmbox.vhd:97
vm_stat_type := vm_stat_init VM_STAT_L
ib_mreq_type := ib_mreq_init IB_MREQ
ib_sres_type := ib_sres_init IB_SRES_UBMAP
ib_sres_type := ib_sres_init IB_SRES_SLIM
mmu_cntl_type := mmu_cntl_init MMU_CNTL
regs_type := regs_init R_REGS
ib_sres_type := ib_sres_init IB_SRES_MMU
em_mreq_type := em_mreq_init EM_MREQ_L
regs_type N_REGS
slv16 :=( others => '0') VM_DOUT_L
slv16 :=( others => '0') PADDRH
slv8 :=( others => '0') R_SLIM
mmu_stat_type := mmu_stat_init MMU_STAT
regs_type :=( s_idle, '0', '0', '0', '0', '0', '0', '0', '0',( others => '0'),( others => '0'),( others => '0'), atocnt_init, '0', '0', "00", '0', '0', '0',( others => '0')) regs_init
natural := 6 atowidth
Definition: pdp11_vmbox.vhd:98
ib_sres_type := ib_sres_init IB_SRES
slv22_1 :=( others => '0') UBMAP_ADDR_PM
(s_idle,s_mem_w,s_ib_w,s_ib_wend,s_ib_rend,s_idle_mw_ib,s_idle_mw_mem,s_mem_mw_w,s_fail,s_errrsv,s_errib) state_type
ib_sres_type := ib_sres_init IB_SRES_INT
slbit := '0' UBMAP_MREQ
slv( atowidth- 1 downto 0) :=( others => '1') atocnt_init
in BRESET slbit
Definition: pdp11_vmbox.vhd:78
out VM_STAT vm_stat_type
Definition: pdp11_vmbox.vhd:83
in MMU_MONI mmu_moni_type
Definition: pdp11_vmbox.vhd:87
in CP_ADDR cp_addr_type
Definition: pdp11_vmbox.vhd:79
in IB_SRES_EXT ib_sres_type
Definition: pdp11_vmbox.vhd:90
in GRESET slbit
Definition: pdp11_vmbox.vhd:76
in CLK slbit
Definition: pdp11_vmbox.vhd:75
in EM_SRES em_sres_type
Definition: pdp11_vmbox.vhd:86
in CRESET slbit
Definition: pdp11_vmbox.vhd:77
out IB_MREQ_M ib_mreq_type
Definition: pdp11_vmbox.vhd:88
out VM_DOUT slv16
Definition: pdp11_vmbox.vhd:84
in VM_CNTL vm_cntl_type
Definition: pdp11_vmbox.vhd:80
out DM_STAT_VM dm_stat_vm_type
Definition: pdp11_vmbox.vhd:92
in VM_DIN slv16
Definition: pdp11_vmbox.vhd:82
in VM_ADDR slv16
Definition: pdp11_vmbox.vhd:81
out EM_MREQ em_mreq_type
Definition: pdp11_vmbox.vhd:85
in IB_SRES_CPU ib_sres_type
Definition: pdp11_vmbox.vhd:89
Definition: pdp11.vhd:123
std_logic_vector( 21 downto 1) slv22_1
Definition: slvtypes.vhd:69
std_logic_vector( 8 downto 0) slv9
Definition: slvtypes.vhd:41
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic_vector( 21 downto 0) slv22
Definition: slvtypes.vhd:55
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31