@@ -2389,12 +2389,11 @@ void print_blif_port(std::ostream& os, size_t& unconn_count, const std::string&
2389
2389
* Handles special cases like multi-bit and disconnected ports
2390
2390
*/
2391
2391
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
-
2395
2392
// Pins
2396
2393
if (nets.size () == 1 ) {
2397
2394
// Single-bit port
2395
+ // Port name
2396
+ os << indent (depth) << " ." << port_name << " (" ;
2398
2397
if (nets[0 ].empty ()) {
2399
2398
// Disconnected
2400
2399
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
2427
2426
// Connected
2428
2427
os << escape_verilog_identifier (nets[0 ]);
2429
2428
}
2429
+ os << " )" ;
2430
2430
} else {
2431
2431
// A multi-bit port, we explicitly concat the single-bit nets to build the port,
2432
2432
// taking care to print MSB on left and LSB on right
2433
- os << " {"
2434
- << " \n " ;
2435
2433
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) << " (" ;
2437
2438
if (nets[ipin].empty ()) {
2438
2439
// Disconnected
2439
2440
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
2446
2447
// Connected
2447
2448
os << escape_verilog_identifier (nets[ipin]);
2448
2449
}
2450
+ os << " )" ;
2449
2451
if (ipin != 0 ) {
2450
2452
os << " ," ;
2451
2453
os << " \n " ;
2452
2454
}
2453
2455
}
2454
- os << " }" ;
2455
2456
}
2456
- os << " )" ;
2457
2457
}
2458
2458
2459
2459
// /@brief Escapes the given identifier to be safe for verilog
0 commit comments