mirror of
https://github.com/YosysHQ/yosys
synced 2026-08-08 23:21:20 +00:00
sigmap: take the signorm index's map directly instead of via connections()
This commit is contained in:
parent
c17cf30775
commit
3d45ce0fbc
3 changed files with 25 additions and 0 deletions
|
|
@ -144,6 +144,8 @@ namespace RTLIL
|
|||
struct PortBit;
|
||||
};
|
||||
|
||||
struct SigMap;
|
||||
|
||||
|
||||
// TODO clean up?
|
||||
extern int64_t signorm_ns;
|
||||
|
|
@ -3077,6 +3079,8 @@ public:
|
|||
const pool<PortBit> &fanout(SigBit bit);
|
||||
const dict<SigBit, pool<PortBit>> &signorm_fanout() const;
|
||||
|
||||
const SigMap *signorm_sigmap();
|
||||
|
||||
// Equivalent to `connect(lhs, rhs)` followed by `sigNormalize()` for the
|
||||
// merge implied by this single connection: updates the sigmap, promotes
|
||||
// the driven side as canonical, and re-normalizes any existing fanout
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ struct RTLIL::SigNormIndex
|
|||
signorm_restore_ns += time_ns;
|
||||
++signorm_restore_count;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -422,6 +423,21 @@ const std::vector<RTLIL::SigSig> &RTLIL::Module::connections() const
|
|||
return connections_;
|
||||
}
|
||||
|
||||
const SigMap *RTLIL::Module::signorm_sigmap()
|
||||
{
|
||||
if (sig_norm_index == nullptr)
|
||||
return nullptr;
|
||||
|
||||
int64_t start = PerformanceTimer::query();
|
||||
sig_norm_index->flush_connections();
|
||||
int64_t time_ns = PerformanceTimer::query() - start;
|
||||
Pass::subtract_from_current_runtime_ns(time_ns);
|
||||
signorm_restore_ns += time_ns;
|
||||
++signorm_restore_count;
|
||||
|
||||
return &sig_norm_index->sigmap;
|
||||
}
|
||||
|
||||
void RTLIL::Module::new_connections(const std::vector<RTLIL::SigSig> &new_conn)
|
||||
{
|
||||
if (sig_norm_index != nullptr) {
|
||||
|
|
|
|||
|
|
@ -301,6 +301,11 @@ struct SigMap final : public SigMapView
|
|||
// Rebuild SigMap for all connections in module
|
||||
void set(RTLIL::Module *module)
|
||||
{
|
||||
if (const SigMap *index_sigmap = module->signorm_sigmap()) {
|
||||
database = index_sigmap->database;
|
||||
return;
|
||||
}
|
||||
|
||||
int bitcount = 0;
|
||||
for (auto &it : module->connections())
|
||||
bitcount += it.first.size();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue