mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-23 06:13:41 +00:00
Support assign {a,b} = {c,d} with diff widths
This commit is contained in:
parent
a8eb39f569
commit
21034a0b0a
1 changed files with 22 additions and 31 deletions
|
@ -76,6 +76,16 @@ void sigCellDrivers(RTLIL::Design *design, dict<RTLIL::SigSpec, std::set<Cell *>
|
||||||
sig2CellsInFanin[actual] = newSet;
|
sig2CellsInFanin[actual] = newSet;
|
||||||
}
|
}
|
||||||
newSet->insert(cell);
|
newSet->insert(cell);
|
||||||
|
for (int i = 0; i < actual.size(); i++) {
|
||||||
|
SigSpec bit_sig = actual.extract(i, 1);
|
||||||
|
if (sig2CellsInFanin.count(bit_sig)) {
|
||||||
|
newSet = sig2CellsInFanin[bit_sig];
|
||||||
|
} else {
|
||||||
|
newSet = new std::set<Cell *>;
|
||||||
|
sig2CellsInFanin[bit_sig] = newSet;
|
||||||
|
}
|
||||||
|
newSet->insert(cell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,38 +102,19 @@ void lhs2rhs(RTLIL::Design *design, dict<RTLIL::SigSpec, RTLIL::SigSpec> &lhsSig
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!lhs.is_chunk()) {
|
if (!lhs.is_chunk()) {
|
||||||
if (lhs.chunks().size() != rhs.chunks().size()) {
|
std::vector<SigSpec> lhsBits;
|
||||||
auto rit = rhs.chunks().rbegin();
|
for (int i = 0; i < lhs.size(); i++) {
|
||||||
long unsigned rhsSize = 0;
|
SigSpec bit_sig = lhs.extract(i, 1);
|
||||||
while (rit != rhs.chunks().rend()) {
|
lhsBits.push_back(bit_sig);
|
||||||
RTLIL::SigSpec sub_rhs = *rit;
|
|
||||||
if (sub_rhs.is_fully_const()) {
|
|
||||||
rhsSize += (sub_rhs.as_chunk()).width;
|
|
||||||
} else {
|
|
||||||
rhsSize++;
|
|
||||||
}
|
|
||||||
rit++;
|
|
||||||
}
|
|
||||||
if (lhs.chunks().size() != rhsSize) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
auto lit = lhs.chunks().rbegin();
|
std::vector<SigSpec> rhsBits;
|
||||||
auto rit = rhs.chunks().rbegin();
|
for (int i = 0; i < rhs.size(); i++) {
|
||||||
while (rit != rhs.chunks().rend()) {
|
SigSpec bit_sig = rhs.extract(i, 1);
|
||||||
RTLIL::SigSpec sub_lhs = *lit;
|
rhsBits.push_back(bit_sig);
|
||||||
RTLIL::SigSpec sub_rhs = *rit;
|
}
|
||||||
if (sub_rhs.is_fully_const()) {
|
for (uint32_t i = 0; i < lhsBits.size(); i++) {
|
||||||
int constSize = (sub_rhs.as_chunk()).width;
|
if (i < rhsBits.size())
|
||||||
while (constSize--) {
|
lhsSig2rhsSig[lhsBits[i]] = rhsBits[i];
|
||||||
lit++;
|
|
||||||
}
|
|
||||||
rit++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lhsSig2rhsSig[sub_lhs] = sub_rhs;
|
|
||||||
lit++;
|
|
||||||
rit++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lhsSig2rhsSig[lhs] = rhs;
|
lhsSig2rhsSig[lhs] = rhs;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue