17 #include "mlir/IR/Operation.h"
19 using namespace circt;
26 SmallVectorImpl<Dependence> &result) {
33 <<
"Delays of operator type '" << opr.getValue()
34 <<
"' exceed maximum cycle time: " << cycleTime;
38 DenseMap<Operation *, SmallDenseMap<Operation *, float>> chains;
44 chains[op][op] = 0.0f;
48 if (dep.isAuxiliary())
51 Operation *pred = dep.getSource();
52 if (!chains.count(pred))
55 auto predOpr = *prob.getLinkedOperatorType(pred);
56 if (*prob.getLatency(predOpr) > 0) {
60 chains[op][pred] = *prob.getOutgoingDelay(predOpr);
66 for (
auto incomingChain : chains[pred]) {
67 Operation *origin = incomingChain.first;
68 float delay = incomingChain.second;
76 for (
auto incomingChain : chains[op]) {
77 Operation *origin = incomingChain.first;
78 float delay = incomingChain.second;
83 result.emplace_back(origin, op);
85 chains[op].erase(origin);
98 float startTimeInCycle = 0.0f;
102 if (dep.isAuxiliary())
105 Operation *pred = dep.getSource();
106 auto predStartTimeInCycle = prob.getStartTimeInCycle(pred);
107 if (!predStartTimeInCycle)
110 auto predOpr = *prob.getLinkedOperatorType(pred);
111 unsigned predStartTime = *prob.getStartTime(pred);
112 unsigned predEndTime = predStartTime + *prob.getLatency(predOpr);
114 if (predEndTime < startTime)
120 assert(predEndTime == startTime);
122 float predEndTimeInCycle =
123 (predStartTime == predEndTime ? *predStartTimeInCycle : 0.0f) +
124 *prob.getOutgoingDelay(predOpr);
125 startTimeInCycle = std::max(predEndTimeInCycle, startTimeInCycle);
This class models the accumulation of physical propagation delays on combinational paths along SSA de...
void setStartTimeInCycle(Operation *op, float time)
std::optional< float > getIncomingDelay(OperatorType opr)
The incoming delay denotes the propagation time from the operand inputs to either the result outputs ...
std::optional< float > getOutgoingDelay(OperatorType opr)
The outgoing delay denotes the propagation time from either the operand inputs (combinational operato...
std::optional< OperatorType > getLinkedOperatorType(Operation *op)
The linked operator type provides the runtime characteristics for op.
const OperatorTypeSet & getOperatorTypes()
Return the set of operator types.
std::optional< unsigned > getStartTime(Operation *op)
Return the start time for op, as computed by the scheduler.
detail::Dependence Dependence
A thin wrapper to allow a uniform handling of def-use and auxiliary dependences.
DependenceRange getDependences(Operation *op)
Return a range object to transparently iterate over op's incoming 1) implicit def-use dependences (ba...
Operation * getContainingOp()
Return the operation containing this problem, e.g. to emit diagnostics.
A wrapper class to uniformly handle def-use and auxiliary dependence edges.
LogicalResult handleOperationsInTopologicalOrder(Problem &prob, HandleOpFn fun)
Visit prob's operations in topological order, using an internal worklist.
LogicalResult computeChainBreakingDependences(ChainingProblem &prob, float cycleTime, SmallVectorImpl< Problem::Dependence > &result)
Analyse combinational chains in prob's dependence graph and determine pairs of operations that must b...
LogicalResult computeStartTimesInCycle(ChainingProblem &prob)
Assuming prob is scheduled and contains (integer) start times, this method fills in the start times i...
This file defines an intermediate representation for circuits acting as an abstraction for constraint...