@@ -32,12 +32,12 @@ struct SdcexpandPass : public ScriptPass
3232 }
3333
3434 string opensta_exe, sdc_filename, sdc_expanded_filename;
35- bool cleanup;
35+ bool cleanup = true ;
3636 void execute (std::vector<std::string> args, RTLIL::Design *design) override
3737 {
3838 log_header (design, " Executing SDC_EXPAND pass.\n " );
3939 string run_from, run_to;
40- cleanup = true ;
40+ opensta_exe = " sta " ;
4141
4242 size_t argidx;
4343 for (argidx = 1 ; argidx < args.size (); argidx++)
@@ -58,7 +58,6 @@ struct SdcexpandPass : public ScriptPass
5858 cleanup = false ;
5959 continue ;
6060 }
61- // repetitive boring bit
6261 if (args[argidx] == " -run" && argidx+1 < args.size ()) {
6362 size_t pos = args[argidx+1 ].find (' :' );
6463 if (pos == std::string::npos) {
@@ -72,6 +71,12 @@ struct SdcexpandPass : public ScriptPass
7271 }
7372 break ;
7473 }
74+
75+ if (sdc_filename.empty ())
76+ log_cmd_error (" Missing -sdc-in argument\n " );
77+ if (sdc_expanded_filename.empty ())
78+ log_cmd_error (" Missing -sdc-out argument\n " );
79+
7580 extra_args (args, argidx, design);
7681
7782 if (!design->full_selection ())
@@ -88,39 +93,33 @@ struct SdcexpandPass : public ScriptPass
8893 void script () override
8994 {
9095 std::string tempdir_name;
91- std::string liberty_path;
92- std::string verilog_path;
9396
9497 run (" design -save pre_expand" );
9598 run (" proc" );
9699 run (" memory" );
97100 // run("dfflegalize -cell $dff");
98101
99- std::string write_verilog_cmd = " write_verilog -norename -noexpr -attr2comment -defparam " ;
100102 if (help_mode) {
101- run (write_verilog_cmd + " <tmp_dir>/elaborated.v " ) ;
103+ tempdir_name = " <tmp_dir>" ;
102104 } else {
103105 if (cleanup)
104106 tempdir_name = get_base_tmpdir () + " /" ;
105107 else
106108 tempdir_name = " _tmp_" ;
107109 tempdir_name += proc_program_prefix () + " yosys-sdc_expand-XXXXXX" ;
108110 tempdir_name = make_temp_dir (tempdir_name);
109- verilog_path = tempdir_name + " /elaborated.v" ;
110- run (write_verilog_cmd + verilog_path);
111111 }
112+ std::string verilog_path = tempdir_name + " /elaborated.v" ;
112113
114+ std::string write_verilog_cmd = " write_verilog -norename -noexpr -attr2comment -defparam " ;
115+ run (write_verilog_cmd + verilog_path);
113116 run (" read_verilog -setattr whitebox -defer -DSIMLIB_NOCHECKS +/simlib.v" );
114117 run (" proc" );
115118 run (" hierarchy -auto-top" );
116119 run (" chtype -publish_icells" );
117120
118- if (help_mode) {
119- run (" icell_liberty <tmp_dir>/yosys.lib" );
120- } else {
121- liberty_path = tempdir_name + " /yosys.lib" ;
122- run (stringf (" icell_liberty %s" , liberty_path.c_str ()));
123- }
121+ std::string liberty_path = tempdir_name + " /yosys.lib" ;
122+ run (" icell_liberty " + liberty_path);
124123
125124 std::string opensta_pass_call = " opensta -exe " ;
126125 opensta_pass_call += help_mode ? " <exe>" : opensta_exe;
@@ -134,7 +133,7 @@ struct SdcexpandPass : public ScriptPass
134133 opensta_pass_call += help_mode ? " <tmp_dir>/yosys.lib" : liberty_path;
135134 if (!cleanup)
136135 opensta_pass_call += " -nocleanup" ;
137- run (opensta_pass_call. c_str () );
136+ run (opensta_pass_call);
138137
139138 if (!help_mode) {
140139 if (cleanup) {
0 commit comments