write_verilog -include_pwr_gnd
This commit is contained in:
parent
0d73b5b65a
commit
fc279f0b34
|
|
@ -28,6 +28,7 @@ class LibertyCell;
|
||||||
void
|
void
|
||||||
writeVerilog(const char *filename,
|
writeVerilog(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
|
bool include_pwr_gnd,
|
||||||
vector<LibertyCell*> *remove_cells,
|
vector<LibertyCell*> *remove_cells,
|
||||||
Network *network);
|
Network *network);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,14 @@ delete_verilog_reader()
|
||||||
void
|
void
|
||||||
write_verilog_cmd(const char *filename,
|
write_verilog_cmd(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
|
bool include_pwr_gnd,
|
||||||
vector<LibertyCell*> *remove_cells)
|
vector<LibertyCell*> *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.
|
||||||
Sta *sta = Sta::sta();
|
Sta *sta = Sta::sta();
|
||||||
Network *network = sta->network();
|
Network *network = sta->network();
|
||||||
writeVerilog(filename, sort, remove_cells, network);
|
writeVerilog(filename, sort, include_pwr_gnd, remove_cells, network);
|
||||||
}
|
}
|
||||||
|
|
||||||
%} // inline
|
%} // inline
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,22 @@ namespace eval sta {
|
||||||
# Defined by SWIG interface Verilog.i.
|
# Defined by SWIG interface Verilog.i.
|
||||||
define_cmd_args "read_verilog" {filename}
|
define_cmd_args "read_verilog" {filename}
|
||||||
|
|
||||||
define_cmd_args "write_verilog" {[-sort] [-remove_cells cells] filename}
|
define_cmd_args "write_verilog" {[-sort] [-include_pwr_gnd]\
|
||||||
|
[-remove_cells cells] filename}
|
||||||
|
|
||||||
proc write_verilog { args } {
|
proc write_verilog { args } {
|
||||||
parse_key_args "write_verilog" args keys {-remove_cells} flags {-sort}
|
parse_key_args "write_verilog" args keys {-remove_cells} \
|
||||||
|
flags {-sort -include_pwr_gnd}
|
||||||
|
|
||||||
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 [sta::parse_libcell_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)]
|
||||||
check_argc_eq1 "write_verilog" $args
|
check_argc_eq1 "write_verilog" $args
|
||||||
set filename $args
|
set filename $args
|
||||||
write_verilog_cmd $filename $sort $remove_cells
|
write_verilog_cmd $filename $sort $include_pwr_gnd $remove_cells
|
||||||
}
|
}
|
||||||
|
|
||||||
# sta namespace end
|
# sta namespace end
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class VerilogWriter
|
||||||
public:
|
public:
|
||||||
VerilogWriter(const char *filename,
|
VerilogWriter(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
|
bool include_pwr_gnd_pins,
|
||||||
vector<LibertyCell*> *remove_cells,
|
vector<LibertyCell*> *remove_cells,
|
||||||
FILE *stream,
|
FILE *stream,
|
||||||
Network *network);
|
Network *network);
|
||||||
|
|
@ -55,6 +56,7 @@ protected:
|
||||||
|
|
||||||
const char *filename_;
|
const char *filename_;
|
||||||
bool sort_;
|
bool sort_;
|
||||||
|
bool include_pwr_gnd_;
|
||||||
CellSet remove_cells_;
|
CellSet remove_cells_;
|
||||||
FILE *stream_;
|
FILE *stream_;
|
||||||
Network *network_;
|
Network *network_;
|
||||||
|
|
@ -67,13 +69,15 @@ protected:
|
||||||
void
|
void
|
||||||
writeVerilog(const char *filename,
|
writeVerilog(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
|
bool include_pwr_gnd_pins,
|
||||||
vector<LibertyCell*> *remove_cells,
|
vector<LibertyCell*> *remove_cells,
|
||||||
Network *network)
|
Network *network)
|
||||||
{
|
{
|
||||||
if (network->topInstance()) {
|
if (network->topInstance()) {
|
||||||
FILE *stream = fopen(filename, "w");
|
FILE *stream = fopen(filename, "w");
|
||||||
if (stream) {
|
if (stream) {
|
||||||
VerilogWriter writer(filename, sort, remove_cells, stream, network);
|
VerilogWriter writer(filename, sort, include_pwr_gnd_pins,
|
||||||
|
remove_cells, stream, network);
|
||||||
writer.writeModule(network->topInstance());
|
writer.writeModule(network->topInstance());
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
}
|
}
|
||||||
|
|
@ -84,11 +88,13 @@ writeVerilog(const char *filename,
|
||||||
|
|
||||||
VerilogWriter::VerilogWriter(const char *filename,
|
VerilogWriter::VerilogWriter(const char *filename,
|
||||||
bool sort,
|
bool sort,
|
||||||
|
bool include_pwr_gnd_pins,
|
||||||
vector<LibertyCell*> *remove_cells,
|
vector<LibertyCell*> *remove_cells,
|
||||||
FILE *stream,
|
FILE *stream,
|
||||||
Network *network) :
|
Network *network) :
|
||||||
filename_(filename),
|
filename_(filename),
|
||||||
sort_(sort),
|
sort_(sort),
|
||||||
|
include_pwr_gnd_(include_pwr_gnd_pins),
|
||||||
stream_(stream),
|
stream_(stream),
|
||||||
network_(network),
|
network_(network),
|
||||||
unconnected_net_index_(1)
|
unconnected_net_index_(1)
|
||||||
|
|
@ -224,10 +230,13 @@ VerilogWriter::writeChild(Instance *child)
|
||||||
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();
|
||||||
if (network_->hasMembers(port))
|
if (include_pwr_gnd_
|
||||||
writeInstBusPin(child, port, first_port);
|
|| !network_->direction(port)->isPowerGround()) {
|
||||||
else
|
if (network_->hasMembers(port))
|
||||||
writeInstPin(child, port, first_port);
|
writeInstBusPin(child, port, first_port);
|
||||||
|
else
|
||||||
|
writeInstPin(child, port, first_port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delete port_iter;
|
delete port_iter;
|
||||||
fprintf(stream_, ");\n");
|
fprintf(stream_, ");\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue