Generate one trigger per SenItem instead of per SenTree (#5483)

This commit is contained in:
Geza Lore
2024-09-25 10:35:50 +01:00
committed by GitHub
parent 6c61a9aff3
commit 3bc09d49fb
10 changed files with 253 additions and 186 deletions
+3 -20
View File
@@ -39,9 +39,6 @@ class V3OrderProcessDomains final {
// STATE
OrderGraph& m_graph; // The ordering graph
// Map from Trigger reference AstSenItem to the original AstSenTree
const V3Order::TrigToSenMap& m_trigToSen;
// This is a function provided by the invoker of the ordering that can provide additional
// sensitivity expression that when triggered indicates the passed AstVarScope might have
// changed external to the code being ordered.
@@ -165,11 +162,6 @@ class V3OrderProcessDomains final {
std::deque<string> report;
// Rebuild the trigger to original AstSenTree map using equality key comparison, as
// merging domains have created new AstSenTree instances which are not in the map
std::unordered_map<VNRef<const AstSenItem>, const AstSenTree*> trigToSen;
for (const auto& pair : m_trigToSen) trigToSen.emplace(*pair.first, pair.second);
for (V3GraphVertex& vtx : m_graph.vertices()) {
if (OrderVarVertex* const vvertexp = vtx.cast<OrderVarVertex>()) {
string name(vvertexp->vscp()->prettyName());
@@ -190,12 +182,7 @@ class V3OrderProcessDomains final {
for (AstSenItem* senItemp = senTreep->sensesp(); senItemp;
senItemp = VN_AS(senItemp->nextp(), SenItem)) {
if (senItemp != senTreep->sensesp()) os << " or ";
const auto it = trigToSen.find(*senItemp);
if (it != trigToSen.end()) {
V3EmitV::verilogForTree(it->second, os);
} else {
V3EmitV::verilogForTree(senItemp, os);
}
V3EmitV::verilogForTree(senItemp, os);
}
}
report.push_back(os.str());
@@ -209,10 +196,8 @@ class V3OrderProcessDomains final {
// CONSTRUCTOR
V3OrderProcessDomains(AstNetlist* netlistp, OrderGraph& graph, const string& tag,
const V3Order::TrigToSenMap& trigToSen,
const V3Order::ExternalDomainsProvider& externalDomains)
: m_graph{graph}
, m_trigToSen{trigToSen}
, m_externalDomains{externalDomains}
, m_finder{netlistp}
, m_tag{tag} {
@@ -238,16 +223,14 @@ class V3OrderProcessDomains final {
public:
// Order the logic
static void apply(AstNetlist* netlistp, OrderGraph& graph, const string& tag,
const V3Order::TrigToSenMap& trigToSen,
const V3Order::ExternalDomainsProvider& externalDomains) {
V3OrderProcessDomains{netlistp, graph, tag, trigToSen, externalDomains};
V3OrderProcessDomains{netlistp, graph, tag, externalDomains};
}
};
void V3Order::processDomains(AstNetlist* netlistp, //
OrderGraph& graph, //
const std::string& tag, //
const V3Order::TrigToSenMap& trigToSen, //
const ExternalDomainsProvider& externalDomains) {
V3OrderProcessDomains::apply(netlistp, graph, tag, trigToSen, externalDomains);
V3OrderProcessDomains::apply(netlistp, graph, tag, externalDomains);
}