Skip to content

Commit 743eed7

Browse files
mkurc-anttjurtsch
authored andcommitted
Added command-line options that will control handling of unconnected ports in post-synthesis netlist
Signed-off-by: Maciej Kurc <[email protected]>
1 parent 083f875 commit 743eed7

File tree

5 files changed

+129
-0
lines changed

5 files changed

+129
-0
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysi
607607
analysis_opts.timing_report_skew = Options.timing_report_skew;
608608
analysis_opts.echo_dot_timing_graph_node = Options.echo_dot_timing_graph_node;
609609

610+
analysis_opts.post_synth_netlist_unconn_input_handling = Options.post_synth_netlist_unconn_input_handling;
611+
analysis_opts.post_synth_netlist_unconn_output_handling = Options.post_synth_netlist_unconn_output_handling;
612+
610613
analysis_opts.timing_update_type = Options.timing_update_type;
611614
}
612615

vpr/src/base/ShowSetup.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,31 @@ static void ShowAnalysisOpts(const t_analysis_opts& AnalysisOpts) {
600600
default:
601601
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown timing_report_detail\n");
602602
}
603+
604+
const auto opts = {
605+
std::make_tuple(&AnalysisOpts.post_synth_netlist_unconn_input_handling, "post_synth_netlist_unconn_input_handling"),
606+
std::make_tuple(&AnalysisOpts.post_synth_netlist_unconn_output_handling, "post_synth_netlist_unconn_output_handling"),
607+
};
608+
for (const auto& opt : opts) {
609+
auto value = *std::get<0>(opt);
610+
VTR_LOG("AnalysisOpts.%s: ", std::get<1>(opt));
611+
switch(value) {
612+
case e_post_synth_netlist_unconn_handling::UNCONNECTED:
613+
VTR_LOG("UNCONNECTED\n");
614+
break;
615+
case e_post_synth_netlist_unconn_handling::NETS:
616+
VTR_LOG("NETS\n");
617+
break;
618+
case e_post_synth_netlist_unconn_handling::GND:
619+
VTR_LOG("GND\n");
620+
break;
621+
case e_post_synth_netlist_unconn_handling::VCC:
622+
VTR_LOG("VCC\n");
623+
break;
624+
default:
625+
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown post_synth_netlist_unconn_handling\n");
626+
}
627+
}
603628
VTR_LOG("\n");
604629
}
605630

vpr/src/base/read_options.cpp

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,76 @@ struct ParseTimingUpdateType {
10751075
}
10761076
};
10771077

1078+
struct ParsePostSynthNetlistUnconnInputHandling {
1079+
ConvertedValue<e_post_synth_netlist_unconn_handling> from_str(std::string str) {
1080+
ConvertedValue<e_post_synth_netlist_unconn_handling> conv_value;
1081+
if (str == "unconnected")
1082+
conv_value.set_value(e_post_synth_netlist_unconn_handling::UNCONNECTED);
1083+
else if (str == "nets")
1084+
conv_value.set_value(e_post_synth_netlist_unconn_handling::NETS);
1085+
else if (str == "gnd")
1086+
conv_value.set_value(e_post_synth_netlist_unconn_handling::GND);
1087+
else if (str == "vcc")
1088+
conv_value.set_value(e_post_synth_netlist_unconn_handling::VCC);
1089+
else {
1090+
std::stringstream msg;
1091+
msg << "Invalid conversion from '" << str << "' to e_post_synth_netlist_unconn_handling (expected one of: " << argparse::join(default_choices(), ", ") << ")";
1092+
conv_value.set_error(msg.str());
1093+
}
1094+
return conv_value;
1095+
}
1096+
1097+
ConvertedValue<std::string> to_str(e_post_synth_netlist_unconn_handling val) {
1098+
ConvertedValue<std::string> conv_value;
1099+
if (val == e_post_synth_netlist_unconn_handling::NETS)
1100+
conv_value.set_value("nets");
1101+
else if (val == e_post_synth_netlist_unconn_handling::GND)
1102+
conv_value.set_value("gnd");
1103+
else if (val == e_post_synth_netlist_unconn_handling::VCC)
1104+
conv_value.set_value("vcc");
1105+
else {
1106+
VTR_ASSERT(val == e_post_synth_netlist_unconn_handling::UNCONNECTED);
1107+
conv_value.set_value("unconnected");
1108+
}
1109+
return conv_value;
1110+
}
1111+
1112+
std::vector<std::string> default_choices() {
1113+
return {"unconnected", "nets", "gnd", "vcc"};
1114+
}
1115+
};
1116+
1117+
struct ParsePostSynthNetlistUnconnOutputHandling {
1118+
ConvertedValue<e_post_synth_netlist_unconn_handling> from_str(std::string str) {
1119+
ConvertedValue<e_post_synth_netlist_unconn_handling> conv_value;
1120+
if (str == "unconnected")
1121+
conv_value.set_value(e_post_synth_netlist_unconn_handling::UNCONNECTED);
1122+
else if (str == "nets")
1123+
conv_value.set_value(e_post_synth_netlist_unconn_handling::NETS);
1124+
else {
1125+
std::stringstream msg;
1126+
msg << "Invalid conversion from '" << str << "' to e_post_synth_netlist_unconn_handling (expected one of: " << argparse::join(default_choices(), ", ") << ")";
1127+
conv_value.set_error(msg.str());
1128+
}
1129+
return conv_value;
1130+
}
1131+
1132+
ConvertedValue<std::string> to_str(e_post_synth_netlist_unconn_handling val) {
1133+
ConvertedValue<std::string> conv_value;
1134+
if (val == e_post_synth_netlist_unconn_handling::NETS)
1135+
conv_value.set_value("nets");
1136+
else {
1137+
VTR_ASSERT(val == e_post_synth_netlist_unconn_handling::UNCONNECTED);
1138+
conv_value.set_value("unconnected");
1139+
}
1140+
return conv_value;
1141+
}
1142+
1143+
std::vector<std::string> default_choices() {
1144+
return {"unconnected", "nets"};
1145+
}
1146+
};
1147+
10781148
argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& args) {
10791149
std::string description =
10801150
"Implements the specified circuit onto the target FPGA architecture"
@@ -2419,6 +2489,26 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
24192489
.default_value("-1")
24202490
.show_in(argparse::ShowIn::HELP_ONLY);
24212491

2492+
analysis_grp.add_argument<e_post_synth_netlist_unconn_handling, ParsePostSynthNetlistUnconnInputHandling>(args.post_synth_netlist_unconn_input_handling, "--post_synth_netlist_unconn_inputs")
2493+
.help(
2494+
"Controls how unconnected input cell ports are handled in the post-synthesis netlist\n"
2495+
" * unconnected: leave unconnected\n"
2496+
" * nets: connect each unconnected input pin to its own separate\n"
2497+
" undriven net\n"
2498+
" * gnd: tie all to ground (1'b0)\n"
2499+
" * vcc: tie all to VCC (1'b1)\n")
2500+
.default_value("unconnected")
2501+
.show_in(argparse::ShowIn::HELP_ONLY);
2502+
2503+
analysis_grp.add_argument<e_post_synth_netlist_unconn_handling, ParsePostSynthNetlistUnconnOutputHandling>(args.post_synth_netlist_unconn_output_handling, "--post_synth_netlist_unconn_outputs")
2504+
.help(
2505+
"Controls how unconnected output cell ports are handled in the post-synthesis netlist\n"
2506+
" * unconnected: leave unconnected\n"
2507+
" * nets: connect each unconnected input pin to its own separate\n"
2508+
" undriven net\n")
2509+
.default_value("unconnected")
2510+
.show_in(argparse::ShowIn::HELP_ONLY);
2511+
24222512
auto& power_grp = parser.add_argument_group("power analysis options");
24232513

24242514
power_grp.add_argument<bool, ParseOnOff>(args.do_power, "--power")

vpr/src/base/read_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ struct t_options {
206206
argparse::ArgValue<e_timing_report_detail> timing_report_detail;
207207
argparse::ArgValue<bool> timing_report_skew;
208208
argparse::ArgValue<std::string> echo_dot_timing_graph_node;
209+
argparse::ArgValue<e_post_synth_netlist_unconn_handling> post_synth_netlist_unconn_input_handling;
210+
argparse::ArgValue<e_post_synth_netlist_unconn_handling> post_synth_netlist_unconn_output_handling;
209211
};
210212

211213
argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& args);

vpr/src/base/vpr_types.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,13 @@ enum class e_timing_report_detail {
11891189
DEBUG, //Show additional internal debugging information
11901190
};
11911191

1192+
enum class e_post_synth_netlist_unconn_handling {
1193+
UNCONNECTED, // Leave unrouted ports unconnected
1194+
NETS, // Leave unrouted ports unconnected but add new named nets to each of them
1195+
GND, // Tie unrouted ports to ground (only for input ports)
1196+
VCC // Tie unrouted ports to VCC (only for input ports)
1197+
};
1198+
11921199
struct t_timing_analysis_profile_info {
11931200
double timing_analysis_wallclock_time() const {
11941201
return sta_wallclock_time + slack_wallclock_time;
@@ -1284,6 +1291,8 @@ struct t_analysis_opts {
12841291
e_stage_action doAnalysis;
12851292

12861293
bool gen_post_synthesis_netlist;
1294+
e_post_synth_netlist_unconn_handling post_synth_netlist_unconn_input_handling;
1295+
e_post_synth_netlist_unconn_handling post_synth_netlist_unconn_output_handling;
12871296

12881297
int timing_report_npaths;
12891298
e_timing_report_detail timing_report_detail;

0 commit comments

Comments
 (0)