URL
https://opencores.org/ocsvn/w11/w11/trunk
Subversion Repositories w11
Compare Revisions
- This comparison shows the changes necessary to convert path
/w11/tags/w11a_V0.6/rtl/vlib/xlib
- from Rev 22 to Rev 24
- ↔ Reverse comparison
Rev 22 → Rev 24
/s6_cmt_sfs_gsim.vbom
0,0 → 1,4
# libs |
../slvtypes.vhd |
# design |
s6_cmt_sfs_gsim.vhd |
/s6_cmt_sfs_unisim.vbom
0,0 → 1,5
# libs |
../slvtypes.vhd |
@lib:unisim |
# design |
s6_cmt_sfs_unisim.vhd |
/dcm_sfs_unisim_s3e.vhd
0,0 → 1,86
-- $Id: dcm_sfs_unisim_s3e.vhd 534 2013-09-22 21:37:24Z mueller $ |
-- |
-- Copyright 2010-2011 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_sfs - syn |
-- Description: DCM for simple frequency synthesis; SPARTAN-3E version |
-- Direct instantiation of Xilinx UNISIM primitives |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan-3A,-3E; Spartan-6 |
-- Tool versions: xst 12.1; ghdl 0.29 |
-- |
-- Revision History: |
-- Date Rev Version Comment |
-- 2011-11-17 426 1.0.3 rename dcm_sp_sfs -> dcm_sfs, SPARTAN-3E version |
-- 2011-11-10 423 1.0.2 add FAMILY generic, SPARTAN-3 support |
-- 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_sfs is -- DCM for simple frequency 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_sfs; |
|
|
architecture syn of dcm_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; |
/s6_cmt_sfs_gsim.vhd
0,0 → 1,202
-- $Id: s6_cmt_sfs_gsim.vhd 556 2014-05-29 19:01:39Z mueller $ |
-- |
-- Copyright 2013- 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: s6_cmt_sfs - sim |
-- Description: Spartan-6 CMT for simple frequency synthesis |
-- simple vhdl model, without Xilinx UNISIM primitives |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan-6 |
-- Tool versions: xst 14.5, 14.6; ghdl 0.29 |
-- |
-- Revision History: |
-- Date Rev Version Comment |
-- 2013-10-06 538 1.0 Initial version (derived from s7_cmt_sfs_gsim) |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
|
entity s6_cmt_sfs is -- Spartan-6 CMT for simple freq. synth. |
generic ( |
VCO_DIVIDE : positive := 1; -- vco clock divide |
VCO_MULTIPLY : positive := 1; -- vco clock multiply |
OUT_DIVIDE : positive := 1; -- output divide |
CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns) |
CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps) |
STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED |
GEN_TYPE : string := "PLL"); -- PLL or MMCM |
port ( |
CLKIN : in slbit; -- clock input |
CLKFX : out slbit; -- clock output (synthesized freq.) |
LOCKED : out slbit -- pll/mmcm locked |
); |
end s6_cmt_sfs; |
|
|
architecture sim of s6_cmt_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_init : process |
|
-- currently frequency limits taken from Spartan-6 speed grade -2 |
constant f_vcomin_pll : integer := 400; |
constant f_vcomax_pll : integer := 1000; |
constant f_pdmin_pll : integer := 19; |
constant f_pdmax_pll : integer := 375; |
|
variable t_vco : time := 0 ns; |
variable t_vcomin : time := 0 ns; |
variable t_vcomax : time := 0 ns; |
variable t_pd : time := 0 ns; |
variable t_pdmin : time := 0 ns; |
variable t_pdmax : time := 0 ns; |
|
begin |
-- validate generics |
|
|
if not (GEN_TYPE = "PLL" or GEN_TYPE = "DCM") then |
assert false |
report "assert(GEN_TYPE='PLL' or GEN_TYPE='DCM')" |
severity failure; |
end if; |
|
if VCO_DIVIDE/=1 or VCO_MULTIPLY/=1 or OUT_DIVIDE/=1 then |
|
if GEN_TYPE = "PLL" then |
-- check DIV/MULT parameter range |
if VCO_DIVIDE<1 or VCO_DIVIDE>52 or |
VCO_MULTIPLY<1 or VCO_MULTIPLY>64 or |
OUT_DIVIDE<1 or OUT_DIVIDE>128 |
then |
assert false |
report |
"assert(VCO_DIVIDE in 1:52 VCO_MULTIPLY in 1:64 OUT_DIVIDE in 1:128)" |
severity failure; |
end if; |
-- setup VCO and PD range check boundaries |
t_vcomin := (1000 ns / f_vcomax_pll) - 1 ps; |
t_vcomax := (1000 ns / f_vcomin_pll) + 1 ps; |
t_pdmin := (1000 ns / f_pdmax_pll) - 1 ps; |
t_pdmax := (1000 ns / f_pdmin_pll) + 1 ps; |
|
-- now check whether VCO and PD frequency is in range |
t_pd := (1 ps * (1000.0*CLKIN_PERIOD)) * VCO_DIVIDE; |
t_vco := t_pd / VCO_MULTIPLY; |
|
if t_vco<t_vcomin or t_vco>t_vcomax then |
assert false |
report "assert(VCO frequency out of range)" |
severity failure; |
end if; |
|
if t_pd<t_pdmin or t_pd>t_pdmax then |
assert FALSE |
report "assert(PD frequency out of range)" |
severity failure; |
end if; |
|
end if; -- GEN_TYPE = "PLL" |
|
if GEN_TYPE = "DCM" then |
-- check DIV/MULT parameter range |
if VCO_DIVIDE<1 or VCO_DIVIDE>32 or |
VCO_MULTIPLY<2 or VCO_MULTIPLY>32 or |
OUT_DIVIDE/=1 |
then |
assert false |
report |
"assert(VCO_DIVIDE in 1:32 VCO_MULTIPLY in 2:32 OUT_DIVIDE=1)" |
severity failure; |
end if; |
end if; -- GEN_TYPE = "MMCM" |
|
end if; -- one factor /= 1 |
|
wait; |
end process proc_init; |
|
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 * VCO_DIVIDE * OUT_DIVIDE) / VCO_MULTIPLY; |
if t_lastperiod > 0 ns and abs(t_period-t_lastperiod) > 1 ps then |
report "s6_cmt_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 := VCO_DIVIDE * OUT_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 VCO_MULTIPLY loop |
R_CLKOUT <= '1'; |
wait for CLKOUT_PERIOD/2; |
R_CLKOUT <= '0'; |
if i /= VCO_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; |
/s6_cmt_sfs_unisim.vhd
0,0 → 1,147
-- $Id: $ |
-- |
-- Copyright 2013- 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: s6_cmt_sfs - syn |
-- Description: Spartan-6 CMT for simple frequency synthesis |
-- Direct instantiation of Xilinx UNISIM primitives |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan-6 |
-- Tool versions: xst 14.5; ghdl 0.29 |
-- |
-- Revision History: |
-- Date Rev Version Comment |
-- 2013-10-05 537 1.0 Initial version (derived from s7_cmt_sfs) |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
library unisim; |
use unisim.vcomponents.ALL; |
|
use work.slvtypes.all; |
|
entity s6_cmt_sfs is -- Spartan-6 CMT for simple freq. synth. |
generic ( |
VCO_DIVIDE : positive := 1; -- vco clock divide |
VCO_MULTIPLY : positive := 1; -- vco clock multiply |
OUT_DIVIDE : positive := 1; -- output divide |
CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns) |
CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps) |
STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED |
GEN_TYPE : string := "PLL"); -- PLL or DCM |
port ( |
CLKIN : in slbit; -- clock input |
CLKFX : out slbit; -- clock output (synthesized freq.) |
LOCKED : out slbit -- pll/dcm locked |
); |
end s6_cmt_sfs; |
|
|
architecture syn of s6_cmt_sfs is |
|
begin |
|
assert GEN_TYPE = "PLL" or GEN_TYPE = "DCM" |
report "assert(GEN_TYPE='PLL' or GEN_TYPE='DCM')" |
severity failure; |
|
NOGEN: if VCO_DIVIDE=1 and VCO_MULTIPLY=1 and OUT_DIVIDE=1 generate |
CLKFX <= CLKIN; |
LOCKED <= '1'; |
end generate NOGEN; |
|
USEPLL: if GEN_TYPE = "PLL" and |
not(VCO_DIVIDE=1 and VCO_MULTIPLY=1 and OUT_DIVIDE=1) generate |
|
signal CLKFBOUT : slbit; |
signal CLKOUT0 : slbit; |
signal CLKOUT1_UNUSED : slbit; |
signal CLKOUT2_UNUSED : slbit; |
signal CLKOUT3_UNUSED : slbit; |
signal CLKOUT4_UNUSED : slbit; |
signal CLKOUT5_UNUSED : slbit; |
|
begin |
|
PLL : pll_base |
generic map ( |
BANDWIDTH => "OPTIMIZED", |
CLK_FEEDBACK => "CLKFBOUT", |
COMPENSATION => "INTERNAL", |
DIVCLK_DIVIDE => VCO_DIVIDE, |
CLKFBOUT_MULT => VCO_MULTIPLY, |
CLKFBOUT_PHASE => 0.000, |
CLKOUT0_DIVIDE => OUT_DIVIDE, |
CLKOUT0_PHASE => 0.000, |
CLKOUT0_DUTY_CYCLE => 0.500, |
CLKIN_PERIOD => CLKIN_PERIOD, |
REF_JITTER => CLKIN_JITTER) |
port map ( |
CLKFBOUT => CLKFBOUT, |
CLKOUT0 => CLKOUT0, |
CLKOUT1 => CLKOUT1_UNUSED, |
CLKOUT2 => CLKOUT2_UNUSED, |
CLKOUT3 => CLKOUT3_UNUSED, |
CLKOUT4 => CLKOUT4_UNUSED, |
CLKOUT5 => CLKOUT5_UNUSED, |
CLKFBIN => CLKFBOUT, |
CLKIN => CLKIN, |
LOCKED => LOCKED, |
RST => '0' |
); |
|
BUFG_CLKOUT : bufg |
port map ( |
I => CLKOUT0, |
O => CLKFX |
); |
|
end generate USEPLL; |
|
USEDCM: if GEN_TYPE = "DCM" and |
not(VCO_DIVIDE=1 and VCO_MULTIPLY=1 and OUT_DIVIDE=1) generate |
|
signal CLKOUT0 : slbit; |
|
begin |
|
DCM : dcm_sp |
generic map ( |
CLK_FEEDBACK => "NONE", |
CLKFX_DIVIDE => VCO_DIVIDE, |
CLKFX_MULTIPLY => VCO_MULTIPLY, |
CLKIN_DIVIDE_BY_2 => false, |
CLKIN_PERIOD => CLKIN_PERIOD, |
CLKOUT_PHASE_SHIFT => "NONE", |
DESKEW_ADJUST => "SYSTEM_SYNCHRONOUS", |
DSS_MODE => "NONE", |
STARTUP_WAIT => STARTUP_WAIT) |
port map ( |
CLKIN => CLKIN, |
CLKFX => CLKOUT0, |
LOCKED => LOCKED |
); |
|
BUFG_CLKOUT : bufg |
port map ( |
I => CLKOUT0, |
O => CLKFX |
); |
|
end generate USEDCM; |
|
end syn; |
/xlib.vhd
0,0 → 1,217
-- $Id: xlib.vhd 538 2013-10-06 17:21:25Z mueller $ |
-- |
-- Copyright 2007-2013 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. |
-- |
------------------------------------------------------------------------------ |
-- Package Name: xlib |
-- Description: Xilinx specific components |
-- |
-- Dependencies: - |
-- Tool versions: xst 8.2, 9.1, 9.2, 13.1, 14.5, 14.6; ghdl 0.18-0.29 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2013-10-06 538 1.0.10 add s6_cmt_sfs |
-- 2013-09-28 535 1.0.9 add s7_cmt_sfs |
-- 2011-11-24 432 1.0.8 add iob_oddr2_simple |
-- 2011-11-17 426 1.0.7 rename dcm_sp_sfs -> dcm_sfs; remove family generic |
-- 2011-11-10 423 1.0.6 add family generic for dcm_sp_sfs |
-- 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) |
-- 2007-12-16 101 1.0.1 add INIT generic ports |
-- 2007-12-08 100 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
|
package xlib is |
|
component iob_reg_i is -- registered IOB, input |
generic ( |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DI : out slbit; -- input data |
PAD : in slbit -- i/o pad |
); |
end component; |
|
component iob_reg_i_gen is -- registered IOB, input, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DI : out slv(DWIDTH-1 downto 0); -- input data |
PAD : in slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end component; |
|
component iob_reg_o is -- registered IOB, output |
generic ( |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DO : in slbit; -- output data |
PAD : out slbit -- i/o pad |
); |
end component; |
|
component iob_reg_o_gen is -- registered IOB, output, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DO : in slv(DWIDTH-1 downto 0); -- output data |
PAD : out slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end component; |
|
component iob_reg_io is -- registered IOB, in/output |
generic ( |
INITI : slbit := '0'; -- initial state ( in flop) |
INITO : slbit := '0'; -- initial state (out flop) |
INITE : slbit := '0'; -- initial state ( oe flop) |
PULL : string := "NONE"); -- pull-up,-down or keeper |
port ( |
CLK : in slbit; -- clock |
CEI : in slbit := '1'; -- clock enable ( in flops) |
CEO : in slbit := '1'; -- clock enable (out flops) |
OE : in slbit; -- output enable |
DI : out slbit; -- input data (read from pad) |
DO : in slbit; -- output data (write to pad) |
PAD : inout slbit -- i/o pad |
); |
end component; |
|
component iob_reg_io_gen is -- registered IOB, in/output, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
INITI : slbit := '0'; -- initial state ( in flop) |
INITO : slbit := '0'; -- initial state (out flop) |
INITE : slbit := '0'; -- initial state ( oe flop) |
PULL : string := "NONE"); -- pull-up,-down or keeper |
port ( |
CLK : in slbit; -- clock |
CEI : in slbit := '1'; -- clock enable ( in flops) |
CEO : in slbit := '1'; -- clock enable (out flops) |
OE : in slbit; -- output enable |
DI : out slv(DWIDTH-1 downto 0); -- input data (read from pad) |
DO : in slv(DWIDTH-1 downto 0); -- output data (write to pad) |
PAD : inout slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end component; |
|
component iob_io is -- un-registered IOB, in/output |
generic ( |
PULL : string := "NONE"); -- pull-up,-down or keeper |
port ( |
OE : in slbit; -- output enable |
DI : out slbit; -- input data (read from pad) |
DO : in slbit; -- output data (write to pad) |
PAD : inout slbit -- i/o pad |
); |
end component; |
|
component iob_oddr2_simple is -- DDR2 output I/O pad |
generic ( |
ALIGN : string := "NONE"; -- ddr_alignment |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DO0 : in slbit; -- output data |
DO1 : in slbit; -- output data |
PAD : out slbit -- i/o pad |
); |
end component; |
|
component iob_io_gen is -- un-registered IOB, in/output, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
PULL : string := "NONE"); -- pull-up,-down or keeper |
port ( |
OE : in slbit; -- output enable |
DI : out slv(DWIDTH-1 downto 0); -- input data (read from pad) |
DO : in slv(DWIDTH-1 downto 0); -- output data (write to pad) |
PAD : inout slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end component; |
|
component iob_keeper is -- keeper for IOB |
port ( |
PAD : inout slbit -- i/o pad |
); |
end component; |
|
component iob_keeper_gen is -- keeper for IOB, vector |
generic ( |
DWIDTH : positive := 16); -- data port width |
port ( |
PAD : inout slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end component; |
|
component dcm_sfs is -- DCM for simple frequency synthesis |
generic ( |
CLKFX_DIVIDE : positive := 2; -- FX clock divide (1-32) |
CLKFX_MULTIPLY : positive := 2; -- 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 component; |
|
component s7_cmt_sfs is -- 7-Series CMT for simple freq. synth. |
generic ( |
VCO_DIVIDE : positive := 1; -- vco clock divide |
VCO_MULTIPLY : positive := 1; -- vco clock multiply |
OUT_DIVIDE : positive := 1; -- output divide |
CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns) |
CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps) |
STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED |
GEN_TYPE : string := "PLL"); -- PLL or MMCM |
port ( |
CLKIN : in slbit; -- clock input |
CLKFX : out slbit; -- clock output (synthesized freq.) |
LOCKED : out slbit -- pll/mmcm locked |
); |
end component; |
|
component s6_cmt_sfs is -- Spartan-6 CMT for simple freq. synth. |
generic ( |
VCO_DIVIDE : positive := 1; -- vco clock divide |
VCO_MULTIPLY : positive := 1; -- vco clock multiply |
OUT_DIVIDE : positive := 1; -- output divide |
CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns) |
CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps) |
STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED |
GEN_TYPE : string := "PLL"); -- PLL or DCM |
port ( |
CLKIN : in slbit; -- clock input |
CLKFX : out slbit; -- clock output (synthesized freq.) |
LOCKED : out slbit -- pll/mmcm locked |
); |
end component; |
|
end package xlib; |
/Makefile
0,0 → 1,27
# $Id: Makefile 477 2013-01-27 14:07:10Z mueller $ |
# |
# Revision History: |
# Date Rev Version omment |
# 2011-08-13 405 1.1 use includes from rtl/make |
# 2007-12-08 100 1.0 Initial version |
# |
VBOM_all = $(wildcard *.vbom) |
NGC_all = $(VBOM_all:.vbom=.ngc) |
# |
# reference board for test synthesis is Spartan-6 based Nexys3 |
include $(RETROBASE)/rtl/make/xflow_default_nexys3.mk |
# |
.PHONY : all clean |
# |
all : $(NGC_all) |
# |
clean : ise_clean |
# |
#---- |
# |
include $(RETROBASE)/rtl/make/generic_xflow.mk |
# |
ifndef DONTINCDEP |
include $(VBOM_all:.vbom=.dep_xst) |
endif |
# |
/dcm_sfs_unisim_s3.vhd
0,0 → 1,86
-- $Id: dcm_sfs_unisim_s3.vhd 426 2011-11-18 18:14:08Z mueller $ |
-- |
-- Copyright 2010-2011 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_sfs - syn |
-- Description: DCM for simple frequency synthesis; SPARTAN-3 version |
-- 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 |
-- 2011-11-17 426 1.0.3 rename dcm_sp_sfs -> dcm_sfs, SPARTAN-3 version |
-- 2011-11-10 423 1.0.2 add FAMILY generic, SPARTAN-3 support |
-- 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_sfs is -- DCM for simple frequency 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_sfs; |
|
|
architecture syn of dcm_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 |
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; |
/dcm_sfs_unisim_s3.vbom
0,0 → 1,5
# libs |
../slvtypes.vhd |
@lib:unisim |
# design |
dcm_sfs_unisim_s3.vhd |
/iob_reg_i_gen.vhd
0,0 → 1,67
-- $Id: iob_reg_i_gen.vhd 426 2011-11-18 18:14:08Z mueller $ |
-- |
-- Copyright 2007- 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: iob_reg_i_gen - syn |
-- Description: Registered IOB, input only, vector |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan, Virtex |
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2007-12-16 101 1.0.1 add INIT generic port |
-- 2007-12-08 100 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
use work.xlib.all; |
|
entity iob_reg_i_gen is -- registered IOB, input, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DI : out slv(DWIDTH-1 downto 0); -- input data |
PAD : in slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end iob_reg_i_gen; |
|
|
architecture syn of iob_reg_i_gen is |
|
signal R_DI : slv(DWIDTH-1 downto 0) := (others=>INIT); |
|
attribute iob : string; |
attribute iob of R_DI : signal is "true"; |
|
begin |
|
proc_regs: process (CLK) |
begin |
if rising_edge(CLK) then |
if CE = '1' then |
R_DI <= PAD; |
end if; |
end if; |
end process proc_regs; |
|
DI <= R_DI; |
|
end syn; |
/iob_reg_o_gen.vhd
0,0 → 1,67
-- $Id: iob_reg_o_gen.vhd 426 2011-11-18 18:14:08Z mueller $ |
-- |
-- Copyright 2007- 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: iob_reg_o_gen - syn |
-- Description: Registered IOB, output only, vector |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan, Virtex |
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2007-12-16 101 1.0.1 add INIT generic port |
-- 2007-12-08 100 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
use work.xlib.all; |
|
entity iob_reg_o_gen is -- registered IOB, output, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DO : in slv(DWIDTH-1 downto 0); -- output data |
PAD : out slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end iob_reg_o_gen; |
|
|
architecture syn of iob_reg_o_gen is |
|
signal R_DO : slv(DWIDTH-1 downto 0) := (others=>INIT); |
|
attribute iob : string; |
attribute iob of R_DO : signal is "true"; |
|
begin |
|
proc_regs: process (CLK) |
begin |
if rising_edge(CLK) then |
if CE = '1' then |
R_DO <= DO; |
end if; |
end if; |
end process proc_regs; |
|
PAD <= R_DO; |
|
end syn; |
/dcm_sfs_gsim.vbom
0,0 → 1,4
# libs |
../slvtypes.vhd |
# design |
dcm_sfs_gsim.vhd |
/iob_reg_io_gen.vhd
0,0 → 1,123
-- $Id: iob_reg_io_gen.vhd 427 2011-11-19 21:04:11Z mueller $ |
-- |
-- Copyright 2007-2008 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: iob_reg_io_gen - syn |
-- Description: Registered IOB, in/output, vector |
-- |
-- Dependencies: iob_keeper_gen [sim only] |
-- Test bench: - |
-- Target Devices: generic Spartan, Virtex |
-- Tool versions: xst 8.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2008-05-22 149 1.0.4 use internally TE to match OBUFT T polarity |
-- 2008-05-22 148 1.0.3 remove UNISIM prim's; PULL implemented only for sim |
-- 2008-05-18 147 1.0.2 add PULL generic, to enable PULL-UP,-DOWN or KEEPER |
-- 2007-12-16 101 1.0.1 add INIT generic ports |
-- 2007-12-08 100 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
use work.xlib.all; |
|
entity iob_reg_io_gen is -- registered IOB, in/output, vector |
generic ( |
DWIDTH : positive := 16; -- data port width |
INITI : slbit := '0'; -- initial state ( in flop) |
INITO : slbit := '0'; -- initial state (out flop) |
INITE : slbit := '0'; -- initial state ( oe flop) |
PULL : string := "NONE"); -- pull-up,-down or keeper |
port ( |
CLK : in slbit; -- clock |
CEI : in slbit := '1'; -- clock enable ( in flops) |
CEO : in slbit := '1'; -- clock enable (out flops) |
OE : in slbit; -- output enable |
DI : out slv(DWIDTH-1 downto 0); -- input data (read from pad) |
DO : in slv(DWIDTH-1 downto 0); -- output data (write to pad) |
PAD : inout slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end iob_reg_io_gen; |
|
|
architecture syn of iob_reg_io_gen is |
|
signal R_TE : slbit := not INITE; |
signal R_DI : slv(DWIDTH-1 downto 0) := (others=>INITI); |
signal R_DO : slv(DWIDTH-1 downto 0) := (others=>INITO); |
|
constant all_z : slv(DWIDTH-1 downto 0) := (others=>'Z'); |
constant all_l : slv(DWIDTH-1 downto 0) := (others=>'L'); |
constant all_h : slv(DWIDTH-1 downto 0) := (others=>'H'); |
|
attribute iob : string; |
attribute iob of R_TE : signal is "true"; |
attribute iob of R_DI : signal is "true"; |
attribute iob of R_DO : signal is "true"; |
|
begin |
|
assert PULL="NONE" or PULL="UP" or PULL="DOWN" or PULL="KEEP" |
report "assert(PULL): only NONE, UP, DOWN, OR KEEP supported" |
severity failure; |
|
proc_regs: process (CLK) |
begin |
if rising_edge(CLK) then |
R_TE <= not OE; |
if CEI = '1' then |
R_DI <= to_x01(PAD); |
end if; |
if CEO = '1' then |
R_DO <= DO; |
end if; |
end if; |
end process proc_regs; |
|
proc_comb: process (R_TE, R_DO) |
begin |
if R_TE = '1' then |
PAD <= all_z; |
else |
PAD <= R_DO; |
end if; |
end process proc_comb; |
|
DI <= R_DI; |
|
-- Note: PULL (UP, DOWN or KEEP) is only implemented for simulation, not |
-- for inference in synthesis. Use pin attributes in UCF's or use |
-- iob_reg_io_gen_unisim |
-- |
-- synthesis translate_off |
|
PULL_UP: if PULL = "UP" generate |
PAD <= all_h; |
end generate PULL_UP; |
|
PULL_DOWN: if PULL = "DOWN" generate |
PAD <= all_l; |
end generate PULL_DOWN; |
|
PULL_KEEP: if PULL = "KEEP" generate |
KEEPER : iob_keeper_gen |
generic map (DWIDTH => DWIDTH) |
port map (PAD => PAD); |
end generate PULL_KEEP; |
|
-- synthesis translate_on |
|
end syn; |
/dcm_sfs_gsim.vhd
0,0 → 1,119
-- $Id: dcm_sfs_gsim.vhd 426 2011-11-18 18:14:08Z mueller $ |
-- |
-- Copyright 2010-2011 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_sfs - sim |
-- Description: DCM for simple frequency synthesis |
-- simple vhdl model, without Xilinx UNISIM primitives |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan-3A,-3E |
-- Tool versions: xst 12.1, 13.1; ghdl 0.29 |
-- |
-- Revision History: |
-- Date Rev Version Comment |
-- 2011-11-17 426 1.0.1 rename dcm_sp_sfs -> dcm_sfs |
-- 2010-11-12 338 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
|
entity dcm_sfs is -- DCM for simple frequency 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_sfs; |
|
|
architecture sim of dcm_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; |
/dcm_sfs_unisim_s3e.vbom
0,0 → 1,5
# libs |
../slvtypes.vhd |
@lib:unisim |
# design |
dcm_sfs_unisim_s3e.vhd |
/iob_reg_o_gen.vbom
0,0 → 1,4
# libs |
../slvtypes.vhd |
# design |
iob_reg_o_gen.vhd |
/iob_keeper_gen.vbom
0,0 → 1,4
# libs |
../slvtypes.vhd |
# design |
iob_keeper_gen.vhd |
/iob_reg_i.vbom
0,0 → 1,7
# libs |
../slvtypes.vhd |
xlib.vhd |
# components |
iob_reg_i_gen.vbom |
# design |
iob_reg_i.vhd |
/iob_reg_o.vhd
0,0 → 1,61
-- $Id: iob_reg_o.vhd 314 2010-07-09 17:38:41Z mueller $ |
-- |
-- Copyright 2007- 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: iob_reg_i - syn |
-- Description: Registered IOB, output only |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan, Virtex |
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2007-12-16 101 1.0.1 add INIT generic port |
-- 2007-12-08 100 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
use work.xlib.all; |
|
entity iob_reg_o is -- registered IOB, output |
generic ( |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DO : in slbit; -- output data |
PAD : out slbit -- i/o pad |
); |
end iob_reg_o; |
|
|
architecture syn of iob_reg_o is |
|
begin |
|
IOB : iob_reg_o_gen |
generic map ( |
DWIDTH => 1, |
INIT => INIT) |
port map ( |
CLK => CLK, |
CE => CE, |
DO(0) => DO, |
PAD(0) => PAD |
); |
|
end syn; |
/iob_reg_o.vbom
0,0 → 1,7
# libs |
../slvtypes.vhd |
xlib.vhd |
# components |
iob_reg_o_gen.vbom |
# design |
iob_reg_o.vhd |
/iob_reg_io_gen.vbom
0,0 → 1,6
# libs |
../slvtypes.vhd |
# components |
[ghdl,isim]iob_keeper_gen.vbom |
# design |
iob_reg_io_gen.vhd |
/iob_reg_i_gen.vbom
0,0 → 1,4
# libs |
../slvtypes.vhd |
# design |
iob_reg_i_gen.vhd |
/iob_keeper_gen.vhd
0,0 → 1,63
-- $Id: iob_keeper_gen.vhd 314 2010-07-09 17:38:41Z 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: iob_keeper_gen - sim |
-- Description: keeper for IOB, vector |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan, Virtex |
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2010-06-03 299 1.1 add explicit R_KEEP and driver |
-- 2008-05-22 148 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
use work.xlib.all; |
|
entity iob_keeper_gen is -- keeper for IOB, vector |
generic ( |
DWIDTH : positive := 16); -- data port width |
port ( |
PAD : inout slv(DWIDTH-1 downto 0) -- i/o pad |
); |
end iob_keeper_gen; |
|
-- Is't possible to directly use 'PAD<='H' in proc_pad. Introduced R_KEEP and |
-- the explicit driver 'PAD<=R_KEEP' to state the keeper function more clearly. |
|
architecture sim of iob_keeper_gen is |
signal R_KEEP : slv(DWIDTH-1 downto 0) := (others=>'W'); |
begin |
|
proc_keep: process (PAD) |
begin |
for i in PAD'range loop |
if PAD(i) = '1' then |
R_KEEP(i) <= 'H'; |
elsif PAD(i) = '0' then |
R_KEEP(i) <= 'L'; |
elsif PAD(i)='X' or PAD(i)='U' then |
R_KEEP(i) <= 'W'; |
end if; |
end loop; |
PAD <= R_KEEP; |
end process proc_keep; |
|
end sim; |
/iob_reg_i.vhd
0,0 → 1,61
-- $Id: iob_reg_i.vhd 314 2010-07-09 17:38:41Z mueller $ |
-- |
-- Copyright 2007- 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: iob_reg_i - syn |
-- Description: Registered IOB, input only |
-- |
-- Dependencies: - |
-- Test bench: - |
-- Target Devices: generic Spartan, Virtex |
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25 |
-- Revision History: |
-- Date Rev Version Comment |
-- 2007-12-16 101 1.0.1 add INIT generic port |
-- 2007-12-08 100 1.0 Initial version |
------------------------------------------------------------------------------ |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.slvtypes.all; |
use work.xlib.all; |
|
entity iob_reg_i is -- registered IOB, input |
generic ( |
INIT : slbit := '0'); -- initial state |
port ( |
CLK : in slbit; -- clock |
CE : in slbit := '1'; -- clock enable |
DI : out slbit; -- input data |
PAD : in slbit -- i/o pad |
); |
end iob_reg_i; |
|
|
architecture syn of iob_reg_i is |
|
begin |
|
IOB : iob_reg_i_gen |
generic map ( |
DWIDTH => 1, |
INIT => INIT) |
port map ( |
CLK => CLK, |
CE => CE, |
DI(0) => DI, |
PAD(0) => PAD |
); |
|
end syn; |
.
Property changes :
Added: svn:ignore
## -0,0 +1,32 ##
+*.dep_ghdl
+*.dep_isim
+*.dep_xst
+work-obj93.cf
+*.vcd
+*.ghw
+*.sav
+*.tmp
+*.exe
+ise
+xflow.his
+*.ngc
+*.ncd
+*.pcf
+*.bit
+*.msk
+isim
+isim.log
+isim.wdb
+fuse.log
+*_[sft]sim.vhd
+*_tsim.sdf
+*_xst.log
+*_tra.log
+*_twr.log
+*_map.log
+*_par.log
+*_pad.log
+*_bgn.log
+*_svn.log
+*_sum.log
+*_[dsft]sim.log