write_verilog -remove_cells support non-liberty cells
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
d163ccbf8e
commit
1af03c8d0f
|
|
@ -16,20 +16,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include "NetworkClass.hh"
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class Network;
|
|
||||||
class LibertyCell;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
writeVerilog(const char *filename,
|
writeVerilog(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
bool include_pwr_gnd,
|
bool include_pwr_gnd,
|
||||||
vector<LibertyCell*> *remove_cells,
|
CellSeq *remove_cells,
|
||||||
Network *network);
|
Network *network);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,12 @@ proc parse_libcell_inst_net_arg { objects libcells_var insts_var nets_var } {
|
||||||
get_object_args $objects {} libcells {} {} insts {} {} nets {} {}
|
get_object_args $objects {} libcells {} {} insts {} {} nets {} {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc parse_cell_arg { objects } {
|
||||||
|
set cells {}
|
||||||
|
get_object_args $objects {} {} {} cells {} {} {} {} {} {}
|
||||||
|
return $cells
|
||||||
|
}
|
||||||
|
|
||||||
proc parse_cell_port_args { objects cells_var ports_var } {
|
proc parse_cell_port_args { objects cells_var ports_var } {
|
||||||
upvar 1 $cells_var cells
|
upvar 1 $cells_var cells
|
||||||
upvar 1 $ports_var ports
|
upvar 1 $ports_var ports
|
||||||
|
|
|
||||||
15
tcl/StaTcl.i
15
tcl/StaTcl.i
|
|
@ -184,13 +184,6 @@ tclListSeqLibertyLibrary(Tcl_Obj *const source,
|
||||||
return tclListSeq<LibertyLibrary*>(source, SWIGTYPE_p_LibertyLibrary, interp);
|
return tclListSeq<LibertyLibrary*>(source, SWIGTYPE_p_LibertyLibrary, interp);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<LibertyCell*> *
|
|
||||||
tclListSeqLibertyCell(Tcl_Obj *const source,
|
|
||||||
Tcl_Interp *interp)
|
|
||||||
{
|
|
||||||
return tclListSeq<LibertyCell*>(source, SWIGTYPE_p_LibertyCell, interp);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class TYPE>
|
template <class TYPE>
|
||||||
Set<TYPE> *
|
Set<TYPE> *
|
||||||
tclListSet(Tcl_Obj *const source,
|
tclListSet(Tcl_Obj *const source,
|
||||||
|
|
@ -428,6 +421,10 @@ using namespace sta;
|
||||||
Tcl_SetObjResult(interp, list);
|
Tcl_SetObjResult(interp, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(in) CellSeq* {
|
||||||
|
$1 = tclListSeq<Cell*>($input, SWIGTYPE_p_Cell, interp);
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(out) TmpCellSeq* {
|
%typemap(out) TmpCellSeq* {
|
||||||
Tcl_Obj *list = Tcl_NewListObj(0, nullptr);
|
Tcl_Obj *list = Tcl_NewListObj(0, nullptr);
|
||||||
CellSeq *cells = $1;
|
CellSeq *cells = $1;
|
||||||
|
|
@ -441,10 +438,6 @@ using namespace sta;
|
||||||
delete cells;
|
delete cells;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) vector<LibertyCell*> * {
|
|
||||||
$1 = tclListSeqLibertyCell($input, interp);
|
|
||||||
}
|
|
||||||
|
|
||||||
%typemap(out) LibertyCellSeq* {
|
%typemap(out) LibertyCellSeq* {
|
||||||
Tcl_Obj *list = Tcl_NewListObj(0, nullptr);
|
Tcl_Obj *list = Tcl_NewListObj(0, nullptr);
|
||||||
LibertyCellSeq *cells = $1;
|
LibertyCellSeq *cells = $1;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void
|
||||||
write_verilog_cmd(const char *filename,
|
write_verilog_cmd(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
bool include_pwr_gnd,
|
bool include_pwr_gnd,
|
||||||
vector<LibertyCell*> *remove_cells)
|
CellSeq *remove_cells)
|
||||||
{
|
{
|
||||||
// This does NOT want the SDC (cmd) network because it wants
|
// This does NOT want the SDC (cmd) network because it wants
|
||||||
// to see the sta internal names.
|
// to see the sta internal names.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ proc write_verilog { args } {
|
||||||
|
|
||||||
set remove_cells {}
|
set remove_cells {}
|
||||||
if { [info exists keys(-remove_cells)] } {
|
if { [info exists keys(-remove_cells)] } {
|
||||||
set remove_cells [sta::parse_libcell_arg $keys(-remove_cells)]
|
set remove_cells [parse_cell_arg $keys(-remove_cells)]
|
||||||
}
|
}
|
||||||
set sort [info exists flags(-sort)]
|
set sort [info exists flags(-sort)]
|
||||||
set include_pwr_gnd [info exists flags(-include_pwr_gnd)]
|
set include_pwr_gnd [info exists flags(-include_pwr_gnd)]
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
VerilogWriter(const char *filename,
|
VerilogWriter(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
bool include_pwr_gnd_pins,
|
bool include_pwr_gnd_pins,
|
||||||
vector<LibertyCell*> *remove_cells,
|
CellSeq *remove_cells,
|
||||||
FILE *stream,
|
FILE *stream,
|
||||||
Network *network);
|
Network *network);
|
||||||
void writeModule(Instance *inst);
|
void writeModule(Instance *inst);
|
||||||
|
|
@ -70,7 +70,7 @@ protected:
|
||||||
const char *filename_;
|
const char *filename_;
|
||||||
bool sort_;
|
bool sort_;
|
||||||
bool include_pwr_gnd_;
|
bool include_pwr_gnd_;
|
||||||
LibertyCellSet remove_cells_;
|
CellSet remove_cells_;
|
||||||
FILE *stream_;
|
FILE *stream_;
|
||||||
Network *network_;
|
Network *network_;
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ void
|
||||||
writeVerilog(const char *filename,
|
writeVerilog(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
bool include_pwr_gnd_pins,
|
bool include_pwr_gnd_pins,
|
||||||
vector<LibertyCell*> *remove_cells,
|
CellSeq *remove_cells,
|
||||||
Network *network)
|
Network *network)
|
||||||
{
|
{
|
||||||
if (network->topInstance()) {
|
if (network->topInstance()) {
|
||||||
|
|
@ -102,7 +102,7 @@ writeVerilog(const char *filename,
|
||||||
VerilogWriter::VerilogWriter(const char *filename,
|
VerilogWriter::VerilogWriter(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
bool include_pwr_gnd_pins,
|
bool include_pwr_gnd_pins,
|
||||||
vector<LibertyCell*> *remove_cells,
|
CellSeq *remove_cells,
|
||||||
FILE *stream,
|
FILE *stream,
|
||||||
Network *network) :
|
Network *network) :
|
||||||
filename_(filename),
|
filename_(filename),
|
||||||
|
|
@ -113,7 +113,7 @@ VerilogWriter::VerilogWriter(const char *filename,
|
||||||
unconnected_net_index_(1)
|
unconnected_net_index_(1)
|
||||||
{
|
{
|
||||||
if (remove_cells) {
|
if (remove_cells) {
|
||||||
for(LibertyCell *lib_cell : *remove_cells)
|
for(Cell *lib_cell : *remove_cells)
|
||||||
remove_cells_.insert(lib_cell);
|
remove_cells_.insert(lib_cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,8 +293,7 @@ void
|
||||||
VerilogWriter::writeChild(Instance *child)
|
VerilogWriter::writeChild(Instance *child)
|
||||||
{
|
{
|
||||||
Cell *child_cell = network_->cell(child);
|
Cell *child_cell = network_->cell(child);
|
||||||
LibertyCell *lib_cell = network_->libertyCell(child_cell);
|
if (!remove_cells_.hasKey(child_cell)) {
|
||||||
if (!remove_cells_.hasKey(lib_cell)) {
|
|
||||||
const char *child_name = network_->name(child);
|
const char *child_name = network_->name(child);
|
||||||
const char *child_vname = instanceVerilogName(child_name,
|
const char *child_vname = instanceVerilogName(child_name,
|
||||||
network_->pathEscape());
|
network_->pathEscape());
|
||||||
|
|
@ -451,8 +450,7 @@ VerilogWriter::findChildNCcount(Instance *child)
|
||||||
{
|
{
|
||||||
int nc_count = 0;
|
int nc_count = 0;
|
||||||
Cell *child_cell = network_->cell(child);
|
Cell *child_cell = network_->cell(child);
|
||||||
LibertyCell *lib_cell = network_->libertyCell(child_cell);
|
if (!remove_cells_.hasKey(child_cell)) {
|
||||||
if (!remove_cells_.hasKey(lib_cell)) {
|
|
||||||
CellPortIterator *port_iter = network_->portIterator(child_cell);
|
CellPortIterator *port_iter = network_->portIterator(child_cell);
|
||||||
while (port_iter->hasNext()) {
|
while (port_iter->hasNext()) {
|
||||||
Port *port = port_iter->next();
|
Port *port = port_iter->next();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue