write_sdc -mode

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry
2026-05-01 10:32:20 -07:00
parent f622da7134
commit bd1cbefcd5
7 changed files with 58 additions and 11 deletions

View File

@@ -4,6 +4,13 @@ OpenSTA Timing Analyzer Release Notes
This file summarizes user visible changes for each release.
See ApiChangeLog.txt for changes to the STA api.
2026/05/01
----------
The write_sdc command supports a -mode argument.
read_sdc [-mode mode]
2026/03/23
----------

View File

@@ -1041,6 +1041,13 @@ public:
const Scene *scene,
const MinMax *min_max,
int digits);
void writeSdc(std::string_view filename,
std::string_view mode_name,
bool leaf,
bool native,
int digits,
bool gzip,
bool no_timestamp);
void writeSdc(const Sdc *sdc,
std::string_view filename,
// Map hierarchical pins and instances to leaf pins and instances.

View File

@@ -94,15 +94,15 @@ private:
void
write_sdc_cmd(std::string filename,
bool leaf,
bool compatible,
int digits,
bool gzip,
bool no_timestamp)
std::string mode_name,
bool leaf,
bool compatible,
int digits,
bool gzip,
bool no_timestamp)
{
Sta *sta = Sta::sta();
const Sdc *sdc = sta->cmdSdc();
sta->writeSdc(sdc, filename, leaf, compatible, digits, gzip, no_timestamp);
sta->writeSdc(filename, mode_name, leaf, compatible, digits, gzip, no_timestamp);
}
void

View File

@@ -62,13 +62,18 @@ proc_redirect read_sdc {
################################################################
define_cmd_args "write_sdc" \
{[-map_hpins] [-digits digits] [-gzip] [-no_timestamp] filename}
{[-mode mode] [-map_hpins] [-digits digits] [-gzip] [-no_timestamp] filename}
proc write_sdc { args } {
parse_key_args "write_sdc" args keys {-digits -significant_digits} \
parse_key_args "write_sdc" args keys {-mode -digits} \
flags {-map_hpins -compatible -gzip -no_timestamp}
check_argc_eq1 "write_sdc" $args
set mode [cmd_mode]
if { [info exists keys(-mode)] } {
set mode $keys(-mode)
}
set digits 4
if { [info exists keys(-digits)] } {
set digits $keys(-digits)
@@ -80,7 +85,7 @@ proc write_sdc { args } {
set no_timestamp [info exists flags(-no_timestamp)]
set map_hpins [info exists flags(-map_hpins)]
set native [expr ![info exists flags(-compatible)]]
write_sdc_cmd $filename $map_hpins $native $digits $gzip $no_timestamp
write_sdc_cmd $filename $mode $map_hpins $native $digits $gzip $no_timestamp
}
################################################################

View File

@@ -180,7 +180,7 @@ define_cmd_args "write_sdf" \
proc_redirect write_sdf {
parse_key_args "write_sdf" args \
keys {-corner -scene -divider -digits -significant_digits} \
keys {-corner -scene -divider -digits} \
flags {-include_typ -gzip -no_timestamp -no_version}
check_argc_eq1 "write_sdf" $args
set scene [parse_scene keys]

View File

@@ -816,6 +816,12 @@ cmd_mode_name()
return Sta::sta()->cmdMode()->name();
}
Mode *
cmd_mode()
{
return Sta::sta()->cmdMode();
}
void
set_cmd_mode(std::string mode_name)
{
@@ -828,6 +834,12 @@ find_modes(std::string mode_name)
return Sta::sta()->findModes(mode_name);
}
Mode *
find_mode(std::string mode_name)
{
return Sta::sta()->findMode(mode_name);
}
////////////////////////////////////////////////////////////////
CheckErrorSeq &

View File

@@ -2206,6 +2206,22 @@ Sta::checkExceptionToPins(ExceptionTo *to,
}
}
void
Sta::writeSdc(std::string_view filename,
std::string_view mode_name,
bool leaf,
bool native,
int digits,
bool gzip,
bool no_timestamp)
{
Mode *mode = findMode(mode_name);
if (mode)
writeSdc(mode->sdc(), filename, leaf, native, digits, gzip, no_timestamp);
else
report_->warn(1561, "mode {} not found.", mode_name);
}
void
Sta::writeSdc(const Sdc *sdc,
std::string_view filename,