How to change Verilog simulator time precision

D

Daku

Guest
Could some Verilog guru please help me ? I am using Icarus Verilog
v0.9, and I want to know how to change the simulator's default time
precision. Suppose I have the following snippet:
parameter clk_period = 10;
.......
.......
.......
always
begin
#(clk_period) clock = ! clock
end

In this case, what is the default time precision, and how do I change
it ? Apparently, there are no general users' forum for this superb
package, and so I ask my question here. Any hints, suggestions would
be of immense help. Thanks in advance.
 
On Mon, 07 Jun 2010 20:12:38 -0700, Daku wrote:

Could some Verilog guru please help me ? I am using Icarus Verilog v0.9,
and I want to know how to change the simulator's default time precision.
Suppose I have the following snippet: parameter clk_period = 10;
......
......
......
always
begin
#(clk_period) clock = ! clock
end

In this case, what is the default time precision, and how do I change it
? Apparently, there are no general users' forum for this superb package,
and so I ask my question here. Any hints, suggestions would be of
immense help. Thanks in advance.
You should have a `timescale in each module, for example

`timescale 1 ns/100 ps

The first value is the reference time, the second is the precision. So in
this example #10 would be 10 ns.
 
Daku wrote:
Could some Verilog guru please help me ? I am using Icarus Verilog
v0.9, and I want to know how to change the simulator's default time
precision. Suppose I have the following snippet:
parameter clk_period = 10;
......
......
......
always
begin
#(clk_period) clock = ! clock
end

In this case, what is the default time precision, and how do I change
it ? Apparently, there are no general users' forum for this superb
package, and so I ask my question here. Any hints, suggestions would
be of immense help. Thanks in advance.
The `timescale compiler directive has already been mentioned. That is
the original way to change both the time unit and time precision in
Verilog. SystemVerilog added the timeunit and timeprecision declarations
that change just the unit or the precision value. Icarus supports these
SV declarations if you use the correct generation.

To get the current time unit and time precision use the $printtimescale
system task. It displays the values for the current module if no
argument is given. If you pass it an argument it displays the
information for the given module. FYI Icarus defaults to 1s / 1s. This
default can be changed from a command file.

I hope this helps,

Cary
 

Welcome to EDABoard.com

Sponsor

Back
Top