CIRCT  19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
circt::moore::UnpackedType Class Reference

An unpacked SystemVerilog type. More...

#include <MooreTypes.h>

Inheritance diagram for circt::moore::UnpackedType:
Inheritance graph
[legend]
Collaboration diagram for circt::moore::UnpackedType:
Collaboration graph
[legend]

Public Member Functions

UnpackedType resolved () const
 Resolve one level of name or type reference indirection. More...
 
UnpackedType fullyResolved () const
 Resolve all name or type reference indirections. More...
 
Domain getDomain () const
 Get the value domain of this type. More...
 
Sign getSign () const
 Get the sign for this type. More...
 
std::optional< unsigned > getBitSize () const
 Get the size of this type in bits. More...
 
SimpleBitVectorType getSimpleBitVectorOrNull () const
 Get this type as a simple bit vector, if it is one. More...
 
bool isSimpleBitVector () const
 Check whether this is a simple bit vector type. More...
 
SimpleBitVectorType getSimpleBitVector () const
 Get this type as a simple bit vector. More...
 
SimpleBitVectorType castToSimpleBitVectorOrNull () const
 Cast this type to a simple bit vector. More...
 
bool isCastableToSimpleBitVector () const
 Check whether this type can be cast to a simple bit vector type. More...
 
SimpleBitVectorType castToSimpleBitVector () const
 Cast this type to a simple bit vector. More...
 
void format (llvm::raw_ostream &os, llvm::function_ref< void(llvm::raw_ostream &os)> around={}) const
 Format this type in SystemVerilog syntax into an output stream. More...
 
void format (llvm::raw_ostream &os, StringRef around) const
 
template<typename... Args>
std::string toString (Args... args) const
 Format this type in SystemVerilog syntax into a string. More...
 

Static Public Member Functions

static bool classof (Type type)
 

Detailed Description

An unpacked SystemVerilog type.

Unpacked types are a second level of types in SystemVerilog. They extend a core unpacked type with a variety of unpacked dimensions, depending on which syntactic construct generated the type (variable or otherwise). The core unpacked types are:

The unpacked dimensions are:

Definition at line 291 of file MooreTypes.h.

Member Function Documentation

◆ castToSimpleBitVector()

SimpleBitVectorType circt::moore::UnpackedType::castToSimpleBitVector ( ) const
inline

Cast this type to a simple bit vector.

Aborts if this type cannot be cast to a simple bit vector.

Definition at line 350 of file MooreTypes.h.

References assert(), and castToSimpleBitVectorOrNull().

◆ castToSimpleBitVectorOrNull()

SimpleBitVectorType UnpackedType::castToSimpleBitVectorOrNull ( ) const

Cast this type to a simple bit vector.

Returns null if this type cannot be cast to a simple bit vector.

Definition at line 192 of file MooreTypes.cpp.

References fullyResolved(), and getSimpleBitVectorOrNull().

Referenced by castToSimpleBitVector(), and isCastableToSimpleBitVector().

◆ classof()

static bool circt::moore::UnpackedType::classof ( Type  type)
inlinestatic

Definition at line 293 of file MooreTypes.h.

◆ format() [1/2]

void UnpackedType::format ( llvm::raw_ostream &  os,
llvm::function_ref< void(llvm::raw_ostream &os)>  around = {} 
) const

Format this type in SystemVerilog syntax into an output stream.

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

Definition at line 212 of file MooreTypes.cpp.

Referenced by circt::moore::UnpackedDim::format(), format(), and toString().

◆ format() [2/2]

void circt::moore::UnpackedType::format ( llvm::raw_ostream &  os,
StringRef  around 
) const
inline

Definition at line 364 of file MooreTypes.h.

References format().

◆ fullyResolved()

UnpackedType UnpackedType::fullyResolved ( ) const

Resolve all name or type reference indirections.

For example, given typedef int foo; typedef foo bar;, resolves bar to int.

Definition at line 108 of file MooreTypes.cpp.

Referenced by castToSimpleBitVectorOrNull(), circt::moore::detail::DimStorage::finalize(), and getSimpleBitVectorOrNull().

◆ getBitSize()

std::optional< unsigned > UnpackedType::getBitSize ( ) const

Get the size of this type in bits.

Returns None if any of the type's dimensions is unsized, associative, or a queue, or the core type itself has no known size.

Definition at line 133 of file MooreTypes.cpp.

◆ getDomain()

Domain UnpackedType::getDomain ( ) const

Get the value domain of this type.

Definition at line 115 of file MooreTypes.cpp.

References circt::moore::TwoValued.

◆ getSign()

Sign UnpackedType::getSign ( ) const

Get the sign for this type.

Definition at line 125 of file MooreTypes.cpp.

References circt::moore::Unsigned.

◆ getSimpleBitVector()

SimpleBitVectorType circt::moore::UnpackedType::getSimpleBitVector ( ) const
inline

Get this type as a simple bit vector.

Aborts if it is no simple bit vector.

Definition at line 333 of file MooreTypes.h.

References assert(), and getSimpleBitVectorOrNull().

◆ getSimpleBitVectorOrNull()

SimpleBitVectorType UnpackedType::getSimpleBitVectorOrNull ( ) const

◆ isCastableToSimpleBitVector()

bool circt::moore::UnpackedType::isCastableToSimpleBitVector ( ) const
inline

Check whether this type can be cast to a simple bit vector type.

Definition at line 344 of file MooreTypes.h.

References castToSimpleBitVectorOrNull().

◆ isSimpleBitVector()

bool circt::moore::UnpackedType::isSimpleBitVector ( ) const
inline

Check whether this is a simple bit vector type.

Definition at line 329 of file MooreTypes.h.

References getSimpleBitVectorOrNull().

◆ resolved()

UnpackedType UnpackedType::resolved ( ) const

Resolve one level of name or type reference indirection.

For example, given typedef int foo; typedef foo bar;, resolves bar to foo.

Definition at line 101 of file MooreTypes.cpp.

Referenced by circt::moore::detail::DimStorage::finalize().

◆ toString()

template<typename... Args>
std::string circt::moore::UnpackedType::toString ( Args...  args) const
inline

Format this type in SystemVerilog syntax into a string.

Useful to present the type back to the user in diagnostics. Prefer the format function if possible, as that does not need to allocate a string.

Definition at line 372 of file MooreTypes.h.

References format().


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