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

An integer vector or atom type. More...

#include <MooreTypes.h>

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

Public Types

enum  Kind {
  Bit , Logic , Reg , Byte ,
  ShortInt , Int , LongInt , Integer ,
  Time
}
 

Public Member Functions

Kind getKind () const
 Get the concrete integer vector or atom type. More...
 
Sign getSign () const
 Get the sign of this type. More...
 
bool isSignExplicit () const
 Whether the sign of the type was specified explicitly. More...
 
StringRef getKeyword () const
 Get the keyword (like bit) for this type. More...
 
Sign getDefaultSign () const
 Get the default sign for this type. More...
 
Domain getDomain () const
 Get the value domain for this type. More...
 
unsigned getBitSize () const
 Get the size of this type. More...
 
void format (llvm::raw_ostream &os) const
 Format this type in SystemVerilog syntax. More...
 

Static Public Member Functions

static std::optional< KindgetKindFromKeyword (StringRef keyword)
 Get the integer type that corresponds to a keyword (like bit). More...
 
static StringRef getKeyword (Kind kind)
 Get the keyword (like bit) for one of the integer types. More...
 
static Sign getDefaultSign (Kind kind)
 Get the default sign for one of the integer types. More...
 
static Domain getDomain (Kind kind)
 Get the value domain for one of the integer types. More...
 
static unsigned getBitSize (Kind kind)
 Get the size of one of the integer types. More...
 
static Kind getAtomForDomain (Domain domain)
 Get the integer type that corresponds to a single bit of the given domain. More...
 
static std::optional< KindgetKindFromDomainAndSize (Domain domain, unsigned size)
 Get the integer type that corresponds to a domain and bit size. More...
 
static IntType get (MLIRContext *context, Kind kind, std::optional< Sign > sign={})
 
static IntType getLogic (MLIRContext *context)
 Create a logic type. More...
 
static IntType getInt (MLIRContext *context)
 Create a int type. More...
 
static IntType getTime (MLIRContext *context)
 Create a time type. More...
 

Static Public Attributes

static constexpr StringLiteral name = "moore.int"
 

Detailed Description

An integer vector or atom type.

Definition at line 519 of file MooreTypes.h.

Member Enumeration Documentation

◆ Kind

Enumerator
Bit 

A bit.

Logic 

A logic.

Reg 

A reg.

Byte 

A byte.

ShortInt 

A shortint.

Int 

An int.

LongInt 

A longint.

Integer 

An integer.

Time 

A time.

Definition at line 522 of file MooreTypes.h.

Member Function Documentation

◆ format()

void IntType::format ( llvm::raw_ostream &  os) const

Format this type in SystemVerilog syntax.

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

Definition at line 501 of file MooreTypes.cpp.

References getDefaultSign(), getKeyword(), getSign(), and isSignExplicit().

◆ get()

IntType IntType::get ( MLIRContext *  context,
Kind  kind,
std::optional< Sign sign = {} 
)
static

◆ getAtomForDomain()

IntType::Kind IntType::getAtomForDomain ( Domain  domain)
static

Get the integer type that corresponds to a single bit of the given domain.

Definition at line 449 of file MooreTypes.cpp.

References Bit, circt::moore::FourValued, Logic, and circt::moore::TwoValued.

Referenced by getKindFromDomainAndSize().

◆ getBitSize() [1/2]

unsigned circt::moore::IntType::getBitSize ( ) const
inline

Get the size of this type.

Definition at line 590 of file MooreTypes.h.

References getBitSize(), and getKind().

Referenced by getBitSize().

◆ getBitSize() [2/2]

unsigned IntType::getBitSize ( Kind  kind)
static

Get the size of one of the integer types.

Definition at line 427 of file MooreTypes.cpp.

References Bit, Byte, Int, Integer, Logic, LongInt, Reg, ShortInt, and Time.

Referenced by getSimpleBitVectorFromIntType(), and populateTypeConversion().

◆ getDefaultSign() [1/2]

Sign circt::moore::IntType::getDefaultSign ( ) const
inline

Get the default sign for this type.

Definition at line 586 of file MooreTypes.h.

References getDefaultSign(), and getKind().

Referenced by format(), get(), and getDefaultSign().

◆ getDefaultSign() [2/2]

Sign IntType::getDefaultSign ( Kind  kind)
static

Get the default sign for one of the integer types.

Definition at line 393 of file MooreTypes.cpp.

References Bit, Byte, Int, Integer, Logic, LongInt, Reg, ShortInt, circt::moore::Signed, Time, and circt::moore::Unsigned.

◆ getDomain() [1/2]

Domain circt::moore::IntType::getDomain ( ) const
inline

Get the value domain for this type.

Definition at line 588 of file MooreTypes.h.

References getDomain(), and getKind().

Referenced by getDomain().

◆ getDomain() [2/2]

Domain IntType::getDomain ( Kind  kind)
static

Get the value domain for one of the integer types.

Definition at line 410 of file MooreTypes.cpp.

References Bit, Byte, circt::moore::FourValued, Int, Integer, Logic, LongInt, Reg, ShortInt, Time, and circt::moore::TwoValued.

Referenced by getSimpleBitVectorFromIntType().

◆ getInt()

static IntType circt::moore::IntType::getInt ( MLIRContext *  context)
inlinestatic

Create a int type.

Definition at line 570 of file MooreTypes.h.

References get(), and Int.

Referenced by circt::moore::EnumType::get(), and mooreIntTypeGetInt().

◆ getKeyword() [1/2]

StringRef circt::moore::IntType::getKeyword ( ) const
inline

Get the keyword (like bit) for this type.

Definition at line 584 of file MooreTypes.h.

References getKeyword(), and getKind().

Referenced by format(), and getKeyword().

◆ getKeyword() [2/2]

StringRef IntType::getKeyword ( Kind  kind)
static

Get the keyword (like bit) for one of the integer types.

Definition at line 369 of file MooreTypes.cpp.

References Bit, Byte, Int, Integer, Logic, LongInt, Reg, ShortInt, and Time.

◆ getKind()

IntType::Kind IntType::getKind ( ) const

Get the concrete integer vector or atom type.

Definition at line 495 of file MooreTypes.cpp.

Referenced by getBitSize(), getDefaultSign(), getDomain(), and getKeyword().

◆ getKindFromDomainAndSize()

std::optional< IntType::Kind > IntType::getKindFromDomainAndSize ( Domain  domain,
unsigned  size 
)
static

Get the integer type that corresponds to a domain and bit size.

For example, returns int for (TwoValued, 32).

Definition at line 459 of file MooreTypes.cpp.

References Byte, circt::moore::FourValued, getAtomForDomain(), Int, Integer, LongInt, ShortInt, and circt::moore::TwoValued.

Referenced by circt::moore::SimpleBitVectorType::getType().

◆ getKindFromKeyword()

std::optional< IntType::Kind > IntType::getKindFromKeyword ( StringRef  keyword)
static

Get the integer type that corresponds to a keyword (like bit).

Definition at line 355 of file MooreTypes.cpp.

References Bit, Byte, Int, Integer, Logic, LongInt, Reg, ShortInt, and Time.

Referenced by customTypeParser().

◆ getLogic()

static IntType circt::moore::IntType::getLogic ( MLIRContext *  context)
inlinestatic

Create a logic type.

Definition at line 567 of file MooreTypes.h.

References get(), and Logic.

Referenced by mooreIntTypeGetLogic().

◆ getSign()

Sign IntType::getSign ( ) const

Get the sign of this type.

Definition at line 497 of file MooreTypes.cpp.

Referenced by format(), and getSimpleBitVectorFromIntType().

◆ getTime()

static IntType circt::moore::IntType::getTime ( MLIRContext *  context)
inlinestatic

Create a time type.

Definition at line 573 of file MooreTypes.h.

References get(), and Time.

Referenced by mooreIntTypeGetTime().

◆ isSignExplicit()

bool IntType::isSignExplicit ( ) const

Whether the sign of the type was specified explicitly.

This allows us to distinguish bit unsigned from bit.

Definition at line 499 of file MooreTypes.cpp.

Referenced by format(), and getSimpleBitVectorFromIntType().

Member Data Documentation

◆ name

constexpr StringLiteral circt::moore::IntType::name = "moore.int"
staticconstexpr

Definition at line 596 of file MooreTypes.h.


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