mirror of
https://github.com/YosysHQ/yosys
synced 2026-06-01 14:47:53 +00:00
xilinx_dsp: signorm compatibility
This commit is contained in:
parent
6fd7f5c02d
commit
41b3dbbc28
2 changed files with 54 additions and 7 deletions
|
|
@ -64,18 +64,61 @@ static Cell* addDsp(Module *module) {
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SigPool simd_signals(Module *module, SigMap* sigmap)
|
||||||
|
{
|
||||||
|
SigPool simd_signals;
|
||||||
|
// Mark representatives of wires that have the attribute
|
||||||
|
for (auto wire : module->wires()) {
|
||||||
|
SigSpec reps = (*sigmap)(wire);
|
||||||
|
log_assert(reps.size() == wire->width);
|
||||||
|
for (int i = 0; i < reps.size(); i++) {
|
||||||
|
auto bit = reps[i];
|
||||||
|
auto src_bit = SigBit(wire, i);
|
||||||
|
if (src_bit.is_wire() && src_bit.wire->has_attribute(ID::use_dsp)) {
|
||||||
|
if (src_bit.wire->get_strpool_attribute(ID::use_dsp).count("simd")) {
|
||||||
|
simd_signals.add(bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Also mark all aliases of those representatives
|
||||||
|
for (auto wire : module->wires()) {
|
||||||
|
SigSpec reps = (*sigmap)(wire);
|
||||||
|
log_assert(reps.size() == wire->width);
|
||||||
|
for (int i = 0; i < reps.size(); i++) {
|
||||||
|
auto bit = reps[i];
|
||||||
|
auto src_bit = SigBit(wire, i);
|
||||||
|
if (simd_signals.check(bit)) {
|
||||||
|
simd_signals.add(src_bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This seems silly, but that's generalized RTLIL for you!
|
||||||
|
return simd_signals;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_allowed(SigSpec& sig, SigPool& allowed_bits)
|
||||||
|
{
|
||||||
|
for (auto bit : sig.bits()) {
|
||||||
|
if (!allowed_bits.check(bit)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void xilinx_simd_pack(Module *module, SigMap* sigmap, const std::vector<Cell*> &selected_cells)
|
void xilinx_simd_pack(Module *module, SigMap* sigmap, const std::vector<Cell*> &selected_cells)
|
||||||
{
|
{
|
||||||
std::deque<Cell*> simd12_add, simd12_sub;
|
std::deque<Cell*> simd12_add, simd12_sub;
|
||||||
std::deque<Cell*> simd24_add, simd24_sub;
|
std::deque<Cell*> simd24_add, simd24_sub;
|
||||||
|
|
||||||
|
SigPool simds = simd_signals(module, sigmap);
|
||||||
|
|
||||||
for (auto cell : selected_cells) {
|
for (auto cell : selected_cells) {
|
||||||
if (!cell->type.in(ID($add), ID($sub)))
|
if (!cell->type.in(ID($add), ID($sub)))
|
||||||
continue;
|
continue;
|
||||||
SigSpec Y = cell->getPort(ID::Y);
|
SigSpec Y = cell->getPort(ID::Y);
|
||||||
if (!Y.is_chunk())
|
if (!is_allowed(Y, simds))
|
||||||
continue;
|
|
||||||
if (!Y.as_chunk().wire->get_strpool_attribute(ID(use_dsp)).count("simd"))
|
|
||||||
continue;
|
continue;
|
||||||
if (GetSize(Y) > 25)
|
if (GetSize(Y) > 25)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
read_verilog xilinx_srl.v
|
read_verilog -icells xilinx_srl.v
|
||||||
design -save read
|
design -save read
|
||||||
|
blackbox
|
||||||
|
select =*
|
||||||
|
design -save boxes
|
||||||
|
design -reset
|
||||||
|
design -load read
|
||||||
design -copy-to model $__XILINX_SHREG_
|
design -copy-to model $__XILINX_SHREG_
|
||||||
hierarchy -top xilinx_srl_static_test
|
hierarchy -top xilinx_srl_static_test
|
||||||
prep
|
prep
|
||||||
|
|
@ -35,12 +39,12 @@ sat -verify -prove-asserts -show-ports -seq 5 miter
|
||||||
##########
|
##########
|
||||||
|
|
||||||
design -load read
|
design -load read
|
||||||
design -copy-to model $__XILINX_SHREG_
|
|
||||||
hierarchy -top xilinx_srl_variable_test
|
hierarchy -top xilinx_srl_variable_test
|
||||||
prep
|
prep
|
||||||
design -save gold
|
design -save gold
|
||||||
|
|
||||||
xilinx_srl -variable
|
xilinx_srl -variable
|
||||||
|
design -copy-from boxes =$__XILINX_SHREG_
|
||||||
opt
|
opt
|
||||||
|
|
||||||
#stat
|
#stat
|
||||||
|
|
@ -54,7 +58,7 @@ design -stash gate
|
||||||
|
|
||||||
design -import gold -as gold
|
design -import gold -as gold
|
||||||
design -import gate -as gate
|
design -import gate -as gate
|
||||||
design -copy-from model -as $__XILINX_SHREG_ \$__XILINX_SHREG_
|
design -copy-from model -as gate.$__XILINX_SHREG_ \$__XILINX_SHREG_
|
||||||
prep
|
prep
|
||||||
|
|
||||||
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue