OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [rtl/] [w11a/] [pdp11.vhd] - Blame information for rev 28

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 wfjm
-- $Id: pdp11.vhd 621 2014-12-26 21:20:05Z mueller $
2 2 wfjm
--
3 25 wfjm
-- Copyright 2006-2014 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
-- Package Name:   pdp11
16
-- Description:    Definitions for pdp11 components
17
--
18
-- Dependencies:   -
19 25 wfjm
-- Tool versions:  xst 8.2-14.7; ghdl 0.18-0.31
20
--
21 2 wfjm
-- Revision History: 
22
-- Date         Rev Version  Comment
23 27 wfjm
-- 2014-08-28   588   1.5.1  use new rlink v4 iface and 4 bit STAT
24
-- 2014-08-15   583   1.5    rb_mreq addr now 16 bit
25
-- 2014-08-10:  581   1.4.10 add c_cc_f_* field defs for condition code array
26 25 wfjm
-- 2014-07-12   569   1.4.9  dpath_stat_type: merge div_zero+div_ovfl to div_quit
27
--                           dpath_cntl_type: add munit_s_div_sr
28 13 wfjm
-- 2011-11-18   427   1.4.8  now numeric_std clean
29 9 wfjm
-- 2010-12-30   351   1.4.7  rename pdp11_core_rri->pdp11_core_rbus; use rblib
30 8 wfjm
-- 2010-10-23   335   1.4.6  rename RRI_LAM->RB_LAM;
31
-- 2010-10-16   332   1.4.5  renames of pdp11_du_drv port names
32
-- 2010-09-18   330   1.4.4  rename (adlm)box->(oalm)unit
33 2 wfjm
-- 2010-06-20   308   1.4.3  add c_ibrb_ibf_ def's
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  add racc, be to cp_addr_type; rm pdp11_ibdr_rri
36
-- 2010-06-13   305   1.4    add rnum to cp_cntl_type, cprnum to cpustat_type;
37
--                           reassign cp command codes and rename: c_cp_func_...
38
--                           -> c_cpfunc_...; remove  cpaddr_(lal|lah|inc) from
39
--                           dpath_cntl_type; add cpdout_we to dpath_cntl_type;
40
--                           reassign rbus adresses and rename: c_rb_addr_...
41
--                           -> c_rbaddr_...; rename rbus fields: c_rb_statf_...
42
--                           -> c_stat_rbf_...
43
-- 2010-06-12   304   1.3.3  add cpuwait to cp_stat_type and cpustat_type
44
-- 2010-06-11   303   1.3.2  use IB_MREQ.racc instead of RRI_REQ
45
-- 2010-05-02   287   1.3.1  rename RP_STAT->RB_STAT
46
-- 2010-05-01   285   1.3    port to rri V2 interface; drop pdp11_rri_2rp;
47
--                           rename c_rp_addr_* -> c_rb_addr_*
48
-- 2010-03-21   270   1.2.6  add pdp11_du_drv
49
-- 2009-05-30   220   1.2.5  final removal of snoopers (were already commented)
50
-- 2009-05-10   214   1.2.4  add ENA (trace enable) for _tmu; add _pdp11_tmu_sb
51
-- 2009-05-09   213   1.2.3  BUGFIX: default for inst_compl now '0'
52
-- 2008-12-14   177   1.2.2  add gpr_* fields to DM_STAT_DP
53
-- 2008-11-30   174   1.2.1  BUGFIX: add updt_dstadsrc;
54
-- 2008-08-22   161   1.2    move slvnn_m subtypes to slvtypes;
55
--                           move (and rename) intbus defs to iblib package;
56
--                           move intbus devices to ibdlib package;
57
--                           rename ubf_ --> ibf_;
58
-- 2008-05-09   144   1.1.17 use EI_ACK with _kw11l, _dl11
59
-- 2008-05-03   143   1.1.16 rename _cpursta->_cpurust
60
-- 2008-04-27   140   1.1.15 add c_cpursta_xxx defs; cpufail->cpursta in cp_stat
61
-- 2008-04-25   138   1.1.14 add BRESET port to _mmu, _vmbox, use in _irq
62
-- 2008-04-19   137   1.1.13 add _tmu,_sys70 entity, dm_stat_** types and ports
63
-- 2008-04-18   136   1.1.12 ibdr_sdreg: use RESET; ibdr_minisys: add RESET
64
-- 2008-03-02   121   1.1.11 remove snoopers; add waitsusp in cpustat_type
65
-- 2008-02-24   119   1.1.10 add lah,rps,wps commands, cp_addr_type.
66
--                           _vmbox,_mmu interface changed
67
-- 2008-02-17   117   1.1.9  add em_(mreq|sres)_type, pdp11_cache, pdp11_bram
68
-- 2008-01-27   115   1.1.8  add pdp11_ubmap, pdp11_mem70
69
-- 2008-01-26   114   1.1.7  add c_rp_addr_ibr(b) defs (for ibr addresses)
70
-- 2008-01-20   113   1.1.6  _core_rri: use RRI_LAM; _minisys: RRI_LAM vector
71
-- 2008-01-20   112   1.1.5  added ibdr_minisys; _ibdr_rri
72
-- 2008-01-06   111   1.1.4  rename ibdr_kw11l->ibd_kw11l; add ibdr_(dl11|rk11)
73
--                           mod pdp11_intmap;
74
-- 2008-01-05   110   1.1.3  delete _mmu_regfile; rename _mmu_regs->_mmu_sadr
75
--                           rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
76
--                           add ibdr_kw11l.
77
-- 2008-01-01   109   1.1.2  _vmbox w/ IB_SRES_(CPU|EXT); remove vm_regs_type
78
-- 2007-12-30   108   1.1.1  add ibdr_sdreg, ubf_byte[01]
79
-- 2007-12-30   107   1.1    use IB_MREQ/IB_SRES interface now; remove DMA port
80
-- 2007-08-16    74   1.0.6  add AP_LAM interface to pdp11_core_rri
81
-- 2007-08-12    73   1.0.5  add c_rp_addr_xxx and c_rp_statf_xxx def's
82
-- 2007-08-10    72   1.0.4  added c_cp_func_xxx constant def's for commands
83
-- 2007-07-15    66   1.0.3  rename pdp11_top -> pdp11_core
84
-- 2007-07-02    63   1.0.2  reordered ports on pdp11_top (by function, not i/o)
85
-- 2007-06-14    56   1.0.1  Use slvtypes.all
86
-- 2007-05-12    26   1.0    Initial version 
87
------------------------------------------------------------------------------
88
 
89
library ieee;
90
use ieee.std_logic_1164.all;
91 13 wfjm
use ieee.numeric_std.all;
92 2 wfjm
 
93
use work.slvtypes.all;
94
use work.iblib.all;
95 9 wfjm
use work.rblib.all;
96 2 wfjm
 
97
package pdp11 is
98
 
99
  type psw_type is record               -- processor status
100
    cmode : slv2;                       -- current mode
101
    pmode : slv2;                       -- previous mode
102
    rset : slbit;                       -- register set
103
    pri : slv3;                         -- processor priority
104
    tflag : slbit;                      -- trace flag
105
    cc : slv4;                          -- condition codes (NZVC).
106
  end record psw_type;
107
 
108 27 wfjm
  constant c_cc_f_n: integer := 3;      -- condition code: n
109
  constant c_cc_f_z: integer := 2;      -- condition code: z
110
  constant c_cc_f_v: integer := 1;      -- condition code: v
111
  constant c_cc_f_c: integer := 0;      -- condition code: c
112
 
113 2 wfjm
  constant psw_init : psw_type := (
114
    "00","00",                          -- cmode, pmode  (=kernel)
115
    '0',"111",'0',                      -- rset, pri (=7), tflag
116
    "0000"                              -- cc     NZVC=0
117
  );
118
 
119
  constant c_psw_kmode : slv2 := "00";  -- processor mode: kernel
120
  constant c_psw_smode : slv2 := "01";  -- processor mode: supervisor
121
  constant c_psw_umode : slv2 := "11";  -- processor mode: user
122
 
123
  subtype  psw_ibf_cmode  is integer range 15 downto 14;
124
  subtype  psw_ibf_pmode  is integer range 13 downto 12;
125
  constant psw_ibf_rset:  integer := 11;
126
  subtype  psw_ibf_pri    is integer range  7 downto  5;
127
  constant psw_ibf_tflag: integer :=  4;
128
  subtype  psw_ibf_cc     is integer range  3 downto  0;
129
 
130
  type sarsdr_type is record            -- combined SAR/SDR MMU status
131
    saf : slv16;                        -- segment address field
132
    slf : slv7;                         -- segment length field
133
    ed : slbit;                         -- expansion direction
134
    acf : slv3;                         -- access control field
135
  end record sarsdr_type;
136
 
137
  constant sarsdr_init : sarsdr_type := (
138
    (others=>'0'),                      -- saf
139
    "0000000",'0',"000"                 -- slf, ed, acf
140
  );
141
 
142
  type dpath_cntl_type is record        -- data path control
143
    gpr_asrc : slv3;                    -- src register address
144
    gpr_adst : slv3;                    -- dst register address
145
    gpr_mode : slv2;                    -- psw mode for gpr access
146
    gpr_rset : slbit;                   -- register set
147
    gpr_we : slbit;                     -- gpr write enable
148
    gpr_bytop : slbit;                  -- gpr high byte enable
149
    gpr_pcinc : slbit;                  -- pc increment enable
150
    psr_ccwe : slbit;                   -- enable update cc
151
    psr_we: slbit;                      -- write enable psw (from DIN)
152
    psr_func : slv3;                    -- write function psw (from DIN)
153
    dsrc_sel : slbit;                   -- src data register source select
154
    dsrc_we : slbit;                    -- src data register write enable
155
    ddst_sel : slbit;                   -- dst data register source select
156
    ddst_we : slbit;                    -- dst data register write enable
157
    dtmp_sel : slv2;                    -- tmp data register source select
158
    dtmp_we : slbit;                    -- tmp data register write enable
159 8 wfjm
    ounit_asel : slv2;                  -- ounit a port selector
160
    ounit_azero : slbit;                -- ounit a port force zero
161
    ounit_const : slv9;                 -- ounit b port const
162
    ounit_bsel : slv2;                  -- ounit b port selector
163
    ounit_opsub : slbit;                -- ounit operation
164
    aunit_srcmod : slv2;                -- aunit src port modifier
165
    aunit_dstmod : slv2;                -- aunit dst port modifier
166
    aunit_cimod : slv2;                 -- aunit ci port modifier
167
    aunit_cc1op : slbit;                -- aunit use cc modes (1 op instruction)
168
    aunit_ccmode : slv3;                -- aunit cc port mode
169
    aunit_bytop : slbit;                -- aunit byte operation
170
    lunit_func : slv4;                  -- lunit function
171
    lunit_bytop : slbit;                -- lunit byte operation
172
    munit_func : slv2;                  -- munit function
173
    munit_s_div : slbit;                -- munit s_opg_div state
174
    munit_s_div_cn : slbit;             -- munit s_opg_div_cn state
175
    munit_s_div_cr : slbit;             -- munit s_opg_div_cr state
176 25 wfjm
    munit_s_div_sr : slbit;             -- munit s_opg_div_sr state
177 8 wfjm
    munit_s_ash : slbit;                -- munit s_opg_ash state
178
    munit_s_ash_cn : slbit;             -- munit s_opg_ash_cn state
179
    munit_s_ashc : slbit;               -- munit s_opg_ashc state
180
    munit_s_ashc_cn : slbit;            -- munit s_opg_ashc_cn state
181 2 wfjm
    ireg_we : slbit;                    -- ireg register write enable
182
    cres_sel : slv3;                    -- result bus (cres) select
183
    dres_sel : slv3;                    -- result bus (dres) select
184
    vmaddr_sel : slv2;                  -- virtual address select
185
    cpdout_we : slbit;                  -- capture dres for cpdout
186
  end record dpath_cntl_type;
187
 
188
  constant dpath_cntl_init : dpath_cntl_type := (
189
    "000","000","00",'0','0','0','0',   -- gpr
190
    '0','0',"000",                      -- psr
191
    '0','0','0','0',"00",'0',           -- dsrc,..,dtmp
192 8 wfjm
    "00",'0',"000000000","00",'0',      -- ounit
193
    "00","00","00",'0',"000",'0',       -- aunit
194
    "0000",'0',                         -- lunit
195 25 wfjm
    "00",'0','0','0','0','0','0','0','0',-- munit
196 2 wfjm
    '0',"000","000","00",'0'            -- rest
197
  );
198
 
199
  constant c_dpath_dsrc_src  : slbit := '0'; -- DSRC = R(SRC)
200
  constant c_dpath_dsrc_res  : slbit := '1'; -- DSRC = DRES
201
  constant c_dpath_ddst_dst  : slbit := '0'; -- DDST = R(DST)
202
  constant c_dpath_ddst_res  : slbit := '1'; -- DDST = DRES
203
 
204
  constant c_dpath_dtmp_dsrc  : slv2 := "00"; -- DTMP = DSRC
205
  constant c_dpath_dtmp_psw   : slv2 := "01"; -- DTMP = PSW
206
  constant c_dpath_dtmp_dres  : slv2 := "10"; -- DTMP = DRES
207
  constant c_dpath_dtmp_drese : slv2 := "11"; -- DTMP = DRESE
208
 
209 8 wfjm
  constant c_dpath_res_ounit  : slv3 := "000"; -- D/CRES = OUNIT
210
  constant c_dpath_res_aunit  : slv3 := "001"; -- D/CRES = AUNIT
211
  constant c_dpath_res_lunit  : slv3 := "010"; -- D/CRES = LUNIT
212
  constant c_dpath_res_munit  : slv3 := "011"; -- D/CRES = MUNIT
213 2 wfjm
  constant c_dpath_res_vmdout : slv3 := "100"; -- D/CRES = VMDOUT
214
  constant c_dpath_res_fpdout : slv3 := "101"; -- D/CRES = FPDOUT
215
  constant c_dpath_res_ireg   : slv3 := "110"; -- D/CRES = IREG
216
  constant c_dpath_res_cpdin  : slv3 := "111"; -- D/CRES = CPDIN
217
 
218
  constant c_dpath_vmaddr_dsrc : slv2 := "00"; -- VMADDR = DSRC
219
  constant c_dpath_vmaddr_ddst : slv2 := "01"; -- VMADDR = DDST
220
  constant c_dpath_vmaddr_pc   : slv2 := "10"; -- VMADDR = PC
221
  constant c_dpath_vmaddr_dtmp : slv2 := "11"; -- VMADDR = DTMP
222
 
223
  type dpath_stat_type is record        -- data path status
224
    ccout_z : slbit;                    -- current effective Z cc flag
225
    shc_tc : slbit;                     -- last shc cycle (shc==0)
226 25 wfjm
    div_cr : slbit;                     -- division: remainder correction needed
227 2 wfjm
    div_cq : slbit;                     -- division: quotient correction needed
228 25 wfjm
    div_quit : slbit;                   -- division: abort (0/ or /0 or V=1)
229 2 wfjm
  end record dpath_stat_type;
230
 
231
  constant dpath_stat_init : dpath_stat_type := (others=>'0');
232
 
233
  type decode_stat_type is record       -- decode status
234
    is_dstmode0 : slbit;                -- dest. is register mode
235
    is_srcpc : slbit;                   -- source is pc
236
    is_srcpcmode1 : slbit;              -- source is pc and mode=1
237
    is_dstpc : slbit;                   -- dest. is pc
238
    is_dstw_reg : slbit;                -- dest. register to be written
239
    is_dstw_pc  : slbit;                -- pc register to be written
240
    is_rmwop : slbit;                   -- read-modify-write operation
241
    is_bytop : slbit;                   -- byte operation
242
    is_res : slbit;                     -- reserved operation code
243
    op_rtt : slbit;                     -- RTT instruction
244
    op_mov : slbit;                     -- MOV instruction
245
    trap_vec : slv3;                    -- trap vector addr bits 4:2
246
    force_srcsp : slbit;                -- force src register to be sp
247
    updt_dstadsrc : slbit;              -- update dsrc in dsta flow
248 8 wfjm
    aunit_srcmod : slv2;                -- aunit src port modifier
249
    aunit_dstmod : slv2;                -- aunit dst port modifier
250
    aunit_cimod : slv2;                 -- aunit ci port modifier
251
    aunit_cc1op : slbit;                -- aunit use cc modes (1 op instruction)
252
    aunit_ccmode : slv3;                -- aunit cc port mode
253
    lunit_func : slv4;                  -- lunit function
254
    munit_func : slv2;                  -- munit function
255 2 wfjm
    res_sel : slv3;                     -- result bus (cres/dres) select
256
    fork_op : slv4;                     -- op fork after idecode state
257
    fork_srcr : slv2;                   -- src-read fork after idecode state
258
    fork_dstr : slv2;                   -- dst-read fork after src read state
259
    fork_dsta : slv2;                   -- dst-addr fork after idecode state
260
    fork_opg : slv4;                    -- opg fork
261
    fork_opa : slv3;                    -- opa fork
262
    do_fork_op : slbit;                 -- execute fork_op
263
    do_fork_srcr : slbit;               -- execute fork_srcr
264
    do_fork_dstr : slbit;               -- execute fork_dstr
265
    do_fork_dsta : slbit;               -- execute fork_dsta
266
    do_fork_opg : slbit;                -- execute fork_opg
267
    do_pref_dec : slbit;                -- can do prefetch at decode phase
268
  end record decode_stat_type;
269
 
270
  constant decode_stat_init : decode_stat_type := (
271
    '0','0','0','0','0','0','0','0','0', -- is_
272
    '0','0',"000",'0','0',               -- op_, trap_, force_, updt_
273 8 wfjm
    "00","00","00",'0',"000",            -- aunit_
274
    "0000","00","000",                   -- lunit_, munit_, res_
275 2 wfjm
    "0000","00","00","00","0000","000",  -- fork_
276
    '0','0','0','0','0',                 -- do_fork_
277
    '0'                                  -- do_pref_
278
  );
279
 
280
  constant c_fork_op_halt : slv4 := "0000";
281
  constant c_fork_op_wait : slv4 := "0001";
282
  constant c_fork_op_rtti : slv4 := "0010";
283
  constant c_fork_op_trap : slv4 := "0011";
284
  constant c_fork_op_reset: slv4 := "0100";
285
  constant c_fork_op_rts :  slv4 := "0101";
286
  constant c_fork_op_spl :  slv4 := "0110";
287
  constant c_fork_op_mcc :  slv4 := "0111";
288
  constant c_fork_op_br :   slv4 := "1000";
289
  constant c_fork_op_mark : slv4 := "1001";
290
  constant c_fork_op_sob :  slv4 := "1010";
291
  constant c_fork_op_mtp :  slv4 := "1011";
292
 
293
  constant c_fork_srcr_def : slv2:= "00";
294
  constant c_fork_srcr_inc : slv2:= "01";
295
  constant c_fork_srcr_dec : slv2:= "10";
296
  constant c_fork_srcr_ind : slv2:= "11";
297
 
298
  constant c_fork_dstr_def : slv2:= "00";
299
  constant c_fork_dstr_inc : slv2:= "01";
300
  constant c_fork_dstr_dec : slv2:= "10";
301
  constant c_fork_dstr_ind : slv2:= "11";
302
 
303
  constant c_fork_dsta_def : slv2:= "00";
304
  constant c_fork_dsta_inc : slv2:= "01";
305
  constant c_fork_dsta_dec : slv2:= "10";
306
  constant c_fork_dsta_ind : slv2:= "11";
307
 
308
  constant c_fork_opg_gen  : slv4 := "0000";
309
  constant c_fork_opg_wdef : slv4 := "0001";
310
  constant c_fork_opg_winc : slv4 := "0010";
311
  constant c_fork_opg_wdec : slv4 := "0011";
312
  constant c_fork_opg_wind : slv4 := "0100";
313
  constant c_fork_opg_mul  : slv4 := "0101";
314
  constant c_fork_opg_div  : slv4 := "0110";
315
  constant c_fork_opg_ash  : slv4 := "0111";
316
  constant c_fork_opg_ashc : slv4 := "1000";
317
 
318
  constant c_fork_opa_jsr :     slv3 := "000";
319
  constant c_fork_opa_jmp :     slv3 := "001";
320
  constant c_fork_opa_mtp :     slv3 := "010";
321
  constant c_fork_opa_mfp_reg : slv3 := "011";
322
  constant c_fork_opa_mfp_mem : slv3 := "100";
323
 
324
  -- Note: MSB=0 are 'normal' states, MSB=1 are fatal errors
325
  constant c_cpurust_init   : slv4 := "0000";  -- cpu in init state
326
  constant c_cpurust_halt   : slv4 := "0001";  -- cpu executed HALT
327
  constant c_cpurust_reset  : slv4 := "0010";  -- cpu was reset    
328
  constant c_cpurust_stop   : slv4 := "0011";  -- cpu was stopped
329
  constant c_cpurust_step   : slv4 := "0100";  -- cpu was stepped
330
  constant c_cpurust_susp   : slv4 := "0101";  -- cpu was suspended
331
  constant c_cpurust_runs   : slv4 := "0111";  -- cpu running
332
  constant c_cpurust_vecfet : slv4 := "1000";  -- vector fetch error halt
333
  constant c_cpurust_recrsv : slv4 := "1001";  -- recursive red-stack halt
334
  constant c_cpurust_sfail  : slv4 := "1100";  -- sequencer failure
335
  constant c_cpurust_vfail  : slv4 := "1101";  -- vmbox failure
336
 
337
  type cpustat_type is record           -- CPU status
338
    cmdbusy : slbit;                    -- command busy
339
    cmdack  : slbit;                    -- command acknowledge
340
    cmderr  : slbit;                    -- command error
341
    cmdmerr : slbit;                    -- command memory access error
342
    cpugo   : slbit;                    -- CPU go state
343
    cpustep : slbit;                    -- CPU step flag
344
    cpuhalt : slbit;                    -- CPU halt flag
345
    cpuwait : slbit;                    -- CPU wait flag
346
    cpurust : slv4;                     -- CPU run status
347
    cpfunc  : slv5;                     -- current control port function
348
    cprnum  : slv3;                     -- current control port register number
349
    waitsusp : slbit;                   -- WAIT instruction suspended
350
    intvect  : slv9_2;                  -- current interrupt vector
351
    trap_mmu : slbit;                   -- mmu trace trap pending
352
    trap_ysv : slbit;                   -- ysv trap pending
353
    prefdone : slbit;                   -- prefetch done
354
    do_gprwe : slbit;                   -- pending gpr_we
355
    do_intrsv : slbit;                  -- active rsv interrupt sequence
356
  end record cpustat_type;
357
 
358
  constant cpustat_init : cpustat_type := (
359
    '0','0','0','0',                    -- cmd..
360
    '0','0','0','0',                    -- cpu..
361
    c_cpurust_init,                     -- cpurust
362
    "00000","000",                      -- cpfunc, cprnum
363
    '0',                                -- waitsusp
364
    (others=>'0'),                      -- intvect 
365
    '0','0','0',                        -- trap_(mmu|ysv), prefdone
366
    '0','0'                             -- do_gprwe, do_intrsv
367
  );
368
 
369
  type cpuerr_type is record            -- CPU error register
370
    illhlt : slbit;                     -- illegal halt (in non-kernel mode)
371
    adderr : slbit;                     -- address error (odd, jmp/jsr reg)
372
    nxm : slbit;                        -- non-existent memory
373
    iobto : slbit;                      -- I/O bus timeout (non-exist UB)
374
    ysv : slbit;                        -- yellow stack violation
375
    rsv : slbit;                        -- red stack violation
376
  end record cpuerr_type;
377
 
378
  constant cpuerr_init : cpuerr_type := (others=>'0');
379
 
380
  type vm_cntl_type is record           -- virt memory control port
381
    req : slbit;                        -- request
382
    wacc : slbit;                       -- write access
383
    macc : slbit;                       -- modify access (r-m-w sequence)
384
    cacc : slbit;                       -- console access
385
    bytop : slbit;                      -- byte operation
386
    dspace : slbit;                     -- dspace operation
387
    kstack : slbit;                     -- access through kernel stack
388
    intrsv : slbit;                     -- active rsv interrupt sequence
389
    mode : slv2;                        -- mode
390
    trap_done : slbit;                  -- mmu trap taken (to set ssr0 bit)
391
  end record vm_cntl_type;
392
 
393
  constant vm_cntl_init : vm_cntl_type := (
394
    '0','0','0','0',                    -- req, wacc, macc,cacc
395
    '0','0','0',                        -- bytop, dspace, kstack
396
    '0',"00",'0'                        -- intrsv, mode, trap_done
397
  );
398
 
399
  type vm_stat_type is record           -- virt memory status port
400
    ack : slbit;                        -- acknowledge
401
    err : slbit;                        -- error (see err_xxx for reason)
402
    fail : slbit;                       -- failure (machine check)
403
    err_odd : slbit;                    -- abort: odd address error
404
    err_mmu : slbit;                    -- abort: mmu reject
405
    err_nxm : slbit;                    -- abort: non-existing memory
406
    err_iobto : slbit;                  -- abort: non-existing I/O resource
407
    err_rsv : slbit;                    -- abort: red stack violation
408
    trap_ysv : slbit;                   -- trap: yellow stack violation
409
    trap_mmu : slbit;                   -- trap: mmu trace trap
410
  end record vm_stat_type;
411
 
412
  constant vm_stat_init : vm_stat_type := (others=>'0');
413
 
414
  type em_mreq_type is record           -- external memory - master request
415
    req : slbit;                        -- request
416
    we : slbit;                         -- write enable
417
    be : slv2;                          -- byte enables
418
    cancel : slbit;                     -- cancel request
419
    addr : slv22_1;                     -- address
420
    din : slv16;                        -- data in (input to memory)
421
  end record em_mreq_type;
422
 
423
  constant em_mreq_init : em_mreq_type := (
424
    '0','0',"00",'0',                   -- req, we, be, cancel
425
    (others=>'0'),(others=>'0')         -- addr, din
426
  );
427
 
428
  type em_sres_type is record           -- external memory - slave response
429
    ack_r  : slbit;                     -- acknowledge read
430
    ack_w  : slbit;                     -- acknowledge write
431
    dout : slv16;                       -- data out (output from memory)
432
  end record em_sres_type;
433
 
434
  constant em_sres_init : em_sres_type := (
435
    '0','0',                            -- ack_r, ack_w
436
    (others=>'0')                       -- dout
437
  );
438
 
439
  type mmu_cntl_type is record          -- mmu control port
440
    req : slbit;                        -- translate request
441
    wacc : slbit;                       -- write access
442
    macc : slbit;                       -- modify access (r-m-w sequence)
443
    cacc : slbit;                       -- console access (bypass mmu)
444
    dspace : slbit;                     -- dspace access
445
    mode : slv2;                        -- processor mode
446
    trap_done : slbit;                  -- mmu trap taken (set ssr0 bit)
447
  end record mmu_cntl_type;
448
 
449
  constant mmu_cntl_init : mmu_cntl_type := (
450
    '0','0','0','0',                    -- req, wacc, macc, cacc
451
    '0',"00",'0'                        -- dspace, mode, trap_done
452
  );
453
 
454
  type mmu_stat_type is record          -- mmu status port
455
    vaok : slbit;                       -- virtual address valid
456
    trap : slbit;                       -- mmu trap request
457
    ena_mmu : slbit;                    -- mmu enable (ssr0 bit 0)
458
    ena_22bit : slbit;                  -- mmu in 22 bit mode (ssr3 bit 4)
459
    ena_ubmap : slbit;                  -- ubmap enable (ssr3 bit 5)
460
  end record mmu_stat_type;
461
 
462
  constant mmu_stat_init : mmu_stat_type := (others=>'0');
463
 
464
  type mmu_moni_type is record          -- mmu monitor port
465
    istart : slbit;                     -- instruction start
466
    idone : slbit;                      -- instruction done
467
    pc : slv16;                         -- PC of new instruction
468
    regmod : slbit;                     -- register modified
469
    regnum : slv3;                      -- register number
470
    delta : slv4;                       -- register offset
471
    isdec : slbit;                      -- offset to be subtracted
472
    trace_prev : slbit;                 -- use ssr12 trace state of prev. state
473
  end record mmu_moni_type;
474
 
475
  constant mmu_moni_init : mmu_moni_type := (
476
    '0','0',(others=>'0'),              -- istart, idone, pc
477
    '0',"000","0000",                   -- regmod, regnum, delta
478
    '0','0'                             -- isdec, trace_prev
479
  );
480
 
481
  type mmu_ssr0_type is record          -- MMU ssr0
482
    abo_nonres : slbit;                 -- abort non resident
483
    abo_length : slbit;                 -- abort segment length
484
    abo_rdonly : slbit;                 -- abort read-only
485
    trap_mmu : slbit;                   -- trap management
486
    ena_trap : slbit;                   -- enable traps
487
    inst_compl : slbit;                 -- instruction complete
488
    seg_mode : slv2;                    -- segement mode
489
    dspace : slbit;                     -- address space (D=1, I=0)
490
    seg_num : slv3;                     -- segment number
491
    ena_mmu : slbit;                    -- enable memory management
492
    trace_prev : slbit;                 -- ssr12 trace status in prev. state
493
  end record mmu_ssr0_type;
494
 
495
  constant mmu_ssr0_init : mmu_ssr0_type := (
496
    inst_compl=>'0', seg_mode=>"00", seg_num=>"000",
497
    others=>'0'
498
  );
499
 
500
  type mmu_ssr1_type is record          -- MMU ssr1
501
    rb_delta : slv5;                    -- RB: amount change
502
    rb_num : slv3;                      -- RB: register number
503
    ra_delta : slv5;                    -- RA: amount change
504
    ra_num : slv3;                      -- RA: register number
505
  end record mmu_ssr1_type;
506
 
507
  constant mmu_ssr1_init : mmu_ssr1_type := (
508
    "00000","000",                      -- rb_...
509
    "00000","000"                       -- ra_...
510
  );
511
 
512
  type mmu_ssr3_type is record          -- MMU ssr3
513
    ena_ubmap : slbit;                  -- enable unibus mapping
514
    ena_22bit : slbit;                  -- enable 22 bit mapping
515
    dspace_km : slbit;                  -- enable dspace kernel
516
    dspace_sm : slbit;                  -- enable dspace supervisor
517
    dspace_um : slbit;                  -- enable dspace user
518
  end record mmu_ssr3_type;
519
 
520
  constant mmu_ssr3_init : mmu_ssr3_type := (others=>'0');
521
 
522
-- control port definitions --------------------------------------------------
523
 
524
  type cp_cntl_type is record           -- control port control
525
    req : slbit;                        -- request
526
    func : slv5;                        -- function
527
    rnum : slv3;                        -- register number
528
  end record cp_cntl_type;
529
 
530
  constant c_cpfunc_noop : slv5 := "00000";  -- noop : no operation
531
  constant c_cpfunc_sta  : slv5 := "00001";  -- sta  : cpu start
532
  constant c_cpfunc_sto  : slv5 := "00010";  -- sto  : cpu stop 
533
  constant c_cpfunc_cont : slv5 := "00011";  -- cont : cpu continue
534
  constant c_cpfunc_step : slv5 := "00100";  -- step : cpu step 
535
  constant c_cpfunc_rst  : slv5 := "01111";  -- rst  : cpu reset (soft)
536
  constant c_cpfunc_rreg : slv5 := "10000";  -- rreg : read register
537
  constant c_cpfunc_wreg : slv5 := "10001";  -- wreg : write register
538
  constant c_cpfunc_rpsw : slv5 := "10010";  -- rpsw : read psw
539
  constant c_cpfunc_wpsw : slv5 := "10011";  -- wpsw : write psw
540
  constant c_cpfunc_rmem : slv5 := "10100";  -- rmem : read memory
541
  constant c_cpfunc_wmem : slv5 := "10101";  -- wmem : write memory
542
 
543
  constant cp_cntl_init : cp_cntl_type := ('0',c_cpfunc_noop,"000");
544
 
545
  type cp_stat_type is record           -- control port status
546
    cmdbusy : slbit;                    -- command busy
547
    cmdack : slbit;                     -- command acknowledge
548
    cmderr : slbit;                     -- command error
549
    cmdmerr : slbit;                    -- command memory access error
550
    cpugo : slbit;                      -- CPU go state
551
    cpustep : slbit;                    -- CPU step flag
552
    cpuhalt : slbit;                    -- CPU halt flag
553
    cpuwait : slbit;                    -- CPU wait flag
554
    cpurust : slv4;                     -- CPU run status
555
  end record cp_stat_type;
556
 
557
  constant cp_stat_init : cp_stat_type := (
558
    '0','0','0','0',                    -- cmd...
559
    '0','0','0','0',                    -- cpu...
560
    (others=>'0')                       -- cpurust
561
  );
562
 
563
  type cp_addr_type is record           -- control port address
564
    addr : slv22_1;                     -- address
565 28 wfjm
    racc : slbit;                       -- ibus remote access
566 2 wfjm
    be : slv2;                          -- byte enables
567
    ena_22bit : slbit;                  -- enable 22 bit mode
568
    ena_ubmap : slbit;                  -- enable unibus mapper
569
  end record cp_addr_type;
570
 
571
  constant cp_addr_init : cp_addr_type := (
572
    (others=>'0'),                      -- addr
573
    '0',"00",                           -- racc, be
574
    '0','0'                             -- ena_...
575
  );
576
 
577
-- debug and monitoring port definitions -------------------------------------
578
 
579
  type dm_cntl_type is record           -- debug and monitor control
580
    dum1 : slbit;                       -- dummy 1
581
    dum2 : slbit;                       -- dummy 2
582
  end record dm_cntl_type;
583
 
584
  constant dm_cntl_init : dm_cntl_type := (others=>'0');
585
 
586
  type dm_stat_dp_type is record        -- debug and monitor status - dpath
587
    pc : slv16;                         -- pc
588
    psw : psw_type;                     -- psw
589
    ireg : slv16;                       -- ireg
590
    ireg_we : slbit;                    -- ireg we
591
    dsrc : slv16;                       -- dsrc register
592
    ddst : slv16;                       -- ddst register
593
    dtmp : slv16;                       -- dtmp register
594
    dres : slv16;                       -- dres bus
595
    gpr_adst : slv3;                    -- gpr dst regsiter
596
    gpr_mode : slv2;                    -- gpr mode
597
    gpr_bytop : slbit;                  -- gpr bytop
598
    gpr_we : slbit;                     -- gpr we
599
  end record dm_stat_dp_type;
600
 
601
  constant dm_stat_dp_init : dm_stat_dp_type := (
602
    (others=>'0'),                      -- pc
603
    psw_init,                           -- psw
604
    (others=>'0'),'0',                  -- ireg, ireg_we
605
    (others=>'0'),(others=>'0'),        -- dsrc, ddst
606
    (others=>'0'),(others=>'0'),        -- dtmp, dres
607
    (others=>'0'),(others=>'0'),        -- gpr_adst, gpr_mode
608
    '0','0'                             -- gpr_bytop, gpr_we
609
  );
610
 
611
  type dm_stat_vm_type is record        -- debug and monitor status - vmbox
612
    ibmreq : ib_mreq_type;              -- ibus master request
613
    ibsres : ib_sres_type;              -- ibus slave response
614
  end record dm_stat_vm_type;
615
 
616
  constant dm_stat_vm_init : dm_stat_vm_type := (ib_mreq_init,ib_sres_init);
617
 
618
  type dm_stat_co_type is record        -- debug and monitor status - core
619
    cpugo : slbit;                      -- cpugo state flag
620
    cpuhalt : slbit;                    -- cpuhalt state flag
621
  end record dm_stat_co_type;
622
 
623
  constant dm_stat_co_init : dm_stat_co_type := ('0','0');
624
 
625
  type dm_stat_sy_type is record        -- debug and monitor status - system
626
    emmreq : em_mreq_type;              -- external memory: request
627
    emsres : em_sres_type;              -- external memory: response
628
    chit : slbit;                       -- cache hit
629
  end record dm_stat_sy_type;
630
 
631
  constant dm_stat_sy_init : dm_stat_sy_type := (em_mreq_init,em_sres_init,'0');
632
 
633
-- rbus interface definitions ------------------------------------------------
634
 
635
  constant c_rbaddr_conf : slv5 := "00000"; -- R/W configuration reg
636
  constant c_rbaddr_cntl : slv5 := "00001"; -- -/F  control reg
637
  constant c_rbaddr_stat : slv5 := "00010"; -- R/- status reg
638
  constant c_rbaddr_psw  : slv5 := "00011"; -- R/W psw access
639
  constant c_rbaddr_al   : slv5 := "00100"; -- R/W address low reg
640
  constant c_rbaddr_ah   : slv5 := "00101"; -- R/W address high reg
641
  constant c_rbaddr_mem  : slv5 := "00110"; -- R/W memory access
642
  constant c_rbaddr_memi : slv5 := "00111"; -- R/W memory access; inc addr
643
 
644
  constant c_rbaddr_r0   : slv5 := "01000"; -- R/W gpr 0
645
  constant c_rbaddr_r1   : slv5 := "01001"; -- R/W gpr 1
646
  constant c_rbaddr_r2   : slv5 := "01010"; -- R/W gpr 2
647
  constant c_rbaddr_r3   : slv5 := "01011"; -- R/W gpr 3
648
  constant c_rbaddr_r4   : slv5 := "01100"; -- R/W gpr 4
649
  constant c_rbaddr_r5   : slv5 := "01101"; -- R/W gpr 5
650
  constant c_rbaddr_sp   : slv5 := "01110"; -- R/W gpr 6 (sp)
651
  constant c_rbaddr_pc   : slv5 := "01111"; -- R/W gpr 7 (pc)
652
 
653 28 wfjm
  constant c_rbaddr_membe: slv5 := "10000"; -- R/W memory write byte enables
654 2 wfjm
 
655 28 wfjm
  subtype  c_al_rbf_addr        is integer range 15 downto 1;  -- al: address
656
  constant c_ah_rbf_ena_ubmap:  integer :=  7;                 -- ah: ubmap
657
  constant c_ah_rbf_ena_22bit:  integer :=  6;                 -- ah: 22bit
658
  subtype  c_ah_rbf_addr        is integer range  5 downto 0;  -- ah: address
659 2 wfjm
 
660
  constant c_stat_rbf_cmderr:   integer := 0;  -- stat field: cmderr
661
  constant c_stat_rbf_cmdmerr:  integer := 1;  -- stat field: cmdmerr
662
  constant c_stat_rbf_cpugo:    integer := 2;  -- stat field: cpugo
663
  constant c_stat_rbf_cpuhalt:  integer := 3;  -- stat field: cpuhalt
664
  subtype  c_stat_rbf_cpurust   is integer range  7 downto  4;  -- cpurust
665
 
666 28 wfjm
  subtype  c_membe_rbf_be       is integer range  1 downto 0; -- membe: be's
667
  constant c_membe_rbf_stick:   integer := 2;  -- membe: sticky flag
668
 
669 2 wfjm
-- -------------------------------------
670
 
671
component pdp11_gpr is                  -- general purpose registers
672
  port (
673
    CLK : in slbit;                     -- clock
674
    DIN : in slv16;                     -- input data
675
    ASRC : in slv3;                     -- source register number
676
    ADST : in slv3;                     -- destination register number
677
    MODE : in slv2;                     -- processor mode (k=>00,s=>01,u=>11)
678
    RSET : in slbit;                    -- register set
679
    WE : in slbit;                      -- write enable
680
    BYTOP : in slbit;                   -- byte operation (write low byte only)
681
    PCINC : in slbit;                   -- increment PC
682
    DSRC : out slv16;                   -- source register data
683
    DDST : out slv16;                   -- destination register data
684
    PC : out slv16                      -- current PC value
685
  );
686
end component;
687
 
688
constant c_gpr_r5 : slv3 := "101";      -- register number of r5
689
constant c_gpr_sp : slv3 := "110";      -- register number of SP
690
constant c_gpr_pc : slv3 := "111";      -- register number of PC
691
 
692
component pdp11_psr is                  -- processor status word register
693
  port (
694
    CLK : in slbit;                     -- clock
695
    CRESET : in slbit;                  -- console reset
696
    DIN : in slv16;                     -- input data
697
    CCIN : in slv4;                     -- cc input
698
    CCWE : in slbit;                    -- enable update cc
699
    WE : in slbit;                      -- write enable (from DIN)
700
    FUNC : in slv3;                     -- write function (from DIN)
701
    PSW : out psw_type;                 -- current psw
702
    IB_MREQ : in ib_mreq_type;          -- ibus request
703
    IB_SRES : out ib_sres_type          -- ibus response
704
  );
705
end component;
706
 
707
constant c_psr_func_wspl : slv3 := "000"; -- SPL mode: set pri
708
constant c_psr_func_wcc  : slv3 := "001"; -- CC mode: set/clear cc
709
constant c_psr_func_wint : slv3 := "010"; -- interupt mode: pmode=cmode
710
constant c_psr_func_wrti : slv3 := "011"; -- rti mode: protect modes
711
constant c_psr_func_wall : slv3 := "100"; -- write all fields
712
 
713 8 wfjm
component pdp11_ounit is                -- offset adder for addresses (ounit)
714 2 wfjm
  port (
715
    DSRC : in slv16;                    -- 'src' data for port A
716
    DDST : in slv16;                    -- 'dst' data for port A
717
    DTMP : in slv16;                    -- 'tmp' data for port A
718
    PC : in slv16;                      -- PC data for port A
719
    ASEL : in slv2;                     -- selector for port A
720
    AZERO : in slbit;                   -- force zero for port A
721
    IREG8 : in slv8;                    -- 'ireg' data for port B
722
    VMDOUT : in slv16;                  -- virt. memory data for port B
723
    CONST : in slv9;                    -- sequencer const data for port B
724
    BSEL : in slv2;                     -- selector for port B
725
    OPSUB : in slbit;                   -- operation: 0 add, 1 sub
726
    DOUT : out slv16;                   -- data output
727
    NZOUT : out slv2                    -- NZ condition codes out
728
  );
729
end component;
730
 
731 8 wfjm
constant c_ounit_asel_ddst : slv2 := "00";   -- A = DDST
732
constant c_ounit_asel_dsrc : slv2 := "01";   -- A = DSRC
733
constant c_ounit_asel_pc   : slv2 := "10";   -- A = PC  
734
constant c_ounit_asel_dtmp : slv2 := "11";   -- A = DTMP
735 2 wfjm
 
736 8 wfjm
constant c_ounit_bsel_const  : slv2 := "00"; -- B = CONST
737
constant c_ounit_bsel_vmdout : slv2 := "01"; -- B = VMDOUT
738
constant c_ounit_bsel_ireg6  : slv2 := "10"; -- B = 2*IREG(6bit)
739
constant c_ounit_bsel_ireg8  : slv2 := "11"; -- B = 2*IREG(8bit,sign-extend)
740 2 wfjm
 
741 8 wfjm
component pdp11_aunit is                -- arithmetic unit for data (aunit)
742 2 wfjm
  port (
743
    DSRC : in slv16;                    -- 'src' data in
744
    DDST : in slv16;                    -- 'dst' data in
745
    CI : in slbit;                      -- carry flag in
746
    SRCMOD : in slv2;                   -- src modifier mode
747
    DSTMOD : in slv2;                   -- dst modifier mode
748
    CIMOD : in slv2;                    -- ci modifier mode
749
    CC1OP : in slbit;                   -- use cc modes (1 op instruction)
750
    CCMODE : in slv3;                   -- cc mode
751
    BYTOP : in slbit;                   -- byte operation
752
    DOUT : out slv16;                   -- data output
753
    CCOUT : out slv4                    -- condition codes out
754
  );
755
end component;
756
 
757 8 wfjm
constant c_aunit_mod_pass : slv2 := "00"; -- pass data
758
constant c_aunit_mod_inv  : slv2 := "01"; -- invert data
759
constant c_aunit_mod_zero : slv2 := "10"; -- set to 0
760
constant c_aunit_mod_one  : slv2 := "11"; -- set to 1
761 2 wfjm
 
762 8 wfjm
-- the c_aunit_ccmode codes follow exactly the opcode format (bit 8:6)
763
constant c_aunit_ccmode_clr : slv3 := "000"; -- do clr instruction
764
constant c_aunit_ccmode_com : slv3 := "001"; -- do com instruction
765
constant c_aunit_ccmode_inc : slv3 := "010"; -- do inc instruction
766
constant c_aunit_ccmode_dec : slv3 := "011"; -- do dec instruction
767
constant c_aunit_ccmode_neg : slv3 := "100"; -- do neg instruction
768
constant c_aunit_ccmode_adc : slv3 := "101"; -- do adc instruction
769
constant c_aunit_ccmode_sbc : slv3 := "110"; -- do sbc instruction
770
constant c_aunit_ccmode_tst : slv3 := "111"; -- do tst instruction
771 2 wfjm
 
772 8 wfjm
component pdp11_lunit is                -- logic unit for data (lunit)
773 2 wfjm
  port (
774
    DSRC : in slv16;                    -- 'src' data in
775
    DDST : in slv16;                    -- 'dst' data in
776
    CCIN : in slv4;                     -- condition codes in
777
    FUNC : in slv4;                     -- function
778
    BYTOP : in slbit;                   -- byte operation
779
    DOUT : out slv16;                   -- data output
780
    CCOUT : out slv4                    -- condition codes out
781
  );
782
end component;
783
 
784 8 wfjm
constant c_lunit_func_asr  : slv4 := "0000"; -- ASR/ASRB ??? recheck coding !!
785
constant c_lunit_func_asl  : slv4 := "0001"; -- ASL/ASLB
786
constant c_lunit_func_ror  : slv4 := "0010"; -- ROR/RORB
787
constant c_lunit_func_rol  : slv4 := "0011"; -- ROL/ROLB
788
constant c_lunit_func_bis  : slv4 := "0100"; -- BIS/BISB
789
constant c_lunit_func_bic  : slv4 := "0101"; -- BIC/BICB
790
constant c_lunit_func_bit  : slv4 := "0110"; -- BIT/BITB
791
constant c_lunit_func_mov  : slv4 := "0111"; -- MOV/MOVB
792
constant c_lunit_func_sxt  : slv4 := "1000"; -- SXT
793
constant c_lunit_func_swap : slv4 := "1001"; -- SWAB
794
constant c_lunit_func_xor  : slv4 := "1010"; -- XOR
795 2 wfjm
 
796 8 wfjm
component pdp11_munit is                -- mul/div unit for data (munit)
797 2 wfjm
  port (
798
    CLK : in slbit;                     -- clock
799
    DSRC : in slv16;                    -- 'src' data in
800
    DDST : in slv16;                    -- 'dst' data in
801
    DTMP : in slv16;                    -- 'tmp' data in
802
    GPR_DSRC : in slv16;                -- 'src' data from GPR
803
    FUNC : in slv2;                     -- function
804 25 wfjm
    S_DIV : in slbit;                   -- s_opg_div state    (load dd_low)
805
    S_DIV_CN : in slbit;                -- s_opg_div_cn state (1st..16th cycle)
806
    S_DIV_CR : in slbit;                -- s_opg_div_cr state (remainder corr.)
807
    S_DIV_SR : in slbit;                -- s_opg_div_sr state (store remainder)
808 2 wfjm
    S_ASH : in slbit;                   -- s_opg_ash state
809
    S_ASH_CN : in slbit;                -- s_opg_ash_cn state
810
    S_ASHC : in slbit;                  -- s_opg_ashc state
811
    S_ASHC_CN : in slbit;               -- s_opg_ashc_cn state
812
    SHC_TC : out slbit;                 -- last shc cycle (shc==0)
813 25 wfjm
    DIV_CR : out slbit;                 -- division: remainder correction needed
814 2 wfjm
    DIV_CQ : out slbit;                 -- division: quotient correction needed
815 25 wfjm
    DIV_QUIT : out slbit;               -- division: abort (0/ or /0 or V=1)
816 2 wfjm
    DOUT : out slv16;                   -- data output
817
    DOUTE : out slv16;                  -- data output extra
818
    CCOUT : out slv4                    -- condition codes out
819
  );
820
end component;
821
 
822 8 wfjm
constant c_munit_func_mul  : slv2 := "00"; -- MUL
823
constant c_munit_func_div  : slv2 := "01"; -- DIV
824
constant c_munit_func_ash  : slv2 := "10"; -- ASH
825
constant c_munit_func_ashc : slv2 := "11"; -- ASHC
826 2 wfjm
 
827
component pdp11_mmu_sadr is             -- mmu SAR/SDR register set
828
  port (
829
    CLK : in slbit;                     -- clock
830
    MODE : in slv2;                     -- mode
831
    ASN : in slv4;                      -- augmented segment number (1+3 bit)
832
    AIB_WE : in slbit;                  -- update AIB
833
    AIB_SETA : in slbit;                -- set access AIB
834
    AIB_SETW : in slbit;                -- set write AIB
835
    SARSDR : out sarsdr_type;           -- combined SAR/SDR
836
    IB_MREQ : in ib_mreq_type;          -- ibus request
837
    IB_SRES : out ib_sres_type          -- ibus response
838
  );
839
end component;
840
 
841
component pdp11_mmu_ssr12 is            -- mmu register ssr1 and ssr2
842
  port (
843
    CLK : in slbit;                     -- clock
844
    CRESET : in slbit;                  -- console reset
845
    TRACE : in slbit;                   -- trace enable
846
    MONI : in mmu_moni_type;            -- MMU monitor port data
847
    IB_MREQ : in ib_mreq_type;          -- ibus request
848
    IB_SRES : out ib_sres_type          -- ibus response
849
  );
850
end component;
851
 
852
component pdp11_mmu is                  -- mmu - memory management unit
853
  port (
854
    CLK : in slbit;                     -- clock
855
    CRESET : in slbit;                  -- console reset
856
    BRESET : in slbit;                  -- ibus reset
857
    CNTL : in mmu_cntl_type;            -- control port
858
    VADDR : in slv16;                   -- virtual address
859
    MONI : in mmu_moni_type;            -- monitor port
860
    STAT : out mmu_stat_type;           -- status port
861
    PADDRH : out slv16;                 -- physical address (upper 16 bit)
862
    IB_MREQ : in ib_mreq_type;          -- ibus request
863
    IB_SRES : out ib_sres_type          -- ibus response
864
  );
865
end component;
866
 
867
component pdp11_vmbox is                -- virtual memory
868
  port (
869
    CLK : in slbit;                     -- clock
870
    GRESET : in slbit;                  -- global reset
871
    CRESET : in slbit;                  -- console reset
872
    BRESET : in slbit;                  -- ibus reset
873
    CP_ADDR : in cp_addr_type;          -- console port address
874
    VM_CNTL : in vm_cntl_type;          -- vm control port
875
    VM_ADDR : in slv16;                 -- vm address
876
    VM_DIN : in slv16;                  -- vm data in
877
    VM_STAT : out vm_stat_type;         -- vm status port
878
    VM_DOUT : out slv16;                -- vm data out
879
    EM_MREQ : out em_mreq_type;         -- external memory: request
880
    EM_SRES : in em_sres_type;          -- external memory: response
881
    MMU_MONI : in mmu_moni_type;        -- mmu monitor port
882
    IB_MREQ_M : out ib_mreq_type;       -- ibus request  (master)
883
    IB_SRES_CPU : in ib_sres_type;      -- ibus response (CPU registers)
884
    IB_SRES_EXT : in ib_sres_type;      -- ibus response (external devices)
885
    DM_STAT_VM : out dm_stat_vm_type    -- debug and monitor status
886
  );
887
end component;
888
 
889
component pdp11_dpath is                -- CPU datapath
890
  port (
891
    CLK : in slbit;                     -- clock
892
    CRESET : in slbit;                  -- console reset
893
    CNTL : in dpath_cntl_type;          -- control interface
894
    STAT : out dpath_stat_type;         -- status interface
895
    CP_DIN : in slv16;                  -- console port data in
896
    CP_DOUT : out slv16;                -- console port data out
897
    PSWOUT : out psw_type;              -- current psw
898
    PCOUT : out slv16;                  -- current pc
899
    IREG : out slv16;                   -- ireg out
900
    VM_ADDR : out slv16;                -- virt. memory address
901
    VM_DOUT : in slv16;                 -- virt. memory data out
902
    VM_DIN : out slv16;                 -- virt. memory data in
903
    IB_MREQ : in ib_mreq_type;          -- ibus request
904
    IB_SRES : out ib_sres_type;         -- ibus response
905
    DM_STAT_DP : out dm_stat_dp_type    -- debug and monitor status
906
  );
907
end component;
908
 
909
component pdp11_decode is             -- instruction decoder
910
  port (
911
    IREG : in slv16;                  -- input instruction word
912
    STAT : out decode_stat_type       -- status output
913
  );
914
end component;
915
 
916
component pdp11_sequencer is            -- cpu sequencer
917
  port (
918
    CLK : in slbit;                     -- clock
919
    GRESET : in slbit;                  -- global reset
920
    PSW : in psw_type;                  -- processor status
921
    PC : in slv16;                      -- program counter
922
    IREG : in slv16;                    -- IREG
923
    ID_STAT : in decode_stat_type;      -- instr. decoder status
924
    DP_STAT : in dpath_stat_type;       -- data path status
925
    CP_CNTL : in cp_cntl_type;          -- console port control
926
    VM_STAT : in vm_stat_type;          -- virtual memory status port
927
    INT_PRI : in slv3;                  -- interrupt priority
928
    INT_VECT : in slv9_2;               -- interrupt vector
929
    CRESET : out slbit;                 -- console reset
930
    BRESET : out slbit;                 -- ibus reset
931
    MMU_MONI : out mmu_moni_type;       -- mmu monitor port
932
    DP_CNTL : out dpath_cntl_type;      -- data path control
933
    VM_CNTL : out vm_cntl_type;         -- virtual memory control port
934
    CP_STAT : out cp_stat_type;         -- console port status
935
    INT_ACK : out slbit;                -- interrupt acknowledge
936
    IB_MREQ : in ib_mreq_type;          -- ibus request
937
    IB_SRES : out ib_sres_type          -- ibus response    
938
  );
939
end component;
940
 
941
component pdp11_irq is                  -- interrupt requester
942
  port (
943
    CLK : in slbit;                     -- clock
944
    BRESET : in slbit;                  -- ibus reset
945
    INT_ACK : in slbit;                 -- interrupt acknowledge from CPU
946
    EI_PRI : in slv3;                   -- external interrupt priority
947
    EI_VECT : in slv9_2;                -- external interrupt vector
948
    EI_ACKM : out slbit;                -- external interrupt acknowledge
949
    PRI : out slv3;                     -- interrupt priority
950
    VECT : out slv9_2;                  -- interrupt vector
951
    IB_MREQ : in ib_mreq_type;          -- ibus request
952
    IB_SRES : out ib_sres_type          -- ibus response
953
  );
954
end component;
955
 
956
component pdp11_ubmap is                -- 11/70 unibus mapper
957
  port (
958
    CLK : in slbit;                     -- clock
959
    MREQ : in slbit;                    -- request mapping
960
    ADDR_UB : in slv18_1;               -- UNIBUS address (in)
961
    ADDR_PM : out slv22_1;              -- physical memory address (out)
962
    IB_MREQ : in ib_mreq_type;          -- ibus request
963
    IB_SRES : out ib_sres_type          -- ibus response
964
  );
965
end component;
966
 
967
component pdp11_sys70 is                -- 11/70 memory system registers
968
  port (
969
    CLK : in slbit;                     -- clock
970
    CRESET : in slbit;                  -- console reset
971
    IB_MREQ : in ib_mreq_type;          -- ibus request
972
    IB_SRES : out ib_sres_type          -- ibus response
973
  );
974
end component;
975
 
976
component pdp11_mem70 is                -- 11/70 memory system registers
977
  port (
978
    CLK : in slbit;                     -- clock
979
    CRESET : in slbit;                  -- console reset
980
    HM_ENA : in slbit;                  -- hit/miss enable
981
    HM_VAL : in slbit;                  -- hit/miss value
982
    CACHE_FMISS : out slbit;            -- cache force miss
983
    IB_MREQ : in ib_mreq_type;          -- ibus request
984
    IB_SRES : out ib_sres_type          -- ibus response
985
  );
986
end component;
987
 
988
component pdp11_cache is                -- cache
989
  port (
990
    CLK : in slbit;                     -- clock
991
    GRESET : in slbit;                  -- global reset
992
    EM_MREQ : in em_mreq_type;          -- em request
993
    EM_SRES : out em_sres_type;         -- em response
994
    FMISS : in slbit;                   -- force miss
995
    CHIT : out slbit;                   -- cache hit flag
996
    MEM_REQ : out slbit;                -- memory: request
997
    MEM_WE : out slbit;                 -- memory: write enable
998
    MEM_BUSY : in slbit;                -- memory: controller busy
999
    MEM_ACK_R : in slbit;               -- memory: acknowledge read
1000
    MEM_ADDR : out slv20;               -- memory: address
1001
    MEM_BE : out slv4;                  -- memory: byte enable
1002
    MEM_DI : out slv32;                 -- memory: data in  (memory view)
1003
    MEM_DO : in slv32                   -- memory: data out (memory view)
1004
  );
1005
end component;
1006
 
1007
component pdp11_core is                 -- full processor core
1008
  port (
1009
    CLK : in slbit;                     -- clock
1010
    RESET : in slbit;                   -- reset
1011
    CP_CNTL : in cp_cntl_type;          -- console control port
1012
    CP_ADDR : in cp_addr_type;          -- console address port
1013
    CP_DIN : in slv16;                  -- console data in
1014
    CP_STAT : out cp_stat_type;         -- console status port
1015
    CP_DOUT : out slv16;                -- console data out
1016
    EI_PRI : in slv3;                   -- external interrupt priority
1017
    EI_VECT : in slv9_2;                -- external interrupt vector
1018
    EI_ACKM : out slbit;                -- external interrupt acknowledge
1019
    EM_MREQ : out em_mreq_type;         -- external memory: request
1020
    EM_SRES : in em_sres_type;          -- external memory: response
1021
    BRESET : out slbit;                 -- ibus reset
1022
    IB_MREQ_M : out ib_mreq_type;       -- ibus master request (master)
1023
    IB_SRES_M : in ib_sres_type;        -- ibus slave response (master)
1024
    DM_STAT_DP : out dm_stat_dp_type;   -- debug and monitor status - dpath
1025
    DM_STAT_VM : out dm_stat_vm_type;   -- debug and monitor status - vmbox
1026
    DM_STAT_CO : out dm_stat_co_type    -- debug and monitor status - core
1027
  );
1028
end component;
1029
 
1030
component pdp11_tmu is                  -- trace and monitor unit
1031
  port (
1032
    CLK : in slbit;                     -- clock
1033
    ENA : in slbit := '0';              -- enable trace output
1034
    DM_STAT_DP : in dm_stat_dp_type;    -- DM dpath
1035
    DM_STAT_VM : in dm_stat_vm_type;    -- DM vmbox
1036
    DM_STAT_CO : in dm_stat_co_type;    -- DM core
1037
    DM_STAT_SY : in dm_stat_sy_type     -- DM system
1038
  );
1039
end component;
1040
 
1041
component pdp11_tmu_sb is               -- trace and mon. unit; simbus wrapper
1042
  generic (
1043
    ENAPIN : integer := 13);            -- SB_CNTL signal to use for enable
1044
   port (
1045
    CLK : in slbit;                     -- clock
1046
    DM_STAT_DP : in dm_stat_dp_type;    -- DM dpath
1047
    DM_STAT_VM : in dm_stat_vm_type;    -- DM vmbox
1048
    DM_STAT_CO : in dm_stat_co_type;    -- DM core
1049
    DM_STAT_SY : in dm_stat_sy_type     -- DM system
1050
  );
1051
end component;
1052
 
1053
component pdp11_du_drv is               -- display unit low level driver
1054
  generic (
1055
    CDWIDTH : positive :=  3);          -- clock divider width
1056
  port (
1057
    CLK : in slbit;                     -- clock
1058
    GRESET : in slbit;                  -- global reset
1059
    ROW0 : in slv22;                    -- led row 0 (22 leds, top)
1060
    ROW1 : in slv16;                    -- led row 1 (16 leds)
1061
    ROW2 : in slv16;                    -- led row 2 (16 leds)
1062
    ROW3 : in slv10;                    -- led row 3 (10 leds, bottom)
1063
    SWOPT : out slv8;                   -- option pattern from du
1064
    SWOPT_RDY : out slbit;              -- marks update of swopt
1065 8 wfjm
    DU_SCLK : out slbit;                -- DU: sclk
1066
    DU_SS_N : out slbit;                -- DU: ss_n
1067 2 wfjm
    DU_MOSI : out slbit;                -- DU: mosi (master out, slave in)
1068
    DU_MISO : in slbit                  -- DU: miso (master in, slave out)
1069
  );
1070
end component;
1071
 
1072
component pdp11_bram is                 -- BRAM based ext. memory dummy
1073
  generic (
1074
    AWIDTH : positive := 14);           -- address width
1075
  port (
1076
    CLK : in slbit;                     -- clock
1077
    GRESET : in slbit;                  -- global reset
1078
    EM_MREQ : in em_mreq_type;          -- em request
1079
    EM_SRES : out em_sres_type          -- em response
1080
  );
1081
end component;
1082
 
1083 9 wfjm
component pdp11_core_rbus is            -- core to rbus interface
1084 2 wfjm
  generic (
1085 28 wfjm
    RB_ADDR_CORE : slv16 := slv(to_unsigned(16#0000#,16));
1086
    RB_ADDR_IBUS : slv16 := slv(to_unsigned(16#4000#,16)));
1087 2 wfjm
  port (
1088
    CLK : in slbit;                     -- clock
1089
    RESET : in slbit;                   -- reset
1090
    RB_MREQ : in rb_mreq_type;          -- rbus: request
1091
    RB_SRES : out rb_sres_type;         -- rbus: response
1092 27 wfjm
    RB_STAT : out slv4;                 -- rbus: status flags
1093 8 wfjm
    RB_LAM : out slbit;                 -- remote attention
1094 2 wfjm
    CPU_RESET : out slbit;              -- cpu master reset
1095
    CP_CNTL : out cp_cntl_type;         -- console control port
1096
    CP_ADDR : out cp_addr_type;         -- console address port
1097
    CP_DIN : out slv16;                 -- console data in
1098
    CP_STAT : in cp_stat_type;          -- console status port
1099
    CP_DOUT : in slv16                  -- console data out
1100
  );
1101
end component;
1102
 
1103
-- ----- move later to pdp11_conf --------------------------------------------
1104
 
1105
constant conf_vect_pirq : integer := 8#240#;
1106
constant conf_pri_pirq_1 : integer := 1;
1107
constant conf_pri_pirq_2 : integer := 2;
1108
constant conf_pri_pirq_3 : integer := 3;
1109
constant conf_pri_pirq_4 : integer := 4;
1110
constant conf_pri_pirq_5 : integer := 5;
1111
constant conf_pri_pirq_6 : integer := 6;
1112
constant conf_pri_pirq_7 : integer := 7;
1113
 
1114
end package pdp11;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.