[source]

Class uvm_pkg::uvm_tlm_time

Copyright 2010-2011 Synopsys, Inc. Copyright 2011 Mentor Graphics Corporation All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

CLASS

uvm_tlm_time

Canonical time type that can be used in different timescales

This time type is used to represent time values in a canonical form that can bridge initiators and targets located in different timescales and time precisions.

For a detailed explanation of the purpose for this class, see .

Constructors

new(string name = "uvm_tlm_time", real res = 0)

Function

new

Create a new canonical time value.

The new value is initialized to 0. If a resolution is not specified, the default resolution, as specified by set_time_resolution(), is used.

Parameters:
  • name (string)

  • res (real)

Functions

set_time_resolution(real res)

Function

set_time_resolution

Set the default canonical time resolution.

Must be a power of 10. When co-simulating with SystemC, it is recommended that default canonical time resolution be set to the SystemC time resolution.

By default, the default resolution is 1.0e-12 (ps)

Parameters:

res (real)

get_name()

Function

get_name

Return the name of this instance

reset()

Function

reset

Reset the value to 0

get_realtime(time scaled, real secs = 1.0e-9)

Function

get_realtime

Return the current canonical time value, scaled for the caller's timescale

scaled must be a time literal value that corresponds to the number of seconds specified in secs (1ns by default). It must be a time literal value that is greater or equal to the current timescale.

 #(delay.get_realtime(1ns));
 #(delay.get_realtime(1fs, 1.0e-15));
Parameters:
  • scaled (time)

  • secs (real)

incr(real t, time scaled, real secs = 1.0e-9)

Function

incr

Increment the time value by the specified number of scaled time unit

t is a time value expressed in the scale and precision of the caller. scaled must be a time literal value that corresponds to the number of seconds specified in secs (1ns by default). It must be a time literal value that is greater or equal to the current timescale.

 delay.incr(1.5ns, 1ns);
 delay.incr(1.5ns, 1ps, 1.0e-12);
Parameters:
  • t (real)

  • scaled (time)

  • secs (real)

decr(real t, time scaled, real secs)

Function

decr

Decrement the time value by the specified number of scaled time unit

t is a time value expressed in the scale and precision of the caller. scaled must be a time literal value that corresponds to the number of seconds specified in secs (1ns by default). It must be a time literal value that is greater or equal to the current timescale.

 delay.decr(200ps, 1ns);
Parameters:
  • t (real)

  • scaled (time)

  • secs (real)

get_abstime(real secs)

Function

get_abstime

Return the current canonical time value, in the number of specified time unit, regardless of the current timescale of the caller.

secs is the number of seconds in the desired time unit e.g. 1e-9 for nanoseconds.

 $write("%.3f ps\n", delay.get_abstime(1e-12));
Parameters:

secs (real)

set_abstime(real t, real secs)

Function

set_abstime

Set the current canonical time value, to the number of specified time unit, regardless of the current timescale of the caller.

secs is the number of seconds in the time unit in the value t e.g. 1e-9 for nanoseconds.

 delay.set_abstime(1.5, 1e-12));
Parameters:
  • t (real)

  • secs (real)