Line 1... |
Line 1... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-- The Clock Control unit.
|
-- The Clock Control unit.
|
-- Clock States and Machine Cycles are generated here.
|
-- Clock States and Machine Cycles are generated here.
|
--
|
--
|
-- $Id: clock_ctrl.vhd,v 1.6 2004-10-25 20:31:12 arniml Exp $
|
-- $Id: clock_ctrl.vhd,v 1.7 2005-05-04 20:12:36 arniml Exp $
|
--
|
--
|
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
|
-- Copyright (c) 2004, 2005, 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:
|
Line 60... |
Line 60... |
clk_i : in std_logic;
|
clk_i : in std_logic;
|
xtal_i : in std_logic;
|
xtal_i : in std_logic;
|
res_i : in std_logic;
|
res_i : in std_logic;
|
en_clk_i : in boolean;
|
en_clk_i : in boolean;
|
xtal3_o : out boolean;
|
xtal3_o : out boolean;
|
|
t0_o : out std_logic;
|
multi_cycle_i : in boolean;
|
multi_cycle_i : in boolean;
|
assert_psen_i : in boolean;
|
assert_psen_i : in boolean;
|
assert_prog_i : in boolean;
|
assert_prog_i : in boolean;
|
assert_rd_i : in boolean;
|
assert_rd_i : in boolean;
|
assert_wr_i : in boolean;
|
assert_wr_i : in boolean;
|
Line 91... |
Line 92... |
xtal3_s : boolean;
|
xtal3_s : boolean;
|
signal x1_s,
|
signal x1_s,
|
x2_s,
|
x2_s,
|
x3_s : std_logic;
|
x3_s : std_logic;
|
|
|
|
signal t0_q : std_logic;
|
|
|
|
|
-- The five clock states.
|
-- The five clock states.
|
signal mstate_q : mstate_t;
|
signal mstate_q : mstate_t;
|
|
|
signal ale_q : boolean;
|
signal ale_q : boolean;
|
Line 130... |
Line 133... |
use_xtal_div: if xtal_div_3_g = 1 generate
|
use_xtal_div: if xtal_div_3_g = 1 generate
|
xtal: process (res_i, xtal_i)
|
xtal: process (res_i, xtal_i)
|
begin
|
begin
|
if res_i = res_active_c then
|
if res_i = res_active_c then
|
xtal_q <= TO_UNSIGNED(0, 2);
|
xtal_q <= TO_UNSIGNED(0, 2);
|
|
t0_q <= '0';
|
|
|
elsif xtal_i'event and xtal_i = clk_active_c then
|
elsif xtal_i'event and xtal_i = clk_active_c then
|
if xtal_q < 2 then
|
if xtal_q < 2 then
|
xtal_q <= xtal_q + 1;
|
xtal_q <= xtal_q + 1;
|
else
|
else
|
xtal_q <= TO_UNSIGNED(0, 2);
|
xtal_q <= TO_UNSIGNED(0, 2);
|
end if;
|
end if;
|
|
|
|
if xtal3_s then
|
|
t0_q <= '1';
|
|
else
|
|
t0_q <= '0';
|
|
end if;
|
|
|
end if;
|
end if;
|
|
|
end process xtal;
|
end process xtal;
|
|
|
x1_s <= '1'
|
x1_s <= '1'
|
Line 151... |
Line 161... |
when xtal_q = 1 else
|
when xtal_q = 1 else
|
'0';
|
'0';
|
x3_s <= '1'
|
x3_s <= '1'
|
when xtal_q = 2 else
|
when xtal_q = 2 else
|
'0';
|
'0';
|
|
t0_o <= t0_q;
|
|
|
end generate;
|
end generate;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- XTAL1 is used directly for Clock States.
|
-- XTAL1 is used directly for Clock States.
|
Line 163... |
Line 174... |
xtal_q <= TO_UNSIGNED(0, 2);
|
xtal_q <= TO_UNSIGNED(0, 2);
|
|
|
x1_s <= '1';
|
x1_s <= '1';
|
x2_s <= '1';
|
x2_s <= '1';
|
x3_s <= '1';
|
x3_s <= '1';
|
|
t0_o <= xtal_i;
|
|
|
end generate;
|
end generate;
|
|
|
-- And finally the boolean flags --------------------------------------------
|
-- And finally the boolean flags --------------------------------------------
|
xtal1_s <= to_boolean(x1_s);
|
xtal1_s <= to_boolean(x1_s);
|
Line 384... |
Line 396... |
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File History:
|
-- File History:
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.6 2004/10/25 20:31:12 arniml
|
|
-- remove PROG and end of XTAL2, see comment for details
|
|
--
|
-- Revision 1.5 2004/10/25 19:35:41 arniml
|
-- Revision 1.5 2004/10/25 19:35:41 arniml
|
-- deassert rd_q, wr_q and prog_q at end of XTAL3
|
-- deassert rd_q, wr_q and prog_q at end of XTAL3
|
--
|
--
|
-- Revision 1.4 2004/04/24 23:44:25 arniml
|
-- Revision 1.4 2004/04/24 23:44:25 arniml
|
-- move from std_logic_arith to numeric_std
|
-- move from std_logic_arith to numeric_std
|