How to record a transaction end time correctly for high resolution/long duration simulation?

Error: (vsim-8239)

At 2287760 ns, an attempt was made to end a transaction before simulation time zero.

I printed the end_time with %d and %f
end_time d = 2287760000
end_time f = 2287760000.000000

I think what’s happening is the parameter for $end_transaction(transaction_view_h,end_time); is a 32-bit integer and 2287760000 = 0x885C 7280 which has the MSB set and its being interpreted as a negative value by #end_transaction() function because the previous transaction at time 2085283000 = 0x7C4A E4B8 did not throw this error.

on-line documents seem to indicate time is a 64-bit integer so I’m confused by this error.

In reply to jjahlers:
I believe the problem you are facing is caused by an unsinged data type. You should use a signed data type instead.

In reply to chr_sue:

I’m capturing the time with the “time” datatype.

time end_time;
end_time = $time;//picosecond resolution

transaction_view_h = $begin_transaction(transaction_viewing_stream_h, message_name, start_time);
$end_transaction(transaction_view_h,end_time);

If simulation time in picoseconds is more then 0x7FFF_FFFF I get an error from the
$end_transaction() function, I have library that needs ps otherwise I’d modify simulation time resolution to ns and I wouldn’t over-flow.

Do you know where $end_transaction() source is found in the questasim installation?

In reply to jjahlers:

Sorry if I’m misunderstanding, but why not use UVM methods such as begin_tr and end_tr?

Since I’m using these transaction for wave window viewing, I can simply not pass a parameter to the end transaction function and it will end at the current simulation time. This works for my purposes.