Skip to content

Conversation

@magancarz
Copy link
Contributor

This PR fixes a problem with technology mapping of adders which caused arithmetic operations such as addition or subtraction give incorrect results. It is caused by the abc command in the yosys synth pass before extracting and mapping fa/ha adders.

Steps to reproduce:

  • Prerequisites:

    • Verilator (tested on commit 4990b441209)
    • asap7sc7p5t_28 and path to its base directory as env variable ASAP7_SOURCES (tested on commit f970bd3c32)
    • add_tb.sv, add.sv and BUILD.bazel design files added as attachments
    • it is assumed that design files will be placed in add as bazel_rules_hdl subdirectory
  • Steps

    • Synthesize the design:

      bazel build //add:verilog_add_synth
      
    • Move the synthesized add module from the output directory to the design files and run verilation

      verilator --binary -Wno-TIMESCALEMOD --top-module add_tb add_tb.sv verilog_add_synth_synth_output.v \
          $ASAP7_SOURCES/Verilog/asap7sc7p5t_SEQ_RVT_TT_220101.v \
          $ASAP7_SOURCES/Verilog/asap7sc7p5t_SIMPLE_RVT_TT_201020.v \
          $ASAP7_SOURCES/Verilog/asap7sc7p5t_INVBUF_RVT_TT_201020.v \
          $ASAP7_SOURCES/Verilog/asap7sc7p5t_AO_RVT_TT_201020.v \
          $ASAP7_SOURCES/Verilog/asap7sc7p5t_OA_RVT_TT_201020.v
      
    • Simulate the design:

      ./obj_dir/Vadd_tb
      
  • Output pre-change:

 10 +   3 =   0
 10 +   3 =  89
- add_tb.sv:18: Verilog $finish
  • Output post-change:
 10 +   3 =   0
 10 +   3 =  13
- add_tb.sv:18: Verilog $finish

Design files:
add.zip

@mikesinouye
Copy link
Collaborator

/gcbrun

@magancarz magancarz force-pushed the mgan/synth-script-fix branch from c6b1642 to 7ba9354 Compare June 17, 2025 13:25
@magancarz
Copy link
Contributor Author

Rebased PR changes onto latest main

@mikesinouye
Copy link
Collaborator

/gcbrun

@magancarz magancarz force-pushed the mgan/synth-script-fix branch from 7ba9354 to 28bcf43 Compare July 15, 2025 11:26
@magancarz magancarz changed the title Add -noabc flag to the yosys synth pass Add synthesis rule variable for additional Yosys synth pass arguments Jul 15, 2025
@magancarz
Copy link
Contributor Author

magancarz commented Jul 15, 2025

Updated the PR source in a way which now the -noabc flag can be added optionally while creating a rule for synthesis.

@mikesinouye
Copy link
Collaborator

/gcbrun

@mikesinouye mikesinouye self-requested a review July 17, 2025 15:34
@mikesinouye mikesinouye merged commit 97e078d into hdl:main Jul 17, 2025
4 checks passed
@kgugala kgugala deleted the mgan/synth-script-fix branch August 19, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants