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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.5/] [rtl/] [w11a/] [pdp11_lbox.vhd] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wfjm
-- $Id: pdp11_lbox.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2006-2008 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_lbox - syn
16
-- Description:    pdp11: logic unit for data (lbox)
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
-- 2008-03-30   131   1.0.2  BUGFIX: SXT clears V condition code
25
-- 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
entity pdp11_lbox is                    -- logic unit for data (lbox)
39
  port (
40
    DSRC : in slv16;                    -- 'src' data in
41
    DDST : in slv16;                    -- 'dst' data in
42
    CCIN : in slv4;                     -- condition codes in
43
    FUNC : in slv4;                     -- function
44
    BYTOP : in slbit;                   -- byte operation
45
    DOUT : out slv16;                   -- data output
46
    CCOUT : out slv4                    -- condition codes out
47
  );
48
end pdp11_lbox;
49
 
50
architecture syn of pdp11_lbox is
51
 
52
-- --------------------------------------
53
 
54
begin
55
 
56
  process (DSRC, DDST, CCIN, FUNC, BYTOP)
57
    variable iout : slv16 := (others=>'0');
58
    variable inzstd : slbit := '0';
59
    variable ino : slbit := '0';
60
    variable izo : slbit := '0';
61
    variable ivo : slbit := '0';
62
    variable ico : slbit := '0';
63
 
64
    alias DSRC_L : slv8 is DSRC(7 downto 0);
65
    alias DSRC_H : slv8 is DSRC(15 downto 8);
66
    alias DDST_L : slv8 is DDST(7 downto 0);
67
    alias DDST_H : slv8 is DDST(15 downto 8);
68
    alias NI : slbit is CCIN(3);
69
    alias ZI : slbit is CCIN(2);
70
    alias VI : slbit is CCIN(1);
71
    alias CI : slbit is CCIN(0);
72
    alias iout_l : slv8 is iout(7 downto 0);
73
    alias iout_h : slv8 is iout(15 downto 8);
74
 
75
  begin
76
 
77
    iout := (others=>'0');
78
    inzstd := '1';                      -- use standard logic by default
79
    ino := '0';
80
    izo := '0';
81
    ivo := '0';
82
    ico := '0';
83
 
84
--
85
-- the decoding of FUNC is done "manually" to get a structure based on
86
-- a 8->1 pattern. This matches the opcode structure and seems most
87
-- efficient.
88
--
89
 
90
    if FUNC(3) = '0' then
91
      if BYTOP = '0' then
92
 
93
        case FUNC(2 downto 0) is
94
          when "000" =>                 -- ASR
95
            iout := DDST(15) & DDST(15 downto 1);
96
            ico := DDST(0);
97
            ivo := iout(15) xor ico;
98
 
99
          when "001"  =>                -- ASL
100
            iout := DDST(14 downto 0) & '0';
101
            ico := DDST(15);
102
            ivo := iout(15) xor ico;
103
 
104
          when "010" =>                 -- ROR
105
            iout := CI & DDST(15 downto 1);
106
            ico := DDST(0);
107
            ivo := iout(15) xor ico;
108
 
109
          when "011"  =>                -- ROL
110
            iout := DDST(14 downto 0) & CI;
111
            ico := DDST(15);
112
            ivo := iout(15) xor ico;
113
 
114
          when "100" =>                 -- BIS
115
            iout := DDST or DSRC;
116
            ico := CI;
117
 
118
          when "101" =>                 -- BIC
119
            iout := DDST and not DSRC;
120
            ico := CI;
121
 
122
          when "110" =>                 -- BIT
123
            iout := DDST and DSRC;
124
            ico := CI;
125
 
126
          when "111" =>                 -- MOV
127
            iout := DSRC;
128
            ico := CI;
129
          when others => null;
130
        end case;
131
 
132
      else
133
 
134
        case FUNC(2 downto 0) is
135
          when "000" =>                 -- ASRB
136
            iout_l := DDST_L(7) & DDST_L(7 downto 1);
137
            ico := DDST_L(0);
138
            ivo := iout_l(7) xor ico;
139
 
140
          when "001"  =>                -- ASLB
141
            iout_l := DDST(6 downto 0) & '0';
142
            ico := DDST(7);
143
            ivo := iout_l(7) xor ico;
144
 
145
          when "010" =>                 -- RORB
146
            iout_l := CI & DDST_L(7 downto 1);
147
            ico := DDST_L(0);
148
            ivo := iout_l(7) xor ico;
149
 
150
          when "011"  =>                -- ROLB
151
            iout_l := DDST_L(6 downto 0) & CI;
152
            ico := DDST_L(7);
153
            ivo := iout_l(7) xor ico;
154
 
155
          when "100" =>                 -- BISB
156
            iout_l := DDST_L or DSRC_L;
157
            ico := CI;
158
 
159
          when "101" =>                 -- BICB
160
            iout_l := DDST_L and not DSRC_L;
161
            ico := CI;
162
 
163
          when "110" =>                 -- BITB
164
            iout_l := DDST_L and DSRC_L;
165
            ico := CI;
166
 
167
          when "111" =>                 -- MOVB
168
            iout_l := DSRC_L;
169
            iout_h := (others=>DSRC_L(7));
170
            ico := CI;
171
          when others => null;
172
        end case;
173
      end if;
174
 
175
    else
176
      case FUNC(2 downto 0) is
177
        when "000" =>                   -- SXT
178
          iout := (others=>NI);
179
          inzstd := '0';
180
          ino := NI;
181
          izo := not NI;
182
          ivo := '0';
183
          ico := CI;
184
 
185
        when "001" =>                   -- SWAP
186
          iout := DDST_L & DDST_H;
187
          inzstd := '0';
188
          ino := iout(7);
189
          if unsigned(iout(7 downto 0)) = 0 then
190
            izo := '1';
191
          else
192
            izo := '0';
193
          end if;
194
 
195
        when "010" =>                   -- XOR
196
          iout := DDST xor DSRC;
197
          ico := CI;
198
 
199
        when others => null;
200
 
201
      end case;
202
    end if;
203
 
204
    DOUT <= iout;
205
 
206
    if inzstd = '1' then
207
      if BYTOP = '1' then
208
        ino := iout(7);
209
        if unsigned(iout(7 downto 0)) = 0 then
210
          izo := '1';
211
        else
212
          izo := '0';
213
        end if;
214
      else
215
        ino := iout(15);
216
        if unsigned(iout) = 0 then
217
          izo := '1';
218
        else
219
          izo := '0';
220
        end if;
221
      end if;
222
    end if;
223
 
224
    CCOUT(3) <= ino;
225
    CCOUT(2) <= izo;
226
    CCOUT(1) <= ivo;
227
    CCOUT(0) <= ico;
228
 
229
  end process;
230
 
231
end syn;

powered by: WebSVN 2.1.0

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