CIRCT  20.0.0git
Namespaces | Macros | Functions
InferStateProperties.cpp File Reference
#include "circt/Dialect/Arc/ArcOps.h"
#include "circt/Dialect/Arc/ArcPasses.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Support/LLVM.h"
#include "mlir/Pass/Pass.h"
#include "circt/Dialect/Arc/ArcPasses.h.inc"
Include dependency graph for InferStateProperties.cpp:

Go to the source code of this file.

Namespaces

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

Macros

#define DEBUG_TYPE   "arc-infer-state-properties"
 
#define GEN_PASS_DEF_INFERSTATEPROPERTIES
 

Functions

static bool isConstZero (Value value)
 
static bool isConstTrue (Value value)
 
static LogicalResult applyResetTransformation (arc::DefineOp arcOp, ArrayRef< ResetInfo > resetInfos)
 Take an arc and a detected reset per output value and apply it to the arc if applicable (but does not change the state ops referring to the arc). More...
 
static void setResetOperandOfStateOp (arc::StateOp stateOp, unsigned resetConditionIndex)
 Transform the given state operation to match the changes done to the arc in 'applyResetTransformation' without any additional checks. More...
 
static LogicalResult applyEnableTransformation (arc::DefineOp arcOp, arc::StateOp stateOp, ArrayRef< EnableInfo > enableInfos)
 Take an arc and a detected enable per output value and apply it to the given state if applicable (no changes required to the arc::DefineOp operation for enables). More...
 
static ResetInfo getIfMuxBasedReset (OpOperand &output)
 A reset represented with a single mux operation. More...
 
static ResetInfo getIfAndBasedReset (OpOperand &output)
 A reset represented by an AND and XOR operation for i1 values only. More...
 
static EnableInfo checkOperandsForEnable (arc::StateOp stateOp, Value selfArg, Value cond, unsigned outputNr, bool isDisable)
 Just a helper function for the following two patterns. More...
 
static EnableInfo getIfMuxBasedEnable (OpOperand &output, StateOp stateOp)
 An enable represented by a single mux operation. More...
 
static EnableInfo getIfMuxBasedDisable (OpOperand &output, StateOp stateOp)
 A negated enable represented by a single mux operation. More...
 
ResetInfo computeResetInfoFromPattern (OpOperand &output)
 Combine all the reset patterns to one. More...
 
EnableInfo computeEnableInfoFromPattern (OpOperand &output, StateOp stateOp)
 Combine all the enable patterns to one. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "arc-infer-state-properties"

Definition at line 16 of file InferStateProperties.cpp.

◆ GEN_PASS_DEF_INFERSTATEPROPERTIES

#define GEN_PASS_DEF_INFERSTATEPROPERTIES

Definition at line 20 of file InferStateProperties.cpp.

Function Documentation

◆ applyEnableTransformation()

static LogicalResult applyEnableTransformation ( arc::DefineOp  arcOp,
arc::StateOp  stateOp,
ArrayRef< EnableInfo >  enableInfos 
)
static

Take an arc and a detected enable per output value and apply it to the given state if applicable (no changes required to the arc::DefineOp operation for enables).

Definition at line 163 of file InferStateProperties.cpp.

References assert(), and hw.ConstantOp::create().

◆ applyResetTransformation()

static LogicalResult applyResetTransformation ( arc::DefineOp  arcOp,
ArrayRef< ResetInfo >  resetInfos 
)
static

Take an arc and a detected reset per output value and apply it to the arc if applicable (but does not change the state ops referring to the arc).

Definition at line 100 of file InferStateProperties.cpp.

References assert().

◆ checkOperandsForEnable()

static EnableInfo checkOperandsForEnable ( arc::StateOp  stateOp,
Value  selfArg,
Value  cond,
unsigned  outputNr,
bool  isDisable 
)
static

Just a helper function for the following two patterns.

Definition at line 299 of file InferStateProperties.cpp.

Referenced by getIfMuxBasedDisable(), and getIfMuxBasedEnable().

◆ computeEnableInfoFromPattern()

EnableInfo computeEnableInfoFromPattern ( OpOperand &  output,
StateOp  stateOp 
)

Combine all the enable patterns to one.

Definition at line 368 of file InferStateProperties.cpp.

References getIfMuxBasedDisable(), and getIfMuxBasedEnable().

◆ computeResetInfoFromPattern()

ResetInfo computeResetInfoFromPattern ( OpOperand &  output)

Combine all the reset patterns to one.

Definition at line 358 of file InferStateProperties.cpp.

References getIfAndBasedReset(), and getIfMuxBasedReset().

◆ getIfAndBasedReset()

static ResetInfo getIfAndBasedReset ( OpOperand &  output)
static

A reset represented by an AND and XOR operation for i1 values only.

out = and(X); X being a list containing all of {xor(resetCond, true), arcArgument} ==> out = and(X\xor(resetCond, true)) + add resetCond to StateOp

Definition at line 254 of file InferStateProperties.cpp.

References assert(), and isConstTrue().

Referenced by computeResetInfoFromPattern().

◆ getIfMuxBasedDisable()

static EnableInfo getIfMuxBasedDisable ( OpOperand &  output,
StateOp  stateOp 
)
static

A negated enable represented by a single mux operation.

out = mux(enableCond, arcArgument, x) where x is the 'out' of the last cycle ==> out = arcArgument + set xor(enableCond, true) as enable operand to the StateOp

Definition at line 338 of file InferStateProperties.cpp.

References assert(), and checkOperandsForEnable().

Referenced by computeEnableInfoFromPattern().

◆ getIfMuxBasedEnable()

static EnableInfo getIfMuxBasedEnable ( OpOperand &  output,
StateOp  stateOp 
)
static

An enable represented by a single mux operation.

out = mux(enableCond, x, arcArgument) where x is the 'out' of the last cycle ==> out = arcArgument + set enableCond as enable operand to the StateOp

Definition at line 318 of file InferStateProperties.cpp.

References assert(), and checkOperandsForEnable().

Referenced by computeEnableInfoFromPattern().

◆ getIfMuxBasedReset()

static ResetInfo getIfMuxBasedReset ( OpOperand &  output)
static

A reset represented with a single mux operation.

out = mux(resetCondition, 0, arcArgument) ==> return arcArgument directly and add resetCondition to the StateOp

Definition at line 231 of file InferStateProperties.cpp.

References assert(), and isConstZero().

Referenced by computeResetInfoFromPattern().

◆ isConstTrue()

static bool isConstTrue ( Value  value)
static

Definition at line 39 of file InferStateProperties.cpp.

Referenced by getIfAndBasedReset().

◆ isConstZero()

static bool isConstZero ( Value  value)
static

Definition at line 32 of file InferStateProperties.cpp.

Referenced by getIfMuxBasedReset().

◆ setResetOperandOfStateOp()

static void setResetOperandOfStateOp ( arc::StateOp  stateOp,
unsigned  resetConditionIndex 
)
static

Transform the given state operation to match the changes done to the arc in 'applyResetTransformation' without any additional checks.

Definition at line 145 of file InferStateProperties.cpp.