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

Subversion Repositories w11

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

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

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

powered by: WebSVN 2.1.0

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