mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-07 06:33:24 +00:00
Convert floating point cell parameters to strings
This commit is contained in:
parent
f41378af8c
commit
c2ba4fb2fd
1 changed files with 12 additions and 9 deletions
|
@ -1336,16 +1336,19 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child->type == AST_PARASET) {
|
if (child->type == AST_PARASET) {
|
||||||
if (child->children[0]->type != AST_CONSTANT)
|
IdString paraname = child->str.empty() ? stringf("$%d", ++para_counter) : child->str;
|
||||||
log_error("Parameter `%s' with non-constant value at %s:%d!\n",
|
if (child->children[0]->type == AST_REALVALUE) {
|
||||||
child->str.c_str(), filename.c_str(), linenum);
|
log_warning("Replacing floating point parameter %s.%s = %f with string at %s:%d.\n",
|
||||||
if (child->str.size() == 0) {
|
log_id(cell), log_id(paraname), child->children[0]->realvalue,
|
||||||
char buf[100];
|
filename.c_str(), linenum);
|
||||||
snprintf(buf, 100, "$%d", ++para_counter);
|
auto strnode = AstNode::mkconst_str(stringf("%f", child->children[0]->realvalue));
|
||||||
cell->parameters[buf] = child->children[0]->asParaConst();
|
strnode->cloneInto(child->children[0]);
|
||||||
} else {
|
delete strnode;
|
||||||
cell->parameters[child->str] = child->children[0]->asParaConst();
|
|
||||||
}
|
}
|
||||||
|
if (child->children[0]->type != AST_CONSTANT)
|
||||||
|
log_error("Parameter %s.%s with non-constant value at %s:%d!\n",
|
||||||
|
log_id(cell), log_id(paraname), filename.c_str(), linenum);
|
||||||
|
cell->parameters[paraname] = child->children[0]->asParaConst();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child->type == AST_ARGUMENT) {
|
if (child->type == AST_ARGUMENT) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue