CIRCT
18.0.0git
|
An unpacked SystemVerilog type. More...
#include <MooreTypes.h>
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) |
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:
shortreal
, real
, realtime
string
, chandle
, event
The unpacked dimensions are:
[]
)[x]
)[x:y]
)[T]
or [*]
)[$]
or [$:x]
) Definition at line 282 of file MooreTypes.h.
|
inline |
Cast this type to a simple bit vector.
Aborts if this type cannot be cast to a simple bit vector.
Definition at line 341 of file MooreTypes.h.
References assert(), and 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 190 of file MooreTypes.cpp.
References fullyResolved(), circt::moore::PackedType::getBitSize(), and getSimpleBitVectorOrNull().
Referenced by castToSimpleBitVector(), and isCastableToSimpleBitVector().
|
inlinestatic |
Definition at line 284 of file MooreTypes.h.
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 210 of file MooreTypes.cpp.
Referenced by circt::moore::UnpackedDim::format(), format(), and toString().
|
inline |
Definition at line 355 of file MooreTypes.h.
References format().
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 106 of file MooreTypes.cpp.
Referenced by castToSimpleBitVectorOrNull(), circt::moore::detail::DimStorage::finalize(), and getSimpleBitVectorOrNull().
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 131 of file MooreTypes.cpp.
Domain UnpackedType::getDomain | ( | ) | const |
Get the value domain of this type.
Definition at line 113 of file MooreTypes.cpp.
References circt::moore::TwoValued.
Sign UnpackedType::getSign | ( | ) | const |
Get the sign for this type.
Definition at line 123 of file MooreTypes.cpp.
References circt::moore::Unsigned.
|
inline |
Get this type as a simple bit vector.
Aborts if it is no simple bit vector.
Definition at line 324 of file MooreTypes.h.
References assert(), and getSimpleBitVectorOrNull().
SimpleBitVectorType UnpackedType::getSimpleBitVectorOrNull | ( | ) | const |
Get this type as a simple bit vector, if it is one.
Returns a null type otherwise.
Definition at line 160 of file MooreTypes.cpp.
References circt::moore::Down, circt::moore::SimpleBitVectorType::explicitSize, fullyResolved(), circt::moore::SimpleBitVectorType::getRange(), getSimpleBitVectorFromIntType(), and circt::esi::innerType().
Referenced by castToSimpleBitVectorOrNull(), getSimpleBitVector(), and isSimpleBitVector().
|
inline |
Check whether this type can be cast to a simple bit vector type.
Definition at line 335 of file MooreTypes.h.
References castToSimpleBitVectorOrNull().
|
inline |
Check whether this is a simple bit vector type.
Definition at line 320 of file MooreTypes.h.
References getSimpleBitVectorOrNull().
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 99 of file MooreTypes.cpp.
Referenced by circt::moore::detail::DimStorage::finalize().
|
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 363 of file MooreTypes.h.
References format().