diff --git a/PExpr.cc b/PExpr.cc index 36dbce9a1..a48358375 100644 --- a/PExpr.cc +++ b/PExpr.cc @@ -258,11 +258,12 @@ const verireal& PEFNumber::value() const } PEIdent::PEIdent(const pform_name_t&that) -: path_(that) +: path_(that), no_implicit_sig_(false) { } -PEIdent::PEIdent(perm_string s) +PEIdent::PEIdent(perm_string s, bool no_implicit_sig) +: no_implicit_sig_(no_implicit_sig) { path_.push_back(name_component_t(s)); } @@ -273,9 +274,13 @@ PEIdent::~PEIdent() void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type) { - /* We create an implicit wire if this is a simple identifier and - if an identifier of that name has not already been declared in - any enclosing scope. */ + /* We create an implicit wire if: + - this is a simple identifier + - an identifier of that name has not already been declared in + any enclosing scope. + - this is not an implicit named port connection */ + if (no_implicit_sig_) + return; if ((path_.size() == 1) && (path_.front().index.size() == 0)) { perm_string name = path_.front().name; LexicalScope*ss = scope; diff --git a/PExpr.h b/PExpr.h index 2583ec05e..9412de5e7 100644 --- a/PExpr.h +++ b/PExpr.h @@ -255,7 +255,7 @@ class PEFNumber : public PExpr { class PEIdent : public PExpr { public: - explicit PEIdent(perm_string); + explicit PEIdent(perm_string, bool no_implicit_sig=false); explicit PEIdent(const pform_name_t&); ~PEIdent(); @@ -298,6 +298,7 @@ class PEIdent : public PExpr { private: pform_name_t path_; + bool no_implicit_sig_; private: // Common functions to calculate parts of part/bit diff --git a/compiler.h b/compiler.h index d3e6b4c89..92aa8412e 100644 --- a/compiler.h +++ b/compiler.h @@ -123,6 +123,7 @@ enum generation_t { GN_VER2001_NOCONFIG = 2, GN_VER2001 = 3, GN_VER2005 = 4, + GN_VER2009 = 5, GN_DEFAULT = 4 }; @@ -141,9 +142,6 @@ 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 true, then support/elaborate SystemVerilog. */ -extern bool gn_system_verilog_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; @@ -162,7 +160,7 @@ enum { GN_KEYWORDS_1364_1995 = 0x0001, GN_KEYWORDS_1364_2001_CONFIG = 0x0004, GN_KEYWORDS_1364_2005 = 0x0008, GN_KEYWORDS_VAMS_2_3 = 0x0010, - GN_KEYWORDS_1800_2005 = 0x0020, + GN_KEYWORDS_1800_2009 = 0x0020, GN_KEYWORDS_ICARUS = 0x8000 }; extern int lexor_keyword_mask; diff --git a/driver/iverilog.man.in b/driver/iverilog.man.in index d66e14359..a42a89b23 100644 --- a/driver/iverilog.man.in +++ b/driver/iverilog.man.in @@ -6,7 +6,7 @@ iverilog - Icarus Verilog compiler .B iverilog [\-ESVv] [\-Bpath] [\-ccmdfile|\-fcmdfile] [\-Dmacro[=defn]] [\-Pparameter=value] [\-pflag=value] -[\-dname] [\-g1995|\-g2001|\-g2005|\-g] +[\-dname] [\-g1995|\-g2001|\-g2005|-g2009|\-g] [\-Iincludedir] [\-mmodule] [\-M[mode=]file] [\-Nfile] [\-ooutputfilename] [\-stopmodule] [\-ttype] [\-Tmin/typ/max] [\-Wclass] [\-ypath] sourcefile @@ -61,11 +61,11 @@ is the Verilog input, but with file inclusions and macro references expanded and removed. This is useful, for example, to preprocess Verilog source for use by other compilers. .TP 8 -.B -g1995\fI|\fP-g2001\fI|\fP-g2001-noconfig\fI|\fP-g2005 +.B -g1995\fI|\fP-g2001\fI|\fP-g2001-noconfig\fI|\fP-g2005\fI|\fP-g2009 Select the Verilog language \fIgeneration\fP to support in the compiler. This selects between \fIIEEE1364\-1995\fP, -\fIIEEE1364\-2001\fP, or \fIIEEE1364\-2005\fP. Normally, -Icarus Verilog defaults to the latest known generation of the +\fIIEEE1364\-2001\fP, \fIIEEE1364\-2005\fP, or \fIIEEE1800-2009\fP. +Normally, Icarus Verilog defaults to the latest known generation of the language. This flag is most useful to restrict the language to a set supported by tools of specific generations, for compatibility with other tools. @@ -74,10 +74,6 @@ other tools. Enable or disable (default) support for Verilog\-AMS. Very little Verilog\-AMS specific functionality is currently supported. .TP 8 -.B -gsystem-verilog\fI|\fP-gno-system-verilog -Enable or disable (default) support for SystemVerilog. -Very little SystemVerilog specific functionality is currently supported. -.TP 8 .B -gspecify\fI|\fP-gno-specify Enable or disable (default) specify block support. When enabled, specify block code is elaborated. When disabled, specify blocks are diff --git a/driver/main.c b/driver/main.c index 033468a1b..3132a3973 100644 --- a/driver/main.c +++ b/driver/main.c @@ -39,7 +39,7 @@ const char NOTICE[] = const char HELP[] = "Usage: iverilog [-ESvV] [-B base] [-c cmdfile|-f cmdfile]\n" -" [-g1995|-g2001|-g2005] [-g]\n" +" [-g1995|-g2001|-g2005|-g2009] [-g]\n" " [-D macro[=defn]] [-I includedir]\n" " [-M [mode=]depfile] [-m module]\n" " [-N file] [-o filename] [-p flag=value]\n" @@ -119,7 +119,6 @@ const char*gen_icarus = "icarus-misc"; const char*gen_io_range_error = "io-range-error"; const char*gen_strict_ca_eval = "no-strict-ca-eval"; const char*gen_verilog_ams = "no-verilog-ams"; -const char*gen_system_verilog = "no-system-verilog"; /* Boolean: true means use a default include dir, false means don't */ int gen_std_include = 1; @@ -620,6 +619,9 @@ int process_generation(const char*name) else if (strcmp(name,"2005") == 0) generation = "2005"; + else if (strcmp(name,"2009") == 0) + generation = "2009"; + else if (strcmp(name,"1") == 0) { /* Deprecated: use 1995 */ generation = "1995"; gen_xtypes = "no-xtypes"; @@ -683,12 +685,6 @@ int process_generation(const char*name) else if (strcmp(name,"no-verilog-ams") == 0) gen_verilog_ams = "no-verilog-ams"; - else if (strcmp(name,"system-verilog") == 0) - gen_system_verilog = "system-verilog"; - - else if (strcmp(name,"no-system-verilog") == 0) - gen_verilog_ams = "no-system-verilog"; - else { fprintf(stderr, "Unknown/Unsupported Language generation " "%s\n\n", name); @@ -696,17 +692,17 @@ int process_generation(const char*name) fprintf(stderr, " 1995 -- IEEE1364-1995\n" " 2001 -- IEEE1364-2001\n" " 2005 -- IEEE1364-2005\n" + " 2009 -- IEEE1800-2009\n" "Other generation flags:\n" " specify | no-specify\n" " verilog-ams | no-verilog-ams\n" - " system-verilog | no-system-verilog\n" " std-include | no-std-include\n" " relative-include | no-relative-include\n" " xtypes | no-xtypes\n" " icarus-misc | no-icarus-misc\n" " io-range-error | no-io-range-error\n" - " strict-ca-eval | no-strict-ca-eval\n" - " system-verilog\n"); + " strict-ca-eval | no-strict-ca-eval\n"); + return 1; } @@ -1006,9 +1002,10 @@ int main(int argc, char **argv) how to handle them. */ fprintf(iconfig_file, "sys_func:%s%csystem.sft\n", base, sep); - /* If verilog-2005 is enabled or icarus-misc or verilog-ams, + /* If verilog-2005/9 is enabled or icarus-misc or verilog-ams, * then include the v2005_math library. */ if (strcmp(generation, "2005") == 0 || + strcmp(generation, "2009") == 0 || strcmp(gen_icarus, "icarus-misc") == 0 || strcmp(gen_verilog_ams, "verilog-ams") == 0) { fprintf(iconfig_file, "sys_func:%s%cv2005_math.sft\n", base, sep); @@ -1030,7 +1027,6 @@ int main(int argc, char **argv) fprintf(iconfig_file, "generation:%s\n", gen_strict_ca_eval); fprintf(iconfig_file, "generation:%s\n", gen_verilog_ams); fprintf(iconfig_file, "generation:%s\n", gen_icarus); - fprintf(iconfig_file, "generation:%s\n", gen_system_verilog); fprintf(iconfig_file, "warnings:%s\n", warning_flags); fprintf(iconfig_file, "out:%s\n", opath); if (depfile) { diff --git a/lexor.lex b/lexor.lex index 66c99dfa6..737a4daf7 100644 --- a/lexor.lex +++ b/lexor.lex @@ -336,7 +336,7 @@ TU [munpf] /* This rule handles scaled time values for SystemVerilog. */ [0-9][0-9_]*(\.[0-9][0-9_]*)?{TU}?s { - if(gn_system_verilog_flag) { + if(generation_flag & GN_VER2009) { yylval.text = strdupnew(yytext); return TIME_LITERAL; } else REJECT; } @@ -496,6 +496,12 @@ TU [munpf] |GN_KEYWORDS_1364_2001 |GN_KEYWORDS_1364_2001_CONFIG |GN_KEYWORDS_1364_2005; + } else if (strcmp(word,"1800-2009") == 0) { + lexor_keyword_mask = GN_KEYWORDS_1364_1995 + |GN_KEYWORDS_1364_2001 + |GN_KEYWORDS_1364_2001_CONFIG + |GN_KEYWORDS_1364_2005 + |GN_KEYWORDS_1800_2009; } else if (strcmp(word,"VAMS-2.3") == 0) { lexor_keyword_mask = GN_KEYWORDS_1364_1995 |GN_KEYWORDS_1364_2001 diff --git a/lexor_keyword.gperf b/lexor_keyword.gperf index 30cb4e857..b1051d926 100644 --- a/lexor_keyword.gperf +++ b/lexor_keyword.gperf @@ -19,62 +19,62 @@ access, GN_KEYWORDS_VAMS_2_3, K_access acos, GN_KEYWORDS_VAMS_2_3, K_acos acosh, GN_KEYWORDS_VAMS_2_3, K_acosh ac_stim, GN_KEYWORDS_VAMS_2_3, K_ac_stim -alias, GN_KEYWORDS_1800_2005, K_alias +alias, GN_KEYWORDS_1800_2009, K_alias aliasparam, GN_KEYWORDS_VAMS_2_3, K_aliasparam always, GN_KEYWORDS_1364_1995, K_always -always_comb, GN_KEYWORDS_1800_2005, K_always_comb -always_ff, GN_KEYWORDS_1800_2005, K_always_ff -always_latch, GN_KEYWORDS_1800_2005, K_always_latch +always_comb, GN_KEYWORDS_1800_2009, K_always_comb +always_ff, GN_KEYWORDS_1800_2009, K_always_ff +always_latch, GN_KEYWORDS_1800_2009, K_always_latch analog, GN_KEYWORDS_VAMS_2_3, K_analog analysis, GN_KEYWORDS_VAMS_2_3, K_analysis and, GN_KEYWORDS_1364_1995, K_and asin, GN_KEYWORDS_VAMS_2_3, K_asin asinh, GN_KEYWORDS_VAMS_2_3, K_asinh -# This is defined by both SystemVerilog 1800-2005 and Verilog-AMS 2.3 -assert, GN_KEYWORDS_1800_2005|GN_KEYWORDS_VAMS_2_3, K_assert +# This is defined by both SystemVerilog 1800-2009 and Verilog-AMS 2.3 +assert, GN_KEYWORDS_1800_2009|GN_KEYWORDS_VAMS_2_3, K_assert assign, GN_KEYWORDS_1364_1995, K_assign -assume, GN_KEYWORDS_1800_2005, K_assume +assume, GN_KEYWORDS_1800_2009, K_assume atan, GN_KEYWORDS_VAMS_2_3, K_atan atan2, GN_KEYWORDS_VAMS_2_3, K_atan2 atanh, GN_KEYWORDS_VAMS_2_3, K_atanh automatic, GN_KEYWORDS_1364_2001, K_automatic -before, GN_KEYWORDS_1800_2005, K_before +before, GN_KEYWORDS_1800_2009, K_before begin, GN_KEYWORDS_1364_1995, K_begin -bind, GN_KEYWORDS_1800_2005, K_bind -bins, GN_KEYWORDS_1800_2005, K_bins -binsof, GN_KEYWORDS_1800_2005, K_binsof -bit, GN_KEYWORDS_1800_2005, K_bit +bind, GN_KEYWORDS_1800_2009, K_bind +bins, GN_KEYWORDS_1800_2009, K_bins +binsof, GN_KEYWORDS_1800_2009, K_binsof +bit, GN_KEYWORDS_1800_2009, K_bit branch, GN_KEYWORDS_VAMS_2_3, K_branch -break, GN_KEYWORDS_1800_2005, K_break +break, GN_KEYWORDS_1800_2009, K_break bool, GN_KEYWORDS_ICARUS, K_bool buf, GN_KEYWORDS_1364_1995, K_buf bufif0, GN_KEYWORDS_1364_1995, K_bufif0 bufif1, GN_KEYWORDS_1364_1995, K_bufif1 -byte, GN_KEYWORDS_1800_2005, K_byte +byte, GN_KEYWORDS_1800_2009, K_byte case, GN_KEYWORDS_1364_1995, K_case casex, GN_KEYWORDS_1364_1995, K_casex casez, GN_KEYWORDS_1364_1995, K_casez ceil, GN_KEYWORDS_VAMS_2_3, K_ceil cell, GN_KEYWORDS_1364_2001_CONFIG, K_cell -chandle, GN_KEYWORDS_1800_2005, K_chandle -class, GN_KEYWORDS_1800_2005, K_class -clocking, GN_KEYWORDS_1800_2005, K_clocking +chandle, GN_KEYWORDS_1800_2009, K_chandle +class, GN_KEYWORDS_1800_2009, K_class +clocking, GN_KEYWORDS_1800_2009, K_clocking cmos, GN_KEYWORDS_1364_1995, K_cmos config, GN_KEYWORDS_1364_2001_CONFIG, K_config connect, GN_KEYWORDS_VAMS_2_3, K_connect connectmodule, GN_KEYWORDS_VAMS_2_3, K_connectmodule connectrules, GN_KEYWORDS_VAMS_2_3, K_connectrules -const, GN_KEYWORDS_1800_2005, K_const -constraint, GN_KEYWORDS_1800_2005, K_constraint -context, GN_KEYWORDS_1800_2005, K_context -continue, GN_KEYWORDS_1800_2005, K_continue +const, GN_KEYWORDS_1800_2009, K_const +constraint, GN_KEYWORDS_1800_2009, K_constraint +context, GN_KEYWORDS_1800_2009, K_context +continue, GN_KEYWORDS_1800_2009, K_continue continuous, GN_KEYWORDS_VAMS_2_3, K_continuous cos, GN_KEYWORDS_VAMS_2_3, K_cos cosh, GN_KEYWORDS_VAMS_2_3, K_cosh -cover, GN_KEYWORDS_1800_2005, K_cover -covergroup, GN_KEYWORDS_1800_2005, K_covergroup -coverpoint, GN_KEYWORDS_1800_2005, K_coverpoint -cross, GN_KEYWORDS_1800_2005, K_cross +cover, GN_KEYWORDS_1800_2009, K_cover +covergroup, GN_KEYWORDS_1800_2009, K_covergroup +coverpoint, GN_KEYWORDS_1800_2009, K_coverpoint +cross, GN_KEYWORDS_1800_2009, K_cross ddt, GN_KEYWORDS_VAMS_2_3, K_ddt ddt_nature, GN_KEYWORDS_VAMS_2_3, K_ddt_nature ddx, GN_KEYWORDS_VAMS_2_3, K_ddx @@ -85,8 +85,8 @@ design, GN_KEYWORDS_1364_2001_CONFIG, K_design disable, GN_KEYWORDS_1364_1995, K_disable discipline, GN_KEYWORDS_VAMS_2_3, K_discipline discrete, GN_KEYWORDS_VAMS_2_3, K_discrete -dist, GN_KEYWORDS_1800_2005, K_dist -do, GN_KEYWORDS_1800_2005, K_do +dist, GN_KEYWORDS_1800_2009, K_dist +do, GN_KEYWORDS_1800_2009, K_do domain, GN_KEYWORDS_VAMS_2_3, K_domain driver_update, GN_KEYWORDS_VAMS_2_3, K_driver_update edge, GN_KEYWORDS_1364_1995, K_edge @@ -94,45 +94,45 @@ else, GN_KEYWORDS_1364_1995, K_else end, GN_KEYWORDS_1364_1995, K_end endcase, GN_KEYWORDS_1364_1995, K_endcase endconfig, GN_KEYWORDS_1364_2001_CONFIG, K_endconfig -endclass, GN_KEYWORDS_1800_2005, K_endclass -endclocking, GN_KEYWORDS_1800_2005, K_endclocking +endclass, GN_KEYWORDS_1800_2009, K_endclass +endclocking, GN_KEYWORDS_1800_2009, K_endclocking endconnectrules, GN_KEYWORDS_VAMS_2_3, K_endconnectrules enddiscipline, GN_KEYWORDS_VAMS_2_3, K_enddiscipline endfunction, GN_KEYWORDS_1364_1995, K_endfunction endgenerate, GN_KEYWORDS_1364_2001, K_endgenerate -endgroup, GN_KEYWORDS_1800_2005, K_endgroup -endinterface, GN_KEYWORDS_1800_2005, K_endinterface +endgroup, GN_KEYWORDS_1800_2009, K_endgroup +endinterface, GN_KEYWORDS_1800_2009, K_endinterface endmodule, GN_KEYWORDS_1364_1995, K_endmodule endnature, GN_KEYWORDS_VAMS_2_3, K_endnature -endpackage, GN_KEYWORDS_1800_2005, K_endpackage +endpackage, GN_KEYWORDS_1800_2009, K_endpackage endparamset, GN_KEYWORDS_VAMS_2_3, K_endparamset endprimitive, GN_KEYWORDS_1364_1995, K_endprimitive -endprogram, GN_KEYWORDS_1800_2005, K_endprogram -endproperty, GN_KEYWORDS_1800_2005, K_endproperty +endprogram, GN_KEYWORDS_1800_2009, K_endprogram +endproperty, GN_KEYWORDS_1800_2009, K_endproperty endspecify, GN_KEYWORDS_1364_1995, K_endspecify -endsequence, GN_KEYWORDS_1800_2005, K_endsequence +endsequence, GN_KEYWORDS_1800_2009, K_endsequence endtable, GN_KEYWORDS_1364_1995, K_endtable endtask, GN_KEYWORDS_1364_1995, K_endtask -enum, GN_KEYWORDS_1800_2005, K_enum +enum, GN_KEYWORDS_1800_2009, K_enum event, GN_KEYWORDS_1364_1995, K_event exclude, GN_KEYWORDS_VAMS_2_3, K_exclude exp, GN_KEYWORDS_VAMS_2_3, K_exp -expect, GN_KEYWORDS_1800_2005, K_expect -export, GN_KEYWORDS_1800_2005, K_export -extends, GN_KEYWORDS_1800_2005, K_extends -extern, GN_KEYWORDS_1800_2005, K_extern -final, GN_KEYWORDS_1800_2005, K_final +expect, GN_KEYWORDS_1800_2009, K_expect +export, GN_KEYWORDS_1800_2009, K_export +extends, GN_KEYWORDS_1800_2009, K_extends +extern, GN_KEYWORDS_1800_2009, K_extern +final, GN_KEYWORDS_1800_2009, K_final final_step, GN_KEYWORDS_VAMS_2_3, K_final_step -first_match, GN_KEYWORDS_1800_2005, K_first_match +first_match, GN_KEYWORDS_1800_2009, K_first_match flicker_noise, GN_KEYWORDS_VAMS_2_3, K_flicker_noise floor, GN_KEYWORDS_VAMS_2_3, K_floor flow, GN_KEYWORDS_VAMS_2_3, K_flow for, GN_KEYWORDS_1364_1995, K_for -foreach, GN_KEYWORDS_1800_2005, K_foreach +foreach, GN_KEYWORDS_1800_2009, K_foreach force, GN_KEYWORDS_1364_1995, K_force forever, GN_KEYWORDS_1364_1995, K_forever fork, GN_KEYWORDS_1364_1995, K_fork -forkjoin, GN_KEYWORDS_1800_2005, K_forkjoin +forkjoin, GN_KEYWORDS_1800_2009, K_forkjoin from, GN_KEYWORDS_VAMS_2_3, K_from function, GN_KEYWORDS_1364_1995, K_function generate, GN_KEYWORDS_1364_2001, K_generate @@ -145,11 +145,11 @@ idt, GN_KEYWORDS_VAMS_2_3, K_idt idtmod, GN_KEYWORDS_VAMS_2_3, K_idtmod idt_nature, GN_KEYWORDS_VAMS_2_3, K_idt_nature if, GN_KEYWORDS_1364_1995, K_if -iff, GN_KEYWORDS_1800_2005, K_iff +iff, GN_KEYWORDS_1800_2009, K_iff ifnone, GN_KEYWORDS_1364_1995, K_ifnone -ignore_bins, GN_KEYWORDS_1800_2005, K_ignore_bins -illegal_bins, GN_KEYWORDS_1800_2005, K_illegal_bins -import, GN_KEYWORDS_1800_2005, K_import +ignore_bins, GN_KEYWORDS_1800_2009, K_ignore_bins +illegal_bins, GN_KEYWORDS_1800_2009, K_illegal_bins +import, GN_KEYWORDS_1800_2009, K_import incdir, GN_KEYWORDS_1364_2001_CONFIG, K_incdir include, GN_KEYWORDS_1364_2001_CONFIG, K_include inf, GN_KEYWORDS_VAMS_2_3, K_inf @@ -157,15 +157,15 @@ initial, GN_KEYWORDS_1364_1995, K_initial initial_step, GN_KEYWORDS_VAMS_2_3, K_initial_step inout, GN_KEYWORDS_1364_1995, K_inout input, GN_KEYWORDS_1364_1995, K_input -inside, GN_KEYWORDS_1800_2005, K_inside +inside, GN_KEYWORDS_1800_2009, K_inside instance, GN_KEYWORDS_1364_2001_CONFIG, K_instance -int, GN_KEYWORDS_1800_2005, K_int +int, GN_KEYWORDS_1800_2009, K_int integer, GN_KEYWORDS_1364_1995, K_integer -interface, GN_KEYWORDS_1800_2005, K_interface -intersect, GN_KEYWORDS_1800_2005, K_intersect +interface, GN_KEYWORDS_1800_2009, K_interface +intersect, GN_KEYWORDS_1800_2009, K_intersect join, GN_KEYWORDS_1364_1995, K_join -join_any, GN_KEYWORDS_1800_2005, K_join_any -join_none, GN_KEYWORDS_1800_2005, K_join_none +join_any, GN_KEYWORDS_1800_2009, K_join_any +join_none, GN_KEYWORDS_1800_2009, K_join_none laplace_nd, GN_KEYWORDS_VAMS_2_3, K_laplace_nd laplace_np, GN_KEYWORDS_VAMS_2_3, K_laplace_np laplace_zd, GN_KEYWORDS_VAMS_2_3, K_laplace_zd @@ -176,25 +176,25 @@ liblist, GN_KEYWORDS_1364_2001_CONFIG, K_liblist library, GN_KEYWORDS_1364_2001_CONFIG, K_library limexp, GN_KEYWORDS_VAMS_2_3, K_limexp ln, GN_KEYWORDS_VAMS_2_3, K_ln -local, GN_KEYWORDS_1800_2005, K_local +local, GN_KEYWORDS_1800_2009, K_local localparam, GN_KEYWORDS_1364_2001, K_localparam log, GN_KEYWORDS_VAMS_2_3, K_log -# This is defined by SystemVerilog 1800-2005 and as an Icarus extension. -logic, GN_KEYWORDS_1800_2005|GN_KEYWORDS_ICARUS, K_logic -longint, GN_KEYWORDS_1800_2005, K_longint +# This is defined by SystemVerilog 1800-2009 and as an Icarus extension. +logic, GN_KEYWORDS_1800_2009|GN_KEYWORDS_ICARUS, K_logic +longint, GN_KEYWORDS_1800_2009, K_longint macromodule, GN_KEYWORDS_1364_1995, K_macromodule -matches, GN_KEYWORDS_1800_2005, K_matches +matches, GN_KEYWORDS_1800_2009, K_matches max, GN_KEYWORDS_VAMS_2_3, K_max medium, GN_KEYWORDS_1364_1995, K_medium merged, GN_KEYWORDS_VAMS_2_3, K_merged min, GN_KEYWORDS_VAMS_2_3, K_min -modport, GN_KEYWORDS_1800_2005, K_modport +modport, GN_KEYWORDS_1800_2009, K_modport module, GN_KEYWORDS_1364_1995, K_module nand, GN_KEYWORDS_1364_1995, K_nand nature, GN_KEYWORDS_VAMS_2_3, K_nature negedge, GN_KEYWORDS_1364_1995, K_negedge net_resolution, GN_KEYWORDS_VAMS_2_3, K_net_resolution -new, GN_KEYWORDS_1800_2005, K_new +new, GN_KEYWORDS_1800_2009, K_new nmos, GN_KEYWORDS_1364_1995, K_nmos noise_table, GN_KEYWORDS_VAMS_2_3, K_noise_table nor, GN_KEYWORDS_1364_1995, K_nor @@ -202,11 +202,11 @@ noshowcancelled, GN_KEYWORDS_1364_2001, K_noshowcancelled not, GN_KEYWORDS_1364_1995, K_not notif0, GN_KEYWORDS_1364_1995, K_notif0 notif1, GN_KEYWORDS_1364_1995, K_notif1 -null, GN_KEYWORDS_1800_2005, K_null +null, GN_KEYWORDS_1800_2009, K_null or, GN_KEYWORDS_1364_1995, K_or output, GN_KEYWORDS_1364_1995, K_output -package, GN_KEYWORDS_1800_2005, K_package -packed, GN_KEYWORDS_1800_2005, K_packed +package, GN_KEYWORDS_1800_2009, K_package +packed, GN_KEYWORDS_1800_2009, K_packed parameter, GN_KEYWORDS_1364_1995, K_parameter paramset, GN_KEYWORDS_VAMS_2_3, K_paramset pmos, GN_KEYWORDS_1364_1995, K_pmos @@ -214,70 +214,70 @@ posedge, GN_KEYWORDS_1364_1995, K_posedge potential, GN_KEYWORDS_VAMS_2_3, K_potential pow, GN_KEYWORDS_VAMS_2_3, K_pow primitive, GN_KEYWORDS_1364_1995, K_primitive -priority, GN_KEYWORDS_1800_2005, K_priority -program, GN_KEYWORDS_1800_2005, K_program -property, GN_KEYWORDS_1800_2005, K_property -protected, GN_KEYWORDS_1800_2005, K_protected +priority, GN_KEYWORDS_1800_2009, K_priority +program, GN_KEYWORDS_1800_2009, K_program +property, GN_KEYWORDS_1800_2009, K_property +protected, GN_KEYWORDS_1800_2009, K_protected pull0, GN_KEYWORDS_1364_1995, K_pull0 pull1, GN_KEYWORDS_1364_1995, K_pull1 pulldown, GN_KEYWORDS_1364_1995, K_pulldown pullup, GN_KEYWORDS_1364_1995, K_pullup pulsestyle_onevent, GN_KEYWORDS_1364_2001, K_pulsestyle_onevent pulsestyle_ondetect, GN_KEYWORDS_1364_2001, K_pulsestyle_ondetect -pure, GN_KEYWORDS_1800_2005, K_pure -rand, GN_KEYWORDS_1800_2005, K_rand -randc, GN_KEYWORDS_1800_2005, K_randc -randcase, GN_KEYWORDS_1800_2005, K_randcase -randsequence, GN_KEYWORDS_1800_2005, K_randsequence +pure, GN_KEYWORDS_1800_2009, K_pure +rand, GN_KEYWORDS_1800_2009, K_rand +randc, GN_KEYWORDS_1800_2009, K_randc +randcase, GN_KEYWORDS_1800_2009, K_randcase +randsequence, GN_KEYWORDS_1800_2009, K_randsequence rcmos, GN_KEYWORDS_1364_1995, K_rcmos real, GN_KEYWORDS_1364_1995, K_real realtime, GN_KEYWORDS_1364_1995, K_realtime -ref, GN_KEYWORDS_1800_2005, K_ref +ref, GN_KEYWORDS_1800_2009, K_ref reg, GN_KEYWORDS_1364_1995, K_reg release, GN_KEYWORDS_1364_1995, K_release repeat, GN_KEYWORDS_1364_1995, K_repeat resolveto, GN_KEYWORDS_VAMS_2_3, K_resolveto -return, GN_KEYWORDS_1800_2005, K_return +return, GN_KEYWORDS_1800_2009, K_return rnmos, GN_KEYWORDS_1364_1995, K_rnmos rpmos, GN_KEYWORDS_1364_1995, K_rpmos rtran, GN_KEYWORDS_1364_1995, K_rtran rtranif0, GN_KEYWORDS_1364_1995, K_rtranif0 rtranif1, GN_KEYWORDS_1364_1995, K_rtranif1 scalared, GN_KEYWORDS_1364_1995, K_scalared -sequence, GN_KEYWORDS_1800_2005, K_sequence -shortint, GN_KEYWORDS_1800_2005, K_shortint -shortreal, GN_KEYWORDS_1800_2005, K_shortreal +sequence, GN_KEYWORDS_1800_2009, K_sequence +shortint, GN_KEYWORDS_1800_2009, K_shortint +shortreal, GN_KEYWORDS_1800_2009, K_shortreal showcancelled, GN_KEYWORDS_1364_2001, K_showcancelled signed, GN_KEYWORDS_1364_2001, K_signed sin, GN_KEYWORDS_VAMS_2_3, K_sin sinh, GN_KEYWORDS_VAMS_2_3, K_sinh slew, GN_KEYWORDS_VAMS_2_3, K_slew small, GN_KEYWORDS_1364_1995, K_small -solve, GN_KEYWORDS_1800_2005, K_solve +solve, GN_KEYWORDS_1800_2009, K_solve specify, GN_KEYWORDS_1364_1995, K_specify specparam, GN_KEYWORDS_1364_1995, K_specparam split, GN_KEYWORDS_VAMS_2_3, K_split sqrt, GN_KEYWORDS_VAMS_2_3, K_sqrt -static, GN_KEYWORDS_1800_2005, K_static -# This is defined by both SystemVerilog 1800-2005 and Verilog-AMS 2.3 -string, GN_KEYWORDS_1800_2005|GN_KEYWORDS_VAMS_2_3, K_string +static, GN_KEYWORDS_1800_2009, K_static +# This is defined by both SystemVerilog 1800-2009 and Verilog-AMS 2.3 +string, GN_KEYWORDS_1800_2009|GN_KEYWORDS_VAMS_2_3, K_string strong0, GN_KEYWORDS_1364_1995, K_strong0 strong1, GN_KEYWORDS_1364_1995, K_strong1 -struct, GN_KEYWORDS_1800_2005, K_struct -super, GN_KEYWORDS_1800_2005, K_super +struct, GN_KEYWORDS_1800_2009, K_struct +super, GN_KEYWORDS_1800_2009, K_super supply0, GN_KEYWORDS_1364_1995, K_supply0 supply1, GN_KEYWORDS_1364_1995, K_supply1 table, GN_KEYWORDS_1364_1995, K_table -tagged, GN_KEYWORDS_1800_2005, K_tagged +tagged, GN_KEYWORDS_1800_2009, K_tagged tan, GN_KEYWORDS_VAMS_2_3, K_tan tanh, GN_KEYWORDS_VAMS_2_3, K_tanh task, GN_KEYWORDS_1364_1995, K_task -this, GN_KEYWORDS_1800_2005, K_this -throughout, GN_KEYWORDS_1800_2005, K_throughout +this, GN_KEYWORDS_1800_2009, K_this +throughout, GN_KEYWORDS_1800_2009, K_throughout time, GN_KEYWORDS_1364_1995, K_time -timeprecision, GN_KEYWORDS_1800_2005, K_timeprecision +timeprecision, GN_KEYWORDS_1800_2009, K_timeprecision timer, GN_KEYWORDS_VAMS_2_3, K_timer -timeunit, GN_KEYWORDS_1800_2005, K_timeunit +timeunit, GN_KEYWORDS_1800_2009, K_timeunit tran, GN_KEYWORDS_1364_1995, K_tran tranif0, GN_KEYWORDS_1364_1995, K_tranif0 tranif1, GN_KEYWORDS_1364_1995, K_tranif1 @@ -288,30 +288,30 @@ tri1, GN_KEYWORDS_1364_1995, K_tri1 triand, GN_KEYWORDS_1364_1995, K_triand trior, GN_KEYWORDS_1364_1995, K_trior trireg, GN_KEYWORDS_1364_1995, K_trireg -type, GN_KEYWORDS_1800_2005, K_type -typedef, GN_KEYWORDS_1800_2005, K_typedef -union, GN_KEYWORDS_1800_2005, K_union -unique, GN_KEYWORDS_1800_2005, K_unique +type, GN_KEYWORDS_1800_2009, K_type +typedef, GN_KEYWORDS_1800_2009, K_typedef +union, GN_KEYWORDS_1800_2009, K_union +unique, GN_KEYWORDS_1800_2009, K_unique units, GN_KEYWORDS_VAMS_2_3, K_units # Reserved for future use! unsigned, GN_KEYWORDS_1364_2001, K_unsigned use, GN_KEYWORDS_1364_2001_CONFIG, K_use uwire, GN_KEYWORDS_1364_2005, K_uwire -var, GN_KEYWORDS_1800_2005, K_var +var, GN_KEYWORDS_1800_2009, K_var vectored, GN_KEYWORDS_1364_1995, K_vectored -virtual, GN_KEYWORDS_1800_2005, K_virtual -void, GN_KEYWORDS_1800_2005, K_void +virtual, GN_KEYWORDS_1800_2009, K_virtual +void, GN_KEYWORDS_1800_2009, K_void wait, GN_KEYWORDS_1364_1995, K_wait -wait_order, GN_KEYWORDS_1800_2005, K_wait_order +wait_order, GN_KEYWORDS_1800_2009, K_wait_order wand, GN_KEYWORDS_1364_1995, K_wand weak0, GN_KEYWORDS_1364_1995, K_weak0 weak1, GN_KEYWORDS_1364_1995, K_weak1 while, GN_KEYWORDS_1364_1995, K_while white_noise, GN_KEYWORDS_VAMS_2_3, K_white_noise -wildcard, GN_KEYWORDS_1800_2005, K_wildcard +wildcard, GN_KEYWORDS_1800_2009, K_wildcard wire, GN_KEYWORDS_1364_1995, K_wire -with, GN_KEYWORDS_1800_2005, K_with -within, GN_KEYWORDS_1800_2005, K_within +with, GN_KEYWORDS_1800_2009, K_with +within, GN_KEYWORDS_1800_2009, K_within # This is the name originally proposed for uwire and is deprecated! wone, GN_KEYWORDS_1364_2005, K_wone wor, GN_KEYWORDS_1364_1995, K_wor diff --git a/main.cc b/main.cc index 0bd0fbd56..c4d44fb0f 100644 --- a/main.cc +++ b/main.cc @@ -106,7 +106,6 @@ bool gn_specify_blocks_flag = true; bool gn_io_range_error_flag = true; bool gn_strict_ca_eval_flag = false; bool gn_verilog_ams_flag = false; -bool gn_system_verilog_flag = false; map flags; char*vpi_module_list = 0; @@ -247,6 +246,9 @@ static void process_generation_flag(const char*gen) } else if (strcmp(gen,"2005") == 0) { generation_flag = GN_VER2005; + } else if (strcmp(gen,"2009") == 0) { + generation_flag = GN_VER2009; + } else if (strcmp(gen,"icarus-misc") == 0) { gn_icarus_misc_flag = true; @@ -283,9 +285,6 @@ static void process_generation_flag(const char*gen) } else if (strcmp(gen,"no-strict-ca-eval") == 0) { gn_strict_ca_eval_flag = false; - } else if (strcmp(gen,"system-verilog") == 0) { - gn_system_verilog_flag = true; - } else { } } @@ -853,29 +852,21 @@ int main(int argc, char*argv[]) lexor_keyword_mask = 0; switch (generation_flag) { - case GN_VER1995: - lexor_keyword_mask |= GN_KEYWORDS_1364_1995; - break; + case GN_VER2009: + lexor_keyword_mask |= GN_KEYWORDS_1800_2009; + case GN_VER2005: + lexor_keyword_mask |= GN_KEYWORDS_1364_2005; case GN_VER2001: lexor_keyword_mask |= GN_KEYWORDS_1364_2001_CONFIG; case GN_VER2001_NOCONFIG: - lexor_keyword_mask |= GN_KEYWORDS_1364_1995; lexor_keyword_mask |= GN_KEYWORDS_1364_2001; - break; - case GN_VER2005: + case GN_VER1995: lexor_keyword_mask |= GN_KEYWORDS_1364_1995; - lexor_keyword_mask |= GN_KEYWORDS_1364_2001; - lexor_keyword_mask |= GN_KEYWORDS_1364_2001_CONFIG; - lexor_keyword_mask |= GN_KEYWORDS_1364_2005; - break; } if (gn_cadence_types_flag) lexor_keyword_mask |= GN_KEYWORDS_ICARUS; - if (gn_system_verilog_flag) - lexor_keyword_mask |= GN_KEYWORDS_1800_2005; - if (gn_verilog_ams_flag) lexor_keyword_mask |= GN_KEYWORDS_VAMS_2_3; @@ -897,6 +888,9 @@ int main(int argc, char*argv[]) case GN_VER2005: cout << "IEEE1364-2005"; break; + case GN_VER2009: + cout << "IEEE1800-2009"; + break; } if (gn_verilog_ams_flag) diff --git a/parse.y b/parse.y index 896bdf65d..cf81e608f 100644 --- a/parse.y +++ b/parse.y @@ -278,7 +278,7 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2) /* The new tokens from 1364-2005. */ %token K_wone K_uwire - /* The new tokens from 1800-2005. */ + /* The new tokens from 1800-2009. */ %token K_alias K_always_comb K_always_ff K_always_latch K_assert %token K_assume K_before K_bind K_bins K_binsof K_bit K_break K_byte %token K_chandle K_class K_clocking K_const K_constraint K_context @@ -3101,6 +3101,14 @@ port_name delete[]$2; $$ = tmp; } + | '.' IDENTIFIER + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($2); + tmp->parm = new PEIdent(lex_strings.make($2), true); + FILE_NAME(tmp->parm, @1); + delete[]$2; + $$ = tmp; + } ; port_name_list diff --git a/pform.cc b/pform.cc index 88462bbd3..9340c9a05 100644 --- a/pform.cc +++ b/pform.cc @@ -709,7 +709,7 @@ void pform_startmodule(const char*name, const char*file, unsigned lineno, void pform_check_timeunit_prec() { assert(pform_cur_module); - if (gn_system_verilog_flag && (pform_cur_module->time_unit < + if ((generation_flag & GN_VER2009) && (pform_cur_module->time_unit < pform_cur_module->time_precision)) { VLerror("error: a timeprecision is missing or is too " "large!"); diff --git a/vpi/sdf_lexor.lex b/vpi/sdf_lexor.lex index a653ff53c..c4b03d3fe 100644 --- a/vpi/sdf_lexor.lex +++ b/vpi/sdf_lexor.lex @@ -5,7 +5,7 @@ %{ /* - * Copyright (c) 2007-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -73,6 +73,12 @@ static int yywrap(void) [pP][oO][sS][eE][dD][gG][eE] {return K_POSEDGE; } [nN][eE][gG][eE][dD][gG][eE] {return K_NEGEDGE; } + /* Integer values */ +[0-9]+ { + yylval.int_val = strtoul(yytext, 0, 10); + return INTEGER; +} + /* Real values */ [0-9]+(\.[0-9]+)?([Ee][+-]?[0-9]+)? { yylval.real_val = strtod(yytext, 0); diff --git a/vpi/sdf_parse.y b/vpi/sdf_parse.y index f432ed9e6..cf2796ec5 100644 --- a/vpi/sdf_parse.y +++ b/vpi/sdf_parse.y @@ -1,7 +1,7 @@ %{ /* - * Copyright (c) 1998-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -58,7 +58,7 @@ char sdf_use_hchar = '.'; %type celltype %type cell_instance %type hierarchical_identifier -%type port port_instance +%type port port_instance port_interconnect %type rtriple signed_real_number %type delval rvalue @@ -173,6 +173,11 @@ time_scale sdf_parse_path, @2.first_line, $3, $4); free($4); } + | '(' K_TIMESCALE INTEGER IDENTIFIER ')' + { if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: TIMESCALE : %lu%s\n", + sdf_parse_path, @2.first_line, $3, $4); + free($4); + } ; cell_list @@ -254,7 +259,8 @@ del_def | '(' K_IOPATH error ')' { vpi_printf("%s:%d: SDF ERROR: Invalid/malformed IOPATH\n", sdf_parse_path, @2.first_line); } - | '(' K_INTERCONNECT port_instance port_instance delval_list ')' + /* | '(' K_INTERCONNECT port_instance port_instance delval_list ')' */ + | '(' K_INTERCONNECT port_interconnect port_interconnect delval_list ')' { if (sdf_flag_warning) vpi_printf("%s:%d: SDF WARNING: " "INTERCONNECT not supported.\n", sdf_parse_path, @2.first_line); @@ -301,6 +307,14 @@ port /* | hierarchical_identifier '[' INTEGER ']' */ ; + /* Since INTERCONNECT is ignored we can also ignore a vector bit. */ +port_interconnect + : hierarchical_identifier + { $$ = $1; } + | hierarchical_identifier '[' INTEGER ']' + { $$ = $1;} + ; + port_edge : '(' {start_edge_id();} edge_identifier {stop_edge_id();} port_instance ')' { $$.vpi_edge = $3; $$.string_val = $5; } @@ -384,6 +398,9 @@ signed_real_number : REAL_NUMBER { $$ = $1; } | '+' REAL_NUMBER { $$ = $2; } | '-' REAL_NUMBER { $$ = -$2; } + | INTEGER { $$ = $1; } + | '+' INTEGER { $$ = $2; } + | '-' INTEGER { $$ = -$2; } ; %% diff --git a/vpi/sys_display.c b/vpi/sys_display.c index d463f0781..77f22487d 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1850,6 +1850,109 @@ static PLI_INT32 sys_printtimescale_calltf(PLI_BYTE8*xx) return 0; } +static PLI_INT32 sys_fatal_compiletf(PLI_BYTE8*name) +{ + vpiHandle callh = vpi_handle(vpiSysTfCall, 0); + vpiHandle argv = vpi_iterate(vpiArgument, callh); + + if (argv) { + vpiHandle arg; + s_vpi_value val; + + /* Check that finish_number is numeric */ + arg = vpi_scan(argv); + if (! is_numeric_obj(arg)) { + vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), + (int)vpi_get(vpiLineNo, callh)); + vpi_printf("%s's first argument must be numeric\n", name); + vpi_control(vpiFinish, 1); + return 0; + } + + /* Check that it is 0, 1, or 2 */ + val.format = vpiIntVal; + vpi_get_value(arg, &val); + if ((val.value.integer < 0) || (val.value.integer > 2)) { + vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), + (int)vpi_get(vpiLineNo, callh)); + vpi_printf("%s's finish_number must be 0, 1, or 2\n", name); + vpi_control(vpiFinish, 1); + } + } + if (sys_check_args(callh, argv, name, 0, 0)) vpi_control(vpiFinish, 1); + return 0; +} + +static PLI_INT32 sys_severity_calltf(PLI_BYTE8*name) +{ + vpiHandle callh, argv, scope; + struct strobe_cb_info info; + struct t_vpi_time now; + PLI_UINT64 now64; + char *sstr, *t, *dstr; + unsigned int size, location=0; + s_vpi_value finish_number; + + + callh = vpi_handle(vpiSysTfCall, 0); + argv = vpi_iterate(vpiArgument, callh); + + if (strncmp(name,"$fatal",6) == 0) { + vpiHandle arg = vpi_scan(argv); + finish_number.format = vpiIntVal; + vpi_get_value(arg, &finish_number); + } + + /* convert name to upper and drop $ to get severity string */ + sstr = strdup(name) + 1; + t = sstr; + while (*t) *t++ = toupper(*t); + + scope = vpi_handle(vpiScope, callh); + assert(scope); + info.name = name; + info.filename = strdup(vpi_get_str(vpiFile, callh)); + info.lineno = (int)vpi_get(vpiLineNo, callh); + info.default_format = vpiDecStrVal; + info.scope = scope; + array_from_iterator(&info, argv); + + vpi_printf("%s: %s:%d: ", sstr, info.filename, info.lineno); + + dstr = get_display(&size, &info); + while (location < size) { + if (dstr[location] == '\0') { + my_mcd_printf(1, "%c", '\0'); + location += 1; + } else { + my_mcd_printf(1, "%s", &dstr[location]); + location += strlen(&dstr[location]); + } + } + + /* Now blank sstr out for equivalent spacing */ + t = sstr; + while (*t) *t++ = ' '; + + now.type = vpiSimTime; + vpi_get_time(0, &now); + now64 = timerec_to_time64(&now); + + vpi_printf("\n%s Time: %" PLI_UINT64_FMT " Scope: %s\n", + sstr, now64, vpi_get_str(vpiFullName, scope)); + + free(--sstr); + free(info.filename); + free(info.items); + free(dstr); + + if (strncmp(name,"$fatal",6) == 0) + vpi_control(vpiFinish, finish_number.value.integer); + + return 0; +} + + static PLI_INT32 sys_end_of_simulation(p_cb_data cb_data) { free(monitor_callbacks); @@ -2175,6 +2278,39 @@ void sys_display_register() tf_data.user_data = "$printtimescale"; vpi_register_systf(&tf_data); + /*============================ severity tasks */ + tf_data.type = vpiSysTask; + tf_data.tfname = "$fatal"; + tf_data.calltf = sys_severity_calltf; + tf_data.compiletf = sys_fatal_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$fatal"; + vpi_register_systf(&tf_data); + + tf_data.type = vpiSysTask; + tf_data.tfname = "$error"; + tf_data.calltf = sys_severity_calltf; + tf_data.compiletf = sys_display_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$error"; + vpi_register_systf(&tf_data); + + tf_data.type = vpiSysTask; + tf_data.tfname = "$warning"; + tf_data.calltf = sys_severity_calltf; + tf_data.compiletf = sys_display_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$warning"; + vpi_register_systf(&tf_data); + + tf_data.type = vpiSysTask; + tf_data.tfname = "$info"; + tf_data.calltf = sys_severity_calltf; + tf_data.compiletf = sys_display_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$info"; + vpi_register_systf(&tf_data); + cb_data.reason = cbEndOfCompile; cb_data.time = 0; cb_data.cb_rtn = sys_end_of_compile;