Allow Liberty floats as strings for `voltage_map` and `capacitive_load_unit` (#280)
* Allow Liberty floats as strings for voltage_map and capacitive_load_unit * Update liberty_float_as_str.lib * Use valid bool * Remove unused include
This commit is contained in:
parent
88c7779680
commit
2e903ab4da
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include "EnumNameMap.hh"
|
||||
#include "Report.hh"
|
||||
|
|
@ -873,8 +874,23 @@ LibertyReader::visitCapacitiveLoadUnit(LibertyAttr *attr)
|
|||
LibertyAttrValueIterator value_iter(attr->values());
|
||||
if (value_iter.hasNext()) {
|
||||
LibertyAttrValue *value = value_iter.next();
|
||||
bool valid = false;
|
||||
float scale;
|
||||
if (value->isFloat()) {
|
||||
float scale = value->floatValue();
|
||||
scale = value->floatValue();
|
||||
valid = true;
|
||||
}
|
||||
else if (value->isString()) {
|
||||
try {
|
||||
scale = std::stof(value->stringValue());
|
||||
valid = true;
|
||||
}
|
||||
catch (...) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
if (value_iter.hasNext()) {
|
||||
value = value_iter.next();
|
||||
if (value->isString()) {
|
||||
|
|
@ -968,10 +984,24 @@ LibertyReader::visitVoltageMap(LibertyAttr *attr)
|
|||
const char *supply_name = value->stringValue();
|
||||
if (value_iter.hasNext()) {
|
||||
value = value_iter.next();
|
||||
bool valid = false;
|
||||
float voltage;
|
||||
if (value->isFloat()) {
|
||||
float voltage = value->floatValue();
|
||||
library_->addSupplyVoltage(supply_name, voltage);
|
||||
voltage = value->floatValue();
|
||||
valid = true;
|
||||
}
|
||||
else if (value->isString()) {
|
||||
try {
|
||||
voltage = std::stof(value->stringValue());
|
||||
valid = true;
|
||||
}
|
||||
catch (...) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid)
|
||||
library_->addSupplyVoltage(supply_name, voltage);
|
||||
else
|
||||
libWarn(1166, attr, "voltage_map voltage is not a float.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
library (liberty_float_as_str) {
|
||||
delay_model : "table_lookup";
|
||||
simulation : false;
|
||||
capacitive_load_unit ("1","fF");
|
||||
leakage_power_unit : "1pW";
|
||||
current_unit : "1A";
|
||||
pulling_resistance_unit : "1kohm";
|
||||
time_unit : "1ns";
|
||||
voltage_unit : "1v";
|
||||
library_features : "report_delay_calculation";
|
||||
input_threshold_pct_rise : 50;
|
||||
input_threshold_pct_fall : 50;
|
||||
output_threshold_pct_rise : 50;
|
||||
output_threshold_pct_fall : 50;
|
||||
slew_lower_threshold_pct_rise : 30;
|
||||
slew_lower_threshold_pct_fall : 30;
|
||||
slew_upper_threshold_pct_rise : 70;
|
||||
slew_upper_threshold_pct_fall : 70;
|
||||
slew_derate_from_library : 1.0;
|
||||
nom_process : 1.0;
|
||||
nom_temperature : 85.0;
|
||||
nom_voltage : 0.75;
|
||||
voltage_map ("VDD", "0.65");
|
||||
voltage_map ("VSS", "0");
|
||||
voltage_map ("VCC", "-0.1");
|
||||
voltage_map ("VBB", 0.1);
|
||||
voltage_map ("GND", 0);
|
||||
|
||||
cell (my_inv) {
|
||||
pin (A) {
|
||||
capacitance : 1;
|
||||
direction : "input";
|
||||
}
|
||||
pin (Y) {
|
||||
function : "!A";
|
||||
direction : "output";
|
||||
timing () {
|
||||
related_pin : "A";
|
||||
timing_sense : "negative_unate";
|
||||
cell_rise (scalar) {
|
||||
values ("1");
|
||||
}
|
||||
cell_fall (scalar) {
|
||||
values ("1");
|
||||
}
|
||||
rise_transition (scalar) {
|
||||
values ("1");
|
||||
}
|
||||
fall_transition (scalar) {
|
||||
values ("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
time 1ns
|
||||
capacitance 1fF
|
||||
resistance 1kohm
|
||||
voltage 1v
|
||||
current 1A
|
||||
power 1pW
|
||||
distance 1um
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# liberty with float as string in voltage_map and capacitive_load_unit
|
||||
read_liberty liberty_float_as_str.lib
|
||||
report_units
|
||||
|
|
@ -147,6 +147,7 @@ record_sta_tests {
|
|||
liberty_arcs_one2one_2
|
||||
liberty_backslash_eol
|
||||
liberty_ccsn
|
||||
liberty_float_as_str
|
||||
liberty_latch3
|
||||
path_group_names
|
||||
prima3
|
||||
|
|
|
|||
Loading…
Reference in New Issue