Skip to content

Commit ce5c2be

Browse files
committed
vpr: Convert most VPR_THROWs to VPR_ERROR
1 parent dfaabf8 commit ce5c2be

36 files changed

+217
-218
lines changed

vpr/src/base/SetupGrid.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ DeviceGrid create_device_grid(std::string layout_name, const std::vector<t_grid_
5959
}
6060
valid_names += "'" + grid_layouts[i].name + "'";
6161
}
62-
VPR_THROW(VPR_ERROR_ARCH, "Failed to find grid layout named '%s' (valid grid layouts: %s)\n", layout_name.c_str(), valid_names.c_str());
62+
VPR_FATAL_ERROR(VPR_ERROR_ARCH, "Failed to find grid layout named '%s' (valid grid layouts: %s)\n", layout_name.c_str(), valid_names.c_str());
6363
}
6464

6565
return build_device_grid(*iter, iter->width, iter->height);
@@ -120,7 +120,7 @@ DeviceGrid create_device_grid(std::string layout_name, const std::vector<t_grid_
120120
}
121121
valid_names += "'" + grid_layouts[i].name + "'";
122122
}
123-
VPR_THROW(VPR_ERROR_ARCH, "Failed to find grid layout named '%s' (valid grid layouts: %s)\n", layout_name.c_str(), valid_names.c_str());
123+
VPR_FATAL_ERROR(VPR_ERROR_ARCH, "Failed to find grid layout named '%s' (valid grid layouts: %s)\n", layout_name.c_str(), valid_names.c_str());
124124
}
125125

126126
return build_device_grid(*iter, iter->width, iter->height);
@@ -262,9 +262,9 @@ static bool grid_satisfies_instance_counts(const DeviceGrid& grid, std::map<t_ty
262262
static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range, const std::vector<t_type_ptr> limiting_resources) {
263263
if (grid_def.grid_type == GridDefType::FIXED) {
264264
if (grid_def.width != int(grid_width) || grid_def.height != int(grid_height)) {
265-
VPR_THROW(VPR_ERROR_OTHER,
266-
"Requested grid size (%zu%zu) does not match fixed device size (%dx%d)",
267-
grid_width, grid_height, grid_def.width, grid_def.height);
265+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
266+
"Requested grid size (%zu%zu) does not match fixed device size (%dx%d)",
267+
grid_width, grid_height, grid_def.width, grid_def.height);
268268
}
269269
}
270270

@@ -294,9 +294,9 @@ static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t grid_widt
294294
t_type_descriptor* type = find_block_type_by_name(grid_loc_def.block_type, device_ctx.block_types, device_ctx.num_block_types);
295295

296296
if (!type) {
297-
VPR_THROW(VPR_ERROR_ARCH,
298-
"Failed to find block type '%s' for grid location specification",
299-
grid_loc_def.block_type.c_str());
297+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
298+
"Failed to find block type '%s' for grid location specification",
299+
grid_loc_def.block_type.c_str());
300300
}
301301

302302
seen_types.insert(type);
@@ -368,49 +368,49 @@ static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t grid_widt
368368

369369
//The end must fall after (or equal) to the start
370370
if (endx < startx) {
371-
VPR_THROW(VPR_ERROR_ARCH,
372-
"Grid location specification endx (%s = %d) can not come before startx (%s = %d) for block type '%s'",
373-
xspec.end_expr.c_str(), endx, xspec.start_expr.c_str(), startx, type->name);
371+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
372+
"Grid location specification endx (%s = %d) can not come before startx (%s = %d) for block type '%s'",
373+
xspec.end_expr.c_str(), endx, xspec.start_expr.c_str(), startx, type->name);
374374
}
375375

376376
if (endy < starty) {
377-
VPR_THROW(VPR_ERROR_ARCH,
378-
"Grid location specification endy (%s = %d) can not come before starty (%s = %d) for block type '%s'",
379-
yspec.end_expr.c_str(), endy, yspec.start_expr.c_str(), starty, type->name);
377+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
378+
"Grid location specification endy (%s = %d) can not come before starty (%s = %d) for block type '%s'",
379+
yspec.end_expr.c_str(), endy, yspec.start_expr.c_str(), starty, type->name);
380380
}
381381

382382
//The minimum increment is the block dimension
383383
VTR_ASSERT(type->width > 0);
384384
if (incrx < size_t(type->width)) {
385-
VPR_THROW(VPR_ERROR_ARCH,
386-
"Grid location specification incrx for block type '%s' must be at least"
387-
" block width (%d) to avoid overlapping instances (was %s = %d)",
388-
type->name, type->width, xspec.incr_expr.c_str(), incrx);
385+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
386+
"Grid location specification incrx for block type '%s' must be at least"
387+
" block width (%d) to avoid overlapping instances (was %s = %d)",
388+
type->name, type->width, xspec.incr_expr.c_str(), incrx);
389389
}
390390

391391
VTR_ASSERT(type->height > 0);
392392
if (incry < size_t(type->height)) {
393-
VPR_THROW(VPR_ERROR_ARCH,
394-
"Grid location specification incry for block type '%s' must be at least"
395-
" block height (%d) to avoid overlapping instances (was %s = %d)",
396-
type->name, type->height, yspec.incr_expr.c_str(), incry);
393+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
394+
"Grid location specification incry for block type '%s' must be at least"
395+
" block height (%d) to avoid overlapping instances (was %s = %d)",
396+
type->name, type->height, yspec.incr_expr.c_str(), incry);
397397
}
398398

399399
//The minimum repeat is the region dimension
400400
size_t region_width = endx - startx + 1; //+1 since start/end are both inclusive
401401
if (repeatx < region_width) {
402-
VPR_THROW(VPR_ERROR_ARCH,
403-
"Grid location specification repeatx for block type '%s' must be at least"
404-
" the region width (%d) to avoid overlapping instances (was %s = %d)",
405-
type->name, region_width, xspec.repeat_expr.c_str(), repeatx);
402+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
403+
"Grid location specification repeatx for block type '%s' must be at least"
404+
" the region width (%d) to avoid overlapping instances (was %s = %d)",
405+
type->name, region_width, xspec.repeat_expr.c_str(), repeatx);
406406
}
407407

408408
size_t region_height = endy - starty + 1; //+1 since start/end are both inclusive
409409
if (repeaty < region_height) {
410-
VPR_THROW(VPR_ERROR_ARCH,
411-
"Grid location specification repeaty for block type '%s' must be at least"
412-
" the region height (%d) to avoid overlapping instances (was %s = %d)",
413-
type->name, region_height, xspec.repeat_expr.c_str(), repeaty);
410+
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
411+
"Grid location specification repeaty for block type '%s' must be at least"
412+
" the region height (%d) to avoid overlapping instances (was %s = %d)",
413+
type->name, region_height, xspec.repeat_expr.c_str(), repeaty);
414414
}
415415

416416
//VTR_LOG("Applying grid_loc_def for '%s' priority %d startx=%s=%zu, endx=%s=%zu, starty=%s=%zu, endx=%s=%zu,\n",

vpr/src/base/SetupVPR.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ void SetupVPR(t_options* Options,
128128
VTR_ASSERT(device_ctx.EMPTY_TYPE != nullptr);
129129

130130
if (device_ctx.input_types.empty()) {
131-
VPR_THROW(VPR_ERROR_ARCH,
131+
VPR_ERROR(VPR_ERROR_ARCH,
132132
"Architecture contains no top-level block type containing '.input' models");
133133
}
134134

135135
if (device_ctx.output_types.empty()) {
136-
VPR_THROW(VPR_ERROR_ARCH,
136+
VPR_ERROR(VPR_ERROR_ARCH,
137137
"Architecture contains no top-level block type containing '.output' models");
138138
}
139139

@@ -514,15 +514,15 @@ static int find_ipin_cblock_switch_index(const t_arch& Arch) {
514514
for (int i = 0; i < Arch.num_switches; ++i) {
515515
if (Arch.Switches[i].name == Arch.ipin_cblock_switch_name) {
516516
if (ipin_cblock_switch_index != UNDEFINED) {
517-
VPR_THROW(VPR_ERROR_ARCH, "Found duplicate switches named '%s'\n", Arch.ipin_cblock_switch_name.c_str());
517+
VPR_FATAL_ERROR(VPR_ERROR_ARCH, "Found duplicate switches named '%s'\n", Arch.ipin_cblock_switch_name.c_str());
518518
} else {
519519
ipin_cblock_switch_index = i;
520520
}
521521
}
522522
}
523523

524524
if (ipin_cblock_switch_index == UNDEFINED) {
525-
VPR_THROW(VPR_ERROR_ARCH, "Failed to find connection block input pin switch named '%s'\n", Arch.ipin_cblock_switch_name.c_str());
525+
VPR_FATAL_ERROR(VPR_ERROR_ARCH, "Failed to find connection block input pin switch named '%s'\n", Arch.ipin_cblock_switch_name.c_str());
526526
}
527527
return ipin_cblock_switch_index;
528528
}

vpr/src/base/atom_netlist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ AtomPortId AtomNetlist::create_port(const AtomBlockId blk_id, const t_model_port
138138
} else if (model_port->dir == OUT_PORT) {
139139
type = PortType::OUTPUT;
140140
} else {
141-
VPR_THROW(VPR_ERROR_ATOM_NETLIST, "Unrecognized model port type");
141+
VPR_FATAL_ERROR(VPR_ERROR_ATOM_NETLIST, "Unrecognized model port type");
142142
}
143143

144144
if (!port_id) {

vpr/src/base/atom_netlist_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void print_netlist_as_blif(FILE* f, const AtomNetlist& netlist) {
156156
clk_net = netlist.net_name(net_id);
157157

158158
} else {
159-
VPR_THROW(VPR_ERROR_ATOM_NETLIST, "Unrecognzied latch port '%s'", netlist.port_name(port_id).c_str());
159+
VPR_FATAL_ERROR(VPR_ERROR_ATOM_NETLIST, "Unrecognzied latch port '%s'", netlist.port_name(port_id).c_str());
160160
}
161161
}
162162
}
@@ -1154,7 +1154,7 @@ bool truth_table_encodes_on_set(const AtomNetlist::TruthTable& truth_table) {
11541154
encodes_on_set = false;
11551155
break;
11561156
default:
1157-
VPR_THROW(VPR_ERROR_OTHER, "Unrecognized truth-table output value");
1157+
VPR_FATAL_ERROR(VPR_ERROR_OTHER, "Unrecognized truth-table output value");
11581158
}
11591159
}
11601160
return encodes_on_set;

0 commit comments

Comments
 (0)