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 8

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

Line No. Rev Author Line
1 8 wfjm
-- $Id: pdp11_ounit.vhd 330 2010-09-19 17:43:53Z mueller $
2 2 wfjm
--
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 8 wfjm
-- Module Name:    pdp11_ounit - syn
16
-- Description:    pdp11: arithmetic unit for addresses (ounit)
17 2 wfjm
--
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 8 wfjm
-- 2010-09-18   300   1.1    renamed from abox
25 2 wfjm
-- 2007-06-14    56   1.0.1  Use slvtypes.all
26
-- 2007-05-12    26   1.0    Initial version 
27
------------------------------------------------------------------------------
28
 
29
library ieee;
30
use ieee.std_logic_1164.all;
31
use ieee.std_logic_arith.all;
32
 
33
use work.slvtypes.all;
34
use work.pdp11.all;
35
 
36
-- ----------------------------------------------------------------------------
37
 
38 8 wfjm
entity pdp11_ounit is                   -- offset adder for addresses (ounit)
39 2 wfjm
  port (
40
    DSRC : in slv16;                    -- 'src' data for port A
41
    DDST : in slv16;                    -- 'dst' data for port A
42
    DTMP : in slv16;                    -- 'tmp' data for port A
43
    PC : in slv16;                      -- PC data for port A
44
    ASEL : in slv2;                     -- selector for port A
45
    AZERO : in slbit;                   -- force zero for port A
46
    IREG8 : in slv8;                    -- 'ireg' data for port B
47
    VMDOUT : in slv16;                  -- virt. memory data for port B
48
    CONST : in slv9;                    -- sequencer const data for port B
49
    BSEL : in slv2;                     -- selector for port B
50
    OPSUB : in slbit;                   -- operation: 0 add, 1 sub
51
    DOUT : out slv16;                   -- data output
52
    NZOUT : out slv2                    -- NZ condition codes out
53
  );
54 8 wfjm
end pdp11_ounit;
55 2 wfjm
 
56 8 wfjm
architecture syn of pdp11_ounit is
57 2 wfjm
 
58
-- --------------------------------------
59
 
60
begin
61
 
62
  process (DSRC, DDST, DTMP, PC, ASEL, AZERO,
63
           IREG8, VMDOUT, CONST, BSEL, OPSUB)
64
 
65
    variable ma : slv16 := (others=>'0');  -- effective port a data
66
    variable mb : slv16 := (others=>'0');  -- effective port b data
67
    variable sum : slv16 := (others=>'0'); -- sum
68
    variable nzo : slbit := '0';
69
 
70
  begin
71
 
72
    if AZERO = '0' then
73
      case ASEL is
74 8 wfjm
        when c_ounit_asel_dsrc => ma := DSRC;
75
        when c_ounit_asel_ddst => ma := DDST;
76
        when c_ounit_asel_dtmp => ma := DTMP;
77
        when c_ounit_asel_pc   => ma := PC;
78 2 wfjm
        when others => null;
79
      end case;
80
    else
81
      ma := (others=>'0');
82
    end if;
83
 
84
    case BSEL is
85 8 wfjm
      when c_ounit_bsel_ireg6  => mb := "000000000" & IREG8(5 downto 0) & "0";
86
      when c_ounit_bsel_ireg8  => mb := IREG8(7) & IREG8(7) & IREG8(7) &
87 2 wfjm
                                       IREG8(7) & IREG8(7) & IREG8(7) &
88
                                       IREG8(7) & IREG8 & "0";
89 8 wfjm
      when c_ounit_bsel_vmdout => mb := VMDOUT;
90
      when c_ounit_bsel_const  => mb := "0000000" & CONST;
91 2 wfjm
      when others => null;
92
    end case;
93
 
94
    if OPSUB = '0' then
95
      sum := unsigned(ma) + unsigned(mb);
96
    else
97
      sum := unsigned(ma) - unsigned(mb);
98
    end if;
99
 
100
    nzo := '0';
101
    if unsigned(sum) = 0 then
102
        nzo := '1';
103
    else
104
        nzo := '0';
105
    end if;
106
 
107
    DOUT <= sum;
108
    NZOUT(1) <= sum(15);
109
    NZOUT(0) <= nzo;
110
 
111
  end process;
112
 
113
end syn;

powered by: WebSVN 2.1.0

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