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

Subversion Repositories t400

[/] [t400/] [trunk/] [rtl/] [vhdl/] [t400_skip.vhd] - Blame information for rev 70

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

Line No. Rev Author Line
1 2 arniml
-------------------------------------------------------------------------------
2
--
3
-- The skip unit.
4
-- Skip conditions are checked here and communicated to the decoder unit.
5
--
6 70 arniml
-- $Id: t400_skip.vhd,v 1.3 2006-05-27 19:16:52 arniml Exp $
7 2 arniml
--
8
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org)
9
--
10
-- All rights reserved
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/cvsweb.shtml/t400/
44
--
45
-------------------------------------------------------------------------------
46
 
47
library ieee;
48
use ieee.std_logic_1164.all;
49
 
50 70 arniml
use work.t400_opt_pack.all;
51 2 arniml
use work.t400_pack.all;
52
 
53
entity t400_skip is
54
 
55 70 arniml
  generic (
56
    opt_type_g : integer := t400_opt_type_420_c
57
  );
58 2 arniml
  port (
59
    ck_i       : in  std_logic;
60
    ck_en_i    : in  boolean;
61
    por_i      : in  boolean;
62
    res_i      : in  boolean;
63
    op_i       : in  skip_op_t;
64
    dec_data_i : in  dec_data_t;
65
    carry_i    : in  std_logic;
66
    c_i        : in  std_logic;
67
    bd_i       : in  dw_t;
68
    is_lbi_i   : in  boolean;
69
    a_i        : in  dw_t;
70
    m_i        : in  dw_t;
71
    g_i        : in  dw_t;
72 36 arniml
    tim_c_i    : in  boolean;
73 2 arniml
    skip_o     : out boolean;
74
    skip_lbi_o : out boolean
75
  );
76
 
77
end t400_skip;
78
 
79
 
80
library ieee;
81
use ieee.numeric_std.all;
82
 
83
architecture rtl of t400_skip is
84
 
85
  signal skip_q,
86
         skip_next_q : boolean;
87
  signal skip_lbi_q  : boolean;
88
 
89 70 arniml
  signal skip_int_q  : boolean;
90
 
91 2 arniml
begin
92
 
93
  -----------------------------------------------------------------------------
94
  -- Process skip
95
  --
96
  -- Purpose:
97
  --   Implements the skip logic.
98
  --
99
  skip: process (ck_i, por_i)
100 70 arniml
    variable t420_type_v : boolean;
101 2 arniml
  begin
102
    if por_i then
103
      skip_next_q <= false;
104
      skip_q      <= false;
105
      skip_lbi_q  <= false;
106 70 arniml
      skip_int_q  <= false;
107 2 arniml
 
108
    elsif ck_i'event and ck_i = '1' then
109
      if    res_i then
110
        -- synchronous reset upon external reset event
111
        skip_next_q    <= false;
112
        skip_q         <= false;
113
        skip_lbi_q     <= false;
114 70 arniml
        skip_int_q     <= false;
115 2 arniml
 
116
      elsif ck_en_i then
117 70 arniml
        t420_type_v := opt_type_g = t400_opt_type_420_c;
118
 
119 2 arniml
        if ck_en_i then
120
          case op_i is
121
            -- update skip information ----------------------------------------
122
            when SKIP_UPDATE =>
123
              skip_q       <= skip_next_q;
124
              -- also reset skip_next flag
125
              skip_next_q  <= false;
126
 
127
              -- reset skip-on-lbi flag when this was not an LBI
128
              if not is_lbi_i then
129
                skip_lbi_q <= false;
130
              end if;
131
 
132
            -- skip always ----------------------------------------------------
133
            when SKIP_NOW =>
134
              skip_next_q <= true;
135
 
136
            -- skip on carry --------------------------------------------------
137
            when SKIP_CARRY =>
138
              skip_next_q <= carry_i = '1';
139
 
140
            -- skip on C ------------------------------------------------------
141
            when SKIP_C =>
142
              skip_next_q <= c_i = '1';
143
 
144
            -- skip on BD underflow ------------------------------------------
145
            when SKIP_BD_UFLOW =>
146
              skip_next_q <= unsigned(bd_i) = 15;
147
 
148
            -- skip on BD overflow -------------------------------------------
149
            when SKIP_BD_OFLOW =>
150
              skip_next_q <= unsigned(bd_i) = 0;
151
 
152
            -- skip on LBI instruction ----------------------------------------
153
            when SKIP_LBI =>
154
              skip_lbi_q  <= true;
155
 
156
            -- skip on A and M equal ------------------------------------------
157
            when SKIP_A_M =>
158
              skip_next_q <= unsigned(a_i) = unsigned(m_i);
159
 
160
            -- skip on G zero -------------------------------------------------
161
            when SKIP_G_ZERO =>
162
              skip_next_q <= unsigned(g_i) = 0;
163
 
164
            -- skip on G bit --------------------------------------------------
165
            when SKIP_G_BIT =>
166
              skip_next_q <= unsigned(g_i and dec_data_i(dw_range_t)) = 0;
167
 
168
            -- skip on M bit --------------------------------------------------
169
            when SKIP_M_BIT =>
170
              skip_next_q <= unsigned(m_i and dec_data_i(dw_range_t)) = 0;
171
 
172
            -- skip on timer carry --------------------------------------------
173
            when SKIP_TIMER =>
174 36 arniml
              skip_next_q <= tim_c_i;
175 2 arniml
              null;
176
 
177 70 arniml
            -- push skip state when vectoring to interrupt routine ------------
178
            when SKIP_PUSH =>
179
              if t420_type_v then
180
                -- save next skip flag
181
                skip_int_q  <= skip_next_q;
182
                skip_next_q <= false;
183
                -- never skip first instruction of interrupt routine
184
                skip_q      <= false;
185
              end if;
186
 
187
            -- pop skip state for RET from interrupt routine ------------------
188
            when SKIP_POP =>
189
              if t420_type_v then
190
                skip_q      <= skip_int_q;
191
                skip_next_q <= false;
192
                skip_int_q  <= false;
193
              end if;
194
 
195 2 arniml
            when others =>
196
              null;
197
          end case;
198
        end if;
199
      end if;
200
    end if;
201
  end process skip;
202
  --
203
  -----------------------------------------------------------------------------
204
 
205
 
206
  -----------------------------------------------------------------------------
207
  -- Output mapping
208
  -----------------------------------------------------------------------------
209
  skip_o     <= skip_q;
210
  skip_lbi_o <= skip_lbi_q;
211
 
212
end rtl;
213
 
214
 
215
-------------------------------------------------------------------------------
216
-- File History:
217
--
218
-- $Log: not supported by cvs2svn $
219 70 arniml
-- Revision 1.2  2006/05/20 02:47:52  arniml
220
-- skip-on-timer implemented
221
--
222 36 arniml
-- Revision 1.1.1.1  2006/05/06 01:56:45  arniml
223
-- import from local CVS repository, LOC_CVS_0_1
224
--
225 2 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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