From: Clifford Wolf Date: Thu, 23 Feb 2017 14:39:13 +0000 (+0100) Subject: Preserve string parameters X-Git-Tag: yosys-0.8~482 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e927a51d575c19b85db2c73ff70d8a244eb1fb5;p=yosys.git Preserve string parameters --- diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index 38a19a36f..06660102b 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -1104,7 +1104,10 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, dictstr.c_str(), log_signal(RTLIL::SigSpec(parameters[para_id]))); delete child->children.at(0); - child->children[0] = AstNode::mkconst_bits(parameters[para_id].bits, (parameters[para_id].flags & RTLIL::CONST_FLAG_SIGNED) != 0); + if ((parameters[para_id].flags & RTLIL::CONST_FLAG_STRING) != 0) + child->children[0] = AstNode::mkconst_str(parameters[para_id].decode_string()); + else + child->children[0] = AstNode::mkconst_bits(parameters[para_id].bits, (parameters[para_id].flags & RTLIL::CONST_FLAG_SIGNED) != 0); parameters.erase(para_id); continue; } @@ -1118,7 +1121,10 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, dictchildren[0]->str = param.first.str(); - defparam->children.push_back(AstNode::mkconst_bits(param.second.bits, (param.second.flags & RTLIL::CONST_FLAG_SIGNED) != 0)); + if ((param.second.flags & RTLIL::CONST_FLAG_STRING) != 0) + defparam->children.push_back(AstNode::mkconst_str(param.second.decode_string())); + else + defparam->children.push_back(AstNode::mkconst_bits(param.second.bits, (param.second.flags & RTLIL::CONST_FLAG_SIGNED) != 0)); new_ast->children.push_back(defparam); }