-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-- The skip unit.
|
-- The skip unit.
|
-- Skip conditions are checked here and communicated to the decoder unit.
|
-- Skip conditions are checked here and communicated to the decoder unit.
|
--
|
--
|
-- $Id: t400_skip.vhd,v 1.2 2006-05-20 02:47:52 arniml Exp $
|
-- $Id: t400_skip.vhd,v 1.3 2006-05-27 19:16:52 arniml Exp $
|
--
|
--
|
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org)
|
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org)
|
--
|
--
|
-- All rights reserved
|
-- All rights reserved
|
--
|
--
|
-- Redistribution and use in source and synthezised forms, with or without
|
-- Redistribution and use in source and synthezised forms, with or without
|
-- modification, are permitted provided that the following conditions are met:
|
-- modification, are permitted provided that the following conditions are met:
|
--
|
--
|
-- Redistributions of source code must retain the above copyright notice,
|
-- Redistributions of source code must retain the above copyright notice,
|
-- this list of conditions and the following disclaimer.
|
-- this list of conditions and the following disclaimer.
|
--
|
--
|
-- Redistributions in synthesized form must reproduce the above copyright
|
-- Redistributions in synthesized form must reproduce the above copyright
|
-- notice, this list of conditions and the following disclaimer in the
|
-- notice, this list of conditions and the following disclaimer in the
|
-- documentation and/or other materials provided with the distribution.
|
-- documentation and/or other materials provided with the distribution.
|
--
|
--
|
-- Neither the name of the author nor the names of other contributors may
|
-- Neither the name of the author nor the names of other contributors may
|
-- be used to endorse or promote products derived from this software without
|
-- be used to endorse or promote products derived from this software without
|
-- specific prior written permission.
|
-- specific prior written permission.
|
--
|
--
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
|
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
-- POSSIBILITY OF SUCH DAMAGE.
|
-- POSSIBILITY OF SUCH DAMAGE.
|
--
|
--
|
-- Please report bugs to the author, but before you do so, please
|
-- Please report bugs to the author, but before you do so, please
|
-- make sure that this is not a derivative work and that
|
-- make sure that this is not a derivative work and that
|
-- you have the latest version of this file.
|
-- you have the latest version of this file.
|
--
|
--
|
-- The latest version of this file can be found at:
|
-- The latest version of this file can be found at:
|
-- http://www.opencores.org/cvsweb.shtml/t400/
|
-- http://www.opencores.org/cvsweb.shtml/t400/
|
--
|
--
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
|
use work.t400_opt_pack.all;
|
use work.t400_pack.all;
|
use work.t400_pack.all;
|
|
|
entity t400_skip is
|
entity t400_skip is
|
|
|
|
generic (
|
|
opt_type_g : integer := t400_opt_type_420_c
|
|
);
|
port (
|
port (
|
ck_i : in std_logic;
|
ck_i : in std_logic;
|
ck_en_i : in boolean;
|
ck_en_i : in boolean;
|
por_i : in boolean;
|
por_i : in boolean;
|
res_i : in boolean;
|
res_i : in boolean;
|
op_i : in skip_op_t;
|
op_i : in skip_op_t;
|
dec_data_i : in dec_data_t;
|
dec_data_i : in dec_data_t;
|
carry_i : in std_logic;
|
carry_i : in std_logic;
|
c_i : in std_logic;
|
c_i : in std_logic;
|
bd_i : in dw_t;
|
bd_i : in dw_t;
|
is_lbi_i : in boolean;
|
is_lbi_i : in boolean;
|
a_i : in dw_t;
|
a_i : in dw_t;
|
m_i : in dw_t;
|
m_i : in dw_t;
|
g_i : in dw_t;
|
g_i : in dw_t;
|
tim_c_i : in boolean;
|
tim_c_i : in boolean;
|
skip_o : out boolean;
|
skip_o : out boolean;
|
skip_lbi_o : out boolean
|
skip_lbi_o : out boolean
|
);
|
);
|
|
|
end t400_skip;
|
end t400_skip;
|
|
|
|
|
library ieee;
|
library ieee;
|
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
|
|
architecture rtl of t400_skip is
|
architecture rtl of t400_skip is
|
|
|
signal skip_q,
|
signal skip_q,
|
skip_next_q : boolean;
|
skip_next_q : boolean;
|
signal skip_lbi_q : boolean;
|
signal skip_lbi_q : boolean;
|
|
|
|
signal skip_int_q : boolean;
|
|
|
begin
|
begin
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Process skip
|
-- Process skip
|
--
|
--
|
-- Purpose:
|
-- Purpose:
|
-- Implements the skip logic.
|
-- Implements the skip logic.
|
--
|
--
|
skip: process (ck_i, por_i)
|
skip: process (ck_i, por_i)
|
|
variable t420_type_v : boolean;
|
begin
|
begin
|
if por_i then
|
if por_i then
|
skip_next_q <= false;
|
skip_next_q <= false;
|
skip_q <= false;
|
skip_q <= false;
|
skip_lbi_q <= false;
|
skip_lbi_q <= false;
|
|
skip_int_q <= false;
|
|
|
elsif ck_i'event and ck_i = '1' then
|
elsif ck_i'event and ck_i = '1' then
|
if res_i then
|
if res_i then
|
-- synchronous reset upon external reset event
|
-- synchronous reset upon external reset event
|
skip_next_q <= false;
|
skip_next_q <= false;
|
skip_q <= false;
|
skip_q <= false;
|
skip_lbi_q <= false;
|
skip_lbi_q <= false;
|
|
skip_int_q <= false;
|
|
|
elsif ck_en_i then
|
elsif ck_en_i then
|
|
t420_type_v := opt_type_g = t400_opt_type_420_c;
|
|
|
if ck_en_i then
|
if ck_en_i then
|
case op_i is
|
case op_i is
|
-- update skip information ----------------------------------------
|
-- update skip information ----------------------------------------
|
when SKIP_UPDATE =>
|
when SKIP_UPDATE =>
|
skip_q <= skip_next_q;
|
skip_q <= skip_next_q;
|
-- also reset skip_next flag
|
-- also reset skip_next flag
|
skip_next_q <= false;
|
skip_next_q <= false;
|
|
|
-- reset skip-on-lbi flag when this was not an LBI
|
-- reset skip-on-lbi flag when this was not an LBI
|
if not is_lbi_i then
|
if not is_lbi_i then
|
skip_lbi_q <= false;
|
skip_lbi_q <= false;
|
end if;
|
end if;
|
|
|
-- skip always ----------------------------------------------------
|
-- skip always ----------------------------------------------------
|
when SKIP_NOW =>
|
when SKIP_NOW =>
|
skip_next_q <= true;
|
skip_next_q <= true;
|
|
|
-- skip on carry --------------------------------------------------
|
-- skip on carry --------------------------------------------------
|
when SKIP_CARRY =>
|
when SKIP_CARRY =>
|
skip_next_q <= carry_i = '1';
|
skip_next_q <= carry_i = '1';
|
|
|
-- skip on C ------------------------------------------------------
|
-- skip on C ------------------------------------------------------
|
when SKIP_C =>
|
when SKIP_C =>
|
skip_next_q <= c_i = '1';
|
skip_next_q <= c_i = '1';
|
|
|
-- skip on BD underflow ------------------------------------------
|
-- skip on BD underflow ------------------------------------------
|
when SKIP_BD_UFLOW =>
|
when SKIP_BD_UFLOW =>
|
skip_next_q <= unsigned(bd_i) = 15;
|
skip_next_q <= unsigned(bd_i) = 15;
|
|
|
-- skip on BD overflow -------------------------------------------
|
-- skip on BD overflow -------------------------------------------
|
when SKIP_BD_OFLOW =>
|
when SKIP_BD_OFLOW =>
|
skip_next_q <= unsigned(bd_i) = 0;
|
skip_next_q <= unsigned(bd_i) = 0;
|
|
|
-- skip on LBI instruction ----------------------------------------
|
-- skip on LBI instruction ----------------------------------------
|
when SKIP_LBI =>
|
when SKIP_LBI =>
|
skip_lbi_q <= true;
|
skip_lbi_q <= true;
|
|
|
-- skip on A and M equal ------------------------------------------
|
-- skip on A and M equal ------------------------------------------
|
when SKIP_A_M =>
|
when SKIP_A_M =>
|
skip_next_q <= unsigned(a_i) = unsigned(m_i);
|
skip_next_q <= unsigned(a_i) = unsigned(m_i);
|
|
|
-- skip on G zero -------------------------------------------------
|
-- skip on G zero -------------------------------------------------
|
when SKIP_G_ZERO =>
|
when SKIP_G_ZERO =>
|
skip_next_q <= unsigned(g_i) = 0;
|
skip_next_q <= unsigned(g_i) = 0;
|
|
|
-- skip on G bit --------------------------------------------------
|
-- skip on G bit --------------------------------------------------
|
when SKIP_G_BIT =>
|
when SKIP_G_BIT =>
|
skip_next_q <= unsigned(g_i and dec_data_i(dw_range_t)) = 0;
|
skip_next_q <= unsigned(g_i and dec_data_i(dw_range_t)) = 0;
|
|
|
-- skip on M bit --------------------------------------------------
|
-- skip on M bit --------------------------------------------------
|
when SKIP_M_BIT =>
|
when SKIP_M_BIT =>
|
skip_next_q <= unsigned(m_i and dec_data_i(dw_range_t)) = 0;
|
skip_next_q <= unsigned(m_i and dec_data_i(dw_range_t)) = 0;
|
|
|
-- skip on timer carry --------------------------------------------
|
-- skip on timer carry --------------------------------------------
|
when SKIP_TIMER =>
|
when SKIP_TIMER =>
|
skip_next_q <= tim_c_i;
|
skip_next_q <= tim_c_i;
|
null;
|
null;
|
|
|
|
-- push skip state when vectoring to interrupt routine ------------
|
|
when SKIP_PUSH =>
|
|
if t420_type_v then
|
|
-- save next skip flag
|
|
skip_int_q <= skip_next_q;
|
|
skip_next_q <= false;
|
|
-- never skip first instruction of interrupt routine
|
|
skip_q <= false;
|
|
end if;
|
|
|
|
-- pop skip state for RET from interrupt routine ------------------
|
|
when SKIP_POP =>
|
|
if t420_type_v then
|
|
skip_q <= skip_int_q;
|
|
skip_next_q <= false;
|
|
skip_int_q <= false;
|
|
end if;
|
|
|
when others =>
|
when others =>
|
null;
|
null;
|
end case;
|
end case;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process skip;
|
end process skip;
|
--
|
--
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Output mapping
|
-- Output mapping
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
skip_o <= skip_q;
|
skip_o <= skip_q;
|
skip_lbi_o <= skip_lbi_q;
|
skip_lbi_o <= skip_lbi_q;
|
|
|
end rtl;
|
end rtl;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File History:
|
-- File History:
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.2 2006/05/20 02:47:52 arniml
|
|
-- skip-on-timer implemented
|
|
--
|
-- Revision 1.1.1.1 2006/05/06 01:56:45 arniml
|
-- Revision 1.1.1.1 2006/05/06 01:56:45 arniml
|
-- import from local CVS repository, LOC_CVS_0_1
|
-- import from local CVS repository, LOC_CVS_0_1
|
--
|
--
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|