mirror of
https://github.com/wfjm/w11.git
synced 2026-04-25 20:01:57 +00:00
- interim release w11a_V0.51 (untagged)
- migrate to ibus protocol verion 2 - nexys2 systems now with DCM derived system clock supported - sys_w11a_n2 now runs with 58 MHz clksys
This commit is contained in:
4
rtl/vlib/xlib/dcm_sp_sfs_gsim.vbom
Normal file
4
rtl/vlib/xlib/dcm_sp_sfs_gsim.vbom
Normal file
@@ -0,0 +1,4 @@
|
||||
# libs
|
||||
../slvtypes.vhd
|
||||
# design
|
||||
dcm_sp_sfs_gsim.vhd
|
||||
118
rtl/vlib/xlib/dcm_sp_sfs_gsim.vhd
Normal file
118
rtl/vlib/xlib/dcm_sp_sfs_gsim.vhd
Normal file
@@ -0,0 +1,118 @@
|
||||
-- $Id: dcm_sp_sfs_gsim.vhd 338 2010-11-13 22:19:25Z mueller $
|
||||
--
|
||||
-- Copyright 2010- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
--
|
||||
-- This program is free software; you may redistribute and/or modify it under
|
||||
-- the terms of the GNU General Public License as published by the Free
|
||||
-- Software Foundation, either version 2, or at your option any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful, but
|
||||
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
-- for complete details.
|
||||
--
|
||||
------------------------------------------------------------------------------
|
||||
-- Module Name: dcm_sp_sfs - sim
|
||||
-- Description: DCM_SP as 'simple freq. synthesis'
|
||||
-- simple vhdl model, without Xilinx UNISIM primitives
|
||||
--
|
||||
-- Dependencies: -
|
||||
-- Test bench: -
|
||||
-- Target Devices: generic Spartan-3A,-3E
|
||||
-- Tool versions: xst 12.1; ghdl 0.29
|
||||
--
|
||||
-- Revision History:
|
||||
-- Date Rev Version Comment
|
||||
-- 2010-11-12 338 1.0 Initial version
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
use work.slvtypes.all;
|
||||
|
||||
entity dcm_sp_sfs is -- DCM_SP as 'simple freq. synthesis'
|
||||
generic (
|
||||
CLKFX_DIVIDE : positive := 1; -- FX clock divide (1-32)
|
||||
CLKFX_MULTIPLY : positive := 1; -- FX clock multiply (2-32) (1->no DCM)
|
||||
CLKIN_PERIOD : real := 20.0); -- CLKIN period (def is 20.0 ns)
|
||||
port (
|
||||
CLKIN : in slbit; -- clock input
|
||||
CLKFX : out slbit; -- clock output (synthesized freq.)
|
||||
LOCKED : out slbit -- dcm locked
|
||||
);
|
||||
end dcm_sp_sfs;
|
||||
|
||||
|
||||
architecture sim of dcm_sp_sfs is
|
||||
|
||||
signal CLK_DIVPULSE : slbit := '0';
|
||||
signal CLKOUT_PERIOD : time := 0 ns;
|
||||
signal R_CLKOUT : slbit := '0';
|
||||
signal R_LOCKED : slbit := '0';
|
||||
|
||||
begin
|
||||
|
||||
proc_clkin : process (CLKIN)
|
||||
variable t_lastclkin : time := 0 ns;
|
||||
variable t_lastperiod : time := 0 ns;
|
||||
variable t_period : time := 0 ns;
|
||||
variable nclkin : integer := 1;
|
||||
begin
|
||||
|
||||
if CLKIN'event then
|
||||
if CLKIN = '1' then -- if CLKIN rising edge
|
||||
|
||||
if t_lastclkin > 0 ns then
|
||||
t_lastperiod := t_period;
|
||||
t_period := now - t_lastclkin;
|
||||
CLKOUT_PERIOD <= (t_period * CLKFX_DIVIDE) / CLKFX_MULTIPLY;
|
||||
if t_lastperiod > 0 ns and abs(t_period-t_lastperiod) > 1 ps then
|
||||
report "dcm_sp_sfs: CLKIN unstable" severity warning;
|
||||
end if;
|
||||
end if;
|
||||
t_lastclkin := now;
|
||||
|
||||
if t_period > 0 ns then
|
||||
nclkin := nclkin - 1;
|
||||
if nclkin <= 0 then
|
||||
nclkin := CLKFX_DIVIDE;
|
||||
CLK_DIVPULSE <= '1';
|
||||
R_LOCKED <= '1';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
else -- if CLKIN falling edge
|
||||
CLK_DIVPULSE <= '0';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
end process proc_clkin;
|
||||
|
||||
proc_clkout : process
|
||||
variable t_lastclkin : time := 0 ns;
|
||||
variable t_lastperiod : time := 0 ns;
|
||||
variable t_period : time := 0 ns;
|
||||
variable nclkin : integer := 1;
|
||||
begin
|
||||
|
||||
loop
|
||||
wait until CLK_DIVPULSE = '1';
|
||||
|
||||
for i in 1 to CLKFX_MULTIPLY loop
|
||||
R_CLKOUT <= '1';
|
||||
wait for CLKOUT_PERIOD/2;
|
||||
R_CLKOUT <= '0';
|
||||
if i /= CLKFX_MULTIPLY then
|
||||
wait for CLKOUT_PERIOD/2;
|
||||
end if;
|
||||
end loop; -- i
|
||||
|
||||
end loop;
|
||||
|
||||
end process proc_clkout;
|
||||
|
||||
CLKFX <= R_CLKOUT;
|
||||
LOCKED <= R_LOCKED;
|
||||
|
||||
end sim;
|
||||
5
rtl/vlib/xlib/dcm_sp_sfs_unisim.vbom
Normal file
5
rtl/vlib/xlib/dcm_sp_sfs_unisim.vbom
Normal file
@@ -0,0 +1,5 @@
|
||||
# libs
|
||||
../slvtypes.vhd
|
||||
@lib:unisim
|
||||
# design
|
||||
dcm_sp_sfs_unisim.vhd
|
||||
84
rtl/vlib/xlib/dcm_sp_sfs_unisim.vhd
Normal file
84
rtl/vlib/xlib/dcm_sp_sfs_unisim.vhd
Normal file
@@ -0,0 +1,84 @@
|
||||
-- $Id: dcm_sp_sfs_unisim.vhd 338 2010-11-13 22:19:25Z mueller $
|
||||
--
|
||||
-- Copyright 2010- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
--
|
||||
-- This program is free software; you may redistribute and/or modify it under
|
||||
-- the terms of the GNU General Public License as published by the Free
|
||||
-- Software Foundation, either version 2, or at your option any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful, but
|
||||
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
-- for complete details.
|
||||
--
|
||||
------------------------------------------------------------------------------
|
||||
-- Module Name: dcm_sp_sfs - syn
|
||||
-- Description: DCM_SP as 'simple freq. synthesis'
|
||||
-- Direct instantiation of Xilinx UNISIM primitives
|
||||
--
|
||||
-- Dependencies: -
|
||||
-- Test bench: -
|
||||
-- Target Devices: generic Spartan-3A,-3E
|
||||
-- Tool versions: xst 12.1; ghdl 0.29
|
||||
--
|
||||
-- Revision History:
|
||||
-- Date Rev Version Comment
|
||||
-- 2010-11-12 338 1.0.1 drop SB_CLK generic; allow DIV=1,MUL=1 without DCM
|
||||
-- 2010-11-07 337 1.0 Initial version
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
library unisim;
|
||||
use unisim.vcomponents.ALL;
|
||||
|
||||
use work.slvtypes.all;
|
||||
|
||||
entity dcm_sp_sfs is -- DCM_SP as 'simple freq. synthesis'
|
||||
generic (
|
||||
CLKFX_DIVIDE : positive := 1; -- FX clock divide (1-32)
|
||||
CLKFX_MULTIPLY : positive := 1; -- FX clock multiply (2-32) (1->no DCM)
|
||||
CLKIN_PERIOD : real := 20.0); -- CLKIN period (def is 20.0 ns)
|
||||
port (
|
||||
CLKIN : in slbit; -- clock input
|
||||
CLKFX : out slbit; -- clock output (synthesized freq.)
|
||||
LOCKED : out slbit -- dcm locked
|
||||
);
|
||||
end dcm_sp_sfs;
|
||||
|
||||
|
||||
architecture syn of dcm_sp_sfs is
|
||||
|
||||
begin
|
||||
|
||||
assert (CLKFX_DIVIDE=1 and CLKFX_MULTIPLY=1) or CLKFX_MULTIPLY>=2
|
||||
report "assert((FX_DIV=1 and FX_MULT)=1 or FX_MULT>=2"
|
||||
severity failure;
|
||||
|
||||
DCM0: if CLKFX_DIVIDE=1 and CLKFX_MULTIPLY=1 generate
|
||||
CLKFX <= CLKIN;
|
||||
LOCKED <= '1';
|
||||
end generate DCM0;
|
||||
|
||||
DCM1: if CLKFX_MULTIPLY >= 2 generate
|
||||
|
||||
DCM : dcm_sp
|
||||
generic map (
|
||||
CLK_FEEDBACK => "NONE",
|
||||
CLKFX_DIVIDE => CLKFX_DIVIDE,
|
||||
CLKFX_MULTIPLY => CLKFX_MULTIPLY,
|
||||
CLKIN_DIVIDE_BY_2 => false,
|
||||
CLKIN_PERIOD => CLKIN_PERIOD,
|
||||
CLKOUT_PHASE_SHIFT => "NONE",
|
||||
DESKEW_ADJUST => "SYSTEM_SYNCHRONOUS",
|
||||
DSS_MODE => "NONE")
|
||||
port map (
|
||||
CLKIN => CLKIN,
|
||||
CLKFX => CLKFX,
|
||||
LOCKED => LOCKED
|
||||
);
|
||||
|
||||
end generate DCM1;
|
||||
|
||||
end syn;
|
||||
@@ -1,6 +1,6 @@
|
||||
-- $Id: xlib.vhd 314 2010-07-09 17:38:41Z mueller $
|
||||
-- $Id: xlib.vhd 338 2010-11-13 22:19:25Z mueller $
|
||||
--
|
||||
-- Copyright 2007-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
-- Copyright 2007-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
--
|
||||
-- This program is free software; you may redistribute and/or modify it under
|
||||
-- the terms of the GNU General Public License as published by the Free
|
||||
@@ -19,6 +19,7 @@
|
||||
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
|
||||
-- Revision History:
|
||||
-- Date Rev Version Comment
|
||||
-- 2010-11-07 337 1.0.5 add dcm_sp_sfs
|
||||
-- 2008-05-23 149 1.0.4 add iob_io(_gen)
|
||||
-- 2008-05-22 148 1.0.3 add iob_keeper(_gen);
|
||||
-- 2008-05-18 147 1.0.2 add PULL generic to iob_reg_io(_gen)
|
||||
@@ -151,4 +152,16 @@ component iob_keeper_gen is -- keeper for IOB, vector
|
||||
);
|
||||
end component;
|
||||
|
||||
component dcm_sp_sfs is -- DCM_SP as 'simple freq. synthesis'
|
||||
generic (
|
||||
CLKFX_DIVIDE : positive := 2; -- FX clock divide (1-32)
|
||||
CLKFX_MULTIPLY : positive := 2; -- FX clock divide (2-32)
|
||||
CLKIN_PERIOD : real := 20.0); -- CLKIN period (def is 20.0 ns)
|
||||
port (
|
||||
CLKIN : in slbit; -- clock input
|
||||
CLKFX : out slbit; -- clock output (synthesized freq.)
|
||||
LOCKED : out slbit -- dcm locked
|
||||
);
|
||||
end component;
|
||||
|
||||
end xlib;
|
||||
|
||||
Reference in New Issue
Block a user