From 7e0ba747e7e68fcd342a89894627a9ebd842725a Mon Sep 17 00:00:00 2001 From: James Cherry Date: Tue, 7 Jun 2022 08:14:51 -0700 Subject: [PATCH] write_lib sky130 Signed-off-by: James Cherry --- liberty/LibertyWriter.cc | 39 ++++++++++++++++++++++++++++++++------- liberty/TimingRole.cc | 4 ++-- messages.txt | 3 +++ tcl/Liberty.tcl | 3 +-- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/liberty/LibertyWriter.cc b/liberty/LibertyWriter.cc index 31c31e81..39aaee07 100644 --- a/liberty/LibertyWriter.cc +++ b/liberty/LibertyWriter.cc @@ -274,8 +274,14 @@ LibertyWriter::writePort(const LibertyPort *port) fprintf(stream_, " function : \"%s\";\n", func->asString()); auto tristate_enable = port->tristateEnable(); if (tristate_enable) { - FuncExpr three_state(FuncExpr::op_not, tristate_enable, nullptr, nullptr); - fprintf(stream_, " three_state : \"%s\";\n", three_state.asString()); + if (tristate_enable->op() == FuncExpr::op_not) { + FuncExpr *three_state = tristate_enable->left(); + fprintf(stream_, " three_state : \"%s\";\n", three_state->asString()); + } + else { + FuncExpr three_state(FuncExpr::op_not, tristate_enable, nullptr, nullptr); + fprintf(stream_, " three_state : \"%s\";\n", three_state.asString()); + } } if (port->isClock()) fprintf(stream_, " clock : true;\n"); @@ -351,7 +357,10 @@ LibertyWriter::writeTimingModels(const TimingArc *arc, fprintf(stream_, " }\n"); } else - criticalError(701, "timing model not supported."); + report_->error(701, "%s/%s/%s timing model not supported.", + library_->name(), + arc->from()->libertyCell()->name(), + arc->from()->name()); } void @@ -367,7 +376,7 @@ LibertyWriter::writeTableModel(const TableModel *model) writeTableModel2(model); break; case 3: - criticalError(701, "3 axis table models not supported."); + report_->error(702, "3 axis table models not supported."); break; } } @@ -477,10 +486,26 @@ LibertyWriter::timingTypeString(const TimingArcSet *arc_set) else return "hold_falling"; } + else if (role == TimingRole::nonSeqSetup()) { + const TimingArc *arc = arc_set->arcs()[0]; + if (arc->fromEdge()->asRiseFall() == RiseFall::rise()) + return "non_seq_setup_rising"; + else + return "non_seq_setup_falling"; + } + else if (role == TimingRole::nonSeqHold()) { + const TimingArc *arc = arc_set->arcs()[0]; + if (arc->fromEdge()->asRiseFall() == RiseFall::rise()) + return "non_seq_hold_rising"; + else + return "non_seq_hold_falling"; + } else { - report_->reportLine("timing arc type %s not supported yet.", - role->asString()); - criticalError(700, "timing arc type not supported yet."); + report_->error(703, "%s/%s/%s timing arc type %s not supported.", + library_->name(), + arc_set->from()->libertyCell()->name(), + arc_set->from()->name(), + role->asString()); return nullptr; } } diff --git a/liberty/TimingRole.cc b/liberty/TimingRole.cc index c343c01a..0fb89523 100644 --- a/liberty/TimingRole.cc +++ b/liberty/TimingRole.cc @@ -107,9 +107,9 @@ TimingRole::init() MinMax::max(),TimingRole::setup(),23); data_check_hold_ = new TimingRole("data check hold", false, true, false, MinMax::min(), TimingRole::hold(), 24); - non_seq_setup_ = new TimingRole("setup", false, true, true, + non_seq_setup_ = new TimingRole("non-sequential setup", false, true, true, MinMax::max(), TimingRole::setup(), 25); - non_seq_hold_ = new TimingRole("hold", false, true, true, + non_seq_hold_ = new TimingRole("non-sequential hold", false, true, true, MinMax::min(), TimingRole::hold(), 26); } diff --git a/messages.txt b/messages.txt index d1cb2749..dc62f33c 100644 --- a/messages.txt +++ b/messages.txt @@ -476,3 +476,6 @@ 0622 PathVertex.cc:279 missing requireds. 0623 PathVertexRep.cc:153 missing arrivals. 0624 PathVertexRep.cc:150 missing arrivals +0701 LibertyWriter.cc:354 %s/%s/%s timing model not supported. +0702 LibertyWriter.cc:373 3 axis table models not supported. +0703 LibertyWriter.cc:484 %s/%s/%s timing arc type %s not supported. diff --git a/tcl/Liberty.tcl b/tcl/Liberty.tcl index 13c48076..13749056 100644 --- a/tcl/Liberty.tcl +++ b/tcl/Liberty.tcl @@ -33,8 +33,7 @@ proc_redirect read_liberty { read_liberty_cmd $filename $corner $min_max $infer_latches } -define_cmd_args "write_liberty" {library filename} - +# for regression testing proc write_liberty { args } { check_argc_eq2 "write_liberty" $args