Skip to content

Commit

Permalink
write_sdc
Browse files Browse the repository at this point in the history
Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Nov 15, 2021
1 parent 3849b96 commit a218180
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
23 changes: 10 additions & 13 deletions sdc/WriteSdc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,28 +298,24 @@ writeSdc(Instance *instance,
bool no_timestamp,
Sdc *sdc)
{
WriteSdc writer(instance, filename, creator, map_hpins, native,
digits, gzip, no_timestamp, sdc);
writer.write();
WriteSdc writer(instance, creator, map_hpins, native,
digits, no_timestamp, sdc);
writer.write(filename, gzip);
}

WriteSdc::WriteSdc(Instance *instance,
const char *filename,
const char *creator,
bool map_hpins,
bool native,
int digits,
bool gzip,
bool no_timestamp,
Sdc *sdc) :
StaState(sdc),
instance_(instance),
filename_(filename),
creator_(creator),
map_hpins_(map_hpins),
native_(native),
digits_(digits),
gzip_(gzip),
no_timestamp_(no_timestamp),
top_instance_(instance == sdc_network_->topInstance()),
instance_name_length_(strlen(sdc_network_->pathName(instance))),
Expand All @@ -332,9 +328,10 @@ WriteSdc::~WriteSdc()
}

void
WriteSdc::write()
WriteSdc::write(const char *filename,
bool gzip)
{
openFile();
openFile(filename, gzip);
writeHeader();
writeTiming();
writeEnvironment();
Expand All @@ -344,12 +341,12 @@ WriteSdc::write()
}

void
WriteSdc::openFile()

WriteSdc::openFile(const char *filename,
bool gzip)
{
stream_ = gzopen(filename_, gzip_ ? "wb" : "wT");
stream_ = gzopen(filename, gzip ? "wb" : "wT");
if (stream_ == nullptr)
throw FileNotWritable(filename_);
throw FileNotWritable(filename);
}

void
Expand Down
10 changes: 4 additions & 6 deletions sdc/WriteSdcPvt.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ class WriteSdc : public StaState
{
public:
WriteSdc(Instance *instance,
const char *filename,
const char *creator,
bool map_hpins,
bool native,
int digits,
bool gzip,
bool no_timestamp,
Sdc *sdc);
virtual ~WriteSdc();
void write();
void write(const char *filename,
bool gzip);

void openFile();
void openFile(const char *filename,
bool gzip);
void closeFile();
virtual void writeHeader() const;
void writeTiming() const;
Expand Down Expand Up @@ -249,12 +249,10 @@ public:

protected:
Instance *instance_;
const char *filename_;
const char *creator_;
bool map_hpins_;
bool native_;
int digits_;
bool gzip_;
bool no_timestamp_;
bool top_instance_;
size_t instance_name_length_;
Expand Down

0 comments on commit a218180

Please sign in to comment.