M
MNQ
Guest
Hi All
I'm trying to write some code to synchronise my local clock with some
incoming data. At the moment when the receiver sees a specific bit pattern,
it makes pattern go to logic 1 for one clock period. This resets my clock
and adds a small delay to my 2MHz clock. If I use this method I effectively
loose a clock cycle which I cannot afford. I want to reset my clock on the
rising edge of pattern, but when I use the code
If pattern='1' and pattern'event then clock_divide<="00010" ;
I get a bad synchronous error when I synthesize
Am I correct in thinking that this is a digital phase locked loop?
Can anyone suggest a way of doing this as I have no idea at the moment and
time is slipping by.
Thanks for any help
clk = 65.536MHz
clock_2MHz should be 2.048MHz
CPLD is XC2C384
clock_divider : PROCESS (clk, pattern)
BEGIN
IF pattern='1' THEN clock_divide <= "00010";
ELSIF clk='1' AND clk'event THEN
clock_divide <= clock_divide - 1;
END IF;
END PROCESS clock_divider;
clock_2MHz <= clock_divide(4);
--
Mr Naveed Qayyum
www.mnq.org.uk
I'm trying to write some code to synchronise my local clock with some
incoming data. At the moment when the receiver sees a specific bit pattern,
it makes pattern go to logic 1 for one clock period. This resets my clock
and adds a small delay to my 2MHz clock. If I use this method I effectively
loose a clock cycle which I cannot afford. I want to reset my clock on the
rising edge of pattern, but when I use the code
If pattern='1' and pattern'event then clock_divide<="00010" ;
I get a bad synchronous error when I synthesize
Am I correct in thinking that this is a digital phase locked loop?
Can anyone suggest a way of doing this as I have no idea at the moment and
time is slipping by.
Thanks for any help
clk = 65.536MHz
clock_2MHz should be 2.048MHz
CPLD is XC2C384
clock_divider : PROCESS (clk, pattern)
BEGIN
IF pattern='1' THEN clock_divide <= "00010";
ELSIF clk='1' AND clk'event THEN
clock_divide <= clock_divide - 1;
END IF;
END PROCESS clock_divider;
clock_2MHz <= clock_divide(4);
--
Mr Naveed Qayyum
www.mnq.org.uk