mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-24 02:11:28 +00:00
Remove unnecessary usage of .c_str() in parameters to input_error()
This commit is contained in:
parent
ad4ef8b775
commit
733b6f0124
3 changed files with 79 additions and 79 deletions
|
@ -193,7 +193,7 @@ bool AstNode::get_bool_attribute(RTLIL::IdString id)
|
|||
|
||||
auto& attr = attributes.at(id);
|
||||
if (attr->type != AST_CONSTANT)
|
||||
attr->input_error("Attribute `%s' with non-constant value!\n", id.c_str());
|
||||
attr->input_error("Attribute `%s' with non-constant value!\n", id);
|
||||
|
||||
return attr->integer != 0;
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
|
|||
{
|
||||
for (auto& node : ast->children)
|
||||
if (node->type == AST_PARAMETER && param_has_no_default(node.get()))
|
||||
node->input_error("Parameter `%s' has no default value and has not been overridden!\n", node->str.c_str());
|
||||
node->input_error("Parameter `%s' has no default value and has not been overridden!\n", node->str);
|
||||
|
||||
bool blackbox_module = flag_lib;
|
||||
|
||||
|
@ -1256,7 +1256,7 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
|
|||
for (auto &attr : ast->attributes) {
|
||||
log_assert((bool)attr.second.get());
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
ast->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
ast->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
module->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
for (size_t i = 0; i < ast->children.size(); i++) {
|
||||
|
|
|
@ -56,7 +56,7 @@ static RTLIL::SigSpec uniop2rtlil(AstNode *that, IdString type, int result_width
|
|||
if (gen_attributes)
|
||||
for (auto &attr : that->attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
cell->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ static void widthExtend(AstNode *that, RTLIL::SigSpec &sig, int width, bool is_s
|
|||
if (that != nullptr)
|
||||
for (auto &attr : that->attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
cell->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ static RTLIL::SigSpec binop2rtlil(AstNode *that, IdString type, int result_width
|
|||
|
||||
for (auto &attr : that->attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
cell->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ static RTLIL::SigSpec mux2rtlil(AstNode *that, const RTLIL::SigSpec &cond, const
|
|||
|
||||
for (auto &attr : that->attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
that->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
cell->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ struct AST_INTERNAL::ProcessGenerator
|
|||
set_src_attr(proc, always.get());
|
||||
for (auto &attr : always->attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
always->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
always->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
proc->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
current_case = &proc->root_case;
|
||||
|
@ -630,7 +630,7 @@ struct AST_INTERNAL::ProcessGenerator
|
|||
|
||||
for (auto &attr : ast->attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
ast->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
ast->input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
sw->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
}
|
||||
}
|
||||
if (!id_ast)
|
||||
input_error("Failed to resolve identifier %s for width detection!\n", str.c_str());
|
||||
input_error("Failed to resolve identifier %s for width detection!\n", str);
|
||||
if (id_ast->type == AST_PARAMETER || id_ast->type == AST_LOCALPARAM || id_ast->type == AST_ENUM_ITEM) {
|
||||
if (id_ast->children.size() > 1 && id_ast->children[1]->range_valid) {
|
||||
this_width = id_ast->children[1]->range_left - id_ast->children[1]->range_right + 1;
|
||||
|
@ -1017,7 +1017,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
if (id_ast->children[0]->type == AST_CONSTANT)
|
||||
this_width = id_ast->children[0]->bits.size();
|
||||
else
|
||||
input_error("Failed to detect width for parameter %s!\n", str.c_str());
|
||||
input_error("Failed to detect width for parameter %s!\n", str);
|
||||
}
|
||||
if (children.size() != 0)
|
||||
range = children[0].get();
|
||||
|
@ -1030,7 +1030,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
// log("---\n");
|
||||
// id_ast->dumpAst(nullptr, "decl> ");
|
||||
// dumpAst(nullptr, "ref> ");
|
||||
input_error("Failed to detect width of signal access `%s'!\n", str.c_str());
|
||||
input_error("Failed to detect width of signal access `%s'!\n", str);
|
||||
}
|
||||
} else {
|
||||
this_width = id_ast->range_left - id_ast->range_right + 1;
|
||||
|
@ -1041,7 +1041,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
this_width = 32;
|
||||
} else if (id_ast->type == AST_MEMORY) {
|
||||
if (!id_ast->children[0]->range_valid)
|
||||
input_error("Failed to detect width of memory access `%s'!\n", str.c_str());
|
||||
input_error("Failed to detect width of memory access `%s'!\n", str);
|
||||
this_width = id_ast->children[0]->range_left - id_ast->children[0]->range_right + 1;
|
||||
if (children.size() > 1)
|
||||
range = children[1].get();
|
||||
|
@ -1049,7 +1049,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
auto tmp_range = make_index_range(id_ast);
|
||||
this_width = tmp_range->range_left - tmp_range->range_right + 1;
|
||||
} else
|
||||
input_error("Failed to detect width for identifier %s!\n", str.c_str());
|
||||
input_error("Failed to detect width for identifier %s!\n", str);
|
||||
if (range) {
|
||||
if (range->children.size() == 1)
|
||||
this_width = 1;
|
||||
|
@ -1059,7 +1059,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
while (left_at_zero_ast->simplify(true, 1, -1, false)) { }
|
||||
while (right_at_zero_ast->simplify(true, 1, -1, false)) { }
|
||||
if (left_at_zero_ast->type != AST_CONSTANT || right_at_zero_ast->type != AST_CONSTANT)
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str.c_str());
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str);
|
||||
this_width = abs(int(left_at_zero_ast->integer - right_at_zero_ast->integer)) + 1;
|
||||
} else
|
||||
this_width = range->range_left - range->range_right + 1;
|
||||
|
@ -1193,7 +1193,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
if (!id2ast->is_signed)
|
||||
sign_hint = false;
|
||||
if (!id2ast->children[0]->range_valid)
|
||||
input_error("Failed to detect width of memory access `%s'!\n", str.c_str());
|
||||
input_error("Failed to detect width of memory access `%s'!\n", str);
|
||||
this_width = id2ast->children[0]->range_left - id2ast->children[0]->range_right + 1;
|
||||
width_hint = max(width_hint, this_width);
|
||||
break;
|
||||
|
@ -1266,7 +1266,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
// item expressions.
|
||||
const AstNode *func = current_scope.at(str);
|
||||
if (func->type != AST_FUNCTION)
|
||||
input_error("Function call to %s resolved to something that isn't a function!\n", RTLIL::unescape_id(str).c_str());
|
||||
input_error("Function call to %s resolved to something that isn't a function!\n", RTLIL::unescape_id(str));
|
||||
const AstNode *wire = nullptr;
|
||||
for (const auto& child : func->children)
|
||||
if (child->str == func->str) {
|
||||
|
@ -1302,7 +1302,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
|||
AstNode *current_scope_ast = current_ast_mod == nullptr ? current_ast : current_ast_mod;
|
||||
for (auto f : log_files)
|
||||
current_scope_ast->dumpAst(f, "verilog-ast> ");
|
||||
input_error("Don't know how to detect sign and width for %s node!\n", type2str(type).c_str());
|
||||
input_error("Don't know how to detect sign and width for %s node!\n", type2str(type));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1406,7 +1406,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
if (flag_pwires)
|
||||
{
|
||||
if (GetSize(children) < 1 || children[0]->type != AST_CONSTANT)
|
||||
input_error("Parameter `%s' with non-constant value!\n", str.c_str());
|
||||
input_error("Parameter `%s' with non-constant value!\n", str);
|
||||
|
||||
RTLIL::Const val = children[0]->bitsAsConst();
|
||||
RTLIL::IdString id = str;
|
||||
|
@ -1420,7 +1420,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
|
||||
for (auto &attr : attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
wire->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
}
|
||||
|
@ -1429,10 +1429,10 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
// create an RTLIL::Wire for an AST_WIRE node
|
||||
case AST_WIRE: {
|
||||
if (!range_valid)
|
||||
input_error("Signal `%s' with non-constant width!\n", str.c_str());
|
||||
input_error("Signal `%s' with non-constant width!\n", str);
|
||||
|
||||
if (!(range_left + 1 >= range_right))
|
||||
input_error("Signal `%s' with invalid width range %d!\n", str.c_str(), range_left - range_right + 1);
|
||||
input_error("Signal `%s' with invalid width range %d!\n", str, range_left - range_right + 1);
|
||||
|
||||
RTLIL::IdString id = str;
|
||||
check_unique_id(current_module, id, this, "signal");
|
||||
|
@ -1448,7 +1448,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
|
||||
for (auto &attr : attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
wire->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
log_assert(children[1]->type == AST_RANGE);
|
||||
|
||||
if (!children[0]->range_valid || !children[1]->range_valid)
|
||||
input_error("Memory `%s' with non-constant width or size!\n", str.c_str());
|
||||
input_error("Memory `%s' with non-constant width or size!\n", str);
|
||||
|
||||
RTLIL::Memory *memory = new RTLIL::Memory;
|
||||
set_src_attr(memory, this);
|
||||
|
@ -1482,7 +1482,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
|
||||
for (auto &attr : attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
memory->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
}
|
||||
|
@ -1539,11 +1539,11 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
} else if (flag_autowire)
|
||||
log_file_warning(*location.begin.filename, location.begin.line, "Identifier `%s' is implicitly declared.\n", str.c_str());
|
||||
else
|
||||
input_error("Identifier `%s' is implicitly declared and `default_nettype is set to none.\n", str.c_str());
|
||||
input_error("Identifier `%s' is implicitly declared and `default_nettype is set to none.\n", str);
|
||||
}
|
||||
else if (id2ast->type == AST_PARAMETER || id2ast->type == AST_LOCALPARAM || id2ast->type == AST_ENUM_ITEM) {
|
||||
if (id2ast->children[0]->type != AST_CONSTANT)
|
||||
input_error("Parameter %s does not evaluate to constant value!\n", str.c_str());
|
||||
input_error("Parameter %s does not evaluate to constant value!\n", str);
|
||||
chunk = RTLIL::Const(id2ast->children[0]->bits);
|
||||
goto use_const_chunk;
|
||||
}
|
||||
|
@ -1558,11 +1558,11 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
is_interface = true;
|
||||
}
|
||||
else {
|
||||
input_error("Identifier `%s' doesn't map to any signal!\n", str.c_str());
|
||||
input_error("Identifier `%s' doesn't map to any signal!\n", str);
|
||||
}
|
||||
|
||||
if (id2ast->type == AST_MEMORY)
|
||||
input_error("Identifier `%s' does map to an unexpanded memory!\n", str.c_str());
|
||||
input_error("Identifier `%s' does map to an unexpanded memory!\n", str);
|
||||
|
||||
// If identifier is an interface, create a RTLIL::SigSpec with a dummy wire with a attribute called 'is_interface'
|
||||
// This makes it possible for the hierarchy pass to see what are interface connections and then replace them
|
||||
|
@ -1610,7 +1610,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
while (left_at_zero_ast->simplify(true, 1, -1, false)) { }
|
||||
while (right_at_zero_ast->simplify(true, 1, -1, false)) { }
|
||||
if (left_at_zero_ast->type != AST_CONSTANT || right_at_zero_ast->type != AST_CONSTANT)
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str.c_str());
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str);
|
||||
int width = abs(int(left_at_zero_ast->integer - right_at_zero_ast->integer)) + 1;
|
||||
auto fake_ast = std::make_unique<AstNode>(children[0]->location, AST_NONE, clone(), children[0]->children.size() >= 2 ?
|
||||
children[0]->children[1]->clone() : children[0]->children[0]->clone());
|
||||
|
@ -2032,7 +2032,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
set_src_attr(cell, this);
|
||||
for (auto &attr : attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
|
||||
input_error("Attribute `%s' with non-constant value!\n", attr.first);
|
||||
cell->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
cell->setParam(ID(FLAVOR), flavor);
|
||||
|
@ -2148,7 +2148,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
}
|
||||
for (auto &attr : attributes) {
|
||||
if (attr.second->type != AST_CONSTANT)
|
||||
input_error("Attribute `%s' with non-constant value.\n", attr.first.c_str());
|
||||
input_error("Attribute `%s' with non-constant value.\n", attr.first);
|
||||
cell->attributes[attr.first] = attr.second->asAttrConst();
|
||||
}
|
||||
if (cell->type == ID($specify2)) {
|
||||
|
@ -2203,7 +2203,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
log_file_warning(*location.begin.filename, location.begin.line, "\n");
|
||||
} else if (str == "$error") {
|
||||
if (sz > 0)
|
||||
input_error("%s.\n", children[0]->str.c_str());
|
||||
input_error("%s.\n", children[0]->str);
|
||||
else
|
||||
input_error("\n");
|
||||
} else if (str == "$fatal") {
|
||||
|
@ -2212,11 +2212,11 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
// dollar_finish(sz ? children[0] : 1);
|
||||
// perhaps create & use log_file_fatal()
|
||||
if (sz > 0)
|
||||
input_error("FATAL: %s.\n", children[0]->str.c_str());
|
||||
input_error("FATAL: %s.\n", children[0]->str);
|
||||
else
|
||||
input_error("FATAL.\n");
|
||||
} else {
|
||||
input_error("Unknown elaboration system task '%s'.\n", str.c_str());
|
||||
input_error("Unknown elaboration system task '%s'.\n", str);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
@ -2245,7 +2245,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
}
|
||||
|
||||
if (width <= 0)
|
||||
input_error("Failed to detect width of %s!\n", RTLIL::unescape_id(str).c_str());
|
||||
input_error("Failed to detect width of %s!\n", RTLIL::unescape_id(str));
|
||||
|
||||
Cell *cell = current_module->addCell(myid, str.substr(1));
|
||||
set_src_attr(cell, this);
|
||||
|
@ -2272,7 +2272,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
|||
default:
|
||||
for (auto f : log_files)
|
||||
current_ast_mod->dumpAst(f, "verilog-ast> ");
|
||||
input_error("Don't know how to generate RTLIL code for %s node!\n", type2str(type).c_str());
|
||||
input_error("Don't know how to generate RTLIL code for %s node!\n", type2str(type));
|
||||
}
|
||||
|
||||
return RTLIL::SigSpec();
|
||||
|
|
|
@ -250,7 +250,7 @@ static int range_width(AstNode *node, AstNode *rnode)
|
|||
{
|
||||
log_assert(rnode->type==AST_RANGE);
|
||||
if (!rnode->range_valid) {
|
||||
node->input_error("Non-constant range in declaration of %s\n", node->str.c_str());
|
||||
node->input_error("Non-constant range in declaration of %s\n", node->str);
|
||||
}
|
||||
// note: range swapping has already been checked for
|
||||
return rnode->range_left - rnode->range_right + 1;
|
||||
|
@ -265,7 +265,7 @@ static int add_dimension(AstNode *node, AstNode *rnode)
|
|||
|
||||
[[noreturn]] static void struct_array_packing_error(AstNode *node)
|
||||
{
|
||||
node->input_error("Unpacked array in packed struct/union member %s\n", node->str.c_str());
|
||||
node->input_error("Unpacked array in packed struct/union member %s\n", node->str);
|
||||
}
|
||||
|
||||
static int size_packed_struct(AstNode *snode, int base_offset)
|
||||
|
@ -358,7 +358,7 @@ static int size_packed_struct(AstNode *snode, int base_offset)
|
|||
}
|
||||
else {
|
||||
if (packed_width != width)
|
||||
node->input_error("member %s of a packed union has %d bits, expecting %d\n", node->str.c_str(), width, packed_width);
|
||||
node->input_error("member %s of a packed union has %d bits, expecting %d\n", node->str, width, packed_width);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -481,7 +481,7 @@ std::unique_ptr<AstNode> AstNode::make_index_range(AstNode *decl_node, bool unpa
|
|||
dim--; // Step back to the final index / slice
|
||||
}
|
||||
else {
|
||||
input_error("Unsupported range operation for %s\n", str.c_str());
|
||||
input_error("Unsupported range operation for %s\n", str);
|
||||
}
|
||||
|
||||
std::unique_ptr<AstNode> index_range = std::make_unique<AstNode>(rnode->location, AST_RANGE);
|
||||
|
@ -1135,7 +1135,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
if (current_scope.count(enode->str) == 0)
|
||||
current_scope[enode->str] = enode.get();
|
||||
else
|
||||
input_error("enum item %s already exists in current scope\n", enode->str.c_str());
|
||||
input_error("enum item %s already exists in current scope\n", enode->str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1209,7 +1209,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
continue;
|
||||
wires_are_incompatible:
|
||||
if (stage > 1)
|
||||
input_error("Incompatible re-declaration of wire %s.\n", node->str.c_str());
|
||||
input_error("Incompatible re-declaration of wire %s.\n", node->str);
|
||||
continue;
|
||||
}
|
||||
this_wire_scope[node->str] = node;
|
||||
|
@ -1228,7 +1228,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
if (current_scope.count(enode->str) == 0)
|
||||
current_scope[enode->str] = enode.get();
|
||||
else
|
||||
input_error("enum item %s already exists\n", enode->str.c_str());
|
||||
input_error("enum item %s already exists\n", enode->str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1268,7 +1268,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
if (current_scope.count(enode->str) == 0)
|
||||
current_scope[enode->str] = enode.get();
|
||||
else
|
||||
input_error("enum item %s already exists in package\n", enode->str.c_str());
|
||||
input_error("enum item %s already exists in package\n", enode->str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1561,10 +1561,10 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
|
||||
const std::string &type_name = child->children[0]->str;
|
||||
if (!current_scope.count(type_name))
|
||||
input_error("Unknown identifier `%s' used as type name\n", type_name.c_str());
|
||||
input_error("Unknown identifier `%s' used as type name\n", type_name);
|
||||
AstNode *resolved_type_node = current_scope.at(type_name);
|
||||
if (resolved_type_node->type != AST_TYPEDEF)
|
||||
input_error("`%s' does not name a type\n", type_name.c_str());
|
||||
input_error("`%s' does not name a type\n", type_name);
|
||||
log_assert(resolved_type_node->children.size() == 1);
|
||||
auto* template_node = resolved_type_node->children[0].get();
|
||||
|
||||
|
@ -1909,7 +1909,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
}
|
||||
|
||||
if (pos == std::string::npos)
|
||||
input_error("Can't find object for defparam `%s`!\n", RTLIL::unescape_id(paramname).c_str());
|
||||
input_error("Can't find object for defparam `%s`!\n", RTLIL::unescape_id(paramname));
|
||||
|
||||
paramname = "\\" + paramname.substr(pos+1);
|
||||
|
||||
|
@ -1943,11 +1943,11 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
log_assert(children[0]->type == AST_WIRETYPE);
|
||||
auto type_name = children[0]->str;
|
||||
if (!current_scope.count(type_name)) {
|
||||
input_error("Unknown identifier `%s' used as type name\n", type_name.c_str());
|
||||
input_error("Unknown identifier `%s' used as type name\n", type_name);
|
||||
}
|
||||
AstNode *resolved_type_node = current_scope.at(type_name);
|
||||
if (resolved_type_node->type != AST_TYPEDEF)
|
||||
input_error("`%s' does not name a type\n", type_name.c_str());
|
||||
input_error("`%s' does not name a type\n", type_name);
|
||||
log_assert(resolved_type_node->children.size() == 1);
|
||||
auto& template_node = resolved_type_node->children[0];
|
||||
|
||||
|
@ -1985,7 +1985,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
|
||||
// Cannot add packed dimensions if unpacked dimensions are already specified.
|
||||
if (add_packed_dimensions && newNode->type == AST_MEMORY)
|
||||
input_error("Cannot extend unpacked type `%s' with packed dimensions\n", type_name.c_str());
|
||||
input_error("Cannot extend unpacked type `%s' with packed dimensions\n", type_name);
|
||||
|
||||
// Add packed dimensions.
|
||||
if (add_packed_dimensions) {
|
||||
|
@ -2030,7 +2030,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
children.insert(children.begin(), std::move(expr));
|
||||
|
||||
if (children[1]->type == AST_MEMORY)
|
||||
input_error("unpacked array type `%s' cannot be used for a parameter\n", children[1]->str.c_str());
|
||||
input_error("unpacked array type `%s' cannot be used for a parameter\n", children[1]->str);
|
||||
fixup_hierarchy_flags();
|
||||
did_something = true;
|
||||
}
|
||||
|
@ -2331,7 +2331,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
}
|
||||
if (current_scope.count(str) == 0) {
|
||||
if (current_ast_mod == nullptr) {
|
||||
input_error("Identifier `%s' is implicitly declared outside of a module.\n", str.c_str());
|
||||
input_error("Identifier `%s' is implicitly declared outside of a module.\n", str);
|
||||
} else if (flag_autowire || str == "\\$global_clock") {
|
||||
auto auto_wire = std::make_unique<AstNode>(location, AST_AUTOWIRE);
|
||||
auto_wire->str = str;
|
||||
|
@ -2339,7 +2339,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
current_ast_mod->children.push_back(std::move(auto_wire));
|
||||
did_something = true;
|
||||
} else {
|
||||
input_error("Identifier `%s' is implicitly declared and `default_nettype is set to none.\n", str.c_str());
|
||||
input_error("Identifier `%s' is implicitly declared and `default_nettype is set to none.\n", str);
|
||||
}
|
||||
}
|
||||
if (id2ast != current_scope[str]) {
|
||||
|
@ -2562,7 +2562,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
}
|
||||
|
||||
if (buf->type != AST_CONSTANT)
|
||||
input_error("Right hand side of 3rd expression of %s for-loop is not constant (%s)!\n", loop_type_str, type2str(buf->type).c_str());
|
||||
input_error("Right hand side of 3rd expression of %s for-loop is not constant (%s)!\n", loop_type_str, type2str(buf->type));
|
||||
|
||||
varbuf->children[0] = std::move(buf);
|
||||
}
|
||||
|
@ -2778,7 +2778,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
if (type == AST_PRIMITIVE)
|
||||
{
|
||||
if (children.size() < 2)
|
||||
input_error("Insufficient number of arguments for primitive `%s'!\n", str.c_str());
|
||||
input_error("Insufficient number of arguments for primitive `%s'!\n", str);
|
||||
|
||||
std::vector<std::unique_ptr<AstNode>> children_list;
|
||||
for (auto& child : children) {
|
||||
|
@ -2792,7 +2792,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
if (str == "bufif0" || str == "bufif1" || str == "notif0" || str == "notif1")
|
||||
{
|
||||
if (children_list.size() != 3)
|
||||
input_error("Invalid number of arguments for primitive `%s'!\n", str.c_str());
|
||||
input_error("Invalid number of arguments for primitive `%s'!\n", str);
|
||||
|
||||
std::vector<RTLIL::State> z_const(1, RTLIL::State::Sz);
|
||||
|
||||
|
@ -2894,7 +2894,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
|||
auto& range = children[0]->children[0];
|
||||
|
||||
if (!try_determine_range_width(range.get(), result_width))
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str.c_str());
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str);
|
||||
|
||||
if (range->children.size() >= 2)
|
||||
shift_expr = range->children[1]->clone();
|
||||
|
@ -3285,7 +3285,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
int width;
|
||||
|
||||
if (!try_determine_range_width(the_range.get(), width))
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str.c_str());
|
||||
input_error("Unsupported expression on dynamic range select on signal `%s'!\n", str);
|
||||
|
||||
if (the_range->children.size() >= 2)
|
||||
offset_ast = the_range->children[1]->clone();
|
||||
|
@ -3405,7 +3405,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
auto buf = children[1]->clone();
|
||||
while (buf->simplify(true, stage, -1, false)) { }
|
||||
if (buf->type != AST_CONSTANT)
|
||||
input_error("Failed to evaluate system function `%s' with non-constant value.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-constant value.\n", str);
|
||||
|
||||
num_steps = buf->asInt(true);
|
||||
}
|
||||
|
@ -3516,7 +3516,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
auto buf = children[0]->clone();
|
||||
while (buf->simplify(true, stage, width_hint, sign_hint)) { }
|
||||
if (buf->type != AST_CONSTANT)
|
||||
input_error("Failed to evaluate system function `%s' with non-constant value.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-constant value.\n", str);
|
||||
|
||||
RTLIL::Const arg_value = buf->bitsAsConst();
|
||||
if (arg_value.as_bool())
|
||||
|
@ -3563,7 +3563,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
if (id_ast == nullptr && current_scope.count(buf->str))
|
||||
id_ast = current_scope.at(buf->str);
|
||||
if (!id_ast)
|
||||
input_error("Failed to resolve identifier %s for width detection!\n", buf->str.c_str());
|
||||
input_error("Failed to resolve identifier %s for width detection!\n", buf->str);
|
||||
|
||||
if (id_ast->type == AST_WIRE || id_ast->type == AST_MEMORY) {
|
||||
// Check for item in packed struct / union
|
||||
|
@ -3578,7 +3578,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
// TODO: IEEE Std 1800-2017 20.7: "If the first argument to an array query function would cause $dimensions to return 0
|
||||
// or if the second argument is out of range, then 'x shall be returned."
|
||||
if (dim < 1 || dim > dims)
|
||||
input_error("Dimension %d out of range in `%s', as it only has %d dimensions!\n", dim, id_ast->str.c_str(), dims);
|
||||
input_error("Dimension %d out of range in `%s', as it only has %d dimensions!\n", dim, id_ast->str, dims);
|
||||
|
||||
expr_dimensions = dims - dim + 1;
|
||||
expr_unpacked_dimensions = std::max(id_ast->unpacked_dimensions - dim + 1, 0);
|
||||
|
@ -3712,9 +3712,9 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
auto& node = children[i];
|
||||
while (node->simplify(true, stage, -1, false)) { }
|
||||
if (node->type != AST_CONSTANT)
|
||||
input_error("Failed to evaluate system function `%s' with non-constant control bit argument.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-constant control bit argument.\n", str);
|
||||
if (node->bits.size() != 1)
|
||||
input_error("Failed to evaluate system function `%s' with control bit width != 1.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with control bit width != 1.\n", str);
|
||||
control_bits.push_back(node->bits[0]);
|
||||
}
|
||||
|
||||
|
@ -3817,7 +3817,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
if (current_scope.count(str) == 0)
|
||||
str = try_pop_module_prefix();
|
||||
if (current_scope.count(str) == 0 || current_scope[str]->type != AST_FUNCTION)
|
||||
input_error("Can't resolve function name `%s'.\n", str.c_str());
|
||||
input_error("Can't resolve function name `%s'.\n", str);
|
||||
}
|
||||
|
||||
if (type == AST_TCALL)
|
||||
|
@ -3825,9 +3825,9 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
if (str == "$finish" || str == "$stop")
|
||||
{
|
||||
if (!current_always || current_always->type != AST_INITIAL)
|
||||
input_error("System task `%s' outside initial block is unsupported.\n", str.c_str());
|
||||
input_error("System task `%s' outside initial block is unsupported.\n", str);
|
||||
|
||||
input_error("System task `%s' executed.\n", str.c_str());
|
||||
input_error("System task `%s' executed.\n", str);
|
||||
}
|
||||
|
||||
if (str == "\\$readmemh" || str == "\\$readmemb")
|
||||
|
@ -3839,12 +3839,12 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
auto node_filename = children[0]->clone();
|
||||
while (node_filename->simplify(true, stage, width_hint, sign_hint)) { }
|
||||
if (node_filename->type != AST_CONSTANT)
|
||||
input_error("Failed to evaluate system function `%s' with non-constant 1st argument.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-constant 1st argument.\n", str);
|
||||
|
||||
auto node_memory = children[1]->clone();
|
||||
while (node_memory->simplify(true, stage, width_hint, sign_hint)) { }
|
||||
if (node_memory->type != AST_IDENTIFIER || node_memory->id2ast == nullptr || node_memory->id2ast->type != AST_MEMORY)
|
||||
input_error("Failed to evaluate system function `%s' with non-memory 2nd argument.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-memory 2nd argument.\n", str);
|
||||
|
||||
int start_addr = -1, finish_addr = -1;
|
||||
|
||||
|
@ -3852,7 +3852,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
auto node_addr = children[2]->clone();
|
||||
while (node_addr->simplify(true, stage, width_hint, sign_hint)) { }
|
||||
if (node_addr->type != AST_CONSTANT)
|
||||
input_error("Failed to evaluate system function `%s' with non-constant 3rd argument.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-constant 3rd argument.\n", str);
|
||||
start_addr = int(node_addr->asInt(false));
|
||||
}
|
||||
|
||||
|
@ -3860,7 +3860,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
auto node_addr = children[3]->clone();
|
||||
while (node_addr->simplify(true, stage, width_hint, sign_hint)) { }
|
||||
if (node_addr->type != AST_CONSTANT)
|
||||
input_error("Failed to evaluate system function `%s' with non-constant 4th argument.\n", str.c_str());
|
||||
input_error("Failed to evaluate system function `%s' with non-constant 4th argument.\n", str);
|
||||
finish_addr = int(node_addr->asInt(false));
|
||||
}
|
||||
|
||||
|
@ -3888,7 +3888,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
if (current_scope.count(str) == 0)
|
||||
str = try_pop_module_prefix();
|
||||
if (current_scope.count(str) == 0 || current_scope[str]->type != AST_TASK)
|
||||
input_error("Can't resolve task name `%s'.\n", str.c_str());
|
||||
input_error("Can't resolve task name `%s'.\n", str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3928,7 +3928,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
if (in_param)
|
||||
input_error("Non-constant function call in constant expression.\n");
|
||||
if (require_const_eval)
|
||||
input_error("Function %s can only be called with constant arguments.\n", str.c_str());
|
||||
input_error("Function %s can only be called with constant arguments.\n", str);
|
||||
}
|
||||
|
||||
size_t arg_count = 0;
|
||||
|
@ -4050,7 +4050,7 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
goto tcall_incompatible_wires;
|
||||
} else {
|
||||
tcall_incompatible_wires:
|
||||
input_error("Incompatible re-declaration of wire %s.\n", child->str.c_str());
|
||||
input_error("Incompatible re-declaration of wire %s.\n", child->str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4476,7 +4476,7 @@ std::unique_ptr<AstNode> AstNode::readmem(bool is_readmemh, std::string mem_file
|
|||
yosys_input_files.insert(mem_filename);
|
||||
}
|
||||
if (f.fail() || GetSize(mem_filename) == 0)
|
||||
input_error("Can not open file `%s` for %s.\n", mem_filename.c_str(), str.c_str());
|
||||
input_error("Can not open file `%s` for %s.\n", mem_filename, str);
|
||||
|
||||
log_assert(GetSize(memory->children) == 2 && memory->children[1]->type == AST_RANGE && memory->children[1]->range_valid);
|
||||
int range_left = memory->children[1]->range_left, range_right = memory->children[1]->range_right;
|
||||
|
@ -4522,7 +4522,7 @@ std::unique_ptr<AstNode> AstNode::readmem(bool is_readmemh, std::string mem_file
|
|||
char *endptr;
|
||||
cursor = strtol(nptr, &endptr, 16);
|
||||
if (!*nptr || *endptr)
|
||||
input_error("Can not parse address `%s` for %s.\n", nptr, str.c_str());
|
||||
input_error("Can not parse address `%s` for %s.\n", nptr, str);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -5421,7 +5421,7 @@ std::unique_ptr<AstNode> AstNode::eval_const_function(AstNode *fcall, bool must_
|
|||
// if this variable has already been declared as an input, check the
|
||||
// sizes match if it already had an explicit size
|
||||
if (variable.arg && variable.explicitly_sized && variable.val.size() != width) {
|
||||
input_error("Incompatible re-declaration of constant function wire %s.\n", stmt->str.c_str());
|
||||
input_error("Incompatible re-declaration of constant function wire %s.\n", stmt->str);
|
||||
}
|
||||
variable.val = RTLIL::Const(RTLIL::State::Sx, width);
|
||||
variable.offset = stmt->range_swapped ? stmt->range_left : stmt->range_right;
|
||||
|
@ -5503,7 +5503,7 @@ std::unique_ptr<AstNode> AstNode::eval_const_function(AstNode *fcall, bool must_
|
|||
if (!range->range_valid) {
|
||||
if (!must_succeed)
|
||||
goto finished;
|
||||
range->input_error("Non-constant range\n%s: ... called from here.\n", fcall->loc_string().c_str());
|
||||
range->input_error("Non-constant range\n%s: ... called from here.\n", fcall->loc_string());
|
||||
}
|
||||
int offset = min(range->range_left, range->range_right);
|
||||
int width = std::abs(range->range_left - range->range_right) + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue