Skip to content

Commit 35801c2

Browse files
committed
sdc: add help
1 parent a4dc015 commit 35801c2

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

passes/cmds/sdc/sdc.cc

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,15 +773,33 @@ class SDCInterpreter
773773

774774
// Also see TclPass
775775
struct SdcPass : public Pass {
776-
// TODO help
776+
void help() override
777+
{
778+
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
779+
log("\n");
780+
log(" sdc [options] file\n");
781+
log("\n");
782+
log("Read the SDC file for the current design.\n");
783+
log("\n");
784+
log(" -dump\n");
785+
log(" Dump the referenced design objects.\n");
786+
log("\n");
787+
log(" -dump-graph\n");
788+
log(" Dump the uninterpreted call graph.\n");
789+
log("\n");
790+
log(" -keep_hierarchy\n");
791+
log(" Add keep_hierarchy attributes while retaining SDC validity.\n");
792+
log("\n");
793+
}
777794
SdcPass() : Pass("sdc", "sniff at some SDC") { }
778795
void execute(std::vector<std::string> args, RTLIL::Design *design) override {
779796
log_header(design, "Executing SDC pass.\n");
797+
log_experimental("sdc");
780798
size_t argidx;
781799
bool dump_mode = false;
782800
bool dump_graph_mode = false;
783801
bool keep_hierarchy_mode = false;
784-
std::vector<std::string> opensta_stubs_paths;
802+
std::vector<std::string> stubs_paths;
785803
for (argidx = 1; argidx < args.size(); argidx++) {
786804
if (args[argidx] == "-dump") {
787805
dump_mode = true;
@@ -793,23 +811,25 @@ struct SdcPass : public Pass {
793811
keep_hierarchy_mode = true;
794812
continue;
795813
} else if (args[argidx] == "-stubs" && argidx+1 < args.size()) {
796-
opensta_stubs_paths.push_back(args[++argidx]);
814+
stubs_paths.push_back(args[++argidx]);
797815
continue;
798816
}
799817
break;
800818
}
801819
if (argidx >= args.size())
802820
log_cmd_error("Missing SDC file.\n");
803821

804-
std::string sdc_path = args[argidx];
822+
std::string sdc_path = args[argidx++];
823+
if (argidx < args.size())
824+
log_cmd_error("Unexpected extra positional argument %s after SDC file %s.\n", args[argidx], sdc_path);
805825
SDCInterpreter& sdc = SDCInterpreter::get();
806826
Tcl_Interp *interp = sdc.fresh_interp(design);
807827
Tcl_Preserve(interp);
808828
std::string stub_path = "+/sdc/graph-stubs.sdc";
809829
rewrite_filename(stub_path);
810830
if (Tcl_EvalFile(interp, stub_path.c_str()) != TCL_OK)
811831
log_cmd_error("SDC interpreter returned an error in stub preamble file: %s\n", Tcl_GetStringResult(interp));
812-
for (auto path : opensta_stubs_paths)
832+
for (auto path : stubs_paths)
813833
if (Tcl_EvalFile(interp, path.c_str()) != TCL_OK)
814834
log_cmd_error("SDC interpreter returned an error in OpenSTA stub file %s: %s\n", path.c_str(), Tcl_GetStringResult(interp));
815835
if (Tcl_EvalFile(interp, sdc_path.c_str()) != TCL_OK)

0 commit comments

Comments
 (0)