@@ -244,9 +244,14 @@ struct BlifAllocCallback : public blifparse::Callback {
244
244
VTR_ASSERT (ports.size () == nets.size ());
245
245
246
246
LogicalModelId blk_model_id = models_.get_model_by_name (subckt_model);
247
+ if (!blk_model_id.is_valid ()) {
248
+ vpr_throw (VPR_ERROR_BLIF_F, filename_.c_str (), lineno_,
249
+ " Subckt instantiates model '%s', but no such model exists in the architecture file." ,
250
+ subckt_model.c_str ());
251
+ }
247
252
const t_model& blk_model = models_.get_model (blk_model_id);
248
253
249
- // We name the subckt based on the net it's first output pin drives
254
+ // We name the subckt based on the net its first output pin drives
250
255
std::string subckt_name;
251
256
for (size_t i = 0 ; i < ports.size (); ++i) {
252
257
const t_model_ports* model_port = find_model_port (blk_model, ports[i]);
@@ -269,8 +274,7 @@ struct BlifAllocCallback : public blifparse::Callback {
269
274
}
270
275
271
276
// The name for every block should be unique, check that there is no name conflict
272
- AtomBlockId blk_id = curr_model ().find_block (subckt_name);
273
- if (blk_id) {
277
+ if (AtomBlockId blk_id = curr_model ().find_block (subckt_name)) {
274
278
LogicalModelId conflicting_model = curr_model ().block_model (blk_id);
275
279
vpr_throw (VPR_ERROR_BLIF_F, filename_.c_str (), lineno_,
276
280
" Duplicate blocks named '%s' found in netlist."
@@ -279,7 +283,7 @@ struct BlifAllocCallback : public blifparse::Callback {
279
283
}
280
284
281
285
// Create the block
282
- blk_id = curr_model ().create_block (subckt_name, blk_model_id);
286
+ AtomBlockId blk_id = curr_model ().create_block (subckt_name, blk_model_id);
283
287
set_curr_block (blk_id);
284
288
285
289
for (size_t i = 0 ; i < ports.size (); ++i) {
0 commit comments