CIRCT  20.0.0git
Namespaces | Macros | Typedefs | Functions
SVExtractTestCode.cpp File Reference
#include "circt/Dialect/Emit/EmitOps.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWInstanceGraph.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWSymCache.h"
#include "circt/Dialect/HW/InnerSymbolNamespace.h"
#include "circt/Dialect/SV/SVOps.h"
#include "circt/Dialect/SV/SVPasses.h"
#include "circt/Dialect/Seq/SeqDialect.h"
#include "circt/Dialect/Seq/SeqOps.h"
#include "circt/Dialect/Verif/VerifOps.h"
#include "circt/Support/Namespace.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/SetVector.h"
#include <set>
#include "circt/Dialect/SV/SVPasses.h.inc"
Include dependency graph for SVExtractTestCode.cpp:

Go to the source code of this file.

Namespaces

 circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
 
 circt::sv
 

Macros

#define GEN_PASS_DEF_SVEXTRACTTESTCODE
 

Typedefs

using BindTable = DenseMap< StringAttr, SmallDenseMap< StringAttr, sv::BindOp > >
 

Functions

static void getBackwardSliceSimple (Operation *rootOp, SetVector< Operation * > &backwardSlice, llvm::function_ref< bool(Operation *)> filter)
 
static void blockSlice (SetVector< Operation * > &ops, SetVector< Operation * > &blocks)
 
static void computeSlice (SetVector< Operation * > &roots, SetVector< Operation * > &results, llvm::function_ref< bool(Operation *)> filter)
 
static SetVector< Operation * > getBackwardSlice (SetVector< Operation * > &roots, llvm::function_ref< bool(Operation *)> filter)
 
static SetVector< Operation * > getBackwardSlice (hw::HWModuleOp module, llvm::function_ref< bool(Operation *)> rootFn, llvm::function_ref< bool(Operation *)> filterFn)
 
static StringAttr getNameForPort (Value val, SmallVector< mlir::Attribute > modulePorts)
 
static hw::HWModuleOp createModuleForCut (hw::HWModuleOp op, SetVector< Value > &inputs, IRMapping &cutMap, StringRef suffix, Attribute path, Attribute fileName, BindTable &bindTable)
 
static void setInsertPointToEndOrTerminator (OpBuilder &builder, Block *block)
 
static void addBlockMapping (IRMapping &cutMap, Operation *oldOp, Operation *newOp)
 
static bool hasOoOArgs (hw::HWModuleOp newMod, Operation *op)
 
static void updateOoOArgs (SmallVectorImpl< Operation * > &lateBoundOps, IRMapping &cutMap)
 
static void migrateOps (hw::HWModuleOp oldMod, hw::HWModuleOp newMod, SetVector< Operation * > &depOps, IRMapping &cutMap, hw::InstanceGraph &instanceGraph)
 
static bool isBound (hw::HWModuleLike op, hw::InstanceGraph &instanceGraph)
 
static void addExistingBinds (Block *topLevelModule, BindTable &bindTable)
 
static void inlineInputOnly (hw::HWModuleOp oldMod, hw::InstanceGraph &instanceGraph, BindTable &bindTable, SmallPtrSetImpl< Operation * > &opsToErase, llvm::DenseSet< hw::InnerRefAttr > &innerRefUsedByNonBindOp)
 
static bool isAssertOp (hw::HWSymbolCache &symCache, Operation *op)
 
static bool isCoverOp (hw::HWSymbolCache &symCache, Operation *op)
 
static bool isAssumeOp (hw::HWSymbolCache &symCache, Operation *op)
 
bool isInDesign (hw::HWSymbolCache &symCache, Operation *op, bool disableInstanceExtraction=false, bool disableRegisterExtraction=false)
 Return true if the operation belongs to the design. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_SVEXTRACTTESTCODE

#define GEN_PASS_DEF_SVEXTRACTTESTCODE

Definition at line 37 of file SVExtractTestCode.cpp.

Typedef Documentation

◆ BindTable

using BindTable = DenseMap<StringAttr, SmallDenseMap<StringAttr, sv::BindOp> >

Definition at line 46 of file SVExtractTestCode.cpp.

Function Documentation

◆ addBlockMapping()

static void addBlockMapping ( IRMapping &  cutMap,
Operation *  oldOp,
Operation *  newOp 
)
static

Definition at line 277 of file SVExtractTestCode.cpp.

References assert().

Referenced by migrateOps().

◆ addExistingBinds()

static void addExistingBinds ( Block *  topLevelModule,
BindTable bindTable 
)
static

Definition at line 350 of file SVExtractTestCode.cpp.

◆ blockSlice()

static void blockSlice ( SetVector< Operation * > &  ops,
SetVector< Operation * > &  blocks 
)
static

Definition at line 99 of file SVExtractTestCode.cpp.

Referenced by getBackwardSlice().

◆ computeSlice()

static void computeSlice ( SetVector< Operation * > &  roots,
SetVector< Operation * > &  results,
llvm::function_ref< bool(Operation *)>  filter 
)
static

Definition at line 109 of file SVExtractTestCode.cpp.

References getBackwardSliceSimple().

Referenced by getBackwardSlice().

◆ createModuleForCut()

static hw::HWModuleOp createModuleForCut ( hw::HWModuleOp  op,
SetVector< Value > &  inputs,
IRMapping &  cutMap,
StringRef  suffix,
Attribute  path,
Attribute  fileName,
BindTable bindTable 
)
static

◆ getBackwardSlice() [1/2]

static SetVector<Operation *> getBackwardSlice ( hw::HWModuleOp  module,
llvm::function_ref< bool(Operation *)>  rootFn,
llvm::function_ref< bool(Operation *)>  filterFn 
)
static

Definition at line 140 of file SVExtractTestCode.cpp.

References getBackwardSlice().

◆ getBackwardSlice() [2/2]

static SetVector<Operation *> getBackwardSlice ( SetVector< Operation * > &  roots,
llvm::function_ref< bool(Operation *)>  filter 
)
static

Definition at line 119 of file SVExtractTestCode.cpp.

References blockSlice(), and computeSlice().

Referenced by getBackwardSlice().

◆ getBackwardSliceSimple()

static void getBackwardSliceSimple ( Operation *  rootOp,
SetVector< Operation * > &  backwardSlice,
llvm::function_ref< bool(Operation *)>  filter 
)
static

Definition at line 57 of file SVExtractTestCode.cpp.

References assert().

Referenced by computeSlice().

◆ getNameForPort()

static StringAttr getNameForPort ( Value  val,
SmallVector< mlir::Attribute >  modulePorts 
)
static

Definition at line 151 of file SVExtractTestCode.cpp.

References circt::calyx::direction::get(), and seq::reg().

Referenced by createModuleForCut().

◆ hasOoOArgs()

static bool hasOoOArgs ( hw::HWModuleOp  newMod,
Operation *  op 
)
static

Definition at line 290 of file SVExtractTestCode.cpp.

Referenced by inlineInputOnly(), and migrateOps().

◆ inlineInputOnly()

static void inlineInputOnly ( hw::HWModuleOp  oldMod,
hw::InstanceGraph &  instanceGraph,
BindTable bindTable,
SmallPtrSetImpl< Operation * > &  opsToErase,
llvm::DenseSet< hw::InnerRefAttr > &  innerRefUsedByNonBindOp 
)
static

◆ isAssertOp()

static bool isAssertOp ( hw::HWSymbolCache &  symCache,
Operation *  op 
)
static

Definition at line 544 of file SVExtractTestCode.cpp.

Referenced by isInDesign().

◆ isAssumeOp()

static bool isAssumeOp ( hw::HWSymbolCache &  symCache,
Operation *  op 
)
static

Definition at line 580 of file SVExtractTestCode.cpp.

Referenced by isInDesign().

◆ isBound()

static bool isBound ( hw::HWModuleLike  op,
hw::InstanceGraph &  instanceGraph 
)
static

Definition at line 338 of file SVExtractTestCode.cpp.

◆ isCoverOp()

static bool isCoverOp ( hw::HWSymbolCache &  symCache,
Operation *  op 
)
static

Definition at line 569 of file SVExtractTestCode.cpp.

Referenced by isInDesign().

◆ isInDesign()

bool isInDesign ( hw::HWSymbolCache &  symCache,
Operation *  op,
bool  disableInstanceExtraction = false,
bool  disableRegisterExtraction = false 
)

Return true if the operation belongs to the design.

Definition at line 593 of file SVExtractTestCode.cpp.

References isAssertOp(), isAssumeOp(), and isCoverOp().

◆ migrateOps()

static void migrateOps ( hw::HWModuleOp  oldMod,
hw::HWModuleOp  newMod,
SetVector< Operation * > &  depOps,
IRMapping &  cutMap,
hw::InstanceGraph &  instanceGraph 
)
static

◆ setInsertPointToEndOrTerminator()

static void setInsertPointToEndOrTerminator ( OpBuilder &  builder,
Block *  block 
)
static

Definition at line 268 of file SVExtractTestCode.cpp.

Referenced by migrateOps().

◆ updateOoOArgs()

static void updateOoOArgs ( SmallVectorImpl< Operation * > &  lateBoundOps,
IRMapping &  cutMap 
)
static

Definition at line 302 of file SVExtractTestCode.cpp.

Referenced by inlineInputOnly(), and migrateOps().