1 |
2 |
arniml |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- The skip unit.
|
4 |
|
|
-- Skip conditions are checked here and communicated to the decoder unit.
|
5 |
|
|
--
|
6 |
102 |
arniml |
-- $Id: t400_skip.vhd,v 1.5 2006-06-05 14:20:34 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 |
102 |
arniml |
-- System Interface -------------------------------------------------------
|
60 |
2 |
arniml |
ck_i : in std_logic;
|
61 |
|
|
ck_en_i : in boolean;
|
62 |
|
|
por_i : in boolean;
|
63 |
|
|
res_i : in boolean;
|
64 |
102 |
arniml |
-- Control Interface ------------------------------------------------------
|
65 |
2 |
arniml |
op_i : in skip_op_t;
|
66 |
|
|
dec_data_i : in dec_data_t;
|
67 |
|
|
carry_i : in std_logic;
|
68 |
|
|
c_i : in std_logic;
|
69 |
|
|
bd_i : in dw_t;
|
70 |
|
|
is_lbi_i : in boolean;
|
71 |
102 |
arniml |
skip_o : out boolean;
|
72 |
|
|
skip_lbi_o : out boolean;
|
73 |
|
|
-- Data Interface ---------------------------------------------------------
|
74 |
2 |
arniml |
a_i : in dw_t;
|
75 |
|
|
m_i : in dw_t;
|
76 |
|
|
g_i : in dw_t;
|
77 |
102 |
arniml |
tim_c_i : in boolean
|
78 |
2 |
arniml |
);
|
79 |
|
|
|
80 |
|
|
end t400_skip;
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
library ieee;
|
84 |
|
|
use ieee.numeric_std.all;
|
85 |
|
|
|
86 |
|
|
architecture rtl of t400_skip is
|
87 |
|
|
|
88 |
|
|
signal skip_q,
|
89 |
|
|
skip_next_q : boolean;
|
90 |
|
|
signal skip_lbi_q : boolean;
|
91 |
|
|
|
92 |
70 |
arniml |
signal skip_int_q : boolean;
|
93 |
|
|
|
94 |
2 |
arniml |
begin
|
95 |
|
|
|
96 |
|
|
-----------------------------------------------------------------------------
|
97 |
|
|
-- Process skip
|
98 |
|
|
--
|
99 |
|
|
-- Purpose:
|
100 |
|
|
-- Implements the skip logic.
|
101 |
|
|
--
|
102 |
|
|
skip: process (ck_i, por_i)
|
103 |
70 |
arniml |
variable t420_type_v : boolean;
|
104 |
2 |
arniml |
begin
|
105 |
|
|
if por_i then
|
106 |
|
|
skip_next_q <= false;
|
107 |
|
|
skip_q <= false;
|
108 |
|
|
skip_lbi_q <= false;
|
109 |
70 |
arniml |
skip_int_q <= false;
|
110 |
2 |
arniml |
|
111 |
|
|
elsif ck_i'event and ck_i = '1' then
|
112 |
|
|
if res_i then
|
113 |
|
|
-- synchronous reset upon external reset event
|
114 |
|
|
skip_next_q <= false;
|
115 |
|
|
skip_q <= false;
|
116 |
|
|
skip_lbi_q <= false;
|
117 |
70 |
arniml |
skip_int_q <= false;
|
118 |
2 |
arniml |
|
119 |
|
|
elsif ck_en_i then
|
120 |
70 |
arniml |
t420_type_v := opt_type_g = t400_opt_type_420_c;
|
121 |
|
|
|
122 |
2 |
arniml |
if ck_en_i then
|
123 |
|
|
case op_i is
|
124 |
|
|
-- update skip information ----------------------------------------
|
125 |
|
|
when SKIP_UPDATE =>
|
126 |
|
|
skip_q <= skip_next_q;
|
127 |
|
|
-- also reset skip_next flag
|
128 |
|
|
skip_next_q <= false;
|
129 |
|
|
|
130 |
|
|
-- reset skip-on-lbi flag when this was not an LBI
|
131 |
|
|
if not is_lbi_i then
|
132 |
|
|
skip_lbi_q <= false;
|
133 |
|
|
end if;
|
134 |
|
|
|
135 |
|
|
-- skip always ----------------------------------------------------
|
136 |
|
|
when SKIP_NOW =>
|
137 |
|
|
skip_next_q <= true;
|
138 |
|
|
|
139 |
|
|
-- skip on carry --------------------------------------------------
|
140 |
|
|
when SKIP_CARRY =>
|
141 |
|
|
skip_next_q <= carry_i = '1';
|
142 |
|
|
|
143 |
|
|
-- skip on C ------------------------------------------------------
|
144 |
|
|
when SKIP_C =>
|
145 |
|
|
skip_next_q <= c_i = '1';
|
146 |
|
|
|
147 |
|
|
-- skip on BD underflow ------------------------------------------
|
148 |
|
|
when SKIP_BD_UFLOW =>
|
149 |
|
|
skip_next_q <= unsigned(bd_i) = 15;
|
150 |
|
|
|
151 |
|
|
-- skip on BD overflow -------------------------------------------
|
152 |
|
|
when SKIP_BD_OFLOW =>
|
153 |
|
|
skip_next_q <= unsigned(bd_i) = 0;
|
154 |
|
|
|
155 |
|
|
-- skip on LBI instruction ----------------------------------------
|
156 |
|
|
when SKIP_LBI =>
|
157 |
|
|
skip_lbi_q <= true;
|
158 |
|
|
|
159 |
|
|
-- skip on A and M equal ------------------------------------------
|
160 |
|
|
when SKIP_A_M =>
|
161 |
|
|
skip_next_q <= unsigned(a_i) = unsigned(m_i);
|
162 |
|
|
|
163 |
|
|
-- skip on G zero -------------------------------------------------
|
164 |
|
|
when SKIP_G_ZERO =>
|
165 |
|
|
skip_next_q <= unsigned(g_i) = 0;
|
166 |
|
|
|
167 |
|
|
-- skip on G bit --------------------------------------------------
|
168 |
|
|
when SKIP_G_BIT =>
|
169 |
|
|
skip_next_q <= unsigned(g_i and dec_data_i(dw_range_t)) = 0;
|
170 |
|
|
|
171 |
|
|
-- skip on M bit --------------------------------------------------
|
172 |
|
|
when SKIP_M_BIT =>
|
173 |
|
|
skip_next_q <= unsigned(m_i and dec_data_i(dw_range_t)) = 0;
|
174 |
|
|
|
175 |
|
|
-- skip on timer carry --------------------------------------------
|
176 |
|
|
when SKIP_TIMER =>
|
177 |
36 |
arniml |
skip_next_q <= tim_c_i;
|
178 |
2 |
arniml |
null;
|
179 |
|
|
|
180 |
70 |
arniml |
-- push skip state when vectoring to interrupt routine ------------
|
181 |
|
|
when SKIP_PUSH =>
|
182 |
|
|
if t420_type_v then
|
183 |
|
|
-- save next skip flag
|
184 |
|
|
skip_int_q <= skip_next_q;
|
185 |
|
|
skip_next_q <= false;
|
186 |
|
|
-- never skip first instruction of interrupt routine
|
187 |
|
|
skip_q <= false;
|
188 |
|
|
end if;
|
189 |
|
|
|
190 |
|
|
-- pop skip state for RET from interrupt routine ------------------
|
191 |
|
|
when SKIP_POP =>
|
192 |
|
|
if t420_type_v then
|
193 |
90 |
arniml |
-- push'ed info must be pop'ed to skip_next_q as pop'ing
|
194 |
|
|
-- happens during RET of interrupt routine
|
195 |
|
|
-- skip info is valid for next instruction
|
196 |
|
|
skip_next_q <= skip_int_q;
|
197 |
70 |
arniml |
skip_int_q <= false;
|
198 |
|
|
end if;
|
199 |
|
|
|
200 |
2 |
arniml |
when others =>
|
201 |
|
|
null;
|
202 |
|
|
end case;
|
203 |
|
|
end if;
|
204 |
|
|
end if;
|
205 |
|
|
end if;
|
206 |
|
|
end process skip;
|
207 |
|
|
--
|
208 |
|
|
-----------------------------------------------------------------------------
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
-----------------------------------------------------------------------------
|
212 |
|
|
-- Output mapping
|
213 |
|
|
-----------------------------------------------------------------------------
|
214 |
|
|
skip_o <= skip_q;
|
215 |
|
|
skip_lbi_o <= skip_lbi_q;
|
216 |
|
|
|
217 |
|
|
end rtl;
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
-------------------------------------------------------------------------------
|
221 |
|
|
-- File History:
|
222 |
|
|
--
|
223 |
|
|
-- $Log: not supported by cvs2svn $
|
224 |
102 |
arniml |
-- Revision 1.4 2006/05/28 15:35:33 arniml
|
225 |
|
|
-- fix pop'ing of skip flag
|
226 |
|
|
--
|
227 |
90 |
arniml |
-- Revision 1.3 2006/05/27 19:16:52 arniml
|
228 |
|
|
-- interrupt functionality added
|
229 |
|
|
--
|
230 |
70 |
arniml |
-- Revision 1.2 2006/05/20 02:47:52 arniml
|
231 |
|
|
-- skip-on-timer implemented
|
232 |
|
|
--
|
233 |
36 |
arniml |
-- Revision 1.1.1.1 2006/05/06 01:56:45 arniml
|
234 |
|
|
-- import from local CVS repository, LOC_CVS_0_1
|
235 |
|
|
--
|
236 |
2 |
arniml |
-------------------------------------------------------------------------------
|