CIRCT  18.0.0git
Macros | Functions
SVOps.cpp File Reference
#include "circt/Dialect/SV/SVOps.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWSymCache.h"
#include "circt/Dialect/HW/HWTypes.h"
#include "circt/Dialect/SV/SVAttributes.h"
#include "circt/Support/CustomDirectiveImpl.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include <optional>
#include "circt/Dialect/SV/SV.cpp.inc"
Include dependency graph for SVOps.cpp:

Go to the source code of this file.

Macros

#define GET_OP_CLASSES
 

Functions

static Operation * lookupSymbolInNested (Operation *symbolTableOp, StringRef symbol)
 Returns the operation registered with the given symbol name with the regions of 'symbolTableOp'. More...
 
static void getVerbatimExprAsmResultNames (Operation *op, function_ref< void(Value, StringRef)> setNameFn)
 Get the asm name for sv.verbatim.expr and sv.verbatim.expr.se. More...
 
static MacroDeclOp getReferencedMacro (const hw::HWSymbolCache *cache, Operation *op, FlatSymbolRefAttr macroName)
 
static LogicalResult verifyMacroSymbolUse (Operation *op, StringAttr name, SymbolTableCollection &symbolTable)
 Ensure that the symbol being instantiated exists and is a MacroDeclOp. More...
 
static ParseResult parseImplicitInitType (OpAsmParser &p, mlir::Type regType, std::optional< OpAsmParser::UnresolvedOperand > &initValue, mlir::Type &initType)
 
static void printImplicitInitType (OpAsmPrinter &p, Operation *op, mlir::Type regType, mlir::Value initValue, mlir::Type initType)
 
template<class Op >
static LogicalResult canonicalizeIfDefLike (Op op, PatternRewriter &rewriter)
 
static void replaceOpWithRegion (PatternRewriter &rewriter, Operation *op, Region &region)
 Replaces the given op with the contents of the given single-block region. More...
 
static ParseResult parseEventList (OpAsmParser &p, Attribute &eventsAttr, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &clocksOperands)
 
static void printEventList (OpAsmPrinter &p, AlwaysOp op, ArrayAttr portsAttr, OperandRange operands)
 
static SmallVector< CasePatternBit > getPatternBitsForValue (const APInt &value)
 
template<typename AssignTy >
static LogicalResult mergeNeiboringAssignments (AssignTy op, PatternRewriter &rewriter)
 
static ParseResult parseModportStructs (OpAsmParser &parser, ArrayAttr &portsAttr)
 
static void printModportStructs (OpAsmPrinter &p, Operation *, ArrayAttr portsAttr)
 
ParseResult parseIfaceTypeAndSignal (OpAsmParser &p, Type &ifaceTy, FlatSymbolRefAttr &signalName)
 
void printIfaceTypeAndSignal (OpAsmPrinter &p, Operation *op, Type type, FlatSymbolRefAttr signalName)
 
LogicalResult verifySignalExists (Value ifaceVal, FlatSymbolRefAttr signalName)
 
static Type getElementTypeOfWidth (Type type, int32_t width)
 
template<class Op >
static Op findInstanceSymbolInBlock (StringAttr name, Block *body)
 Instances must be at the top level of the hw.module (or within a `ifdef) More...
 
ParseResult parseXMRPath (::mlir::OpAsmParser &parser, ArrayAttr &pathAttr, StringAttr &terminalAttr)
 
void printXMRPath (OpAsmPrinter &p, XMROp op, ArrayAttr pathAttr, StringAttr terminalAttr)
 
static LogicalResult eraseIfZeroOrNotZero (Operation *op, Value value, PatternRewriter &rewriter, bool eraseIfZero)
 
template<class Op , bool EraseIfZero = false>
static LogicalResult canonicalizeImmediateVerifOp (Op op, PatternRewriter &rewriter)
 
template<class Op , bool EraseIfZero = false>
static LogicalResult canonicalizeConcurrentVerifOp (Op op, PatternRewriter &rewriter)
 
bool parseCaseRegions (OpAsmParser &p, ArrayAttr &patternsArray, ArrayAttr &caseNamesArray, SmallVectorImpl< std::unique_ptr< Region >> &caseRegions)
 Parse cases formatted like: case (pattern, "name") { ... More...
 
void printCaseRegions (OpAsmPrinter &p, Operation *, ArrayAttr patternsArray, ArrayAttr namesArray, MutableArrayRef< Region > caseRegions)
 Print cases formatted like: case (pattern, "name") { ... More...
 

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 2088 of file SVOps.cpp.

Function Documentation

◆ canonicalizeConcurrentVerifOp()

template<class Op , bool EraseIfZero = false>
static LogicalResult canonicalizeConcurrentVerifOp ( Op  op,
PatternRewriter &  rewriter 
)
static

Definition at line 1990 of file SVOps.cpp.

References eraseIfZeroOrNotZero().

◆ canonicalizeIfDefLike()

template<class Op >
static LogicalResult canonicalizeIfDefLike ( Op  op,
PatternRewriter &  rewriter 
)
static

Definition at line 385 of file SVOps.cpp.

◆ canonicalizeImmediateVerifOp()

template<class Op , bool EraseIfZero = false>
static LogicalResult canonicalizeImmediateVerifOp ( Op  op,
PatternRewriter &  rewriter 
)
static

Definition at line 1969 of file SVOps.cpp.

References eraseIfZeroOrNotZero().

◆ eraseIfZeroOrNotZero()

static LogicalResult eraseIfZeroOrNotZero ( Operation *  op,
Value  value,
PatternRewriter &  rewriter,
bool  eraseIfZero 
)
static

Definition at line 1956 of file SVOps.cpp.

References value.

Referenced by canonicalizeConcurrentVerifOp(), and canonicalizeImmediateVerifOp().

◆ findInstanceSymbolInBlock()

template<class Op >
static Op findInstanceSymbolInBlock ( StringAttr  name,
Block *  body 
)
static

Instances must be at the top level of the hw.module (or within a `ifdef)

Definition at line 1784 of file SVOps.cpp.

◆ getElementTypeOfWidth()

static Type getElementTypeOfWidth ( Type  type,
int32_t  width 
)
static

Definition at line 1655 of file SVOps.cpp.

References circt::calyx::direction::get(), and width.

◆ getPatternBitsForValue()

static SmallVector<CasePatternBit> getPatternBitsForValue ( const APInt &  value)
static

Definition at line 733 of file SVOps.cpp.

References value.

◆ getReferencedMacro()

static MacroDeclOp getReferencedMacro ( const hw::HWSymbolCache *  cache,
Operation *  op,
FlatSymbolRefAttr  macroName 
)
static

Definition at line 139 of file SVOps.cpp.

◆ getVerbatimExprAsmResultNames()

static void getVerbatimExprAsmResultNames ( Operation *  op,
function_ref< void(Value, StringRef)>  setNameFn 
)
static

Get the asm name for sv.verbatim.expr and sv.verbatim.expr.se.

Definition at line 100 of file SVOps.cpp.

◆ lookupSymbolInNested()

static Operation* lookupSymbolInNested ( Operation *  symbolTableOp,
StringRef  symbol 
)
static

Returns the operation registered with the given symbol name with the regions of 'symbolTableOp'.

recurse through nested regions which don't contain the symboltable trait. Returns nullptr if no valid symbol was found.

Definition at line 71 of file SVOps.cpp.

References circt::calyx::direction::get().

◆ mergeNeiboringAssignments()

template<typename AssignTy >
static LogicalResult mergeNeiboringAssignments ( AssignTy  op,
PatternRewriter &  rewriter 
)
static

Definition at line 1258 of file SVOps.cpp.

References circt::calyx::direction::get(), and circt::hw::isOffset().

◆ parseCaseRegions()

bool parseCaseRegions ( OpAsmParser &  p,
ArrayAttr &  patternsArray,
ArrayAttr &  caseNamesArray,
SmallVectorImpl< std::unique_ptr< Region >> &  caseRegions 
)

Parse cases formatted like: case (pattern, "name") { ...

}

Definition at line 2017 of file SVOps.cpp.

◆ parseEventList()

static ParseResult parseEventList ( OpAsmParser &  p,
Attribute &  eventsAttr,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  clocksOperands 
)
static

Definition at line 568 of file SVOps.cpp.

◆ parseIfaceTypeAndSignal()

ParseResult parseIfaceTypeAndSignal ( OpAsmParser &  p,
Type &  ifaceTy,
FlatSymbolRefAttr &  signalName 
)

Definition at line 1495 of file SVOps.cpp.

References circt::calyx::direction::get().

◆ parseImplicitInitType()

static ParseResult parseImplicitInitType ( OpAsmParser &  p,
mlir::Type  regType,
std::optional< OpAsmParser::UnresolvedOperand > &  initValue,
mlir::Type &  initType 
)
static

Definition at line 248 of file SVOps.cpp.

◆ parseModportStructs()

static ParseResult parseModportStructs ( OpAsmParser &  parser,
ArrayAttr &  portsAttr 
)
static

Definition at line 1346 of file SVOps.cpp.

References circt::calyx::direction::get().

◆ parseXMRPath()

ParseResult parseXMRPath ( ::mlir::OpAsmParser &  parser,
ArrayAttr &  pathAttr,
StringAttr &  terminalAttr 
)

Definition at line 1901 of file SVOps.cpp.

◆ printCaseRegions()

void printCaseRegions ( OpAsmPrinter &  p,
Operation *  ,
ArrayAttr  patternsArray,
ArrayAttr  namesArray,
MutableArrayRef< Region >  caseRegions 
)

Print cases formatted like: case (pattern, "name") { ...

}

Definition at line 2042 of file SVOps.cpp.

References assert().

◆ printEventList()

static void printEventList ( OpAsmPrinter &  p,
AlwaysOp  op,
ArrayAttr  portsAttr,
OperandRange  operands 
)
static

Definition at line 599 of file SVOps.cpp.

◆ printIfaceTypeAndSignal()

void printIfaceTypeAndSignal ( OpAsmPrinter &  p,
Operation *  op,
Type  type,
FlatSymbolRefAttr  signalName 
)

Definition at line 1508 of file SVOps.cpp.

References assert(), and circt::calyx::direction::get().

◆ printImplicitInitType()

static void printImplicitInitType ( OpAsmPrinter &  p,
Operation *  op,
mlir::Type  regType,
mlir::Value  initValue,
mlir::Type  initType 
)
static

Definition at line 262 of file SVOps.cpp.

◆ printModportStructs()

static void printModportStructs ( OpAsmPrinter &  p,
Operation *  ,
ArrayAttr  portsAttr 
)
static

Definition at line 1373 of file SVOps.cpp.

◆ printXMRPath()

void printXMRPath ( OpAsmPrinter &  p,
XMROp  op,
ArrayAttr  pathAttr,
StringAttr  terminalAttr 
)

Definition at line 1926 of file SVOps.cpp.

◆ replaceOpWithRegion()

static void replaceOpWithRegion ( PatternRewriter &  rewriter,
Operation *  op,
Region &  region 
)
static

Replaces the given op with the contents of the given single-block region.

Definition at line 467 of file SVOps.cpp.

References assert().

◆ verifyMacroSymbolUse()

static LogicalResult verifyMacroSymbolUse ( Operation *  op,
StringAttr  name,
SymbolTableCollection &  symbolTable 
)
static

Ensure that the symbol being instantiated exists and is a MacroDeclOp.

Definition at line 166 of file SVOps.cpp.

◆ verifySignalExists()

LogicalResult verifySignalExists ( Value  ifaceVal,
FlatSymbolRefAttr  signalName 
)

Definition at line 1517 of file SVOps.cpp.