w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
pdp11_ounit.vhd
Go to the documentation of this file.
1-- $Id: pdp11_ounit.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: pdp11_ounit - syn
7-- Description: pdp11: arithmetic unit for addresses (ounit)
8--
9-- Dependencies: -
10-- Test bench: tb/tb_pdp11_core (implicit)
11-- Target Devices: generic
12-- Tool versions: ise 8.2-14.7; viv 2014.4; ghdl 0.18-0.31
13-- Revision History:
14-- Date Rev Version Comment
15-- 2011-11-18 427 1.1.1 now numeric_std clean
16-- 2010-09-18 300 1.1 renamed from abox
17-- 2007-06-14 56 1.0.1 Use slvtypes.all
18-- 2007-05-12 26 1.0 Initial version
19------------------------------------------------------------------------------
20
21library ieee;
22use ieee.std_logic_1164.all;
23use ieee.numeric_std.all;
24
25use work.slvtypes.all;
26use work.pdp11.all;
27
28-- ----------------------------------------------------------------------------
29
30entity pdp11_ounit is -- offset adder for addresses (ounit)
31 port (
32 DSRC : in slv16; -- 'src' data for port A
33 DDST : in slv16; -- 'dst' data for port A
34 DTMP : in slv16; -- 'tmp' data for port A
35 PC : in slv16; -- PC data for port A
36 ASEL : in slv2; -- selector for port A
37 AZERO : in slbit; -- force zero for port A
38 IREG8 : in slv8; -- 'ireg' data for port B
39 VMDOUT : in slv16; -- virt. memory data for port B
40 CONST : in slv9; -- sequencer const data for port B
41 BSEL : in slv2; -- selector for port B
42 OPSUB : in slbit; -- operation: 0 add, 1 sub
43 DOUT : out slv16; -- data output
44 NZOUT : out slv2 -- NZ condition codes out
45 );
46end pdp11_ounit;
47
48architecture syn of pdp11_ounit is
49
50-- --------------------------------------
51
52begin
53
54 process (DSRC, DDST, DTMP, PC, ASEL, AZERO,
56
57 variable ma : slv16 := (others=>'0'); -- effective port a data
58 variable mb : slv16 := (others=>'0'); -- effective port b data
59 variable sum : slv16 := (others=>'0'); -- sum
60 variable nzo : slbit := '0';
61
62 begin
63
64 if AZERO = '0' then
65 case ASEL is
66 when c_ounit_asel_dsrc => ma := DSRC;
67 when c_ounit_asel_ddst => ma := DDST;
68 when c_ounit_asel_dtmp => ma := DTMP;
69 when c_ounit_asel_pc => ma := PC;
70 when others => null;
71 end case;
72 else
73 ma := (others=>'0');
74 end if;
75
76 case BSEL is
77 when c_ounit_bsel_ireg6 => mb := "000000000" & IREG8(5 downto 0) & "0";
78 when c_ounit_bsel_ireg8 => mb := IREG8(7) & IREG8(7) & IREG8(7) &
79 IREG8(7) & IREG8(7) & IREG8(7) &
80 IREG8(7) & IREG8 & "0";
81 when c_ounit_bsel_vmdout => mb := VMDOUT;
82 when c_ounit_bsel_const => mb := "0000000" & CONST;
83 when others => null;
84 end case;
85
86 if OPSUB = '0' then
87 sum := slv(unsigned(ma) + unsigned(mb));
88 else
89 sum := slv(unsigned(ma) - unsigned(mb));
90 end if;
91
92 nzo := '0';
93 if unsigned(sum) = 0 then
94 nzo := '1';
95 else
96 nzo := '0';
97 end if;
98
99 DOUT <= sum;
100 NZOUT(1) <= sum(15);
101 NZOUT(0) <= nzo;
102
103 end process;
104
105end syn;
in VMDOUT slv16
Definition: pdp11_ounit.vhd:39
in OPSUB slbit
Definition: pdp11_ounit.vhd:42
in DDST slv16
Definition: pdp11_ounit.vhd:33
in AZERO slbit
Definition: pdp11_ounit.vhd:37
in ASEL slv2
Definition: pdp11_ounit.vhd:36
in IREG8 slv8
Definition: pdp11_ounit.vhd:38
out NZOUT slv2
Definition: pdp11_ounit.vhd:45
in DSRC slv16
Definition: pdp11_ounit.vhd:32
in CONST slv9
Definition: pdp11_ounit.vhd:40
in PC slv16
Definition: pdp11_ounit.vhd:35
in BSEL slv2
Definition: pdp11_ounit.vhd:41
out DOUT slv16
Definition: pdp11_ounit.vhd:43
in DTMP slv16
Definition: pdp11_ounit.vhd:34
Definition: pdp11.vhd:123
std_logic_vector( 8 downto 0) slv9
Definition: slvtypes.vhd:41
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31