mirror of https://github.com/YosysHQ/yosys.git
Auto-initialize OnehotDatabase on-demand in pmux2shiftx.cc
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
97e9caa4fa
commit
fc23af1707
|
@ -28,6 +28,7 @@ struct OnehotDatabase
|
||||||
Module *module;
|
Module *module;
|
||||||
const SigMap &sigmap;
|
const SigMap &sigmap;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
bool initialized = false;
|
||||||
|
|
||||||
pool<SigBit> init_ones;
|
pool<SigBit> init_ones;
|
||||||
dict<SigSpec, pool<SigSpec>> sig_sources_db;
|
dict<SigSpec, pool<SigSpec>> sig_sources_db;
|
||||||
|
@ -40,6 +41,9 @@ struct OnehotDatabase
|
||||||
|
|
||||||
void initialize()
|
void initialize()
|
||||||
{
|
{
|
||||||
|
log_assert(!initialized);
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
for (auto wire : module->wires())
|
for (auto wire : module->wires())
|
||||||
{
|
{
|
||||||
auto it = wire->attributes.find("\\init");
|
auto it = wire->attributes.find("\\init");
|
||||||
|
@ -176,6 +180,9 @@ struct OnehotDatabase
|
||||||
if (verbose)
|
if (verbose)
|
||||||
log("** ONEHOT QUERY START (%s)\n", log_signal(sig));
|
log("** ONEHOT QUERY START (%s)\n", log_signal(sig));
|
||||||
|
|
||||||
|
if (!initialized)
|
||||||
|
initialize();
|
||||||
|
|
||||||
query_worker(sig, retval, cache, 3);
|
query_worker(sig, retval, cache, 3);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -273,9 +280,6 @@ struct Pmux2ShiftxPass : public Pass {
|
||||||
OnehotDatabase onehot_db(module, sigmap);
|
OnehotDatabase onehot_db(module, sigmap);
|
||||||
onehot_db.verbose = verbose_onehot;
|
onehot_db.verbose = verbose_onehot;
|
||||||
|
|
||||||
if (optimize_onehot)
|
|
||||||
onehot_db.initialize();
|
|
||||||
|
|
||||||
dict<SigBit, pair<SigSpec, Const>> eqdb;
|
dict<SigBit, pair<SigSpec, Const>> eqdb;
|
||||||
|
|
||||||
for (auto cell : module->cells())
|
for (auto cell : module->cells())
|
||||||
|
@ -743,7 +747,6 @@ struct OnehotPass : public Pass {
|
||||||
SigMap sigmap(module);
|
SigMap sigmap(module);
|
||||||
OnehotDatabase onehot_db(module, sigmap);
|
OnehotDatabase onehot_db(module, sigmap);
|
||||||
onehot_db.verbose = verbose_onehot;
|
onehot_db.verbose = verbose_onehot;
|
||||||
onehot_db.initialize();
|
|
||||||
|
|
||||||
for (auto cell : module->selected_cells())
|
for (auto cell : module->selected_cells())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue