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

Subversion Repositories w11

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

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

Line No. Rev Author Line
1 2 wfjm
-- $Id: pdp11_abox.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2006-2007 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
-- Module Name:    pdp11_abox - syn
16
-- Description:    pdp11: arithmetic unit for addresses (abox)
17
--
18
-- Dependencies:   -
19
-- Test bench:     tb/tb_pdp11_core (implicit)
20
-- Target Devices: generic
21
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
22
-- Revision History: 
23
-- Date         Rev Version  Comment
24
-- 2007-06-14    56   1.0.1  Use slvtypes.all
25
-- 2007-05-12    26   1.0    Initial version 
26
------------------------------------------------------------------------------
27
 
28
library ieee;
29
use ieee.std_logic_1164.all;
30
use ieee.std_logic_arith.all;
31
 
32
use work.slvtypes.all;
33
use work.pdp11.all;
34
 
35
-- ----------------------------------------------------------------------------
36
 
37
entity pdp11_abox is                    -- arithmetic unit for addresses (abox)
38
  port (
39
    DSRC : in slv16;                    -- 'src' data for port A
40
    DDST : in slv16;                    -- 'dst' data for port A
41
    DTMP : in slv16;                    -- 'tmp' data for port A
42
    PC : in slv16;                      -- PC data for port A
43
    ASEL : in slv2;                     -- selector for port A
44
    AZERO : in slbit;                   -- force zero for port A
45
    IREG8 : in slv8;                    -- 'ireg' data for port B
46
    VMDOUT : in slv16;                  -- virt. memory data for port B
47
    CONST : in slv9;                    -- sequencer const data for port B
48
    BSEL : in slv2;                     -- selector for port B
49
    OPSUB : in slbit;                   -- operation: 0 add, 1 sub
50
    DOUT : out slv16;                   -- data output
51
    NZOUT : out slv2                    -- NZ condition codes out
52
  );
53
end pdp11_abox;
54
 
55
architecture syn of pdp11_abox is
56
 
57
-- --------------------------------------
58
 
59
begin
60
 
61
  process (DSRC, DDST, DTMP, PC, ASEL, AZERO,
62
           IREG8, VMDOUT, CONST, BSEL, OPSUB)
63
 
64
    variable ma : slv16 := (others=>'0');  -- effective port a data
65
    variable mb : slv16 := (others=>'0');  -- effective port b data
66
    variable sum : slv16 := (others=>'0'); -- sum
67
    variable nzo : slbit := '0';
68
 
69
  begin
70
 
71
    if AZERO = '0' then
72
      case ASEL is
73
        when c_abox_asel_dsrc => ma := DSRC;
74
        when c_abox_asel_ddst => ma := DDST;
75
        when c_abox_asel_dtmp => ma := DTMP;
76
        when c_abox_asel_pc   => ma := PC;
77
        when others => null;
78
      end case;
79
    else
80
      ma := (others=>'0');
81
    end if;
82
 
83
    case BSEL is
84
      when c_abox_bsel_ireg6  => mb := "000000000" & IREG8(5 downto 0) & "0";
85
      when c_abox_bsel_ireg8  => mb := IREG8(7) & IREG8(7) & IREG8(7) &
86
                                       IREG8(7) & IREG8(7) & IREG8(7) &
87
                                       IREG8(7) & IREG8 & "0";
88
      when c_abox_bsel_vmdout => mb := VMDOUT;
89
      when c_abox_bsel_const  => mb := "0000000" & CONST;
90
      when others => null;
91
    end case;
92
 
93
    if OPSUB = '0' then
94
      sum := unsigned(ma) + unsigned(mb);
95
    else
96
      sum := unsigned(ma) - unsigned(mb);
97
    end if;
98
 
99
    nzo := '0';
100
    if unsigned(sum) = 0 then
101
        nzo := '1';
102
    else
103
        nzo := '0';
104
    end if;
105
 
106
    DOUT <= sum;
107
    NZOUT(1) <= sum(15);
108
    NZOUT(0) <= nzo;
109
 
110
  end process;
111
 
112
end syn;

powered by: WebSVN 2.1.0

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