mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-05 01:45:17 +00:00
Refactor Yosys-Verific settings structure
This commit is contained in:
parent
276136cd50
commit
bd710134fc
1 changed files with 13 additions and 17 deletions
|
|
@ -126,7 +126,6 @@ struct YosysVerificSettings {
|
||||||
std::string default_string;
|
std::string default_string;
|
||||||
std::vector<std::string> default_string_list;
|
std::vector<std::string> default_string_list;
|
||||||
std::string description;
|
std::string description;
|
||||||
bool available;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<std::string, Option> options;
|
std::map<std::string, Option> options;
|
||||||
|
|
@ -138,10 +137,8 @@ struct YosysVerificSettings {
|
||||||
{
|
{
|
||||||
Option opt;
|
Option opt;
|
||||||
opt.type = Type::BOOL;
|
opt.type = Type::BOOL;
|
||||||
opt.bool_value = false;
|
|
||||||
opt.default_bool = false;
|
opt.default_bool = false;
|
||||||
opt.description = "Ignore translate_off/translate_on pragmas";
|
opt.description = "Ignore translate_off/translate_on pragmas";
|
||||||
opt.available = true;
|
|
||||||
options["ignore_translate_off"] = opt;
|
options["ignore_translate_off"] = opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,13 +147,12 @@ struct YosysVerificSettings {
|
||||||
{
|
{
|
||||||
Option opt;
|
Option opt;
|
||||||
opt.type = Type::STRING_LIST;
|
opt.type = Type::STRING_LIST;
|
||||||
opt.string_list_value = {".v", ".vh", ".sv", ".svh"};
|
|
||||||
opt.default_string_list = {".v", ".vh", ".sv", ".svh"};
|
opt.default_string_list = {".v", ".vh", ".sv", ".svh"};
|
||||||
opt.description = "Comma-separated Verilog/SystemVerilog file extensions";
|
opt.description = "Comma-separated Verilog/SystemVerilog file extensions";
|
||||||
opt.available = true;
|
|
||||||
options["vlog_file_extensions"] = opt;
|
options["vlog_file_extensions"] = opt;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
|
@ -177,8 +173,7 @@ struct YosysVerificSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_option(const std::string &name) const {
|
bool has_option(const std::string &name) const {
|
||||||
auto it = options.find(name);
|
return options.find(name) != options.end();
|
||||||
return it != options.end() && it->second.available;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_bool(const std::string &name) const {
|
bool get_bool(const std::string &name) const {
|
||||||
|
|
@ -3517,18 +3512,21 @@ struct VerificPass : public Pass {
|
||||||
log("With two arguments, sets the specified setting to the given value.\n");
|
log("With two arguments, sets the specified setting to the given value.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log("Available settings:\n");
|
log("Available settings:\n");
|
||||||
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
|
// Initialize settings to get option metadata
|
||||||
log(" ignore_translate_off (bool) Ignore translate_off/translate_on pragmas\n");
|
if (!yosys_verific_settings_initialized) {
|
||||||
log(" vlog_file_extensions (string-list) Verilog/SV file extensions for relaxed mode\n");
|
yosys_verific_settings.init();
|
||||||
#endif
|
yosys_verific_settings_initialized = true;
|
||||||
|
}
|
||||||
|
for (const auto &it : yosys_verific_settings.options) {
|
||||||
|
const char *type_str =
|
||||||
|
it.second.type == YosysVerificSettings::Type::BOOL ? "bool" :
|
||||||
|
it.second.type == YosysVerificSettings::Type::STRING ? "string" : "string-list";
|
||||||
|
log(" %-20s (%s) %s\n", it.first.c_str(), type_str, it.second.description.c_str());
|
||||||
|
}
|
||||||
log("\n");
|
log("\n");
|
||||||
log("For boolean settings, use 0/1, true/false, on/off, yes/no.\n");
|
log("For boolean settings, use 0/1, true/false, on/off, yes/no.\n");
|
||||||
log("For string-list settings, provide comma-separated values (e.g. \".v,.sv,.vh\").\n");
|
log("For string-list settings, provide comma-separated values (e.g. \".v,.sv,.vh\").\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log("Example usage:\n");
|
|
||||||
log(" verific -set ignore_translate_off true\n");
|
|
||||||
log(" verific -set vlog_file_extensions \".v,.sv,.vh,.svh,.h,.inc\"\n");
|
|
||||||
log("\n");
|
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" verific -set-reset\n");
|
log(" verific -set-reset\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
|
@ -4522,8 +4520,6 @@ struct VerificPass : public Pass {
|
||||||
if (argidx+1 == GetSize(args)) {
|
if (argidx+1 == GetSize(args)) {
|
||||||
log("Yosys-Verific settings:\n");
|
log("Yosys-Verific settings:\n");
|
||||||
for (const auto &it : yosys_verific_settings.options) {
|
for (const auto &it : yosys_verific_settings.options) {
|
||||||
if (!it.second.available)
|
|
||||||
continue;
|
|
||||||
const auto &name = it.first;
|
const auto &name = it.first;
|
||||||
const auto &opt = it.second;
|
const auto &opt = it.second;
|
||||||
switch (opt.type) {
|
switch (opt.type) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue