CIRCT  18.0.0git
Public Types | Public Member Functions | Static Public Member Functions | 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 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...
 

Detailed Description

An integer vector or atom type.

Definition at line 502 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 505 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 491 of file MooreTypes.cpp.

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

◆ get()

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

◆ getBitSize() [1/2]

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

Get the size of this type.

Definition at line 571 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 425 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 567 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 391 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 569 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 408 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 551 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 565 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 367 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 485 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 447 of file MooreTypes.cpp.

References Bit, Byte, circt::moore::FourValued, Int, Integer, Logic, 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 353 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 548 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 487 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 554 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 489 of file MooreTypes.cpp.

Referenced by format(), and getSimpleBitVectorFromIntType().


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