In reply to dave_59:
Dave ,
The period of a 1Mhz clock is 1us. If the current timescale is 1ns, $realtime returns 1000.0, not 10**-6.
Hence if timescale is 1ns , clock frequency of 1MHz i.e 1 us is scaled to 1000ns
EDIT : A short sample_code for the same .
Two quick questions ::
$realtime returns the time scaled to current time scale/unit
[Q1] Assuming that I use a time literal , would the numbers post the decimal point be taken care of automatically ?
My concern was that if the Clock period is in ns / ps / fs , would the actual argument to J ( 5% of 1ns / 1ps / 1fs ) be the appropriate value .
[Q2] What if the input argument of type ’ real ’ is unit less ? Eg: Duty Cycle .
I have code snippet as :: Duty_Cycle_EDA
If I were to add input argument to the property ' duty_cycle ' .
property duty_cycle ( real duty , real diff );
realtime Tpos , Ton , T ;
......................................
##0 ( T inside { [ duty - diff ] : [ duty + diff ] } ) ;
endproperty
// Duty Cycle Must be 55.555 % +- 0.05 %
assert property( clock_frequency( 55.555 , 0.05 * ( 55.555 ) )
else $display(" TIME : %0t Assertion Fails " , $time ) ;