rm redundant StaState args

This commit is contained in:
James Cherry 2019-06-17 08:32:28 -07:00
parent 3f7e207491
commit 49b2c3cea7
15 changed files with 47 additions and 77 deletions

View File

@ -24,7 +24,7 @@
using sta::stringEq;
using sta::Sta;
using sta::staMain;
using sta::showUseage;
using sta::showUsage;
// Swig uses C linkage for init functions.
extern "C" {
@ -40,7 +40,7 @@ main(int argc,
char *argv[])
{
if (argc == 2 && stringEq(argv[1], "-help")) {
showUseage(argv[0]);
showUsage(argv[0]);
return 0;
}
else if (argc == 2 && stringEq(argv[1], "-version")) {

View File

@ -125,7 +125,7 @@ staTclAppInit(Tcl_Interp *interp)
if (argc > 2 ||
(argc > 1 && argv[1][0] == '-'))
showUseage(argv[0]);
showUsage(argv[0]);
else {
if (argc == 2) {
char *cmd_file = argv[1];
@ -230,7 +230,7 @@ evalTclInit(Tcl_Interp *interp,
}
void
showUseage(char *prog)
showUsage(const char * prog)
{
printf("Usage: %s [-help] [-version] [-no_init] [-exit] cmd_file\n", prog);
printf(" -help show help and exit\n");

View File

@ -62,7 +62,7 @@ findCmdLineKey(int &argc,
const char *key);
void
showUseage(char *prog);
showUsage(const char *prog);
void
parseThreadsArg(int argc,
char **argv,

View File

@ -48,14 +48,11 @@ scaleFloats(FloatSeq *floats,
LibertyLibrary *
readLibertyFile(const char *filename,
bool infer_latches,
Report *report,
Debug *debug,
Network *network)
{
LibertyBuilder builder;
LibertyReader reader(&builder);
return reader.readLibertyFile(filename, infer_latches,
report, debug, network);
return reader.readLibertyFile(filename, infer_latches, network);
}
LibertyReader::LibertyReader(LibertyBuilder *builder) :
@ -91,14 +88,12 @@ LibertyReader::~LibertyReader()
LibertyLibrary *
LibertyReader::readLibertyFile(const char *filename,
bool infer_latches,
Report *report,
Debug *debug,
Network *network)
{
filename_ = filename;
infer_latches_ = infer_latches;
report_ = report;
debug_ = debug;
report_ = network->report();
debug_ = network->debug();
network_ = network;
var_map_ = nullptr;
library_ = nullptr;
@ -143,7 +138,7 @@ LibertyReader::readLibertyFile(const char *filename,
have_slew_upper_threshold_[tr_index] = false;
}
parseLibertyFile(filename, this, report);
parseLibertyFile(filename, this, report_);
return library_;
}

View File

@ -19,16 +19,12 @@
namespace sta {
class Report;
class Debug;
class Network;
class LibertyLibrary;
LibertyLibrary *
readLibertyFile(const char *filename,
bool infer_latches,
Report *report,
Debug *debug,
Network *network);
} // namespace

View File

@ -64,8 +64,6 @@ public:
virtual ~LibertyReader();
virtual LibertyLibrary *readLibertyFile(const char *filename,
bool infer_latches,
Report *report,
Debug *debug,
Network *network);
LibertyLibrary *library() const { return library_; }
virtual bool save(LibertyGroup *) { return false; }

View File

@ -601,8 +601,7 @@ Sta::readLiberty(const char *filename,
{
Stats stats(debug_);
LibertyLibrary *library = readLibertyFile(filename, corner, min_max,
infer_latches,
report_, debug_, network_);
infer_latches, network_);
if (library
// The default library is the first library read.
// This corresponds to a link_path of '*'.
@ -620,12 +619,10 @@ Sta::readLibertyFile(const char *filename,
Corner *corner,
const MinMaxAll *min_max,
bool infer_latches,
Report *report,
Debug *debug,
Network *network)
{
LibertyLibrary *liberty = sta::readLibertyFile(filename, infer_latches,
report, debug, network);
network);
if (liberty) {
// Don't map liberty cells if they are redefined by reading another
// library with the same cell names.
@ -643,12 +640,9 @@ Sta::readLibertyFile(const char *filename,
LibertyLibrary *
Sta::readLibertyFile(const char *filename,
bool infer_latches,
Report *report,
Debug *debug,
Network *network)
{
return sta::readLibertyFile(filename, infer_latches,
report, debug, network);
return sta::readLibertyFile(filename, infer_latches, network);
}
void
@ -669,7 +663,7 @@ Sta::setMinLibrary(const char *min_filename,
if (max_lib) {
LibertyLibrary *min_lib = readLibertyFile(min_filename, cmd_corner_,
MinMaxAll::min(), false,
report_, debug_, network_);
network_);
return min_lib != nullptr;
}
else

View File

@ -1215,14 +1215,10 @@ protected:
Corner *corner,
const MinMaxAll *min_max,
bool infer_latches,
Report *report,
Debug *debug,
Network *network);
// Allow external Liberty reader to parse forms not used by Sta.
virtual LibertyLibrary *readLibertyFile(const char *filename,
bool infer_latches,
Report *report,
Debug *debug,
Network *network);
void ensureLevelized();
void ensureClkArrivals();

View File

@ -48,18 +48,11 @@ using std::string;
using std::ofstream;
using std::ifstream;
typedef Vector<string> StringVector;
typedef Map<string, StringVector*> CellSpicePortNames;
typedef int Stage;
typedef Map<ParasiticNode*, int> ParasiticNodeMap;
typedef Map<LibertyPort*, LogicValue> LibertyPortLogicValues;
void
split(const string &text,
const string &delims,
// Return values.
StringVector &tokens);
void
streamPrint(ofstream &stream,
const char *fmt,
@ -1630,22 +1623,4 @@ streamPrint(ofstream &stream,
va_end(args);
}
void
split(const string &text,
const string &delims,
// Return values.
StringVector &tokens)
{
auto start = text.find_first_not_of(delims);
auto end = text.find_first_of(delims, start);
while (end != string::npos) {
tokens.push_back(text.substr(start, end - start));
start = text.find_first_not_of(delims, end);
end = text.find_first_of(delims, start);
}
if (start != string::npos)
tokens.push_back(text.substr(start));
}
} // namespace

View File

@ -231,4 +231,21 @@ trimRight(string &str)
str.erase(str.find_last_not_of(" ") + 1);
}
void
split(const string &text,
const string &delims,
// Return values.
StringVector &tokens)
{
auto start = text.find_first_not_of(delims);
auto end = text.find_first_of(delims, start);
while (end != string::npos) {
tokens.push_back(text.substr(start, end - start));
start = text.find_first_not_of(delims, end);
end = text.find_first_of(delims, start);
}
if (start != string::npos)
tokens.push_back(text.substr(start));
}
} // namespace

View File

@ -20,6 +20,7 @@
#include <stdarg.h>
#include <string.h>
#include <string>
#include "Vector.hh"
namespace sta {
@ -168,5 +169,13 @@ deleteTmpStrings();
void
trimRight(string &str);
typedef Vector<string> StringVector;
void
split(const string &text,
const string &delims,
// Return values.
StringVector &tokens);
} // namespace
#endif

View File

@ -74,9 +74,7 @@ extern VerilogReader *verilog_reader;
class VerilogReader
{
public:
explicit VerilogReader(Report *report,
Debug *debug,
NetworkReader *network);
explicit VerilogReader(NetworkReader *network);
~VerilogReader();
bool read(const char *filename);
// flex YY_INPUT yy_n_chars arg changed definition from int to size_t,

View File

@ -37,7 +37,7 @@ read_verilog(const char *filename)
NetworkReader *network = sta->networkReader();
if (network) {
sta->readNetlistBefore();
return readVerilogFile(filename, sta->report(), sta->debug(), network);
return readVerilogFile(filename, network);
}
else
return false;

View File

@ -54,12 +54,10 @@ linkVerilogNetwork(Cell *top_cell,
bool
readVerilogFile(const char *filename,
Report *report,
Debug *debug,
NetworkReader *network)
{
if (verilog_reader == nullptr)
verilog_reader = new VerilogReader(report, debug, network);
verilog_reader = new VerilogReader(network);
return verilog_reader->read(filename);
}
@ -140,11 +138,9 @@ public:
////////////////////////////////////////////////////////////////
VerilogReader::VerilogReader(Report *report,
Debug *debug,
NetworkReader *network) :
report_(report),
debug_(debug),
VerilogReader::VerilogReader(NetworkReader *network) :
report_(network->report()),
debug_(network->debug()),
network_(network),
library_(nullptr),
black_box_index_(0),

View File

@ -19,15 +19,11 @@
namespace sta {
class Report;
class Debug;
class Cell;
class NetworkEdit;
class Instance;
class NetworkReader;
// Return true if successful.
bool
readVerilogFile(const char *filename, Report *report, Debug *debug,
readVerilogFile(const char *filename,
NetworkReader *network);
void