Skip to content

Commit 64b61ca

Browse files
committed
vpr: netlist writer: don't concat multi bit ports
Instead of concating multi bit ports set each bit separately Signed-off-by: Paweł Czarnecki <[email protected]>
1 parent 6e9a897 commit 64b61ca

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

vpr/src/base/netlist_writer.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,12 +2433,11 @@ void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::strin
24332433
}
24342434
};
24352435

2436-
//Port name
2437-
os << indent(depth) << "." << port_name << "(";
2438-
24392436
//Pins
24402437
if (nets.size() == 1) {
24412438
//Single-bit port
2439+
//Port name
2440+
os << indent(depth) << "." << port_name << "(";
24422441
if (nets[0].empty()) {
24432442
//Disconnected
24442443
if (type == PortType::INPUT || type == PortType::CLOCK) {
@@ -2451,6 +2450,7 @@ void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::strin
24512450
//Connected
24522451
os << escape_verilog_identifier(nets[0]);
24532452
}
2453+
os << ")";
24542454
} else {
24552455
// Check if all pins are unconnected
24562456
bool all_unconnected = true;
@@ -2467,10 +2467,10 @@ void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::strin
24672467
// Empty connection
24682468
} else {
24692469
// Individual bits
2470-
os << "{"
2471-
<< "\n";
24722470
for (int ipin = (int)nets.size() - 1; ipin >= 0; --ipin) { //Reverse order to match endianess
2473-
os << indent(depth + 1);
2471+
//Port name
2472+
std::string name = port_name + "[" + std::to_string(ipin) + "]";
2473+
os << indent(depth) << "." << escape_verilog_identifier(name) << "(";
24742474
if (nets[ipin].empty()) {
24752475
//Disconnected
24762476
if (type == PortType::INPUT || type == PortType::CLOCK) {
@@ -2486,15 +2486,14 @@ void print_verilog_port(std::ostream& os, size_t& unconn_count, const std::strin
24862486
//Connected
24872487
os << escape_verilog_identifier(nets[ipin]);
24882488
}
2489+
os << ")";
24892490
if (ipin != 0) {
24902491
os << ",";
24912492
}
24922493
os << "\n";
24932494
}
2494-
os << indent(depth) + " }";
24952495
}
24962496
}
2497-
os << ")";
24982497
}
24992498

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

0 commit comments

Comments
 (0)