Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20705 Discussions

wait statement error

Altera_Forum
Honored Contributor II
1,064 Views

hello, 

here i'm getting error in using of wait statement. how to use wait statement for executing an event after a particular time like after every 83 ns high and low respectively?
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
316 Views

please post your code. 

 

wait statements with specific delays are not appropriate for synthesis, only simulation. For synthesis you need to use counters to wait for the specified time.
0 Kudos
Altera_Forum
Honored Contributor II
316 Views

First you should use the numeric_std library, to have access to the signed and unsigned types. 

Then declare count and z as unsigned(1 downto 0) and unsigned(6 downto 0) respectively, and you can directly use arithmetic operators on them: 

count<=count+1; IF ((Z = 15) or (Z = 30) or (Z = 45) or (Z = 60)) then clkout<= not clkout; END IF; IF(Z = 83) THEN Z <="0000000"; ELSE Z <=Z+1; END IF; I don't understand the values you use though... do you want to divide the clock frequency by 3 (meaning 666.666kHz) or by 3000 to get 666 Hz? IF dividing by 3 you won't be able to produce a square signal with 50% duty cycle. But you can generate a clock enable signal quite easily.
0 Kudos
Altera_Forum
Honored Contributor II
316 Views

thank you for your advice, yes i want to divide the clk frequency by 3 to get 666kHz which is equal to 166ns....

0 Kudos
Reply