lnis-uofu / LSOracle

IDEA project source files
MIT License
97 stars 41 forks source link

Discrepancies in Verilog Netlist Generated by Different Optimization Sequences in LSOracle #102

Open DeLoSoCode opened 2 months ago

DeLoSoCode commented 2 months ago

Dear LSOracle Community,

I have encountered an inconsistency issue during synthesis using LSOracle. My current setup includes the following versions: Yosys 0.41+126, ABC 1.01, and Icarus Verilog version 13.0 (devel) (s20221226-221-g272771d18).

During synthesis, we deviated from the default synthesis process and employed a custom sequence of optimization passes. The commands used for the two synthesis processes are as follows:

1.!yosys -p "read_verilog /home/user/LSOracle_project/rtl.v; synth; write_verilog /home/user/LSOracle_project/ori_syn_yosys.v" 2.!yosys -p "read_verilog /home/user/LSOracle_project/rtl.v; prep -ifx; prep -nomem; hierarchy; flatten; proc -noopt; opt_expr -mux_undef; fsm_recode; opt_expr -mux_bool; fsm_expand; memory_map; opt_expr -mux_undef; check; opt_mem; fsm_recode; opt_reduce -fine; opt_dff; opt_expr; opt_expr -undriven; memory_memx; opt_expr -fine; memory_libmap; opt_expr -noclkinv; memory_unpack; memory_bram; fsm_info; fsm_info; write_verilog /home/user/LSOracle_project/syn_yosys.v"

The changes in the optimization sequence should not affect the consistency of the code.

Attached are the relevant files and steps to reproduce the issue:

(1)rtl.v: Our design file. (2)syn_yosys.v: The synthesized file generated using the original optimization sequence (commands saved in ori.lso script; can be executed in Ubuntu with ./core/lsoracle -f /home/user/LSOracle_project/ori.lso). (3)change_syn_yosys.v: The synthesized file generated using the custom optimization sequence (commands saved in change.lso script; can be executed in Ubuntu with ./core/lsoracle -f /home/user/LSOracle_project/change.lso). (4)yosys_testbench.v: The testbench file used for functional simulation. We performed functional simulation verification on both syn_yosys.v and change_syn_yosys.v using the Icarus Verilog simulator. The simulation results were saved in file1.txt and file2.txt. Comparing file1.txt and file2.txt, we found inconsistencies in the functional simulation results between syn_yosys.v and change_syn_yosys.v. However, the functional simulation results for the same design file should be consistent, regardless of the optimization parameter selections. (The commands for this step are stored in simulation.sh; you can execute bash simulation.sh after obtaining syn_yosys.v and change_syn_yosys.v to verify whether the functional simulation results of the two synthesized files are consistent.)

I would appreciate it if you could help identify the root cause of this issue. Thank you very much for your assistance. project.zip