In reply to dave_59:
Thank you for the response.
I am trying to generate the pulses within the rates of 1,2,5 and 10. I have written point wise how I tried to analyse the question and wrote the above code.
1) function pulse_gen should generate the pulse at the rates specified
2) class which will have the declaration of the rand variable rate and the constraint for rate
3) module which should randomize the rate within the given values
4) sending the result of randomization to the function pulse_gen which will generate the pulse
I didn't have a specific signal as such, I want to generate the signal pulse which is more like a clock which has its positive level for less than 50% of the time period. Here I am trying to assign that clock period using the variable rate.
Just like #4 clk = ~clk
I want the # rate and would like to define the rate within some range or within some specific rates as mentioned in this question.
For the above code I have written, I am getting the following error.
Error-[SE] Syntax error
Following verilog source has syntax error :
"testbench.sv", 21: token is 'function'