CIRCT 24.0.0git
Loading...
Searching...
No Matches
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

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
namespace  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).
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.
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).
static ResetInfo getIfMuxBasedReset (OpOperand &output)
 A reset represented with a single mux operation.
static ResetInfo getIfAndBasedReset (OpOperand &output)
 A reset represented by an AND and XOR operation for i1 values only.
static EnableInfo checkOperandsForEnable (arc::StateOp stateOp, Value selfArg, Value cond, unsigned outputNr, bool isDisable)
 Just a helper function for the following two patterns.
static EnableInfo getIfMuxBasedEnable (OpOperand &output, StateOp stateOp)
 An enable represented by a single mux operation.
static EnableInfo getIfMuxBasedDisable (OpOperand &output, StateOp stateOp)
 A negated enable represented by a single mux operation.
ResetInfo computeResetInfoFromPattern (OpOperand &output)
 Combine all the reset patterns to one.
EnableInfo computeEnableInfoFromPattern (OpOperand &output, StateOp stateOp)
 Combine all the enable patterns to one.

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()

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(), hw.BitcastOp::create(), hw.ConstantOp::create(), failure(), circt::hw::getBitWidth(), and success().

◆ applyResetTransformation()

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(), failure(), and success().

◆ checkOperandsForEnable()

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 310 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 379 of file InferStateProperties.cpp.

References getIfMuxBasedDisable(), and getIfMuxBasedEnable().

◆ computeResetInfoFromPattern()

ResetInfo computeResetInfoFromPattern ( OpOperand & output)

Combine all the reset patterns to one.

Definition at line 369 of file InferStateProperties.cpp.

References getIfAndBasedReset(), and getIfMuxBasedReset().

◆ getIfAndBasedReset()

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 265 of file InferStateProperties.cpp.

References assert(), and isConstTrue().

Referenced by computeResetInfoFromPattern().

◆ getIfMuxBasedDisable()

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 349 of file InferStateProperties.cpp.

References assert(), and checkOperandsForEnable().

Referenced by computeEnableInfoFromPattern().

◆ getIfMuxBasedEnable()

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 329 of file InferStateProperties.cpp.

References assert(), and checkOperandsForEnable().

Referenced by computeEnableInfoFromPattern().

◆ getIfMuxBasedReset()

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 242 of file InferStateProperties.cpp.

References assert(), and isConstZero().

Referenced by computeResetInfoFromPattern().

◆ isConstTrue()

bool isConstTrue ( Value value)
static

Definition at line 39 of file InferStateProperties.cpp.

Referenced by getIfAndBasedReset().

◆ isConstZero()

bool isConstZero ( Value value)
static

Definition at line 32 of file InferStateProperties.cpp.

Referenced by getIfMuxBasedReset().

◆ setResetOperandOfStateOp()

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.