Skip to content

Commit ebde36a

Browse files
committed
vpr: base: netlist writer: split multi-bit cell instance ports
Signed-off-by: Pawel Czarnecki <[email protected]>
1 parent 846273e commit ebde36a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vpr/src/base/netlist_writer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,12 +2389,11 @@ void print_blif_port(std::ostream& os, size_t& unconn_count, const std::string&
23892389
* Handles special cases like multi-bit and disconnected ports
23902390
*/
23912391
void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::string& port_name, const std::vector<std::string>& nets, PortType type, int depth, struct t_analysis_opts& opts) {
2392-
//Port name
2393-
os << indent(depth) << "." << port_name << "(";
2394-
23952392
//Pins
23962393
if (nets.size() == 1) {
23972394
//Single-bit port
2395+
//Port name
2396+
os << indent(depth) << "." << port_name << "(";
23982397
if (nets[0].empty()) {
23992398
//Disconnected
24002399
if (type == PortType::INPUT || type == PortType::CLOCK) {
@@ -2427,13 +2426,15 @@ void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::strin
24272426
//Connected
24282427
os << escape_verilog_identifier(nets[0]);
24292428
}
2429+
os << ")";
24302430
} else {
24312431
//A multi-bit port, we explicitly concat the single-bit nets to build the port,
24322432
//taking care to print MSB on left and LSB on right
2433-
os << "{"
2434-
<< "\n";
24352433
for (int ipin = (int)nets.size() - 1; ipin >= 0; --ipin) { //Reverse order to match endianess
2436-
os << indent(depth + 1);
2434+
//Port name
2435+
2436+
std::string name = port_name + "[" + std::to_string(ipin) + "]";
2437+
os << indent(depth) << "." << escape_verilog_identifier(name) << " (";
24372438
if (nets[ipin].empty()) {
24382439
//Disconnected
24392440
if (type == PortType::INPUT || type == PortType::CLOCK) {
@@ -2446,14 +2447,13 @@ void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::strin
24462447
//Connected
24472448
os << escape_verilog_identifier(nets[ipin]);
24482449
}
2450+
os << ")";
24492451
if (ipin != 0) {
24502452
os << ",";
24512453
os << "\n";
24522454
}
24532455
}
2454-
os << "}";
24552456
}
2456-
os << ")";
24572457
}
24582458

24592459
///@brief Escapes the given identifier to be safe for verilog

0 commit comments

Comments
 (0)