w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
pdp11_mmu_mmr12.vhd
Go to the documentation of this file.
1-- $Id: pdp11_mmu_mmr12.vhd 1330 2022-12-16 17:52:40Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2006-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: pdp11_mmu_mmr12 - syn
7-- Description: pdp11: mmu register mmr1 and mmr2
8--
9-- Dependencies: ib_sel
10-- Test bench: tb/tb_pdp11_core (implicit)
11-- Target Devices: generic
12-- Tool versions: ise 8.2-14.7; viv 2014.4-2022.1; ghdl 0.18-2.0.0
13--
14-- Revision History:
15-- Date Rev Version Comment
16-- 2022-12-12 1330 1.2.5 implement MMR2 instruction complete
17-- 2022-08-30 1291 1.2.4 use ra_delta to steer mmr1 updates
18-- 2022-08-13 1279 1.2.3 ssr->mmr rename
19-- 2011-11-18 427 1.2.2 now numeric_std clean
20-- 2010-10-23 335 1.2.1 use ib_sel
21-- 2010-10-17 333 1.2 use ibus V2 interface
22-- 2009-05-30 220 1.1.4 final removal of snoopers (were already commented)
23-- 2008-08-22 161 1.1.3 rename ubf_ -> ibf_; use iblib
24-- 2008-03-02 121 1.1.2 remove snoopers
25-- 2008-01-05 110 1.1.1 rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
26-- 2007-12-30 107 1.1 use IB_MREQ/IB_SRES interface now
27-- 2007-06-14 56 1.0.1 Use slvtypes.all
28-- 2007-05-12 26 1.0 Initial version
29------------------------------------------------------------------------------
30
31library ieee;
32use ieee.std_logic_1164.all;
33use ieee.numeric_std.all;
34
35use work.slvtypes.all;
36use work.iblib.all;
37use work.pdp11.all;
38
39-- ----------------------------------------------------------------------------
40
41entity pdp11_mmu_mmr12 is -- mmu register mmr1 and mmr2
42 port (
43 CLK : in slbit; -- clock
44 CRESET : in slbit; -- cpu reset
45 TRACE : in slbit; -- trace enable
46 MONI : in mmu_moni_type; -- MMU monitor port data
47 VADDR : in slv16; -- virtual address
48 IB_MREQ : in ib_mreq_type; -- ibus request
49 IB_SRES : out ib_sres_type -- ibus response
50 );
52
53architecture syn of pdp11_mmu_mmr12 is
54
55 constant ibaddr_mmr1 : slv16 := slv(to_unsigned(8#177574#,16));
56 constant ibaddr_mmr2 : slv16 := slv(to_unsigned(8#177576#,16));
57
58 subtype mmr1_ibf_rb_delta is integer range 15 downto 11;
59 subtype mmr1_ibf_rb_num is integer range 10 downto 8;
60 subtype mmr1_ibf_ra_delta is integer range 7 downto 3;
61 subtype mmr1_ibf_ra_num is integer range 2 downto 0;
62
63 signal IBSEL_MMR1 : slbit := '0';
64 signal IBSEL_MMR2 : slbit := '0';
65 signal R_MMR1 : mmu_mmr1_type := mmu_mmr1_init;
66 signal R_MMR2 : slv16 := (others=>'0');
67 signal N_MMR1 : mmu_mmr1_type := mmu_mmr1_init;
68 signal N_MMR2 : slv16 := (others=>'0');
69
70begin
71
72 SEL_MMR1 : ib_sel
73 generic map (
75 port map (
76 CLK => CLK,
79 );
80 SEL_MMR2 : ib_sel
81 generic map (
83 port map (
84 CLK => CLK,
87 );
88
89 proc_ibres : process (IBSEL_MMR1, IBSEL_MMR2, IB_MREQ, R_MMR1, R_MMR2)
90 variable mmr1out : slv16 := (others=>'0');
91 variable mmr2out : slv16 := (others=>'0');
92 begin
93
94 mmr1out := (others=>'0');
95 if IBSEL_MMR1 = '1' then
96 mmr1out(mmr1_ibf_rb_delta) := R_MMR1.rb_delta;
97 mmr1out(mmr1_ibf_rb_num) := R_MMR1.rb_num;
98 mmr1out(mmr1_ibf_ra_delta) := R_MMR1.ra_delta;
99 mmr1out(mmr1_ibf_ra_num) := R_MMR1.ra_num;
100 end if;
101
102 mmr2out := (others=>'0');
103 if IBSEL_MMR2 = '1' then
104 mmr2out := R_MMR2;
105 end if;
106
107 IB_SRES.dout <= mmr1out or mmr2out;
108 IB_SRES.ack <= (IBSEL_MMR1 or IBSEL_MMR2) and
109 (IB_MREQ.re or IB_MREQ.we); -- ack all
110 IB_SRES.busy <= '0';
111
112 end process proc_ibres;
113
114 proc_regs : process (CLK)
115 begin
116 if rising_edge(CLK) then
117 R_MMR1 <= N_MMR1;
118 R_MMR2 <= N_MMR2;
119 end if;
120 end process proc_regs;
121
122 proc_comb : process (CRESET, IBSEL_MMR1, IB_MREQ,
124
125 variable nmmr1 : mmu_mmr1_type := mmu_mmr1_init;
126 variable nmmr2 : slv16 := (others=>'0');
127 variable delta : slv5 := (others=>'0');
128
129 begin
130
131 nmmr1 := R_MMR1;
132 nmmr2 := R_MMR2;
133 delta := "0" & MONI.delta;
134
135 if CRESET = '1' then
136 nmmr1 := mmu_mmr1_init;
137 nmmr2 := (others=>'0');
138
139 elsif IBSEL_MMR1='1' and IB_MREQ.we='1' then
140
141 if IB_MREQ.be1 = '1' then
142 nmmr1.rb_delta := IB_MREQ.din(mmr1_ibf_rb_delta);
143 nmmr1.rb_num := IB_MREQ.din(mmr1_ibf_rb_num);
144 end if;
145 if IB_MREQ.be0 = '1' then
146 nmmr1.ra_delta := IB_MREQ.din(mmr1_ibf_ra_delta);
147 nmmr1.ra_num := IB_MREQ.din(mmr1_ibf_ra_num);
148 end if;
149
150 elsif TRACE = '1' then
151
152 if MONI.istart='1' or MONI.vstart='1' then
153 nmmr1 := mmu_mmr1_init;
154 nmmr2 := VADDR;
155
156 elsif MONI.regmod = '1' then
157 if R_MMR1.ra_delta = "00000" then
158 nmmr1.ra_num := MONI.regnum;
159 if MONI.isdec = '0' then
160 nmmr1.ra_delta := delta;
161 else
162 nmmr1.ra_delta := slv(-signed(delta));
163 end if;
164 else
165 nmmr1.rb_num := MONI.regnum;
166 if MONI.isdec = '0' then
167 nmmr1.rb_delta := delta;
168 else
169 nmmr1.rb_delta := slv(-signed(delta));
170 end if;
171 end if;
172 end if;
173
174 end if;
175
176 N_MMR1 <= nmmr1;
177 N_MMR2 <= nmmr2;
178
179 end process proc_comb;
180
181end 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
Definition: iblib.vhd:33
integer range 2 downto 0 mmr1_ibf_ra_num
slv16 :=( others => '0') N_MMR2
mmu_mmr1_type := mmu_mmr1_init R_MMR1
slv16 := slv( to_unsigned( 8#177576#, 16) ) ibaddr_mmr2
integer range 15 downto 11 mmr1_ibf_rb_delta
slbit := '0' IBSEL_MMR2
slbit := '0' IBSEL_MMR1
mmu_mmr1_type := mmu_mmr1_init N_MMR1
integer range 10 downto 8 mmr1_ibf_rb_num
slv16 := slv( to_unsigned( 8#177574#, 16) ) ibaddr_mmr1
integer range 7 downto 3 mmr1_ibf_ra_delta
slv16 :=( others => '0') R_MMR2
in MONI mmu_moni_type
in IB_MREQ ib_mreq_type
out IB_SRES ib_sres_type
Definition: pdp11.vhd:123
std_logic_vector( 4 downto 0) slv5
Definition: slvtypes.vhd:37
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector slv
Definition: slvtypes.vhd:31