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

Subversion Repositories w11

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

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

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

powered by: WebSVN 2.1.0

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