Hello everyone ,
I was referring to the following quote from LRM 3.14.2.3 :
The time unit of the compilation-unit scope can only be set by a timeunit declaration, not a ` timescale directive.
I wanted to understand it’s meaning .
If I were to define timeunit and timeprecision within a package like
package my_pkg;
timeunit 1ns;
timeprecision 1fs;
`include "seq_item.sv"
`include "base_seq.sv"
`include "sequencer.sv"
`include "driver.sv"
`include "monitor.sv"
`include "agent.sv"
`include "env.sv"
`include "test.sv"
endpackage
// Within top_tb.sv :
`include "my_pkg.sv"
import my_pkg::*; // Imported outside the module
module top_tb;
..............
endmodule
We define the units and precision once and as a result all the classes included within the package ‘my_pkg’ would have a unanimous time units of 1ns and time precision of 1fs.
[Q1] As the package is included outside top_tb , would the top_tb also follow the same units and precision defined within the package ?
If the package were to be imported within the module , would it have any difference ?
[Q2] Similarly how would one define a common time unit and time precision for design elements like module and interface ?
[Q3] Within the class object/component I was thinking of using $printtimescale to check the time unit and precision.
However LRM 20.4.1 says :
The $printtimescale system task displays the time unit and precision for a particular module
So is there any alternative to observe the time unit and precision within a class ?