‘dpi’ Dialect

SystemVerilog DPI-C boundary metadata (IEEE 1800-2023 35)

dpi describes the C ABI of imported and exported subroutines: one #dpi.abi entry per logical value, exact C layouts for unpacked aggregates and open arrays, and the identity metadata that elaboration attaches to DPI calls, simulation functions and native thunks. It has no operations; its attributes annotate operations of other dialects.

Attributes

ABIAttr

One logical value in a DPI-C signature

Syntax:

#dpi.abi<
  ::talos::dpi::ABIKind,   # kind
  ::talos::dpi::ArgumentDirection,   # direction
  uint32_t,   # width
  bool,   # fourState
  bool   # isSigned
>

Parameters:

Parameter

C++ type

Description

kind

::talos::dpi::ABIKind

an enum of type ABIKind

direction

::talos::dpi::ArgumentDirection

an enum of type ArgumentDirection

width

uint32_t

fourState

bool

isSigned

bool

AggregateABIAttr

Exact C layout for one sized DPI unpacked aggregate

Syntax:

#dpi.aggregate_abi<
  uint64_t,   # cSize
  uint32_t,   # cAlignment
  uint64_t,   # stringCount
  ::mlir::DenseI64ArrayAttr   # leaves
>

Parameters:

Parameter

C++ type

Description

cSize

uint64_t

cAlignment

uint32_t

stringCount

uint64_t

leaves

::mlir::DenseI64ArrayAttr

OpenArrayABIAttr

Concrete actual shape bound to one DPI open-array formal

Syntax:

#dpi.open_array_abi<
  uint32_t,   # storage
  ::talos::dpi::ABIKind,   # elementKind
  uint32_t,   # elementWidth
  uint64_t,   # transportWidth
  bool,   # transportFourState
  bool,   # fourState
  uint64_t,   # elementCSize
  uint32_t,   # elementCAlignment
  uint64_t,   # elementStringCount
  ::mlir::DenseI64ArrayAttr,   # elementLeaves
  int64_t,   # packedLeft
  int64_t,   # packedRight
  ::mlir::DenseI64ArrayAttr,   # ranges
  ::mlir::DenseI64ArrayAttr,   # sourceRanges
  ::mlir::DenseI64ArrayAttr   # shapePlan
>

Parameters:

Parameter

C++ type

Description

storage

uint32_t

elementKind

::talos::dpi::ABIKind

an enum of type ABIKind

elementWidth

uint32_t

transportWidth

uint64_t

transportFourState

bool

fourState

bool

elementCSize

uint64_t

elementCAlignment

uint32_t

elementStringCount

uint64_t

elementLeaves

::mlir::DenseI64ArrayAttr

packedLeft

int64_t

packedRight

int64_t

ranges

::mlir::DenseI64ArrayAttr

sourceRanges

::mlir::DenseI64ArrayAttr

shapePlan

::mlir::DenseI64ArrayAttr

Enums

ABIKind

DPI-C value ABI category

Cases:

Symbol

Value

String

Bit

0

bit

Logic

1

logic

Byte

2

byte

ShortInt

3

shortint

Int

4

int

LongInt

5

longint

BitVector

6

bit_vector

LogicVector

7

logic_vector

String

8

string

Chandle

9

chandle

ShortReal

10

shortreal

Real

11

real

OpenArray

12

open_array

UnpackedAggregate

13

unpacked_aggregate

ArgumentDirection

DPI-C ABI value role

Cases:

Symbol

Value

String

Input

0

input

Output

1

output

InOut

2

inout

Result

3

result