mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-25 19:01:30 +00:00
Remove .c_str() from stringf parameters
This commit is contained in:
parent
c41ba912d8
commit
c7df6954b9
90 changed files with 773 additions and 773 deletions
|
@ -72,7 +72,7 @@ struct Clk2fflogicPass : public Pass {
|
|||
}
|
||||
std::string sig_str = log_signal(sig);
|
||||
sig_str.erase(std::remove(sig_str.begin(), sig_str.end(), ' '), sig_str.end());
|
||||
Wire *sampled_sig = module->addWire(NEW_ID_SUFFIX(stringf("%s#sampled", sig_str.c_str())), GetSize(sig));
|
||||
Wire *sampled_sig = module->addWire(NEW_ID_SUFFIX(stringf("%s#sampled", sig_str)), GetSize(sig));
|
||||
sampled_sig->attributes[ID::init] = RTLIL::Const(State::S0, GetSize(sig));
|
||||
if (is_fine)
|
||||
module->addFfGate(NEW_ID, sig, sampled_sig);
|
||||
|
@ -84,7 +84,7 @@ struct Clk2fflogicPass : public Pass {
|
|||
SigSpec sample_control_edge(Module *module, SigSpec sig, bool polarity, bool is_fine) {
|
||||
std::string sig_str = log_signal(sig);
|
||||
sig_str.erase(std::remove(sig_str.begin(), sig_str.end(), ' '), sig_str.end());
|
||||
Wire *sampled_sig = module->addWire(NEW_ID_SUFFIX(stringf("%s#sampled", sig_str.c_str())), GetSize(sig));
|
||||
Wire *sampled_sig = module->addWire(NEW_ID_SUFFIX(stringf("%s#sampled", sig_str)), GetSize(sig));
|
||||
sampled_sig->attributes[ID::init] = RTLIL::Const(polarity ? State::S1 : State::S0, GetSize(sig));
|
||||
if (is_fine)
|
||||
module->addFfGate(NEW_ID, sig, sampled_sig);
|
||||
|
@ -98,7 +98,7 @@ struct Clk2fflogicPass : public Pass {
|
|||
sig_str.erase(std::remove(sig_str.begin(), sig_str.end(), ' '), sig_str.end());
|
||||
|
||||
|
||||
Wire *sampled_sig = module->addWire(NEW_ID_SUFFIX(stringf("%s#sampled", sig_str.c_str())), GetSize(sig));
|
||||
Wire *sampled_sig = module->addWire(NEW_ID_SUFFIX(stringf("%s#sampled", sig_str)), GetSize(sig));
|
||||
sampled_sig->attributes[ID::init] = init;
|
||||
|
||||
Cell *cell;
|
||||
|
|
|
@ -129,7 +129,7 @@ struct CutpointPass : public Pass {
|
|||
if (attr.first == ID::hdlname)
|
||||
scopeinfo->attributes.insert(attr);
|
||||
else
|
||||
scopeinfo->attributes.emplace(stringf("\\cell_%s", RTLIL::unescape_id(attr.first).c_str()), attr.second);
|
||||
scopeinfo->attributes.emplace(stringf("\\cell_%s", RTLIL::unescape_id(attr.first)), attr.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ struct VlogHammerReporter
|
|||
RTLIL::SigSpec sig(wire);
|
||||
if (!ce.eval(sig))
|
||||
log_error("Can't read back value for port %s!\n", log_id(inputs[i]));
|
||||
input_pattern_list += stringf(" %s", sig.as_const().as_string().c_str());
|
||||
input_pattern_list += stringf(" %s", sig.as_const().as_string());
|
||||
log("++PAT++ %d %s %s #\n", idx, log_id(inputs[i]), sig.as_const().as_string().c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ struct FmcombineWorker
|
|||
|
||||
FmcombineWorker(Design *design, IdString orig_type, const opts_t &opts) :
|
||||
opts(opts), design(design), original(design->module(orig_type)),
|
||||
orig_type(orig_type), combined_type(stringf("$fmcombine%s", orig_type.c_str()))
|
||||
orig_type(orig_type), combined_type(stringf("$fmcombine%s", orig_type))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -595,9 +595,9 @@ struct FreduceWorker
|
|||
|
||||
void dump()
|
||||
{
|
||||
std::string filename = stringf("%s_%s_%05d.il", dump_prefix.c_str(), RTLIL::id2cstr(module->name), reduce_counter);
|
||||
std::string filename = stringf("%s_%s_%05d.il", dump_prefix, RTLIL::id2cstr(module->name), reduce_counter);
|
||||
log("%s Writing dump file `%s'.\n", reduce_counter ? " " : "", filename.c_str());
|
||||
Pass::call(design, stringf("dump -outfile %s %s", filename.c_str(), design->selected_active_module.empty() ? module->name.c_str() : ""));
|
||||
Pass::call(design, stringf("dump -outfile %s %s", filename, design->selected_active_module.empty() ? module->name.c_str() : ""));
|
||||
}
|
||||
|
||||
int run()
|
||||
|
|
|
@ -570,7 +570,7 @@ void mutate_list(Design *design, const mutate_opts_t &opts, const string &filena
|
|||
string str = "mutate";
|
||||
if (!opts.ctrl_name.empty())
|
||||
str += stringf(" -ctrl %s %d %d", log_id(opts.ctrl_name), opts.ctrl_width, ctrl_value++);
|
||||
str += stringf(" -mode %s", entry.mode.c_str());
|
||||
str += stringf(" -mode %s", entry.mode);
|
||||
if (!entry.module.empty())
|
||||
str += stringf(" -module %s", log_id(entry.module));
|
||||
if (!entry.cell.empty())
|
||||
|
@ -586,7 +586,7 @@ void mutate_list(Design *design, const mutate_opts_t &opts, const string &filena
|
|||
if (entry.wirebit >= 0)
|
||||
str += stringf(" -wirebit %d", entry.wirebit);
|
||||
for (auto &s : entry.src)
|
||||
str += stringf(" -src %s", s.c_str());
|
||||
str += stringf(" -src %s", s);
|
||||
if (filename.empty())
|
||||
log("%s\n", str.c_str());
|
||||
else
|
||||
|
|
|
@ -219,14 +219,14 @@ QbfSolutionType call_qbf_solver(RTLIL::Module *mod, const QbfSolveOptions &opt,
|
|||
const std::string smtbmc_warning = "z3: WARNING:";
|
||||
const std::string smtbmc_cmd = stringf("\"%s\" -s %s %s -t 1 -g --binary %s %s/problem%d.smt2 2>&1",
|
||||
yosys_smtbmc_exe.c_str(), opt.get_solver_name().c_str(),
|
||||
(opt.timeout != 0? stringf("--timeout %d", opt.timeout) : "").c_str(),
|
||||
(opt.timeout != 0? stringf("--timeout %d", opt.timeout) : ""),
|
||||
(opt.dump_final_smt2? "--dump-smt2 " + opt.dump_final_smt2_file : "").c_str(),
|
||||
tempdir_name.c_str(), iter_num);
|
||||
|
||||
std::string smt2_command = "write_smt2 -stbv -wires ";
|
||||
for (auto &solver_opt : opt.solver_options)
|
||||
smt2_command += stringf("-solver-option %s %s ", solver_opt.first.c_str(), solver_opt.second.c_str());
|
||||
smt2_command += stringf("%s/problem%d.smt2", tempdir_name.c_str(), iter_num);
|
||||
smt2_command += stringf("-solver-option %s %s ", solver_opt.first, solver_opt.second);
|
||||
smt2_command += stringf("%s/problem%d.smt2", tempdir_name, iter_num);
|
||||
Pass::call(mod->design, smt2_command);
|
||||
|
||||
auto process_line = [&ret, &smtbmc_warning, &opt, &quiet](const std::string &line) {
|
||||
|
|
|
@ -380,7 +380,7 @@ struct RecoverModuleWorker {
|
|||
if (root2buffered.count(gate_bit)) {
|
||||
int buf_idx = 0;
|
||||
for (auto buf_bit : root2buffered.at(gate_bit)) {
|
||||
std::string buf_name_str = stringf("%s_buf_%d", pair.second.bit.name.c_str(), ++buf_idx);
|
||||
std::string buf_name_str = stringf("%s_buf_%d", pair.second.bit.name, ++buf_idx);
|
||||
if (buf_name_str[0] == '\\')
|
||||
buf_name_str[0] = '$';
|
||||
rename_map[buf_bit] = std::make_pair(
|
||||
|
@ -396,7 +396,7 @@ struct RecoverModuleWorker {
|
|||
bool must_invert_name = rule.second.first.inverted;
|
||||
while (must_invert_name ||
|
||||
(mod->wire(new_name.name) && !unused_bits.count(SigBit(mod->wire(new_name.name), new_name.bit)))) {
|
||||
std::string new_name_str = stringf("%s_%s_%d", rule.second.first.bit.name.c_str(),
|
||||
std::string new_name_str = stringf("%s_%s_%d", rule.second.first.bit.name,
|
||||
rule.second.first.inverted ? "inv" : "dup", ++dup_idx);
|
||||
if (new_name_str[0] == '\\')
|
||||
new_name_str[0] = '$';
|
||||
|
|
|
@ -2095,12 +2095,12 @@ struct SimWorker : SimShared
|
|||
std::stringstream f;
|
||||
|
||||
if (wire->width==1)
|
||||
f << stringf("%s", RTLIL::unescape_id(wire->name).c_str());
|
||||
f << stringf("%s", RTLIL::unescape_id(wire->name));
|
||||
else
|
||||
if (wire->upto)
|
||||
f << stringf("[%d:%d] %s", wire->start_offset, wire->width - 1 + wire->start_offset, RTLIL::unescape_id(wire->name).c_str());
|
||||
f << stringf("[%d:%d] %s", wire->start_offset, wire->width - 1 + wire->start_offset, RTLIL::unescape_id(wire->name));
|
||||
else
|
||||
f << stringf("[%d:%d] %s", wire->width - 1 + wire->start_offset, wire->start_offset, RTLIL::unescape_id(wire->name).c_str());
|
||||
f << stringf("[%d:%d] %s", wire->width - 1 + wire->start_offset, wire->start_offset, RTLIL::unescape_id(wire->name));
|
||||
return f.str();
|
||||
}
|
||||
|
||||
|
@ -2108,7 +2108,7 @@ struct SimWorker : SimShared
|
|||
{
|
||||
std::stringstream f;
|
||||
for(auto item=signals.begin();item!=signals.end();item++)
|
||||
f << stringf("%c%s", (item==signals.begin() ? ' ' : ','), RTLIL::unescape_id(item->first->name).c_str());
|
||||
f << stringf("%c%s", (item==signals.begin() ? ' ' : ','), RTLIL::unescape_id(item->first->name));
|
||||
return f.str();
|
||||
}
|
||||
|
||||
|
@ -2207,7 +2207,7 @@ struct SimWorker : SimShared
|
|||
|
||||
std::stringstream f;
|
||||
f << stringf("`timescale 1%s/1%s\n", fst->getTimescaleString(),fst->getTimescaleString());
|
||||
f << stringf("module %s();\n",tb_filename.c_str());
|
||||
f << stringf("module %s();\n",tb_filename);
|
||||
int clk_len = 0;
|
||||
int inputs_len = 0;
|
||||
int outputs_len = 0;
|
||||
|
@ -2225,13 +2225,13 @@ struct SimWorker : SimShared
|
|||
}
|
||||
int data_len = clk_len + inputs_len + outputs_len + 32;
|
||||
f << "\n";
|
||||
f << stringf("\t%s uut(",RTLIL::unescape_id(topmod->name).c_str());
|
||||
f << stringf("\t%s uut(",RTLIL::unescape_id(topmod->name));
|
||||
for(auto item=clocks.begin();item!=clocks.end();item++)
|
||||
f << stringf("%c.%s(%s)", (item==clocks.begin() ? ' ' : ','), RTLIL::unescape_id(item->first->name).c_str(), RTLIL::unescape_id(item->first->name).c_str());
|
||||
f << stringf("%c.%s(%s)", (item==clocks.begin() ? ' ' : ','), RTLIL::unescape_id(item->first->name), RTLIL::unescape_id(item->first->name));
|
||||
for(auto &item : inputs)
|
||||
f << stringf(",.%s(%s)", RTLIL::unescape_id(item.first->name).c_str(), RTLIL::unescape_id(item.first->name).c_str());
|
||||
f << stringf(",.%s(%s)", RTLIL::unescape_id(item.first->name), RTLIL::unescape_id(item.first->name));
|
||||
for(auto &item : outputs)
|
||||
f << stringf(",.%s(%s)", RTLIL::unescape_id(item.first->name).c_str(), RTLIL::unescape_id(item.first->name).c_str());
|
||||
f << stringf(",.%s(%s)", RTLIL::unescape_id(item.first->name), RTLIL::unescape_id(item.first->name));
|
||||
f << ");\n";
|
||||
f << "\n";
|
||||
f << "\tinteger i;\n";
|
||||
|
@ -2242,21 +2242,21 @@ struct SimWorker : SimShared
|
|||
unsigned int end_cycle = cycles_set ? numcycles*2 : INT_MAX;
|
||||
fst->reconstructAllAtTimes(fst_clock, startCount, stopCount, end_cycle, [&](uint64_t time) {
|
||||
for(auto &item : clocks)
|
||||
data_file << stringf("%s",fst->valueOf(item.second).c_str());
|
||||
data_file << stringf("%s",fst->valueOf(item.second));
|
||||
for(auto &item : inputs)
|
||||
data_file << stringf("%s",fst->valueOf(item.second).c_str());
|
||||
data_file << stringf("%s",fst->valueOf(item.second));
|
||||
for(auto &item : outputs)
|
||||
data_file << stringf("%s",fst->valueOf(item.second).c_str());
|
||||
data_file << stringf("%s\n",Const(time-prev_time).as_string().c_str());
|
||||
data_file << stringf("%s",fst->valueOf(item.second));
|
||||
data_file << stringf("%s\n",Const(time-prev_time).as_string());
|
||||
|
||||
if (time==startCount) {
|
||||
// initial state
|
||||
for(auto var : fst->getVars()) {
|
||||
if (var.is_reg && !Const::from_string(fst->valueOf(var.id).c_str()).is_fully_undef()) {
|
||||
if (var.scope == scope) {
|
||||
initstate << stringf("\t\tuut.%s = %d'b%s;\n", var.name.c_str(), var.width, fst->valueOf(var.id).c_str());
|
||||
initstate << stringf("\t\tuut.%s = %d'b%s;\n", var.name, var.width, fst->valueOf(var.id));
|
||||
} else if (var.scope.find(scope+".")==0) {
|
||||
initstate << stringf("\t\tuut.%s.%s = %d'b%s;\n",var.scope.substr(scope.size()+1).c_str(), var.name.c_str(), var.width, fst->valueOf(var.id).c_str());
|
||||
initstate << stringf("\t\tuut.%s.%s = %d'b%s;\n",var.scope.substr(scope.size()+1), var.name, var.width, fst->valueOf(var.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2267,22 +2267,22 @@ struct SimWorker : SimShared
|
|||
|
||||
f << stringf("\treg [0:%d] data [0:%d];\n", data_len-1, cycle-1);
|
||||
f << "\tinitial begin;\n";
|
||||
f << stringf("\t\t$dumpfile(\"%s\");\n",tb_filename.c_str());
|
||||
f << stringf("\t\t$dumpvars(0,%s);\n",tb_filename.c_str());
|
||||
f << stringf("\t\t$dumpfile(\"%s\");\n",tb_filename);
|
||||
f << stringf("\t\t$dumpvars(0,%s);\n",tb_filename);
|
||||
f << initstate.str();
|
||||
f << stringf("\t\t$readmemb(\"%s.txt\", data);\n",tb_filename.c_str());
|
||||
f << stringf("\t\t$readmemb(\"%s.txt\", data);\n",tb_filename);
|
||||
|
||||
f << stringf("\t\t#(data[0][%d:%d]);\n", data_len-32, data_len-1);
|
||||
f << stringf("\t\t{%s } = data[0][%d:%d];\n", signal_list(clocks).c_str(), 0, clk_len-1);
|
||||
f << stringf("\t\t{%s } <= data[0][%d:%d];\n", signal_list(inputs).c_str(), clk_len, clk_len+inputs_len-1);
|
||||
f << stringf("\t\t{%s } = data[0][%d:%d];\n", signal_list(clocks), 0, clk_len-1);
|
||||
f << stringf("\t\t{%s } <= data[0][%d:%d];\n", signal_list(inputs), clk_len, clk_len+inputs_len-1);
|
||||
|
||||
f << stringf("\t\tfor (i = 1; i < %d; i++) begin\n",cycle);
|
||||
|
||||
f << stringf("\t\t\t#(data[i][%d:%d]);\n", data_len-32, data_len-1);
|
||||
f << stringf("\t\t\t{%s } = data[i][%d:%d];\n", signal_list(clocks).c_str(), 0, clk_len-1);
|
||||
f << stringf("\t\t\t{%s } <= data[i][%d:%d];\n", signal_list(inputs).c_str(), clk_len, clk_len+inputs_len-1);
|
||||
f << stringf("\t\t\t{%s } = data[i][%d:%d];\n", signal_list(clocks), 0, clk_len-1);
|
||||
f << stringf("\t\t\t{%s } <= data[i][%d:%d];\n", signal_list(inputs), clk_len, clk_len+inputs_len-1);
|
||||
|
||||
f << stringf("\t\t\tif ({%s } != data[i-1][%d:%d]) begin\n", signal_list(outputs).c_str(), clk_len+inputs_len, clk_len+inputs_len+outputs_len-1);
|
||||
f << stringf("\t\t\tif ({%s } != data[i-1][%d:%d]) begin\n", signal_list(outputs), clk_len+inputs_len, clk_len+inputs_len+outputs_len-1);
|
||||
f << "\t\t\t\t$error(\"Signal difference detected\\n\");\n";
|
||||
f << "\t\t\tend\n";
|
||||
|
||||
|
@ -2337,7 +2337,7 @@ struct VCDWriter : public OutputWriter
|
|||
}
|
||||
|
||||
if (!worker->timescale.empty())
|
||||
vcdfile << stringf("$timescale %s $end\n", worker->timescale.c_str());
|
||||
vcdfile << stringf("$timescale %s $end\n", worker->timescale);
|
||||
|
||||
worker->top->write_output_header(
|
||||
[this](IdString name) { vcdfile << stringf("$scope module %s $end\n", log_id(name)); },
|
||||
|
@ -2349,7 +2349,7 @@ struct VCDWriter : public OutputWriter
|
|||
// this is consistent with the range gtkwave makes up if it doesn't find a
|
||||
// range
|
||||
std::string full_name = form_vcd_name(name, size, w);
|
||||
vcdfile << stringf("$var %s %d n%d %s%s $end\n", is_reg ? "reg" : "wire", size, id, name[0] == '$' ? "\\" : "", full_name.c_str());
|
||||
vcdfile << stringf("$var %s %d n%d %s%s $end\n", is_reg ? "reg" : "wire", size, id, name[0] == '$' ? "\\" : "", full_name);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue