@@ -152,25 +152,35 @@ proc stitch_procedure {base_dir stitch_project_name original_project_name bd_nam
152
152
# Get the CONFIG.POLARITY property from one of the IP's 'ap_rst' pins
153
153
set sample_rst_pin [lindex $ap_rst_ports 0]
154
154
set rst_polarity [get_property CONFIG.POLARITY $sample_rst_pin ]
155
- # Create the 'ap_rst' port
156
- set rst_port_name " ap_rst"
157
- create_bd_port -dir I -type rst $rst_port_name
158
- set ap_rst_port [get_bd_ports ap_rst]
159
155
160
- # Set the CONFIG.POLARITY property of the 'ap_rst' port based on the retrieved polarity
156
+ # Only proceed if the polarity is defined
161
157
if {$rst_polarity ne " " } {
158
+ # Create the 'ap_rst' port
159
+ set rst_port_name " ap_rst"
160
+ create_bd_port -dir I -type rst $rst_port_name
161
+ set ap_rst_port [get_bd_ports ap_rst]
162
+
163
+ # Set the CONFIG.POLARITY property of the 'ap_rst' port based on the retrieved polarity
162
164
set_property CONFIG.POLARITY $rst_polarity $ap_rst_port
163
- # naming convention for active-low signals
164
- set rst_port_name " ap_rst_n"
165
- set_property NAME $rst_port_name $ap_rst_port
165
+
166
+ # Rename the port based on polarity
167
+ if {$rst_polarity eq " ACTIVE_LOW" } {
168
+ set rst_port_name " ap_rst_n"
169
+ set_property NAME $rst_port_name $ap_rst_port
170
+ puts " Setting reset port ap_rst_n (ACTIVE_LOW)."
171
+ } else {
172
+ puts " Setting reset port ap_rst (ACTIVE_HIGH)."
173
+ }
174
+ # Connect all 'ap_rst' pins to the 'ap_rst' port
175
+ foreach rst_pin $ap_rst_ports {
176
+ connect_bd_net $ap_rst_port $rst_pin
177
+ }
166
178
} else {
167
- # Fallback to ACTIVE_HIGH if the retrieved polarity is not defined
168
- set_property CONFIG.POLARITY ACTIVE_HIGH $ap_rst_port
169
- }
170
- # Connect all 'ap_rst' pins to the 'ap_rst' port
171
- foreach rst_pin $ap_rst_ports {
172
- connect_bd_net $ap_rst_port $rst_pin
179
+ # Fallback: Undefined polarity, no port created
180
+ puts " Warning: CONFIG.POLARITY of ap_rst is undefined. No reset port created."
173
181
}
182
+ } else {
183
+ puts " Error: No reset ports found."
174
184
}
175
185
176
186
# Determine interface type
@@ -185,7 +195,7 @@ proc stitch_procedure {base_dir stitch_project_name original_project_name bd_nam
185
195
set interface_type " axi_stream"
186
196
break
187
197
} elseif {[regexp {^layer(?:\d+_)?out_(\d+)$} $port_name ]} {
188
- set interface_type " unpacked "
198
+ set interface_type " partition "
189
199
break
190
200
}
191
201
}
@@ -220,8 +230,8 @@ proc stitch_procedure {base_dir stitch_project_name original_project_name bd_nam
220
230
set ip_i_cell [get_bd_cells $ip_i ]
221
231
set ip_i_plus1_cell [get_bd_cells $ip_i_plus1 ]
222
232
223
- if {$interface_type == " unpacked " } {
224
- # Existing unpacked interface connection logic
233
+ if {$interface_type == " partition " } {
234
+ # Existing partitioned interface connection logic
225
235
# Get all output pins from ip_i
226
236
set output_ports [get_bd_pins -of $ip_i_cell ]
227
237
@@ -434,7 +444,7 @@ proc stitch_procedure {base_dir stitch_project_name original_project_name bd_nam
434
444
puts " Warning: Could not find 'ap_done' pin for last IP"
435
445
}
436
446
437
- } elseif {$interface_type == " unpacked " } {
447
+ } elseif {$interface_type == " partition " } {
438
448
# Make 'ap_start' of the first IP external
439
449
set first_ip_cell [get_bd_cells [lindex $ip_instances 0]]
440
450
if {[string length $first_ip_cell ] == 0} {
0 commit comments