mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-03 04:41:22 +00:00
register.h: Add internal_flag to Pass
Update experimental pass warnings to use a shared function. Reduces repetition, and also allows all of the warning flags to be combined (which at present is just experimental and the new internal). Update `test_*` passes to call `internal()` in their constructors.
This commit is contained in:
parent
f4ad934542
commit
b9485ce094
7 changed files with 40 additions and 20 deletions
|
@ -116,7 +116,9 @@ struct MemContentsTest {
|
||||||
|
|
||||||
struct FunctionalTestGeneric : public Pass
|
struct FunctionalTestGeneric : public Pass
|
||||||
{
|
{
|
||||||
FunctionalTestGeneric() : Pass("test_generic", "test the generic compute graph") {}
|
FunctionalTestGeneric() : Pass("test_generic", "test the generic compute graph") {
|
||||||
|
internal();
|
||||||
|
}
|
||||||
|
|
||||||
void help() override
|
void help() override
|
||||||
{
|
{
|
||||||
|
|
|
@ -695,6 +695,23 @@ static string get_cell_name(string name) {
|
||||||
return is_code_getter(name) ? name.substr(0, name.length()-1) : name;
|
return is_code_getter(name) ? name.substr(0, name.length()-1) : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void log_warning_flags(Pass *pass) {
|
||||||
|
bool has_warnings = false;
|
||||||
|
const string name = pass->pass_name;
|
||||||
|
if (pass->experimental_flag) {
|
||||||
|
if (!has_warnings) log("\n");
|
||||||
|
has_warnings = true;
|
||||||
|
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", name.c_str());
|
||||||
|
}
|
||||||
|
if (pass->internal_flag) {
|
||||||
|
if (!has_warnings) log("\n");
|
||||||
|
has_warnings = true;
|
||||||
|
log("WARNING: THE '%s' COMMAND IS INTENDED FOR INTERNAL DEVELOPER USE ONLY.\n", name.c_str());
|
||||||
|
}
|
||||||
|
if (has_warnings)
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
|
|
||||||
static struct CellHelpMessages {
|
static struct CellHelpMessages {
|
||||||
dict<string, SimHelper> cell_help;
|
dict<string, SimHelper> cell_help;
|
||||||
CellHelpMessages() {
|
CellHelpMessages() {
|
||||||
|
@ -1125,11 +1142,7 @@ struct HelpPass : public Pass {
|
||||||
log("=");
|
log("=");
|
||||||
log("\n");
|
log("\n");
|
||||||
it.second->help();
|
it.second->help();
|
||||||
if (it.second->experimental_flag) {
|
log_warning_flags(it.second);
|
||||||
log("\n");
|
|
||||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", it.first.c_str());
|
|
||||||
log("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[1] == "-cells") {
|
else if (args[1] == "-cells") {
|
||||||
|
@ -1149,22 +1162,14 @@ struct HelpPass : public Pass {
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
log_streams.push_back(&buf);
|
log_streams.push_back(&buf);
|
||||||
it.second->help();
|
it.second->help();
|
||||||
if (it.second->experimental_flag) {
|
log_warning_flags(it.second);
|
||||||
log("\n");
|
|
||||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", it.first.c_str());
|
|
||||||
log("\n");
|
|
||||||
}
|
|
||||||
log_streams.pop_back();
|
log_streams.pop_back();
|
||||||
write_cmd_rst(it.first, it.second->short_help, buf.str());
|
write_cmd_rst(it.first, it.second->short_help, buf.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pass_register.count(args[1])) {
|
else if (pass_register.count(args[1])) {
|
||||||
pass_register.at(args[1])->help();
|
pass_register.at(args[1])->help();
|
||||||
if (pass_register.at(args[1])->experimental_flag) {
|
log_warning_flags(pass_register.at(args[1]));
|
||||||
log("\n");
|
|
||||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", args[1].c_str());
|
|
||||||
log("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (cell_help_messages.contains(args[1])) {
|
else if (cell_help_messages.contains(args[1])) {
|
||||||
auto help_cell = cell_help_messages.get(args[1]);
|
auto help_cell = cell_help_messages.get(args[1]);
|
||||||
|
|
|
@ -68,11 +68,16 @@ struct Pass
|
||||||
int call_counter;
|
int call_counter;
|
||||||
int64_t runtime_ns;
|
int64_t runtime_ns;
|
||||||
bool experimental_flag = false;
|
bool experimental_flag = false;
|
||||||
|
bool internal_flag = false;
|
||||||
|
|
||||||
void experimental() {
|
void experimental() {
|
||||||
experimental_flag = true;
|
experimental_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void internal() {
|
||||||
|
internal_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
struct pre_post_exec_state_t {
|
struct pre_post_exec_state_t {
|
||||||
Pass *parent_pass;
|
Pass *parent_pass;
|
||||||
int64_t begin_ns;
|
int64_t begin_ns;
|
||||||
|
|
|
@ -117,7 +117,9 @@ void opt_eqpmux(test_pmgen_pm &pm)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestPmgenPass : public Pass {
|
struct TestPmgenPass : public Pass {
|
||||||
TestPmgenPass() : Pass("test_pmgen", "test pass for pmgen") { }
|
TestPmgenPass() : Pass("test_pmgen", "test pass for pmgen") {
|
||||||
|
internal();
|
||||||
|
}
|
||||||
void help() override
|
void help() override
|
||||||
{
|
{
|
||||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
|
|
@ -243,7 +243,9 @@ static void test_abcloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestAbcloopPass : public Pass {
|
struct TestAbcloopPass : public Pass {
|
||||||
TestAbcloopPass() : Pass("test_abcloop", "automatically test handling of loops in abc command") { }
|
TestAbcloopPass() : Pass("test_abcloop", "automatically test handling of loops in abc command") {
|
||||||
|
internal();
|
||||||
|
}
|
||||||
void help() override
|
void help() override
|
||||||
{
|
{
|
||||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
|
|
@ -326,7 +326,9 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int s
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestAutotbBackend : public Backend {
|
struct TestAutotbBackend : public Backend {
|
||||||
TestAutotbBackend() : Backend("=test_autotb", "generate simple test benches") { }
|
TestAutotbBackend() : Backend("=test_autotb", "generate simple test benches") {
|
||||||
|
internal();
|
||||||
|
}
|
||||||
void help() override
|
void help() override
|
||||||
{
|
{
|
||||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
|
|
@ -705,7 +705,9 @@ static void run_eval_test(RTLIL::Design *design, bool verbose, bool nosat, std::
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestCellPass : public Pass {
|
struct TestCellPass : public Pass {
|
||||||
TestCellPass() : Pass("test_cell", "automatically test the implementation of a cell type") { }
|
TestCellPass() : Pass("test_cell", "automatically test the implementation of a cell type") {
|
||||||
|
internal();
|
||||||
|
}
|
||||||
void help() override
|
void help() override
|
||||||
{
|
{
|
||||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue