Skip to content

Commit 829c06d

Browse files
authored
Merge pull request #1957 from antmicro/pcza/merge-verilog-ports
Netlist Writer: write post synthesis netlist that can be simulated
2 parents cd8fb2b + 12830cd commit 829c06d

File tree

8 files changed

+321
-70
lines changed

8 files changed

+321
-70
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,14 @@ Analysis Options
12541254

12551255
**Default:** ``off``
12561256

1257+
.. option:: --gen_post_implementation_merged_netlist { on | off }
1258+
1259+
This option is based on ``--gen_post_synthesis_netlist``.
1260+
The difference is that ``--gen_post_implementation_merged_netlist`` generates a single verilog file with merged top module multi-bit ports of the implemented circuit.
1261+
The name of the file is ``<basename>_merged_post_implementation.v``
1262+
1263+
**Default:** ``off``
1264+
12571265
.. option:: --post_synth_netlist_unconn_inputs { unconnected | nets | gnd | vcc }
12581266

12591267
Controls how unconnected input cell ports are handled in the post-synthesis netlist

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysi
623623
}
624624

625625
analysis_opts.gen_post_synthesis_netlist = Options.Generate_Post_Synthesis_Netlist;
626+
analysis_opts.gen_post_implementation_merged_netlist = Options.Generate_Post_Implementation_Merged_Netlist;
626627

627628
analysis_opts.timing_report_npaths = Options.timing_report_npaths;
628629
analysis_opts.timing_report_detail = Options.timing_report_detail;

vpr/src/base/netlist_writer.cpp

Lines changed: 289 additions & 70 deletions
Large diffs are not rendered by default.

vpr/src/base/netlist_writer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@
1717
*/
1818
void netlist_writer(const std::string basename, std::shared_ptr<const AnalysisDelayCalculator> delay_calc, struct t_analysis_opts opts);
1919

20+
/**
21+
* @brief Writes out the post implementation netlist in Verilog format.
22+
* It has its top module ports merged into multi-bit ones.
23+
*
24+
* Written filename ends in {basename}_merged_post_implementation.v where {basename} is the
25+
* basename argument.
26+
*/
27+
void merged_netlist_writer(const std::string basename, std::shared_ptr<const AnalysisDelayCalculator> delay_calc, struct t_analysis_opts opts);
28+
2029
#endif

vpr/src/base/read_options.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,13 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
25322532
.default_value("off")
25332533
.show_in(argparse::ShowIn::HELP_ONLY);
25342534

2535+
analysis_grp.add_argument<bool, ParseOnOff>(args.Generate_Post_Implementation_Merged_Netlist, "--gen_post_implementation_merged_netlist")
2536+
.help(
2537+
"Generates the post-implementation netlist with merged top module ports"
2538+
" Used for post-implementation simulation and verification")
2539+
.default_value("off")
2540+
.show_in(argparse::ShowIn::HELP_ONLY);
2541+
25352542
analysis_grp.add_argument(args.timing_report_npaths, "--timing_report_npaths")
25362543
.help("Controls how many timing paths are reported.")
25372544
.default_value("100")

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ struct t_options {
208208
/* Analysis options */
209209
argparse::ArgValue<bool> full_stats;
210210
argparse::ArgValue<bool> Generate_Post_Synthesis_Netlist;
211+
argparse::ArgValue<bool> Generate_Post_Implementation_Merged_Netlist;
211212
argparse::ArgValue<int> timing_report_npaths;
212213
argparse::ArgValue<e_timing_report_detail> timing_report_detail;
213214
argparse::ArgValue<bool> timing_report_skew;

vpr/src/base/vpr_api.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,11 @@ void vpr_analysis(t_vpr_setup& vpr_setup, const t_arch& Arch, const RouteStatus&
12821282
vpr_setup.AnalysisOpts);
12831283
}
12841284

1285+
//Write the post-implementation merged netlist
1286+
if (vpr_setup.AnalysisOpts.gen_post_implementation_merged_netlist) {
1287+
merged_netlist_writer(atom_ctx.nlist.netlist_name().c_str(), analysis_delay_calc, vpr_setup.AnalysisOpts);
1288+
}
1289+
12851290
//Do power analysis
12861291
if (vpr_setup.PowerOpts.do_power) {
12871292
vpr_power_estimation(vpr_setup, Arch, *timing_info, route_status);

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,7 @@ struct t_analysis_opts {
12561256
e_stage_action doAnalysis;
12571257

12581258
bool gen_post_synthesis_netlist;
1259+
bool gen_post_implementation_merged_netlist;
12591260
e_post_synth_netlist_unconn_handling post_synth_netlist_unconn_input_handling;
12601261
e_post_synth_netlist_unconn_handling post_synth_netlist_unconn_output_handling;
12611262

0 commit comments

Comments
 (0)