mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-07 06:33:24 +00:00
Fix handling of init attributes with strange width
This commit is contained in:
parent
848062088c
commit
e6cc67b46f
2 changed files with 9 additions and 3 deletions
|
@ -280,8 +280,12 @@ struct OptMergeWorker
|
||||||
|
|
||||||
dff_init_map.set(module);
|
dff_init_map.set(module);
|
||||||
for (auto &it : module->wires_)
|
for (auto &it : module->wires_)
|
||||||
if (it.second->attributes.count("\\init") != 0)
|
if (it.second->attributes.count("\\init") != 0) {
|
||||||
dff_init_map.add(it.second, it.second->attributes.at("\\init"));
|
Const initval = it.second->attributes.at("\\init");
|
||||||
|
for (int i = 0; i < GetSize(initval) && i < GetSize(it.second); i++)
|
||||||
|
if (initval[i] == State::S0 || initval[i] == State::S1)
|
||||||
|
dff_init_map.add(SigBit(it.second, i), initval[i]);
|
||||||
|
}
|
||||||
|
|
||||||
bool did_something = true;
|
bool did_something = true;
|
||||||
while (did_something)
|
while (did_something)
|
||||||
|
|
|
@ -244,7 +244,9 @@ struct OptRmdffPass : public Pass {
|
||||||
{
|
{
|
||||||
if (wire->attributes.count("\\init") != 0) {
|
if (wire->attributes.count("\\init") != 0) {
|
||||||
Const initval = wire->attributes.at("\\init");
|
Const initval = wire->attributes.at("\\init");
|
||||||
dff_init_map.add(wire, initval);
|
for (int i = 0; i < GetSize(initval) && i < GetSize(wire); i++)
|
||||||
|
if (initval[i] == State::S0 || initval[i] == State::S1)
|
||||||
|
dff_init_map.add(SigBit(wire, i), initval[i]);
|
||||||
for (int i = 0; i < GetSize(wire); i++) {
|
for (int i = 0; i < GetSize(wire); i++) {
|
||||||
SigBit wire_bit(wire, i), mapped_bit = assign_map(wire_bit);
|
SigBit wire_bit(wire, i), mapped_bit = assign_map(wire_bit);
|
||||||
if (mapped_bit.wire) {
|
if (mapped_bit.wire) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue