64-Bit Simulation Kernel

On Linux platforms (and some Windows platforms), a 64-bit address space is available for both the sequential and parallel kernels.

When compiling for 64-bit address space, the symbol VOSD_64BIT_SPACE is defined. This symbol can be used by model code to use different data types based on the address space.

Data Type Sizes

The 64-bit address space has some impact on various data types. When using the 64-bit kernel:

  • int remains a 32-bit storage area.
  • long becomes a 64-bit storage area on Linux (it remains 32-bit on Windows).
  • long long becomes a 128-bit storage area on Linux and 64-bit on Windows.
  • Addresses (pointers) are 64-bit values. (Any code that stores pointers into int variables is likely to generate incorrect results or crash when run in the 64-bit kernel.)
  • double is not affected.

To allow models to behave similarly with various OSs and pointer sizes, Modeler provides a set of types with well-defined sizes in all situations:

Table 132: Address Pointer Data Types

Data Type Definition
OpT_Int32 32-bit signed integer
OpT_uInt32 32-bit unsigned integer
OpT_Int64 64-bit signed integer
OpT_uInt64 64-bit unsigned integer

Modeler also provides a set of macros to define special values and formatting information used in printf-like APIs:

Table 133: Print Macros for 64-Bit Numbers

Macro Used For
OPC_INT64_MAX maximum 64-bit signed integer value (2^63 – 1)
OPC_INT64_MIN minimum 64-bit signed integer value (–2^63)
OPC_UINT64_MAX maximum 64-bit unsigned integer value (2^64 – 1)
OPC_INT64_FMT basic format string to display a 64-bit signed integer
OPC_UINT64_FMT basic format string to display a 64-bit unsigned integer
OPC_INT64_PREFIX 64-bit prefix string to include in more complex format strings

Print macro example:

OpT_Int64    i64;
OpT_uInt64   u64;

printf ("64 bit signed = " OPC_INT64_FMT "\n", i64);
printf ("64 bit unsigned = " OPC_UINT64_FMT "\n", u64);
printf ("64 bit signed on 12 char width = %12" OPC_INT64_PREFIX "d \n", i64);
printf ("64 bit unsigned on 12 char width = %12" OPC_INT64_PREFIX "u \n", i64);

Event Codes

The code associated with an event becomes a 64-bit integer in the parallel kernel. The event-creating KPs that take a code argument use OpT_Int64 as the argument type. Code that passes a 32-bit integer does not have to be modified; the 32-bit values are converted automatically to 64-bit.

The KP op_ev_code() returns a 64-bit integer value. If this value is assigned to a 32-bit variable, the value is downcast.

Note: If the event code is used to pass pointers, then retrieving that pointer using op_ev_code() and assigning it to a 32-bit value will fail in a 64-bit address space.

TDAs

TDA integer values are stored as 64-bit numbers. The KPs to set integer TDAs have an OpT_Int64 argument (with appropriate casting of 32-bit values). The KP op_td_get_int() returns an OpT_Int64.

Packet and ICI Fields

Fields of type integer are 32-bit values, regardless of the address space. Use the int64 field type to store 64-bit values. When obtaining the value of int64 fields, model code should use OpT_Int64 variables.

Specific field types exist to represent packet ids and object ids; these correspond to 64- and 32-bit integers, respectively. When obtaining the value of a packet id field, use a variable of type OpT_Packet_Id.

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com