3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-27 11:49:02 +00:00

Remove .c_str() calls from log()/log_error()

There are some leftovers, but this is an easy regex-based approach that removes most of them.
This commit is contained in:
Robert O'Callahan 2025-09-11 05:25:26 +00:00
parent c2291c10a6
commit e0ae7b7af4
140 changed files with 623 additions and 623 deletions

View file

@ -140,7 +140,7 @@ struct FsmExpand
{
optimze_as_needed();
log(" merging %s cell %s.\n", cell->type.c_str(), cell->name.c_str());
log(" merging %s cell %s.\n", cell->type, cell->name);
merged_set.insert(cell);
already_optimized = false;
@ -243,7 +243,7 @@ struct FsmExpand
void execute()
{
log("\n");
log("Expanding FSM `%s' from module `%s':\n", fsm_cell->name.c_str(), module->name.c_str());
log("Expanding FSM `%s' from module `%s':\n", fsm_cell->name, module->name);
already_optimized = false;
limit_transitions = 16 * fsm_cell->parameters[ID::TRANS_NUM].as_int();

View file

@ -76,7 +76,7 @@ void write_kiss2(struct RTLIL::Module *module, struct RTLIL::Cell *cell, std::st
kiss_file.open(kiss_name, std::ios::out | std::ios::trunc);
if (!kiss_file.is_open()) {
log_error("Could not open file \"%s\" with write access.\n", kiss_name.c_str());
log_error("Could not open file \"%s\" with write access.\n", kiss_name);
}
fsm_data.copy_from_cell(cell);

View file

@ -71,7 +71,7 @@ static bool find_states(RTLIL::SigSpec sig, const RTLIL::SigSpec &dff_out, RTLIL
{
RTLIL::Cell *cell = module->cells_.at(cellport.first);
if ((cell->type != ID($mux) && cell->type != ID($pmux)) || cellport.second != ID::Y) {
log(" unexpected cell type %s (%s) found in state selection tree.\n", cell->type.c_str(), cell->name.c_str());
log(" unexpected cell type %s (%s) found in state selection tree.\n", cell->type, cell->name);
return false;
}
@ -255,7 +255,7 @@ undef_bit_in_next_state:
static void extract_fsm(RTLIL::Wire *wire)
{
log("Extracting FSM `%s' from module `%s'.\n", wire->name.c_str(), module->name.c_str());
log("Extracting FSM `%s' from module `%s'.\n", wire->name, module->name);
// get input and output signals for state ff
@ -274,7 +274,7 @@ static void extract_fsm(RTLIL::Wire *wire)
RTLIL::Cell *cell = module->cells_.at(cellport.first);
if ((cell->type != ID($dff) && cell->type != ID($adff)) || cellport.second != ID::Q)
continue;
log(" found %s cell for state register: %s\n", cell->type.c_str(), cell->name.c_str());
log(" found %s cell for state register: %s\n", cell->type, cell->name);
RTLIL::SigSpec sig_q = assign_map(cell->getPort(ID::Q));
RTLIL::SigSpec sig_d = assign_map(cell->getPort(ID::D));
clk = cell->getPort(ID::CLK);

View file

@ -156,7 +156,7 @@ static void implement_pattern_cache(RTLIL::Module *module, std::map<RTLIL::Const
static void map_fsm(RTLIL::Cell *fsm_cell, RTLIL::Module *module)
{
log("Mapping FSM `%s' from module `%s'.\n", fsm_cell->name.c_str(), module->name.c_str());
log("Mapping FSM `%s' from module `%s'.\n", fsm_cell->name, module->name);
FsmData fsm_data;
fsm_data.copy_from_cell(fsm_cell);

View file

@ -293,7 +293,7 @@ struct FsmOpt
FsmOpt(RTLIL::Cell *cell, RTLIL::Module *module)
{
log("Optimizing FSM `%s' from module `%s'.\n", cell->name.c_str(), module->name.c_str());
log("Optimizing FSM `%s' from module `%s'.\n", cell->name, module->name);
fsm_data.copy_from_cell(cell);
this->cell = cell;

View file

@ -56,15 +56,15 @@ static void fsm_recode(RTLIL::Cell *cell, RTLIL::Module *module, FILE *fm_set_fs
{
std::string encoding = cell->attributes.count(ID::fsm_encoding) ? cell->attributes.at(ID::fsm_encoding).decode_string() : "auto";
log("Recoding FSM `%s' from module `%s' using `%s' encoding:\n", cell->name.c_str(), module->name.c_str(), encoding.c_str());
log("Recoding FSM `%s' from module `%s' using `%s' encoding:\n", cell->name, module->name, encoding);
if (encoding != "none" && encoding != "user" && encoding != "one-hot" && encoding != "binary" && encoding != "auto") {
log(" unknown encoding `%s': using auto instead.\n", encoding.c_str());
log(" unknown encoding `%s': using auto instead.\n", encoding);
encoding = "auto";
}
if (encoding == "none" || encoding == "user") {
log(" nothing to do for encoding `%s'.\n", encoding.c_str());
log(" nothing to do for encoding `%s'.\n", encoding);
return;
}
@ -79,7 +79,7 @@ static void fsm_recode(RTLIL::Cell *cell, RTLIL::Module *module, FILE *fm_set_fs
encoding = default_encoding;
else
encoding = GetSize(fsm_data.state_table) < 32 ? "one-hot" : "binary";
log(" mapping auto encoding to `%s` for this FSM.\n", encoding.c_str());
log(" mapping auto encoding to `%s` for this FSM.\n", encoding);
}
if (encoding == "one-hot") {
@ -93,7 +93,7 @@ static void fsm_recode(RTLIL::Cell *cell, RTLIL::Module *module, FILE *fm_set_fs
}
fsm_data.state_bits = new_num_state_bits;
} else
log_error("FSM encoding `%s' is not supported!\n", encoding.c_str());
log_error("FSM encoding `%s' is not supported!\n", encoding);
if (encfile)
fprintf(encfile, ".fsm %s %s\n", log_id(module), RTLIL::unescape_id(cell->parameters[ID::NAME].decode_string()).c_str());
@ -113,7 +113,7 @@ static void fsm_recode(RTLIL::Cell *cell, RTLIL::Module *module, FILE *fm_set_fs
} else
log_abort();
log(" %s -> %s\n", fsm_data.state_table[i].as_string().c_str(), new_code.as_string().c_str());
log(" %s -> %s\n", fsm_data.state_table[i].as_string(), new_code.as_string());
if (encfile)
fprintf(encfile, ".map %s %s\n", fsm_data.state_table[i].as_string().c_str(), new_code.as_string().c_str());
fsm_data.state_table[i] = new_code;
@ -165,13 +165,13 @@ struct FsmRecodePass : public Pass {
if (arg == "-fm_set_fsm_file" && argidx+1 < args.size() && fm_set_fsm_file == NULL) {
fm_set_fsm_file = fopen(args[++argidx].c_str(), "w");
if (fm_set_fsm_file == NULL)
log_error("Can't open fm_set_fsm_file `%s' for writing: %s\n", args[argidx].c_str(), strerror(errno));
log_error("Can't open fm_set_fsm_file `%s' for writing: %s\n", args[argidx], strerror(errno));
continue;
}
if (arg == "-encfile" && argidx+1 < args.size() && encfile == NULL) {
encfile = fopen(args[++argidx].c_str(), "w");
if (encfile == NULL)
log_error("Can't open encfile `%s' for writing: %s\n", args[argidx].c_str(), strerror(errno));
log_error("Can't open encfile `%s' for writing: %s\n", args[argidx], strerror(errno));
continue;
}
if (arg == "-encoding" && argidx+1 < args.size() && default_encoding.empty()) {

View file

@ -134,7 +134,7 @@ struct FsmData
{
log("-------------------------------------\n");
log("\n");
log(" Information on FSM %s (%s):\n", cell->name.c_str(), cell->parameters[ID::NAME].decode_string().c_str());
log(" Information on FSM %s (%s):\n", cell->name, cell->parameters[ID::NAME].decode_string());
log("\n");
log(" Number of input signals: %3d\n", num_inputs);
log(" Number of output signals: %3d\n", num_outputs);