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

Subversion Repositories w11

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

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

Line No. Rev Author Line
1 13 wfjm
-- $Id: pdp11_dpath.vhd 427 2011-11-19 21:04:11Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2006-2011 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
-- Module Name:    pdp11_dpath - syn
16
-- Description:    pdp11: CPU datapath
17
--
18
-- Dependencies:   pdp11_gpr
19
--                 pdp11_psr
20 8 wfjm
--                 pdp11_ounit
21
--                 pdp11_aunit
22
--                 pdp11_lunit
23
--                 pdp11_munit
24 2 wfjm
--
25
-- Test bench:     tb/tb_pdp11_core (implicit)
26
-- Target Devices: generic
27 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29
28 2 wfjm
-- Revision History: 
29
-- Date         Rev Version  Comment
30 13 wfjm
-- 2011-11-18   427   1.2.2  now numeric_std clean
31 8 wfjm
-- 2010-09-18   300   1.2.1  rename (adlm)box->(oalm)unit
32 2 wfjm
-- 2010-06-13   305   1.2    rename CPDIN -> CP_DIN; add CP_DOUT out port;
33
--                           remove CPADDR out port; drop R_CPADDR, proc_cpaddr;
34
--                           added R_CPDOUT, proc_cpdout
35
-- 2009-05-30   220   1.1.6  final removal of snoopers (were already commented)
36
-- 2008-12-14   177   1.1.5  fill gpr_* fields in DM_STAT_DP
37
-- 2008-08-22   161   1.1.4  rename ubf_ -> ibf_; use iblib
38
-- 2008-04-19   137   1.1.3  add DM_STAT_DP port
39
-- 2008-03-02   121   1.1.2  remove snoopers
40
-- 2008-02-24   119   1.1.1  add CPADDR register, remove R_MDIN (not needed)
41
-- 2007-12-30   107   1.1    use IB_MREQ/IB_SRES interface now (for psr access)
42
-- 2007-06-14    56   1.0.1  Use slvtypes.all
43
-- 2007-05-12    26   1.0    Initial version 
44
------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48 13 wfjm
use ieee.numeric_std.all;
49 2 wfjm
 
50
use work.slvtypes.all;
51
use work.iblib.all;
52
use work.pdp11.all;
53
 
54
-- ----------------------------------------------------------------------------
55
 
56
entity pdp11_dpath is                   -- CPU datapath
57
  port (
58
    CLK : in slbit;                     -- clock
59
    CRESET : in slbit;                  -- console reset
60
    CNTL : in dpath_cntl_type;          -- control interface
61
    STAT : out dpath_stat_type;         -- status interface
62
    CP_DIN : in slv16;                  -- console port data in
63
    CP_DOUT : out slv16;                -- console port data out
64
    PSWOUT : out psw_type;              -- current psw
65
    PCOUT : out slv16;                  -- current pc
66
    IREG : out slv16;                   -- ireg out
67
    VM_ADDR : out slv16;                -- virt. memory address
68
    VM_DOUT : in slv16;                 -- virt. memory data out
69
    VM_DIN : out slv16;                 -- virt. memory data in
70
    IB_MREQ : in ib_mreq_type;          -- ibus request
71
    IB_SRES : out ib_sres_type;         -- ibus response    
72
    DM_STAT_DP : out dm_stat_dp_type    -- debug and monitor status
73
  );
74
end pdp11_dpath;
75
 
76
architecture syn of pdp11_dpath is
77
 
78
  signal R_DSRC : slv16 := (others=>'0');  -- SRC register
79
  signal R_DDST : slv16 := (others=>'0');  -- DST register
80
  signal R_DTMP : slv16 := (others=>'0');  -- TMP register
81
 
82
  signal R_IREG : slv16 := (others=>'0');  -- IREG register
83
 
84
  signal R_CPDOUT : slv16 := (others=>'0'); -- cp dout buffer
85
 
86
  signal GPR_DSRC : slv16 := (others=>'0');  -- 
87
  signal GPR_DDST : slv16 := (others=>'0');  -- 
88
  signal GPR_PC : slv16 := (others=>'0');    -- 
89
 
90
  signal PSW : psw_type := psw_init;     --
91
  signal CCIN : slv4 := (others=>'0');   -- cc input to xbox's
92
  signal CCOUT : slv4 := (others=>'0');  -- cc output from xbox's
93
 
94
  signal DRES : slv16 := (others=>'0');  -- result bus
95
  signal DRESE : slv16 := (others=>'0'); -- result bus extra
96
 
97 8 wfjm
  signal OUNIT_DOUT : slv16 := (others=>'0'); -- result ounit
98
  signal AUNIT_DOUT : slv16 := (others=>'0'); -- result aunit
99
  signal LUNIT_DOUT : slv16 := (others=>'0'); -- result lunit
100
  signal MUNIT_DOUT : slv16 := (others=>'0'); -- result munit
101 2 wfjm
 
102 8 wfjm
  signal OUNIT_NZOUT : slv2 := (others=>'0'); -- nz flags ounit
103
  signal OUNIT_CCOUT : slv4 := (others=>'0'); -- cc flags ounit
104
  signal AUNIT_CCOUT : slv4 := (others=>'0'); -- cc flags aunit
105
  signal LUNIT_CCOUT : slv4 := (others=>'0'); -- cc flags lunit
106
  signal MUNIT_CCOUT : slv4 := (others=>'0'); -- cc flags munit
107 2 wfjm
 
108
  subtype  lal_ibf_addr  is integer range 15 downto 1;
109
  subtype  lah_ibf_addr  is integer range  5 downto 0;
110
  constant lah_ibf_ena_22bit: integer :=  6;
111
  constant lah_ibf_ena_ubmap: integer :=  7;
112
 
113
begin
114
 
115
  GPR : pdp11_gpr port map (
116
    CLK   => CLK,
117
    DIN   => DRES,
118
    ASRC  => CNTL.gpr_asrc,
119
    ADST  => CNTL.gpr_adst,
120
    MODE  => CNTL.gpr_mode,
121
    RSET  => CNTL.gpr_rset,
122
    WE    => CNTL.gpr_we,
123
    BYTOP => CNTL.gpr_bytop,
124
    PCINC => CNTL.gpr_pcinc,
125
    DSRC  => GPR_DSRC,
126
    DDST  => GPR_DDST,
127
    PC    => GPR_PC
128
  );
129
 
130
  PSR : pdp11_psr port map(
131
    CLK     => CLK,
132
    CRESET  => CRESET,
133
    DIN     => DRES,
134
    CCIN    => CCOUT,
135
    CCWE    => CNTL.psr_ccwe,
136
    WE      => CNTL.psr_we,
137
    FUNC    => CNTL.psr_func,
138
    PSW     => PSW,
139
    IB_MREQ => IB_MREQ,
140
    IB_SRES => IB_SRES
141
  );
142
 
143 8 wfjm
  OUNIT : pdp11_ounit port map (
144 2 wfjm
    DSRC   => R_DSRC,
145
    DDST   => R_DDST,
146
    DTMP   => R_DTMP,
147
    PC     => GPR_PC,
148 8 wfjm
    ASEL   => CNTL.ounit_asel,
149
    AZERO  => CNTL.ounit_azero,
150 2 wfjm
    IREG8  => R_IREG(7 downto 0),
151
    VMDOUT => VM_DOUT,
152 8 wfjm
    CONST  => CNTL.ounit_const,
153
    BSEL   => CNTL.ounit_bsel,
154
    OPSUB  => CNTL.ounit_opsub,
155
    DOUT   => OUNIT_DOUT,
156
    NZOUT  => OUNIT_NZOUT
157 2 wfjm
  );
158
 
159 8 wfjm
  AUNIT : pdp11_aunit port map (
160 2 wfjm
    DSRC   => R_DSRC,
161
    DDST   => R_DDST,
162
    CI     => CCIN(0),
163 8 wfjm
    SRCMOD => CNTL.aunit_srcmod,
164
    DSTMOD => CNTL.aunit_dstmod,
165
    CIMOD  => CNTL.aunit_cimod,
166
    CC1OP  => CNTL.aunit_cc1op,
167
    CCMODE => CNTL.aunit_ccmode,
168
    BYTOP  => CNTL.aunit_bytop,
169
    DOUT   => AUNIT_DOUT,
170
    CCOUT  => AUNIT_CCOUT
171 2 wfjm
  );
172
 
173 8 wfjm
  LUNIT : pdp11_lunit port map (
174 2 wfjm
    DSRC  => R_DSRC,
175
    DDST  => R_DDST,
176
    CCIN  => CCIN,
177 8 wfjm
    FUNC  => CNTL.lunit_func,
178
    BYTOP => CNTL.lunit_bytop,
179
    DOUT  => LUNIT_DOUT,
180
    CCOUT => LUNIT_CCOUT
181 2 wfjm
  );
182
 
183 8 wfjm
  MUNIT : pdp11_munit port map (
184 2 wfjm
    CLK       => CLK,
185
    DSRC      => R_DSRC,
186
    DDST      => R_DDST,
187
    DTMP      => R_DTMP,
188
    GPR_DSRC  => GPR_DSRC,
189 8 wfjm
    FUNC      => CNTL.munit_func,
190
    S_DIV     => CNTL.munit_s_div,
191
    S_DIV_CN  => CNTL.munit_s_div_cn,
192
    S_DIV_CR  => CNTL.munit_s_div_cr,
193
    S_ASH     => CNTL.munit_s_ash,
194
    S_ASH_CN  => CNTL.munit_s_ash_cn,
195
    S_ASHC    => CNTL.munit_s_ashc,
196
    S_ASHC_CN => CNTL.munit_s_ashc_cn,
197 2 wfjm
    SHC_TC    => STAT.shc_tc,
198
    DIV_CR    => STAT.div_cr,
199
    DIV_CQ    => STAT.div_cq,
200
    DIV_ZERO  => STAT.div_zero,
201
    DIV_OVFL  => STAT.div_ovfl,
202 8 wfjm
    DOUT      => MUNIT_DOUT,
203 2 wfjm
    DOUTE     => DRESE,
204 8 wfjm
    CCOUT     => MUNIT_CCOUT
205 2 wfjm
  );
206
 
207
  CCIN <= PSW.cc;
208
 
209 8 wfjm
  OUNIT_CCOUT <= OUNIT_NZOUT & "0" & CCIN(0); -- clear v, keep c
210 2 wfjm
 
211 8 wfjm
  proc_dres_sel: process (OUNIT_DOUT, AUNIT_DOUT, LUNIT_DOUT, MUNIT_DOUT,
212 2 wfjm
                          VM_DOUT, R_IREG, CP_DIN, CNTL)
213
  begin
214
    case CNTL.dres_sel is
215 8 wfjm
      when c_dpath_res_ounit  => DRES <= OUNIT_DOUT;
216
      when c_dpath_res_aunit  => DRES <= AUNIT_DOUT;
217
      when c_dpath_res_lunit  => DRES <= LUNIT_DOUT;
218
      when c_dpath_res_munit  => DRES <= MUNIT_DOUT;
219 2 wfjm
      when c_dpath_res_vmdout => DRES <= VM_DOUT;
220
      when c_dpath_res_fpdout => DRES <= (others=>'0');
221
      when c_dpath_res_ireg   => DRES <= R_IREG;
222
      when c_dpath_res_cpdin  => DRES <= CP_DIN;
223
      when others => null;
224
    end case;
225
  end process proc_dres_sel;
226
 
227 8 wfjm
  proc_cres_sel: process (OUNIT_CCOUT, AUNIT_CCOUT, LUNIT_CCOUT, MUNIT_CCOUT,
228 2 wfjm
                          CCIN, CNTL)
229
  begin
230
    case CNTL.cres_sel is
231 8 wfjm
      when c_dpath_res_ounit  => CCOUT <= OUNIT_CCOUT;
232
      when c_dpath_res_aunit  => CCOUT <= AUNIT_CCOUT;
233
      when c_dpath_res_lunit  => CCOUT <= LUNIT_CCOUT;
234
      when c_dpath_res_munit  => CCOUT <= MUNIT_CCOUT;
235 2 wfjm
      when c_dpath_res_vmdout => CCOUT <= CCIN;
236
      when c_dpath_res_fpdout => CCOUT <= "0000";
237
      when c_dpath_res_ireg   => CCOUT <= CCIN;
238
      when c_dpath_res_cpdin  => CCOUT <= CCIN;
239
      when others => null;
240
    end case;
241
  end process proc_cres_sel;
242
 
243
  proc_dregs: process (CLK)
244
  begin
245
 
246 13 wfjm
    if rising_edge(CLK) then
247 2 wfjm
 
248
      if CNTL.dsrc_we = '1' then
249
        if CNTL.dsrc_sel = '0' then
250
          R_DSRC <= GPR_DSRC;
251
        else
252
          R_DSRC <= DRES;
253
        end if;
254
      end if;
255
 
256
      if CNTL.ddst_we = '1' then
257
        if CNTL.ddst_sel = '0' then
258
          R_DDST <= GPR_DDST;
259
        else
260
          R_DDST <= DRES;
261
        end if;
262
      end if;
263
 
264
      if CNTL.dtmp_we = '1' then
265
        case CNTL.dtmp_sel is
266
          when c_dpath_dtmp_dsrc  => R_DTMP <= GPR_DSRC;
267
          when c_dpath_dtmp_psw   =>
268
            R_DTMP <= (others=>'0');
269
            R_DTMP(psw_ibf_cmode) <= PSW.cmode;
270
            R_DTMP(psw_ibf_pmode) <= PSW.pmode;
271
            R_DTMP(psw_ibf_rset)  <= PSW.rset;
272
            R_DTMP(psw_ibf_pri)   <= PSW.pri;
273
            R_DTMP(psw_ibf_tflag) <= PSW.tflag;
274
            R_DTMP(psw_ibf_cc)    <= PSW.cc;
275
          when c_dpath_dtmp_dres  => R_DTMP <= DRES;
276
          when c_dpath_dtmp_drese => R_DTMP <= DRESE;
277
          when others => null;
278
        end case;
279
      end if;
280
 
281
    end if;
282
 
283
  end process proc_dregs;
284
 
285
  proc_mregs: process (CLK)
286
  begin
287
 
288 13 wfjm
    if rising_edge(CLK) then
289 2 wfjm
 
290
      if CNTL.ireg_we = '1' then
291
        R_IREG <= VM_DOUT;
292
      end if;
293
 
294
    end if;
295
  end process proc_mregs;
296
 
297
  proc_cpdout: process (CLK)
298
  begin
299 13 wfjm
    if rising_edge(CLK) then
300 2 wfjm
      if CRESET = '1' then
301
        R_CPDOUT <= (others=>'0');
302
      else
303
        if CNTL.cpdout_we = '1' then
304
          R_CPDOUT <= DRES;
305
        end if;
306
      end if;
307
    end if;
308
  end process proc_cpdout;
309
 
310
  proc_vmaddr_sel: process (R_DSRC, R_DDST, R_DTMP, GPR_PC, CNTL)
311
  begin
312
    case CNTL.vmaddr_sel is
313
      when c_dpath_vmaddr_dsrc => VM_ADDR <= R_DSRC;
314
      when c_dpath_vmaddr_ddst => VM_ADDR <= R_DDST;
315
      when c_dpath_vmaddr_dtmp => VM_ADDR <= R_DTMP;
316
      when c_dpath_vmaddr_pc   => VM_ADDR <= GPR_PC;
317
      when others => null;
318
    end case;
319
  end process proc_vmaddr_sel;
320
 
321
  STAT.ccout_z <= CCOUT(2);             -- current Z cc flag
322
 
323
  PSWOUT  <= PSW;
324
  PCOUT   <= GPR_PC;
325
  IREG    <= R_IREG;
326
  VM_DIN  <= DRES;
327
  CP_DOUT <= R_CPDOUT;
328
 
329
  DM_STAT_DP.pc        <= GPR_PC;
330
  DM_STAT_DP.psw       <= PSW;
331
  DM_STAT_DP.ireg      <= R_IREG;
332
  DM_STAT_DP.ireg_we   <= CNTL.ireg_we;
333
  DM_STAT_DP.dsrc      <= R_DSRC;
334
  DM_STAT_DP.ddst      <= R_DDST;
335
  DM_STAT_DP.dtmp      <= R_DTMP;
336
  DM_STAT_DP.dres      <= DRES;
337
  DM_STAT_DP.gpr_adst  <= CNTL.gpr_adst;
338
  DM_STAT_DP.gpr_mode  <= CNTL.gpr_mode;
339
  DM_STAT_DP.gpr_bytop <= CNTL.gpr_bytop;
340
  DM_STAT_DP.gpr_we    <= CNTL.gpr_we;
341
 
342
end syn;

powered by: WebSVN 2.1.0

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