3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-03-23 12:59:15 +00:00

async2sync: inherit src attributes on new_q and new_d wires. Fixes #5674

This commit is contained in:
abhinavputhran 2026-03-06 16:27:03 -05:00
parent 04113eb95d
commit e5560cb8a9
2 changed files with 21 additions and 0 deletions

View file

@ -153,7 +153,10 @@ struct Async2syncPass : public Pass {
initvals.remove_init(ff.sig_q);
Wire *new_d = module->addWire(NEW_ID, ff.width);
new_d->set_src_attribute(cell->get_src_attribute());
Wire *new_q = module->addWire(NEW_ID, ff.width);
new_q->set_src_attribute(cell->get_src_attribute());
SigSpec sig_set = ff.sig_set;
SigSpec sig_clr = ff.sig_clr;
@ -199,7 +202,10 @@ struct Async2syncPass : public Pass {
initvals.remove_init(ff.sig_q);
Wire *new_d = module->addWire(NEW_ID, ff.width);
new_d->set_src_attribute(cell->get_src_attribute());
Wire *new_q = module->addWire(NEW_ID, ff.width);
new_q->set_src_attribute(cell->get_src_attribute());
if (ff.pol_aload) {
if (!ff.is_fine) {
@ -232,6 +238,7 @@ struct Async2syncPass : public Pass {
initvals.remove_init(ff.sig_q);
Wire *new_q = module->addWire(NEW_ID, ff.width);
new_q->set_src_attribute(cell->get_src_attribute());
if (ff.pol_arst) {
if (!ff.is_fine)
@ -266,10 +273,13 @@ struct Async2syncPass : public Pass {
initvals.remove_init(ff.sig_q);
Wire *new_q = module->addWire(NEW_ID, ff.width);
new_q->set_src_attribute(cell->get_src_attribute());
Wire *new_d;
if (ff.has_aload) {
new_d = module->addWire(NEW_ID, ff.width);
new_d->set_src_attribute(cell->get_src_attribute());
if (ff.pol_aload) {
if (!ff.is_fine)
module->addMux(NEW_ID, new_q, ff.sig_ad, ff.sig_aload, new_d);

11
tests/sat/async2sync.ys Normal file
View file

@ -0,0 +1,11 @@
read_verilog << EOT
module top(input clk, arst, d, output reg q);
always @(posedge clk or posedge arst)
if (arst) q <= 0;
else q <= d;
endmodule
EOT
proc
async2sync
dump w:\$auto\$async2sync*