diff --git a/parse.y b/parse.y index 54a478cb1..47dd01550 100644 --- a/parse.y +++ b/parse.y @@ -343,7 +343,7 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2) %type range range_opt %type dimensions_opt dimensions %type net_type var_type net_type_opt -%type gatetype +%type gatetype switchtype %type port_type %type primitive_type primitive_type_opt %type parameter_value_opt @@ -1672,7 +1672,10 @@ gatetype | K_not { $$ = PGBuiltin::NOT; } | K_notif0 { $$ = PGBuiltin::NOTIF0; } | K_notif1 { $$ = PGBuiltin::NOTIF1; } - | K_nmos { $$ = PGBuiltin::NMOS; } + ; + +switchtype + : K_nmos { $$ = PGBuiltin::NMOS; } | K_rnmos { $$ = PGBuiltin::RNMOS; } | K_pmos { $$ = PGBuiltin::PMOS; } | K_rpmos { $$ = PGBuiltin::RPMOS; } @@ -2179,7 +2182,8 @@ module_item | K_defparam defparam_assign_list ';' /* Most gate types have an optional drive strength and optional - three-value delay. These rules handle the different cases. */ + two/three-value delay. These rules handle the different cases. + We check that the actual number of delays is correct later. */ | attribute_list_opt gatetype gate_instance_list ';' { pform_makegates($2, str_strength, 0, $3, $1); @@ -2197,6 +2201,15 @@ module_item { pform_makegates($2, $3, $4, $5, $1); } + /* The switch type gates do not support a strength. */ + | attribute_list_opt switchtype gate_instance_list ';' + { pform_makegates($2, str_strength, 0, $3, $1); + } + + | attribute_list_opt switchtype delay3 gate_instance_list ';' + { pform_makegates($2, str_strength, $3, $4, $1); + } + /* Pullup and pulldown devices cannot have delays, and their strengths are limited. */