CIRCT  18.0.0git
Public Member Functions | Public Attributes | List of all members
circt::moore::Struct Struct Reference

A struct. More...

#include <MooreTypes.h>

Collaboration diagram for circt::moore::Struct:
Collaboration graph
[legend]

Public Member Functions

 Struct (StructKind kind, ArrayRef< StructMember > members, StringAttr name, Location loc)
 Create a new struct. More...
 
void format (llvm::raw_ostream &os, bool packed=false, std::optional< Sign > signing={}) const
 Format this struct in SystemVerilog syntax. More...
 

Public Attributes

StructKind kind
 Whether this is a struct, union, or union tagged. More...
 
SmallVector< StructMember, 4 > members
 The list of members. More...
 
Domain domain
 The value domain of this struct. More...
 
std::optional< unsigned > bitSize
 The size of this struct in bits. More...
 
StringAttr name
 The name of the surrounding typedef, if this struct is embedded in a typedef. More...
 
Location loc
 The location in the source text where the struct was declared. More...
 

Detailed Description

A struct.

This represents both packed and unpacked structs. Which one it is depends on whether this struct is embedded in a PackedStructType or a UnpackedStructType. For the packed version the struct members are guaranteed to be packed types as well.

Definition at line 1079 of file MooreTypes.h.

Constructor & Destructor Documentation

◆ Struct()

Struct::Struct ( StructKind  kind,
ArrayRef< StructMember members,
StringAttr  name,
Location  loc 
)

Create a new struct.

Definition at line 1029 of file MooreTypes.cpp.

References bitSize, domain, circt::moore::FourValued, members, and circt::moore::TwoValued.

Member Function Documentation

◆ format()

void Struct::format ( llvm::raw_ostream &  os,
bool  packed = false,
std::optional< Sign signing = {} 
) const

Format this struct in SystemVerilog syntax.

Useful to present the struct back to the user in diagnostics.

Definition at line 1055 of file MooreTypes.cpp.

References kind, members, and name.

Referenced by circt::moore::PackedStructType::format(), circt::moore::UnpackedStructType::format(), and circt::moore::operator<<().

Member Data Documentation

◆ bitSize

std::optional<unsigned> circt::moore::Struct::bitSize

The size of this struct in bits.

This is None if any member type has an unknown size. This is commonly the case for unpacked member types, or dimensions with unknown size such as [] or [$].

Definition at line 1090 of file MooreTypes.h.

Referenced by Struct().

◆ domain

Domain circt::moore::Struct::domain

The value domain of this struct.

If all members are two-valued, the overall struct is two-valued. Otherwise the struct is four-valued.

Definition at line 1086 of file MooreTypes.h.

Referenced by Struct().

◆ kind

StructKind circt::moore::Struct::kind

Whether this is a struct, union, or union tagged.

Definition at line 1081 of file MooreTypes.h.

Referenced by format(), and circt::moore::UnpackedStructType::get().

◆ loc

Location circt::moore::Struct::loc

The location in the source text where the struct was declared.

This shall be the location of the struct or union keyword, or, if the struct is embedded in a typedef, the location of the typedef name.

Definition at line 1097 of file MooreTypes.h.

Referenced by circt::moore::UnpackedStructType::get().

◆ members

SmallVector<StructMember, 4> circt::moore::Struct::members

The list of members.

Definition at line 1083 of file MooreTypes.h.

Referenced by format(), circt::moore::UnpackedStructType::get(), and Struct().

◆ name

StringAttr circt::moore::Struct::name

The name of the surrounding typedef, if this struct is embedded in a typedef.

Otherwise this is a null attribute.

Definition at line 1093 of file MooreTypes.h.

Referenced by format(), and circt::moore::UnpackedStructType::get().


The documentation for this struct was generated from the following files: