Rate This Document
Findability
Accuracy
Completeness
Readability

Basic Data Types

Table 1 Basic data types

Data Type

Description

void

The void type has no associated value and is currently used only as a function return value type.

match_kind

  • The match_kind type is used to declare available key matching modes. Currently, exact matching (exact) and fuzzy matching (ternary) are supported.
  • match_kind is declared in the architecture file hydra_core.hdr. You cannot declare a new match_kind.

bool

Boolean value.

  • true
  • false

Integer (signed/unsigned)

  • Fixed-width unsigned integer: bit<size>
  • Fixed-width signed integer: int<size>
NOTE:
  • size can only be a literal. Variables and expressions are not supported in this version. For example, bit<a> and bit<2 + 4> are not supported.
  • Slicing is not supported. For example, bit<W>[H:L] is not supported.

An integer literal can consist of the bit width and value. For example, 8w10 indicates an 8-bit unsigned integer whose value is 10.

  • w: Unsigned integer
  • s: Signed integer

The following are some examples of integer literals.

32w255 // 32-bit unsigned integer whose value is 255.
32w0d255 // Same as above. 0d indicates decimal (default).
32w0xFF // Same as above. 0x indicates hexadecimal.
32s0xFF // 32-bit signed integer whose value is 255.
8w0b10101010 // 8-bit unsigned integer whose value is 170. 0b indicates binary.
8w0b_1010_1010 // Same as above. The underscores are used to facilitate reading.