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

Subversion Repositories w11

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

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

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

powered by: WebSVN 2.1.0

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