In reply to dave_59:

Dave,

I don't think I communicated my point very well; specifically, you wrote:

**Dave wrote:**You should define your period as

parameter real Period = 1.56ns/1ps; // value will be in ps 1560

And use the period as

#(Period *1ps)/2 clk = !clk;

My issue is with you comment "// value will be in ps 1560" and in the need

to do the operation 1.56ns/1ps

It seems to me that you could have written this instead, and be correct:

[Ben]You should define your period as

parameter real Period = 1560; // value expressed in ps

And use the period as

#(Period *1ps)/2 clk = !clk;

I say this because 1.56ns/1ps is same as 1560, and IS unit-less.

What puzzled me about you initial comment was the absolute need to do this division by 1ns, implying that without it, it would not work.

Another question about how real numbers are expressed. Shouldn't

parameter real Period = 1560; be written as

parameter real Period = 1560.0;

Quote:

5.7.2 Real literal constants

The real literal constant numbers shall be represented as described by IEEE Std 754, an IEEE standard for double-precision floating-point numbers.

Real numbers can be specified in either decimal notation (for example, 14.72) or in scientific notation (for example, 39e8, which indicates 39 multiplied by 10 to the eighth power). Real numbers expressed with a decimal point shall have at least one digit on each side of the decimal point.

The following code compiles OK, it is correct?

module m;
real r1, r2;
initial r1=1; // Compiles OK ??? seems incorrect to me
initial r2=1.0;
endmodule