Propagate errors

This commit is contained in:
Miodrag Milanovic 2024-12-17 10:52:19 +01:00
parent 8436191307
commit 503fafd574
2 changed files with 69 additions and 73 deletions

View File

@ -75,6 +75,8 @@ struct GateMateCCFReader
if (name == "LOC") {
if (is_default)
log_error("Value '%s' can not be defined for default GPIO in line %d.\n", name.c_str(), lineno);
if (ctx->get_package_pin_bel(ctx->id(value)) == BelId())
log_error("Unknown location '%s' used in line %d.\n", value.c_str(), lineno);
props->emplace(ctx->id(name.c_str()), Property(value));
} else if (name == "SCHMITT_TRIGGER" || name == "PULLUP" || name == "PULLDOWN" || name == "KEEPER" ||
name == "FF_IBF" || name == "FF_OBF" || name == "LVDS_BOOST" || name == "LVDS_RTERM") {
@ -119,9 +121,8 @@ struct GateMateCCFReader
}
}
bool run()
void run()
{
try {
log_info("Parsing CCF file..\n");
std::string line;
@ -164,8 +165,7 @@ struct GateMateCCFReader
boost::algorithm::to_lower(type);
if (type == "default_gpio") {
if (words.size() != 1)
log_error("line with default_GPIO should not contain only parameters (in line %d).\n",
lineno);
log_error("line with default_GPIO should not contain only parameters (in line %d).\n", lineno);
params.erase(params.begin());
parse_params(params, true, &defaults);
@ -198,20 +198,16 @@ struct GateMateCCFReader
}
if (!isempty(linebuf))
log_error("unexpected end of CCF file\n");
return true;
} catch (log_execution_error_exception) {
return false;
}
}
};
bool GateMateImpl::parse_ccf(const std::string &filename)
void GateMateImpl::parse_ccf(const std::string &filename)
{
std::ifstream in(filename);
if (!in)
log_error("failed to open CCF file '%s'\n", filename.c_str());
GateMateCCFReader reader(ctx, in);
return reader.run();
reader.run();
}
NEXTPNR_NAMESPACE_END

View File

@ -45,7 +45,7 @@ struct GateMateImpl : HimbaechelAPI
void drawBel(std::vector<GraphicElement> &g, GraphicElement::style_t style, IdString bel_type, Loc loc) override;
bool parse_ccf(const std::string &filename);
void parse_ccf(const std::string &filename);
private:
HimbaechelHelpers h;