From 5cca77d8a6afc5f152298b301e23284428d383dd Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 28 Oct 2022 18:10:29 -0700 Subject: [PATCH] read_power_activities arg parsing Signed-off-by: James Cherry --- dcalc/LumpedCapDelayCalc.cc | 2 +- messages.txt | 29 +++++++++++++++++------------ power/Power.tcl | 6 ++++-- power/VcdReader.cc | 15 +++++++++------ 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/dcalc/LumpedCapDelayCalc.cc b/dcalc/LumpedCapDelayCalc.cc index d0218973..249619fb 100644 --- a/dcalc/LumpedCapDelayCalc.cc +++ b/dcalc/LumpedCapDelayCalc.cc @@ -165,7 +165,7 @@ LumpedCapDelayCalc::gateDelay(const LibertyCell *drvr_cell, float in_slew1 = delayAsFloat(in_slew); // NaNs cause seg faults during table lookup. if (isnan(load_cap) || isnan(related_out_cap) || isnan(in_slew)) - report_->error(705, "gate delay input variable is NaN"); + report_->error(710, "gate delay input variable is NaN"); model->gateDelay(drvr_cell, pvt, in_slew1, load_cap, related_out_cap, pocv_enabled_, gate_delay1, drvr_slew1); gate_delay = gate_delay1; diff --git a/messages.txt b/messages.txt index d4424f32..3f1f6ea9 100644 --- a/messages.txt +++ b/messages.txt @@ -1,4 +1,3 @@ -Warning: 705 duplicated 0001 DmpCeff.cc:1597 cell %s delay model not supported on SPF parasitics by DMP delay calculator 0002 Liberty.cc:748 cell %s/%s port %s not found in cell %s/%s. 0003 Liberty.cc:774 cell %s/%s %s -> %s timing group %s not found in cell %s/%s. @@ -162,12 +161,12 @@ Warning: 705 duplicated 0166 LibertyReader.cc:2290 timing group from output port. 0167 LibertyReader.cc:2308 timing group from output port. 0168 LibertyReader.cc:2323 timing group from output port. -0179 SpefReader.cc:725 %s. +0179 SpefReader.cc:733 %s. 0190 VerilogReader.cc:1728 %s is not a verilog module. 0191 VerilogReader.cc:1733 %s is not a verilog module. -0201 StaTcl.i:129 no network has been linked. -0202 StaTcl.i:143 network does not support edits. -0204 StaTcl.i:4182 POCV support requires compilation with SSTA=1. +0201 StaTcl.i:128 no network has been linked. +0202 StaTcl.i:142 network does not support edits. +0204 StaTcl.i:4181 POCV support requires compilation with SSTA=1. 0206 LibertyExpr.cc:171 %s %s. 0207 GraphDelayCalc1.cc:738 port not found in cell 0208 Graph.cc:793 arc_delay_annotated array bounds exceeded @@ -197,11 +196,11 @@ Warning: 705 duplicated 0265 TagGroup.cc:297 tag group missing tag 0266 Sta.cc:2091 '%s' is not a valid endpoint. 0267 Sta.cc:2015 '%s' is not a valid start point. -0272 StaTcl.i:4168 unknown common clk pessimism mode. -0273 StaTcl.i:5187 unknown clock sense +0272 StaTcl.i:4167 unknown common clk pessimism mode. +0273 StaTcl.i:5123 unknown clock sense 0300 Util.tcl:218 no commands match '$pattern'. -0301 Power.tcl:215 activity should be 0.0 to 1.0 or 2.0 -0302 Power.tcl:223 duty should be 0.0 to 1.0 +0301 Power.tcl:218 activity should be 0.0 to 1.0 or 2.0 +0302 Power.tcl:226 duty should be 0.0 to 1.0 0303 Sta.tcl:155 -clock ignored for clock objects. 0304 Sta.tcl:384 -from/-to keywords ignored for lib_pin, port and pin arguments. 0305 Cmds.tcl:166 object '$obj' not found. @@ -467,8 +466,8 @@ Warning: 705 duplicated 0604 Sdc.tcl:272 unknown $unit prefix '$prefix'. 0605 Sdc.tcl:3070 wire load model '$model_name' not found. 0606 Sta.tcl:1130 get_property unsupported object type $object_type. -0607 StaTcl.i:4418 unknown report path field %s -0608 StaTcl.i:4430 unknown report path field %s +0607 StaTcl.i:4417 unknown report path field %s +0608 StaTcl.i:4429 unknown report path field %s 0609 Search.tcl:427 -all_violators is deprecated. Use -violators 0610 Search.tcl:507 -max_transition deprecated. Use -max_slew. 0611 Search.tcl:512 -min_transition deprecated. Use -min_slew. @@ -486,5 +485,11 @@ Warning: 705 duplicated 0702 LibertyWriter.cc:436 3 axis table models not supported. 0703 LibertyWriter.cc:576 %s/%s/%s timing arc type %s not supported. 0704 LibertyWriter.cc:289 %s/%s bundled ports not supported. -0705 LumpedCapDelayCalc.cc:168 gate delay input variable is NaN 0705 Liberty.cc:793 Liberty cell %s/%s for corner %s/%s not found +0706 Parasitics.tcl:70 read_spef -increment is deprecated. +0710 LumpedCapDelayCalc.cc:168 gate delay input variable is NaN +0800 VcdReader.cc:108 unhandled vcd command. +0801 VcdReader.cc:143 timescale syntax error. +0802 VcdReader.cc:157 Unknown timescale unit. +0804 VcdReader.cc:205 Variable syntax error. +0805 Vcd.cc:119 Unknown variable %s ID %s diff --git a/power/Power.tcl b/power/Power.tcl index c929a61a..d680b48f 100644 --- a/power/Power.tcl +++ b/power/Power.tcl @@ -34,6 +34,7 @@ proc_redirect report_power { parse_key_args "report_power" args \ keys {-instances -corner -digits} flags {} + check_argc_eq0 "report_power" $args if { [info exists keys(-digits)] } { set digits $keys(-digits) check_positive_integer "-digits" $digits @@ -208,6 +209,7 @@ proc set_power_activity { args } { keys {-input_ports -pins -activity -duty} \ flags {-global -input} + check_argc_eq0 "set_power_activity" $args set activity 0.0 if { [info exists keys(-activity)] } { set activity $keys(-activity) @@ -253,9 +255,9 @@ define_cmd_args "read_power_activities" { -vcd filename } proc read_power_activities { args } { parse_key_args "read_power_activities" args \ - keys {-vcd} flags {} + keys {} flags {-vcd} - check_arg1 $args + check_argc_eq1 "set_power_activity" $args set filename [file nativename [lindex $args 0]] read_vcd_activities $filename } diff --git a/power/VcdReader.cc b/power/VcdReader.cc index 6a02a779..a7935ee4 100644 --- a/power/VcdReader.cc +++ b/power/VcdReader.cc @@ -20,6 +20,7 @@ #include "Zlib.hh" #include "Report.hh" +#include "Error.hh" #include "StringUtil.hh" namespace sta { @@ -111,6 +112,8 @@ VcdReader::read(const char *filename) } gzclose(stream_); } + else + throw FileNotReadable(filename); return vcd; } @@ -137,7 +140,7 @@ VcdReader::parseTimescale() setTimeUnit(tokens[1]); } else - report_->fileError(800, filename_, stmt_line_, "timescale syntax error."); + report_->fileError(801, filename_, stmt_line_, "timescale syntax error."); } void @@ -151,7 +154,7 @@ VcdReader::setTimeUnit(const string &time_unit) else if (time_unit == "ns") time_unit_scale = 1e-9; else - report_->fileError(801, filename_, stmt_line_, "Unknown timescale unit."); + report_->fileError(802, filename_, stmt_line_, "Unknown timescale unit."); vcd_->setTimeUnit(time_unit, time_unit_scale);; } @@ -199,7 +202,7 @@ VcdReader::parseVar() vcd_->makeVar(name, type, width, id); } else - report_->fileError(802, filename_, stmt_line_, "Variable syntax error."); + report_->fileError(804, filename_, stmt_line_, "Variable syntax error."); } void @@ -236,7 +239,7 @@ VcdReader::parseVarValues() || char0 == 'Z') { string id = token.substr(1); if (!vcd_->varIdValid(id)) - report_->fileError(804, filename_, stmt_line_, + report_->fileError(805, filename_, stmt_line_, "unknown variable %s", id.c_str()); vcd_->varAppendValue(id, time_, char0); } @@ -247,7 +250,7 @@ VcdReader::parseVarValues() || char1 == 'Z') { string id = getToken(); if (!vcd_->varIdValid(id)) - report_->fileError(804, filename_, stmt_line_, + report_->fileError(806, filename_, stmt_line_, "unknown variable %s", id.c_str()); // Bus mixed 0/1/X/U not supported. vcd_->varAppendValue(id, time_, char1); @@ -258,7 +261,7 @@ VcdReader::parseVarValues() int64_t bus_value = strtol(bin.c_str(), &end, 2); string id = getToken(); if (!vcd_->varIdValid(id)) - report_->fileError(804, filename_, stmt_line_, + report_->fileError(807, filename_, stmt_line_, "unknown variable %s", id.c_str()); else vcd_->varAppendBusValue(id, time_, bus_value);