64bit - Setting up 64 bit variables in C++ -


I'm wondering how to set a 64-bit variable in my testbench for C ++. When I use variable_name.io_int_write (0, value0) and variable_name.io_int_write (1, value1) (for lower and upper bit), I see That variable can set, but in reverse way.

Ex: When I want it to be 000 ... 002, see me 200 ... 000

Is there an alternative command that will help? Thanks

Edit: I have a function zero set_function (set_ * dut)

and inside this function, I want to set a 64-bit variable If you want to set a 64 bit integer variable in a constant value, then

post-text "itemprop =" text ">

You can just say something like this: L at the end of the long var64bit = 1L; 1l says that it is < Em> 1 has a 64bit constant value

If you have a hexade If you want to have a 64-bit bit-field constant with the mix and the normal way to set the 64bit variable will look something like:

  Unsigned long Bitfield64bit = 0xDEADBEEFDEADBEEFL;   

Again, note L .

If you have two 32 bit values ​​that you want to pack into 64 bit values, Using poly and logical-OR operations can be done as:

  long var64bit = (long-term) (((unsigned) The Bay time) Uchc_bits & lt; & Lt; 32) (unsigned longtime low_bits);   

Where 32bit variables having high bits * high bits and * low_bits * are 32 bit variables with low bits. I operate bit-wise on the values ​​captured because the signature bit between 32bit and 64 bit integers, and probably due to more sereno, about the conversion.

  int high_bits = (int) (var64bit and 0xFFFFFFFF);  

A 64-bit variable can be divided in the opposite operation, high and low bits as follows: Int cum_bits = (int) ((var64bit>> 32) & amp; 0xFFFFFFFFL);

Comments