mirror of https://github.com/YosysHQ/yosys.git
Add log_experimental() and experimental() API and "yosys -x"
Signed-off-by: Claire Wolf <clifford@clifford.at>
This commit is contained in:
parent
07a12ebd4f
commit
cef607c8b7
|
@ -295,6 +295,9 @@ int main(int argc, char **argv)
|
||||||
printf(" -E <depsfile>\n");
|
printf(" -E <depsfile>\n");
|
||||||
printf(" write a Makefile dependencies file with in- and output file names\n");
|
printf(" write a Makefile dependencies file with in- and output file names\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
printf(" -x <feature>\n");
|
||||||
|
printf(" do not print warnings for the specified experimental feature\n");
|
||||||
|
printf("\n");
|
||||||
printf(" -g\n");
|
printf(" -g\n");
|
||||||
printf(" globally enable debug log messages\n");
|
printf(" globally enable debug log messages\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -324,7 +327,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "MXAQTVSgm:f:Hh:b:o:p:l:L:qv:tds:c:W:w:e:D:P:E:")) != -1)
|
while ((opt = getopt(argc, argv, "MXAQTVSgm:f:Hh:b:o:p:l:L:qv:tds:c:W:w:e:D:P:E:x:")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
@ -455,6 +458,9 @@ int main(int argc, char **argv)
|
||||||
case 'E':
|
case 'E':
|
||||||
depsfile = optarg;
|
depsfile = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
log_experimentals.insert(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Run '%s -h' for help.\n", argv[0]);
|
fprintf(stderr, "Run '%s -h' for help.\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -42,7 +42,7 @@ std::vector<FILE*> log_files;
|
||||||
std::vector<std::ostream*> log_streams;
|
std::vector<std::ostream*> log_streams;
|
||||||
std::map<std::string, std::set<std::string>> log_hdump;
|
std::map<std::string, std::set<std::string>> log_hdump;
|
||||||
std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
|
std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
|
||||||
std::set<std::string> log_warnings;
|
std::set<std::string> log_warnings, log_experimentals;
|
||||||
int log_warnings_count = 0;
|
int log_warnings_count = 0;
|
||||||
bool log_hdump_all = false;
|
bool log_hdump_all = false;
|
||||||
FILE *log_errfile = NULL;
|
FILE *log_errfile = NULL;
|
||||||
|
@ -377,6 +377,19 @@ void log_warning(const char *format, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void log_experimental(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
string s = vstringf(format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (log_experimentals.count(s) == 0) {
|
||||||
|
log_warning("Feature '%s' is experimental.\n", s.c_str());
|
||||||
|
log_experimentals.insert(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void log_warning_noprefix(const char *format, ...)
|
void log_warning_noprefix(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
|
@ -50,7 +50,7 @@ extern std::vector<FILE*> log_files;
|
||||||
extern std::vector<std::ostream*> log_streams;
|
extern std::vector<std::ostream*> log_streams;
|
||||||
extern std::map<std::string, std::set<std::string>> log_hdump;
|
extern std::map<std::string, std::set<std::string>> log_hdump;
|
||||||
extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
|
extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
|
||||||
extern std::set<std::string> log_warnings;
|
extern std::set<std::string> log_warnings, log_experimentals;
|
||||||
extern int log_warnings_count;
|
extern int log_warnings_count;
|
||||||
extern bool log_hdump_all;
|
extern bool log_hdump_all;
|
||||||
extern FILE *log_errfile;
|
extern FILE *log_errfile;
|
||||||
|
@ -77,6 +77,7 @@ YS_NORETURN void logv_error(const char *format, va_list ap) YS_ATTRIBUTE(noretur
|
||||||
void log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
void log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(format(printf, 2, 3));
|
void log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(format(printf, 2, 3));
|
||||||
void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
||||||
|
void log_experimental(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
||||||
|
|
||||||
// Log with filename to report a problem in a source file.
|
// Log with filename to report a problem in a source file.
|
||||||
void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
||||||
|
|
|
@ -304,6 +304,9 @@ void Pass::call(RTLIL::Design *design, std::vector<std::string> args)
|
||||||
if (pass_register.count(args[0]) == 0)
|
if (pass_register.count(args[0]) == 0)
|
||||||
log_cmd_error("No such command: %s (type 'help' for a command overview)\n", args[0].c_str());
|
log_cmd_error("No such command: %s (type 'help' for a command overview)\n", args[0].c_str());
|
||||||
|
|
||||||
|
if (pass_register[args[0]]->experimental_flag)
|
||||||
|
log_experimental("%s", args[0].c_str());
|
||||||
|
|
||||||
size_t orig_sel_stack_pos = design->selection_stack.size();
|
size_t orig_sel_stack_pos = design->selection_stack.size();
|
||||||
auto state = pass_register[args[0]]->pre_execute();
|
auto state = pass_register[args[0]]->pre_execute();
|
||||||
pass_register[args[0]]->execute(args, design);
|
pass_register[args[0]]->execute(args, design);
|
||||||
|
@ -824,6 +827,11 @@ struct HelpPass : public Pass {
|
||||||
log("=");
|
log("=");
|
||||||
log("\n");
|
log("\n");
|
||||||
it.second->help();
|
it.second->help();
|
||||||
|
if (it.second->experimental_flag) {
|
||||||
|
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") {
|
||||||
|
@ -846,6 +854,11 @@ 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("\n");
|
||||||
|
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", it.first.c_str());
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
log_streams.pop_back();
|
log_streams.pop_back();
|
||||||
write_tex(f, it.first, it.second->short_help, buf.str());
|
write_tex(f, it.first, it.second->short_help, buf.str());
|
||||||
}
|
}
|
||||||
|
@ -858,6 +871,11 @@ 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("\n");
|
||||||
|
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", it.first.c_str());
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
log_streams.pop_back();
|
log_streams.pop_back();
|
||||||
write_html(f, it.first, it.second->short_help, buf.str());
|
write_html(f, it.first, it.second->short_help, buf.str());
|
||||||
}
|
}
|
||||||
|
@ -865,6 +883,11 @@ struct HelpPass : public Pass {
|
||||||
}
|
}
|
||||||
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("\n");
|
||||||
|
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", args[1].c_str());
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (cell_help_messages.cell_help.count(args[1])) {
|
else if (cell_help_messages.cell_help.count(args[1])) {
|
||||||
log("%s", cell_help_messages.cell_help.at(args[1]).c_str());
|
log("%s", cell_help_messages.cell_help.at(args[1]).c_str());
|
||||||
|
|
|
@ -36,6 +36,11 @@ struct Pass
|
||||||
|
|
||||||
int call_counter;
|
int call_counter;
|
||||||
int64_t runtime_ns;
|
int64_t runtime_ns;
|
||||||
|
bool experimental_flag = false;
|
||||||
|
|
||||||
|
void experimental() {
|
||||||
|
experimental_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
struct pre_post_exec_state_t {
|
struct pre_post_exec_state_t {
|
||||||
Pass *parent_pass;
|
Pass *parent_pass;
|
||||||
|
|
|
@ -26,7 +26,7 @@ USING_YOSYS_NAMESPACE
|
||||||
PRIVATE_NAMESPACE_BEGIN
|
PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
struct SynthIntelPass : public ScriptPass {
|
struct SynthIntelPass : public ScriptPass {
|
||||||
SynthIntelPass() : ScriptPass("synth_intel", "synthesis for Intel (Altera) FPGAs.") {}
|
SynthIntelPass() : ScriptPass("synth_intel", "synthesis for Intel (Altera) FPGAs.") { experimental(); }
|
||||||
|
|
||||||
void help() YS_OVERRIDE
|
void help() YS_OVERRIDE
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue