w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
pdp11_dmhbpt_unit.vhd
Go to the documentation of this file.
1-- $Id: pdp11_dmhbpt_unit.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2015-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: pdp11_dmhbpt_unit - syn
7-- Description: pdp11: dmhbpt - individual unit
8--
9-- Dependencies: -
10-- Test bench: -
11--
12-- Target Devices: generic
13-- Tool versions: ise 14.7; viv 2014.4-2019.1; ghdl 0.31-0.35
14--
15-- Synthesized (xst):
16-- Date Rev ise Target flop lutl lutm slic t peri
17-- 2015-07-12 700 14.7 131013 xc6slx16-2 39 67 0 21 s 3.8
18--
19-- Revision History: -
20-- Date Rev Version Comment
21-- 2019-06-02 1159 1.0.1 use rbaddr_ constants
22-- 2015-07-19 702 1.0 Initial version
23-- 2015-07-05 698 0.1 First draft
24------------------------------------------------------------------------------
25--
26-- rbus registers:
27--
28-- Addr Bits Name r/w/f Function
29-- 00 cntl r/w/- Control register
30-- 05:04 mode r/w/- mode select (k=00,s=01,u=11; 10->all)
31-- 02 irena r/w/- enable instruction read bpt
32-- 01 dwena r/w/- enable data write bpt
33-- 00 drena r/w/- enable data read bpt
34-- 01 stat r/w/- Status register
35-- 01 dwseen r/w/- dw bpt seen
36-- 02 irseen r/w/- ir bpt seen
37-- 00 drseen r/w/- dr bpt seen
38-- 10 15:01 hilim r/w/- upper address limit, inclusive (def: 000000)
39-- 11 15:01 lolim r/w/- lower address limit, inclusive (def: 000000)
40--
41
42library ieee;
43use ieee.std_logic_1164.all;
44use ieee.numeric_std.all;
45
46use work.slvtypes.all;
47use work.rblib.all;
48use work.pdp11.all;
49
50-- ----------------------------------------------------------------------------
51
52entity pdp11_dmhbpt_unit is -- dmhbpt - indivitial unit
53 generic (
54 RB_ADDR : slv16 := rbaddr_dmhbpt_off;
55 INDEX : natural := 0);
56 port (
57 CLK : in slbit; -- clock
58 RESET : in slbit; -- reset
59 RB_MREQ : in rb_mreq_type; -- rbus: request
60 RB_SRES : out rb_sres_type; -- rbus: response
61 DM_STAT_SE : in dm_stat_se_type; -- debug and monitor status - sequencer
62 DM_STAT_DP : in dm_stat_dp_type; -- debug and monitor status - data path
63 DM_STAT_VM : in dm_stat_vm_type; -- debug and monitor status - vmbox
64 DM_STAT_CO : in dm_stat_co_type; -- debug and monitor status - core
65 HBPT : out slbit -- hw break flag
66 );
68
69
70architecture syn of pdp11_dmhbpt_unit is
71
72 constant rbaddr_cntl : slv2 := "00"; -- cntl address offset
73 constant rbaddr_stat : slv2 := "01"; -- stat address offset
74 constant rbaddr_hilim : slv2 := "10"; -- hilim address offset
75 constant rbaddr_lolim : slv2 := "11"; -- lolim address offset
76
77 subtype cntl_rbf_mode is integer range 5 downto 4;
78 constant cntl_rbf_irena : integer := 2;
79 constant cntl_rbf_dwena : integer := 1;
80 constant cntl_rbf_drena : integer := 0;
81
82 constant stat_rbf_irseen : integer := 2;
83 constant stat_rbf_dwseen : integer := 1;
84 constant stat_rbf_drseen : integer := 0;
85
86 -- the mode 10 is used a wildcard, cpu only uses 00 (k) 01 (s) and 11 (u)
87 constant cntl_mode_all : slv2 := "10";
88
89 subtype lim_rbf is integer range 15 downto 1;
90
91 type regs_type is record
92 rbsel : slbit; -- rbus select
93 mode : slv2; -- mode select
94 irena : slbit; -- ir enable
95 dwena : slbit; -- dw enable
96 drena : slbit; -- dr enable
97 irseen : slbit; -- ir seen
98 dwseen : slbit; -- dw seen
99 drseen : slbit; -- dr seen
100 hilim : slv16_1; -- hilim
101 lolim : slv16_1; -- lolim
102 end record regs_type;
103
104 constant regs_init : regs_type := (
105 '0', -- rbsel
106 "00", -- mode
107 '0','0','0', -- *ena
108 '0','0','0', -- *seen
109 (others=>'0'), -- hilim
110 (others=>'0') -- lolim
111 );
112
113 signal R_REGS : regs_type := regs_init; -- state registers
114 signal N_REGS : regs_type := regs_init; -- next value state regs
115
116 begin
117
118 proc_regs: process (CLK)
119 begin
120
121 if rising_edge(CLK) then
122 if RESET = '1' then
123 R_REGS <= regs_init;
124 else
125 R_REGS <= N_REGS;
126 end if;
127 end if;
128
129 end process proc_regs;
130
131 proc_next: process (R_REGS, RB_MREQ, DM_STAT_SE, DM_STAT_DP,
132 DM_STAT_VM, DM_STAT_VM.vmcntl, -- xst needs sub-records
134
135 variable r : regs_type := regs_init;
136 variable n : regs_type := regs_init;
137 variable irb_ack : slbit := '0';
138 variable irb_err : slbit := '0'; -- FIXME: needed ??
139 variable irb_busy : slbit := '0'; -- FIXME: needed ??
140 variable irb_dout : slv16 := (others=>'0');
141 variable irbena : slbit := '0';
142 variable ihbpt : slbit := '0';
143
144 begin
145
146 r := R_REGS;
147 n := R_REGS;
148
149 irb_ack := '0';
150 irb_err := '0';
151 irb_busy := '0';
152 irb_dout := (others=>'0');
153 irbena := RB_MREQ.re or RB_MREQ.we;
154
155 -- rbus address decoder
156 n.rbsel := '0';
157 if RB_MREQ.aval='1' and -- address valid
158 RB_MREQ.addr(12 downto 4)=RB_ADDR(12 downto 4) and -- block address
159 RB_MREQ.addr( 3 downto 2)=slv(to_unsigned(INDEX,2)) -- unit address
160 then
161 n.rbsel := '1';
162 end if;
163
164 -- rbus transactions
165 if r.rbsel = '1' then
166 irb_ack := irbena; -- ack all accesses
167 case RB_MREQ.addr(1 downto 0) is
168 when rbaddr_cntl => -- cntl ------------------
169 if RB_MREQ.we = '1' then
170 n.mode := RB_MREQ.din(cntl_rbf_mode);
171 n.irena := RB_MREQ.din(cntl_rbf_irena);
172 n.dwena := RB_MREQ.din(cntl_rbf_dwena);
173 n.drena := RB_MREQ.din(cntl_rbf_drena);
174 end if;
175
176 when rbaddr_stat => -- stat ------------------
177 if RB_MREQ.we = '1' then
178 n.irseen := RB_MREQ.din(stat_rbf_irseen);
179 n.dwseen := RB_MREQ.din(stat_rbf_dwseen);
180 n.drseen := RB_MREQ.din(stat_rbf_drseen);
181 end if;
182
183 when rbaddr_hilim => -- hilim -----------------
184 if RB_MREQ.we = '1' then
185 n.hilim := RB_MREQ.din(lim_rbf);
186 end if;
187
188 when rbaddr_lolim => -- lolim -----------------
189 if RB_MREQ.we = '1' then
190 n.lolim := RB_MREQ.din(lim_rbf);
191 end if;
192
193 when others => null; -- <> --------------------
194 end case;
195 end if;
196
197 -- rbus output driver
198 if r.rbsel = '1' then
199 case RB_MREQ.addr(1 downto 0) is
200 when rbaddr_cntl => -- cntl ------------------
201 irb_dout(cntl_rbf_mode) := r.mode;
202 irb_dout(cntl_rbf_irena) := r.irena;
203 irb_dout(cntl_rbf_dwena) := r.dwena;
204 irb_dout(cntl_rbf_drena) := r.drena;
205 when rbaddr_stat => -- stat ------------------
206 irb_dout(stat_rbf_irseen) := r.irseen;
207 irb_dout(stat_rbf_dwseen) := r.dwseen;
208 irb_dout(stat_rbf_drseen) := r.drseen;
209 when rbaddr_hilim => -- hilim -----------------
210 irb_dout(lim_rbf) := r.hilim;
211 when rbaddr_lolim => -- lolim -----------------
212 irb_dout(lim_rbf) := r.lolim;
213 when others => null;
214 end case;
215 end if;
216
217 -- breakpoint unit logic
218 ihbpt := '0';
219 if DM_STAT_VM.vmcntl.req = '1' and
220 DM_STAT_VM.vmcntl.cacc = '0' and
221 (DM_STAT_VM.vmcntl.mode = r.mode or r.mode = cntl_mode_all )and
222 unsigned(DM_STAT_VM.vmaddr(lim_rbf))>=unsigned(r.lolim) and
223 unsigned(DM_STAT_VM.vmaddr(lim_rbf))<=unsigned(r.hilim) then
224
225 if r.irena = '1' then
226 if DM_STAT_SE.istart = '1' and -- only for instruction fetches !
227 DM_STAT_VM.vmcntl.dspace = '0' and
228 DM_STAT_VM.vmcntl.wacc = '0' then
229 ihbpt := '1';
230 n.irseen := '1';
231 end if;
232 end if;
233
234 if r.dwena = '1' then
235 if DM_STAT_VM.vmcntl.dspace = '1' and
236 DM_STAT_VM.vmcntl.wacc = '1' then
237 ihbpt := '1';
238 n.dwseen := '1';
239 end if;
240 end if;
241
242 if r.drena = '1' then
243 if DM_STAT_VM.vmcntl.dspace = '1' and
244 DM_STAT_VM.vmcntl.wacc = '0' then
245 ihbpt := '1';
246 n.drseen := '1';
247 end if;
248 end if;
249
250 end if;
251
252 N_REGS <= n;
253
254 HBPT <= ihbpt;
255
256 RB_SRES.ack <= irb_ack;
257 RB_SRES.err <= irb_err;
258 RB_SRES.busy <= irb_busy;
259 RB_SRES.dout <= irb_dout;
260
261 end process proc_next;
262
263end syn;
regs_type := regs_init N_REGS
regs_type :=( '0', "00", '0', '0', '0', '0', '0', '0',( others => '0'),( others => '0')) regs_init
regs_type := regs_init R_REGS
integer range 15 downto 1 lim_rbf
integer range 5 downto 4 cntl_rbf_mode
in DM_STAT_DP dm_stat_dp_type
in DM_STAT_CO dm_stat_co_type
in DM_STAT_SE dm_stat_se_type
RB_ADDR slv16 := rbaddr_dmhbpt_off
in RB_MREQ rb_mreq_type
in DM_STAT_VM dm_stat_vm_type
out RB_SRES rb_sres_type
Definition: pdp11.vhd:123
Definition: rblib.vhd:32
std_logic_vector( 15 downto 1) slv16_1
Definition: slvtypes.vhd:67
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