library IEEE ;use IEEE.STD_LOGIC_1164.ALL ;
use IEEE.STD_LOGIC_UNSIGNED.ALL ;
use IEEE.STD_LOGIC_ARITH.ALL ;
library UNISIM ;
use UNISIM.VCOMPONENTS.ALL ;
entity PULSE_GEN is
generic (
P_TYPE : integer := 0
) ;
port (
XRST : in std_logic ; -- Reset Input ( Asynchronous )
CLK_I : in std_logic ; -- Clock at input side
CLK_O : in std_logic ; -- Clock at output side
PULSE_I : in std_logic ; -- Pulse input
PULSE_O : out std_logic -- Pulse output
) ;
end PULSE_GEN ;
architecture RTL of PULSE_GEN is
-- control signal
signal R_PULSE_I : std_logic ;
signal R_PULSE_O : std_logic_vector(2 downto 0) ;
begin
generatepulse: if ( P_TYPE = 0 ) generate
process ( CLK_I, XRST ) begin
if( XRST = '0' ) then
R_PULSE_I <= '0' ;
elsif ( CLK_I'Event and CLK_I = '1' ) then
if ( PULSE_I = '1' ) then
R_PULSE_I <= not R_PULSE_I ;
end if ;
end if ;
end process ;
-- Output pulse sync. and generate ( CLK_O domain )
process ( CLK_O, XRST ) begin
if( XRST = '0' ) then
R_PULSE_O <= ( others => '0' ) ;
elsif ( CLK_O'Event and CLK_O = '1' ) then
R_PULSE_O <= R_PULSE_O(1 downto 0) & R_PULSE_I ;
end if ;
end process ;
PULSE_O <= '1' when ( R_PULSE_O(2) /= R_PULSE_O(1) ) else '0' ; -- 0 -> 1
end generate ;
end RTL ;
看不懂PULSE_O



最新回复
sxf530006 (2008-7-11 23:21:47)
fwang (2008-7-11 23:41:09)
设计还是很巧妙的,电路正常工作的要求是clk_o >> clk_i (周期).同时plus_in频率不能高于clk_o
[ 本帖最后由 fwang 于 2008-7-11 23:44 编辑 ]
yachong001 (2008-7-17 16:04:39)
QUOTE:
能否详细的解说下?我都看傻了。就是这个功能的yachong001 (2008-7-17 18:09:57)
無題.JPG
tangxiangwei (2008-7-17 18:34:00)
yachong001 (2008-7-18 09:11:40)
yachong001 (2008-7-21 17:46:16)
fwang (2008-7-21 19:00:41)
I can not input chinese, if you still have questions, pls send me message.