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.13 2004-05-20 21:51:40 arniml Exp $
|
-- $Id: decoder.vhd,v 1.14 2004-06-30 21:18:28 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 228... |
Line 228... |
signal dis_i_s : boolean;
|
signal dis_i_s : boolean;
|
signal tim_int_s : boolean;
|
signal tim_int_s : boolean;
|
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;
|
|
signal int_in_progress_s : boolean;
|
|
|
-- pragma translate_off
|
-- pragma translate_off
|
signal istrobe_res_q : std_logic;
|
signal istrobe_res_q : std_logic;
|
signal istrobe_q : std_logic;
|
signal istrobe_q : std_logic;
|
signal injected_int_q : std_logic;
|
signal injected_int_q : std_logic;
|
Line 280... |
Line 281... |
dis_i_i => dis_i_s,
|
dis_i_i => dis_i_s,
|
ext_int_o => open,
|
ext_int_o => open,
|
tim_int_o => tim_int_s,
|
tim_int_o => tim_int_s,
|
retr_executed_i => retr_executed_s,
|
retr_executed_i => retr_executed_s,
|
int_executed_i => int_executed_s,
|
int_executed_i => int_executed_s,
|
int_pending_o => int_pending_s
|
int_pending_o => int_pending_s,
|
|
int_in_progress_o => int_in_progress_s
|
);
|
);
|
|
|
last_cycle_s <= not opc_multi_cycle_s or
|
last_cycle_s <= not opc_multi_cycle_s or
|
(opc_multi_cycle_s and clk_second_cycle_i);
|
(opc_multi_cycle_s and clk_second_cycle_i);
|
|
|
Line 403... |
Line 405... |
psw_carry_i,
|
psw_carry_i,
|
psw_f0_i,
|
psw_f0_i,
|
f1_q,
|
f1_q,
|
mb_q,
|
mb_q,
|
tim_int_s,
|
tim_int_s,
|
int_pending_s)
|
int_pending_s,
|
|
int_in_progress_s)
|
|
|
procedure address_indirect_3_f is
|
procedure address_indirect_3_f is
|
begin
|
begin
|
-- apply dmem address from selected register for indirect mode
|
-- apply dmem address from selected register for indirect mode
|
if opc_opcode_s(3) = '0' or enable_quartus_bugfix_c then
|
if opc_opcode_s(3) = '0' or enable_quartus_bugfix_c then
|
Line 440... |
Line 443... |
pm_write_pcl_o <= true;
|
pm_write_pcl_o <= true;
|
branch_taken_s <= true;
|
branch_taken_s <= true;
|
-- end if;
|
-- end if;
|
end;
|
end;
|
|
|
|
-- intermediate value of the Program Memory Bank Flag
|
|
variable mb_v : std_logic;
|
|
|
begin
|
begin
|
-- default assignments
|
-- default assignments
|
data_s <= (others => '-');
|
data_s <= (others => '-');
|
read_dec_s <= false;
|
read_dec_s <= false;
|
branch_taken_s <= false;
|
branch_taken_s <= false;
|
Line 515... |
Line 521... |
int_executed_s <= false;
|
int_executed_s <= false;
|
add_write_pmem_addr_s <= false;
|
add_write_pmem_addr_s <= false;
|
ent0_clk_s <= false;
|
ent0_clk_s <= false;
|
add_read_bus_s <= false;
|
add_read_bus_s <= false;
|
|
|
|
-- the Program Memory Bank Flag is held low when interrupts are in progress
|
|
-- according to the MCS-48 User's Manual
|
|
if int_in_progress_s then
|
|
mb_v := '0';
|
|
else
|
|
mb_v := mb_q;
|
|
end if;
|
|
|
-- prepare potential register indirect address mode
|
-- prepare potential register indirect address mode
|
if not clk_second_cycle_i and clk_mstate_i = MSTATE2 then
|
if not clk_second_cycle_i and clk_mstate_i = MSTATE2 then
|
data_s <= (others => '0');
|
data_s <= (others => '0');
|
if opc_opcode_s(3) = '1' then
|
if opc_opcode_s(3) = '1' then
|
data_s(2 downto 0) <= opc_opcode_s(2 downto 0);
|
data_s(2 downto 0) <= opc_opcode_s(2 downto 0);
|
Line 750... |
Line 764... |
when MSTATE2 =>
|
when MSTATE2 =>
|
pm_write_pch_o <= true;
|
pm_write_pch_o <= true;
|
read_dec_s <= true;
|
read_dec_s <= true;
|
if not int_pending_s then
|
if not int_pending_s then
|
-- store high part of target address in Program Counter
|
-- store high part of target address in Program Counter
|
data_s <= "0000" & mb_q & opc_opcode_s(7 downto 5);
|
data_s <= "0000" & mb_v & opc_opcode_s(7 downto 5);
|
else
|
else
|
-- apply high part of vector address manually
|
-- apply high part of vector address manually
|
data_s <= (others => '0');
|
data_s <= (others => '0');
|
int_executed_s <= true;
|
int_executed_s <= true;
|
end if;
|
end if;
|
Line 1094... |
Line 1108... |
pm_write_pcl_o <= true;
|
pm_write_pcl_o <= true;
|
branch_taken_s <= true;
|
branch_taken_s <= true;
|
|
|
-- store high part of target address in Program Counter
|
-- store high part of target address in Program Counter
|
when MSTATE2 =>
|
when MSTATE2 =>
|
data_s <= "0000" & mb_q & opc_opcode_s(7 downto 5);
|
data_s <= "0000" & mb_v & opc_opcode_s(7 downto 5);
|
read_dec_s <= true;
|
read_dec_s <= true;
|
pm_write_pch_o <= true;
|
pm_write_pch_o <= true;
|
|
|
|
|
when others =>
|
when others =>
|
null;
|
null;
|
|
|
end case;
|
end case;
|
|
|
Line 1931... |
Line 1944... |
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File History:
|
-- File History:
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.13 2004/05/20 21:51:40 arniml
|
|
-- clean-up use of ea_i
|
|
--
|
-- Revision 1.12 2004/05/17 14:40:09 arniml
|
-- Revision 1.12 2004/05/17 14:40:09 arniml
|
-- assert p2_read_p2_o when expander port is read
|
-- assert p2_read_p2_o when expander port is read
|
--
|
--
|
-- Revision 1.11 2004/05/16 15:33:39 arniml
|
-- Revision 1.11 2004/05/16 15:33:39 arniml
|
-- work around bug in Quartus II 4.0
|
-- work around bug in Quartus II 4.0
|