10#ifndef CONVERSION_SEQTOSV_FIRREGLOWERING_H
11#define CONVERSION_SEQTOSV_FIRREGLOWERING_H
20#include "llvm/ADT/SmallPtrSet.h"
42 llvm::DenseMap<Operation *, llvm::SmallDenseSet<Operation *>>
reachableMuxes;
43 llvm::SmallPtrSet<Operation *, 16>
visited;
51 llvm::filter_iterator<Operation::user_iterator,
52 std::function<bool(
const Operation *)>>;
101 Value rand,
unsigned &pos);
103 void createTree(OpBuilder &builder, Value reg, Value term, Value next);
104 std::optional<std::tuple<Value, Value, Value>>
108 void addToAlwaysBlock(Block *block, sv::EventControl clockEdge, Value clock,
109 const std::function<
void(OpBuilder &)> &body,
110 sv::ResetType resetStyle = {},
111 sv::EventControl resetEdge = {}, Value reset = {},
112 const std::function<void(OpBuilder &)> &resetBody = {});
115 const std::function<
void()> &trueSide,
116 const std::function<
void()> &falseSide);
119 OpBuilder builder(module.getBody());
122 constant->setLoc(builder.getFusedLoc({constant->getLoc(), loc}));
131 sv::ResetType, sv::EventControl, Value>;
Lower FirRegOp to sv.reg and sv.always.
std::unique_ptr< ReachableMuxes > reachableMuxes
bool needsRegRandomization() const
void initialize(OpBuilder &builder, RegLowerInfo reg, ArrayRef< Value > rands)
llvm::SmallDenseMap< std::pair< Value, unsigned >, Value > arrayIndexCache
llvm::SmallDenseMap< IfKeyType, sv::IfOp > ifCache
RegLowerInfo lower(seq::FirRegOp reg)
void addToIfBlock(OpBuilder &builder, Value cond, const std::function< void()> &trueSide, const std::function< void()> &falseSide)
std::optional< std::tuple< Value, Value, Value > > tryRestoringSubaccess(OpBuilder &builder, Value reg, Value term, hw::ArrayCreateOp nextRegValue)
llvm::SmallDenseMap< APInt, hw::ConstantOp > constantCache
std::pair< Block *, Value > IfKeyType
void createTree(OpBuilder &builder, Value reg, Value term, Value next)
unsigned numSubaccessRestored
hw::ConstantOp getOrCreateConstant(Location loc, const APInt &value)
void addToAlwaysBlock(Block *block, sv::EventControl clockEdge, Value clock, const std::function< void(OpBuilder &)> &body, sv::ResetType resetStyle={}, sv::EventControl resetEdge={}, Value reset={}, const std::function< void(OpBuilder &)> &resetBody={})
std::tuple< Block *, sv::EventControl, Value, sv::ResetType, sv::EventControl, Value > AlwaysKeyType
void initializeRegisterElements(Location loc, OpBuilder &builder, Value reg, Value rand, unsigned &pos)
TypeConverter & typeConverter
hw::HWModuleOp bool disableRegRandomization
bool emitSeparateAlwaysBlocks
llvm::SmallDenseMap< AlwaysKeyType, std::pair< sv::AlwaysOp, sv::IfOp > > alwaysBlocks
void buildReachabilityFrom(Operation *startNode)
llvm::SmallPtrSet< Operation *, 16 > visited
HWModuleOp llvm::DenseMap< Operation *, llvm::SmallDenseSet< Operation * > > reachableMuxes
bool isMuxReachableFrom(seq::FirRegOp regOp, comb::MuxOp muxOp)
ReachableMuxes(HWModuleOp m)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
llvm::filter_iterator< Operation::user_iterator, std::function< bool(const Operation *)> > ValidUsersIterator
static std::function< bool(const Operation *op)> opAllowsReachability
OpUserInfo(Operation *op)
ValidUsersIterator userIter
bool getAndSetUnvisited()
ValidUsersIterator userEnd