Line 1... |
Line 1... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-- The Decoder unit.
|
-- The Decoder unit.
|
-- It decodes the instruction opcodes and executes them.
|
-- It decodes the instruction opcodes and executes them.
|
--
|
--
|
-- $Id: decoder.vhd,v 1.7 2004-04-15 22:06:05 arniml Exp $
|
-- $Id: decoder.vhd,v 1.8 2004-04-18 18:57:43 arniml Exp $
|
--
|
--
|
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
|
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
|
--
|
--
|
-- All rights reserved
|
-- All rights reserved
|
--
|
--
|
Line 227... |
Line 227... |
signal retr_executed_s : boolean;
|
signal retr_executed_s : boolean;
|
signal int_executed_s : boolean;
|
signal int_executed_s : boolean;
|
signal int_pending_s : boolean;
|
signal int_pending_s : boolean;
|
|
|
-- pragma translate_off
|
-- pragma translate_off
|
signal istrobe_s : std_logic;
|
signal istrobe_res_q : std_logic;
|
|
signal istrobe_q : std_logic;
|
signal injected_int_q : std_logic;
|
signal injected_int_q : std_logic;
|
-- pragma translate_on
|
-- pragma translate_on
|
|
|
begin
|
begin
|
|
|
Line 291... |
Line 292... |
-- Generates the control signals that are basically needed for the
|
-- Generates the control signals that are basically needed for the
|
-- handling of a machine cycle.
|
-- handling of a machine cycle.
|
--
|
--
|
machine_cycle: process (clk_mstate_i,
|
machine_cycle: process (clk_mstate_i,
|
clk_second_cycle_i,
|
clk_second_cycle_i,
|
|
last_cycle_s,
|
ea_i,
|
ea_i,
|
assert_psen_s,
|
assert_psen_s,
|
branch_taken_q,
|
branch_taken_q,
|
int_pending_s)
|
int_pending_s)
|
|
|
Line 320... |
Line 322... |
if need_address_v and not int_pending_s then
|
if need_address_v and not int_pending_s then
|
if ea_i = '0' then
|
if ea_i = '0' then
|
pm_read_pmem_o <= true;
|
pm_read_pmem_o <= true;
|
else
|
else
|
bus_read_bus_s <= true;
|
bus_read_bus_s <= true;
|
|
p2_output_pch_o <= true;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if not clk_second_cycle_i then
|
if not clk_second_cycle_i then
|
if not int_pending_s then
|
if not int_pending_s then
|
Line 340... |
Line 343... |
end if;
|
end if;
|
|
|
when MSTATE3 =>
|
when MSTATE3 =>
|
if need_address_v then
|
if need_address_v then
|
pm_write_pmem_addr_s <= true;
|
pm_write_pmem_addr_s <= true;
|
|
end if;
|
|
|
if ea_i = '1' then
|
if ea_i = '1' and
|
|
(need_address_v and last_cycle_s) then
|
bus_output_pcl_o <= true;
|
bus_output_pcl_o <= true;
|
end if;
|
end if;
|
end if;
|
|
|
|
when MSTATE4 =>
|
when MSTATE4 =>
|
if need_address_v and ea_i = '1' then
|
if ea_i = '1' and
|
|
(need_address_v or last_cycle_s) then
|
clk_assert_psen_o <= true;
|
clk_assert_psen_o <= true;
|
|
|
p2_output_pch_o <= true;
|
p2_output_pch_o <= true;
|
|
bus_output_pcl_o <= true;
|
end if;
|
end if;
|
|
|
when MSTATE5 =>
|
when MSTATE5 =>
|
if need_address_v and ea_i = '1' then
|
if ea_i = '1' and
|
|
(need_address_v and last_cycle_s) then
|
clk_assert_psen_o <= true;
|
clk_assert_psen_o <= true;
|
|
p2_output_pch_o <= true;
|
end if;
|
end if;
|
|
|
when others =>
|
when others =>
|
-- pragma translate_off
|
-- pragma translate_off
|
assert false
|
assert false
|
Line 1769... |
Line 1776... |
branch_taken_q <= false;
|
branch_taken_q <= false;
|
f1_q <= '0';
|
f1_q <= '0';
|
mb_q <= '0';
|
mb_q <= '0';
|
t0_dir_q <= '0';
|
t0_dir_q <= '0';
|
-- pragma translate_off
|
-- pragma translate_off
|
istrobe_s <= '0';
|
istrobe_res_q <= '1';
|
|
istrobe_q <= '0';
|
injected_int_q <= '0';
|
injected_int_q <= '0';
|
-- pragma translate_on
|
-- pragma translate_on
|
|
|
elsif clk_i'event and clk_i = clk_active_c then
|
elsif clk_i'event and clk_i = clk_active_c then
|
if en_clk_i then
|
if en_clk_i then
|
Line 1804... |
Line 1812... |
if ent0_clk_s then
|
if ent0_clk_s then
|
t0_dir_q <= '1';
|
t0_dir_q <= '1';
|
end if;
|
end if;
|
|
|
-- pragma translate_off
|
-- pragma translate_off
|
-- Instruction Strobe -------------------------------------------------
|
|
if clk_mstate_i = MSTATE5 and last_cycle_s and
|
|
injected_int_q = '0' then
|
|
istrobe_s <= '1';
|
|
else
|
|
istrobe_s <= '0';
|
|
end if;
|
|
|
|
-- Marker for injected instruction ------------------------------------
|
-- Marker for injected instruction ------------------------------------
|
if opc_inj_int_s then
|
if opc_inj_int_s then
|
injected_int_q <= '1';
|
injected_int_q <= '1';
|
elsif clk_mstate_i = MSTATE5 and last_cycle_s then
|
elsif clk_mstate_i = MSTATE5 and last_cycle_s then
|
injected_int_q <= '0';
|
injected_int_q <= '0';
|
end if;
|
end if;
|
|
|
|
-- Remove istrobe after reset suppression -----------------------------
|
|
if clk_mstate_i = MSTATE5 and last_cycle_s then
|
|
istrobe_res_q <= '0';
|
|
end if;
|
-- pragma translate_on
|
-- pragma translate_on
|
|
|
end if;
|
end if;
|
|
|
|
-- pragma translate_off
|
|
-- Instruction Strobe ---------------------------------------------------
|
|
if clk_mstate_i = MSTATE5 and last_cycle_s and
|
|
injected_int_q = '0' then
|
|
if istrobe_res_q = '0' then
|
|
istrobe_q <= '1';
|
|
end if;
|
|
else
|
|
istrobe_q <= '0';
|
|
end if;
|
|
-- pragma translate_on
|
|
|
end if;
|
end if;
|
|
|
end process regs;
|
end process regs;
|
--
|
--
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
-- pragma translate_off
|
-- pragma translate_off
|
-- assign to global signal for testbench
|
-- assign to global signal for testbench
|
tb_istrobe_s <= istrobe_s;
|
tb_istrobe_s <= istrobe_q;
|
-- pragma translate_on
|
-- pragma translate_on
|
|
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Output Mapping.
|
-- Output Mapping.
|
Line 1856... |
Line 1873... |
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File History:
|
-- File History:
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.7 2004/04/15 22:06:05 arniml
|
|
-- + add marker for injected calls
|
|
-- + suppress intstruction strobes for injected calls
|
|
--
|
-- Revision 1.6 2004/04/14 20:53:33 arniml
|
-- Revision 1.6 2004/04/14 20:53:33 arniml
|
-- make istrobe visible through testbench package
|
-- make istrobe visible through testbench package
|
--
|
--
|
-- Revision 1.5 2004/04/07 22:09:03 arniml
|
-- Revision 1.5 2004/04/07 22:09:03 arniml
|
-- remove unused signals
|
-- remove unused signals
|