diff --git a/compiler.h b/compiler.h index 389de3d3b..66adf8865 100644 --- a/compiler.h +++ b/compiler.h @@ -116,6 +116,10 @@ inline bool gn_cadence_types_enabled() is false, then skip elaboration of specify behavior. */ extern bool gn_specify_blocks_flag; + +/* If this flag is true, then support/elaborate Verilog-AMS. */ +extern bool gn_verilog_ams_flag; + /* If this flag is false a warning is printed when the port declaration is scalar and the net/register definition is vectored. */ extern bool gn_io_range_error_flag; @@ -128,6 +132,7 @@ enum { GN_KEYWORDS_1364_1995 = 0x0001, GN_KEYWORDS_1364_2001 = 0x0002, GN_KEYWORDS_1364_2001_CONFIG = 0x0004, GN_KEYWORDS_1364_2005 = 0x0008, + GN_KEYWORDS_VAMS_2_3 = 0x0010, GN_KEYWORDS_ICARUS = 0x8000 }; extern int lexor_keyword_mask; diff --git a/driver/main.c b/driver/main.c index e7f54b592..14cc7e6fc 100644 --- a/driver/main.c +++ b/driver/main.c @@ -110,6 +110,7 @@ const char*generation = "2x"; const char*gen_specify = "specify"; const char*gen_xtypes = "xtypes"; const char*gen_io_range_error = "io-range-error"; +const char*gen_verilog_ams = "no-verilog-ams"; /* Boolean: true means use a default include dir, false means don't */ int gen_std_include = 1; @@ -463,6 +464,12 @@ int process_generation(const char*name) else if (strcmp(name,"no-io-range-error") == 0) gen_io_range_error = "no-io-range-error"; + else if (strcmp(name,"verilog-ams") == 0) + gen_verilog_ams = "verilog_ams"; + + else if (strcmp(name,"no-verilog-ams") == 0) + gen_verilog_ams = "no-verilog-ams"; + else { fprintf(stderr, "Unknown/Unsupported Language generation " "%s\n\n", name); diff --git a/lexor.lex b/lexor.lex index 2dc72347c..87dffe885 100644 --- a/lexor.lex +++ b/lexor.lex @@ -346,6 +346,12 @@ W [ \t\b\f\r]+ |GN_KEYWORDS_1364_2001 |GN_KEYWORDS_1364_2001_CONFIG |GN_KEYWORDS_1364_2005; + } else if (strcmp(word,"VAMS-2.3") == 0) { + lexor_keyword_mask = GN_KEYWORDS_1364_1995 + |GN_KEYWORDS_1364_2001 + |GN_KEYWORDS_1364_2001_CONFIG + |GN_KEYWORDS_1364_2005 + |GN_KEYWORDS_VAMS_2_3; } else { fprintf(stderr, "%s:%d: Ignoring unknown keywords string: %s\n", yylloc.text, yylloc.first_line, word); diff --git a/main.cc b/main.cc index 9d7dc91ea..7c42367ad 100644 --- a/main.cc +++ b/main.cc @@ -88,6 +88,7 @@ generation_t generation_flag = GN_DEFAULT; bool gn_cadence_types_flag = true; bool gn_specify_blocks_flag = true; bool gn_io_range_error_flag = true; +bool gn_verilog_ams_flag = false; map flags; char*vpi_module_list = 0; @@ -218,6 +219,12 @@ static void process_generation_flag(const char*gen) } else if (strcmp(gen,"no-specify") == 0) { gn_specify_blocks_flag = false; + } else if (strcmp(gen,"verilog-ams") == 0) { + gn_verilog_ams_flag = true; + + } else if (strcmp(gen,"no-verilog-ams") == 0) { + gn_verilog_ams_flag = false; + } else if (strcmp(gen,"io-range-error") == 0) { gn_io_range_error_flag = true; @@ -611,7 +618,10 @@ int main(int argc, char*argv[]) } if (gn_cadence_types_enabled()) - lexor_keyword_mask |= GN_KEYWORDS_ICARUS; + lexor_keyword_mask |= GN_KEYWORDS_ICARUS; + + if (gn_verilog_ams_flag) + lexor_keyword_mask |= GN_KEYWORDS_VAMS_2_3; if (verbose_flag) { if (times_flag) @@ -630,6 +640,9 @@ int main(int argc, char*argv[]) break; } + if (gn_verilog_ams_flag) + cout << ",verilog-ams"; + if (gn_specify_blocks_flag) cout << ",specify"; else