The Designer's Guide Community
Models in Minutes
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines. Dec 16th, 2018, 1:07am
  HomeHelpSearchLoginRegisterPM to admin  
Pages: 1
Send Topic Print
How to jump from a forever cycling loop in Veriloga. (Read 609 times)
Senior Member

Posts: 203

How to jump from a forever cycling loop in Veriloga.
Feb 06th, 2018, 7:19am

   I am writing a Veriloga model to do a binary search. The basic idea is: I have an open loop oscillator with binary control signals. I want to control the oscillating frequency to a range. The easiest way is to start the search from 00000 (5-bit) and linearly increase to 11111. But it takes too much simulation time (it is oscillator in time domain simulation).
   So I plan to do a binary search, and now I have a forever loop : for example
   while(1) begin
   What I want is how to quit the forever loop if the frequency meets my range? In Verilog code, it is just a command "break", but I don't know how to do it in Veriloga.
   Any help is highly appreciated.
   By the way, several functions in Verilog don't work in Veriloga, for example
   @(posedge clk_in)

   If you have some good examples about the timing circuits, that would be wonderful.
   Thank you.
Back to top
View Profile   IP Logged
Senior Fellow

Posts: 1939
Massachusetts, USA
Re: How to jump from a forever cycling loop in Veriloga.
Reply #1 - Feb 6th, 2018, 8:57am
Why not have a variable "found" that you initialize to 0, set to 1 when your search is done, and use that in the while condition?

 while (!found) begin
Back to top

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Trouble viewing this site? Copyright © 2002-2018 Designer's Guide Consulting. 'Designer's Guide' is a registered trademark of Designer's Guide LLC. All rights reserved.

Our colleges are not as safe as they seem. Sexual assault is pervasive and the treatment of the victim by the adminstration is often as damaging as the assault: Campus Survivors, Campus Survivors Forum.

Some of our other sites that you might find useful: Avendesora, Inform and QuantiPhy.