Skip to content

Commit

Permalink
Print an error for automatic tasks or functions.
Browse files Browse the repository at this point in the history
This patch adds code to recognize and report that automatic
task or functions are not currently supported.
  • Loading branch information
caryr authored and steveicarus committed Aug 16, 2008
1 parent 1f8ff7f commit d3caa54
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
1 change: 1 addition & 0 deletions lexor_keyword.gperf
Expand Up @@ -25,6 +25,7 @@ assign, GN_KEYWORDS_1364_1995, K_assign
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
begin, GN_KEYWORDS_1364_1995, K_begin
bool, GN_KEYWORDS_ICARUS, K_bool
buf, GN_KEYWORDS_1364_1995, K_buf
Expand Down
63 changes: 36 additions & 27 deletions parse.y
Expand Up @@ -205,7 +205,7 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2)
%token K_PSTAR K_STARP
%token K_LOR K_LAND K_NAND K_NOR K_NXOR K_TRIGGER
%token K_abs K_abstol K_access K_acos K_acosh K_asin K_analog K_asinh
%token K_atan K_atanh K_atan2
%token K_atan K_atanh K_atan2 K_automatic
%token K_always K_and K_assign K_begin K_bool K_buf K_bufif0 K_bufif1 K_case
%token K_casex K_casez K_ceil K_cmos K_continuous K_cos K_cosh
%token K_ddt_nature K_deassign K_default K_defparam K_disable K_discrete
Expand Down Expand Up @@ -2094,84 +2094,84 @@ module_item
statements in the task body. But we continue to accept it as an
extension. */

| K_task IDENTIFIER ';'
| K_task automatic_opt IDENTIFIER ';'
{ assert(current_task == 0);
current_task = pform_push_task_scope($2);
current_task = pform_push_task_scope($3);
FILE_NAME(current_task, @1);
}
task_item_list_opt
statement_or_null
K_endtask
{ current_task->set_ports($5);
current_task->set_statement($6);
{ current_task->set_ports($6);
current_task->set_statement($7);
pform_pop_scope();
current_task = 0;
delete[]$2;
delete[]$3;
}

| K_task IDENTIFIER
| K_task automatic_opt IDENTIFIER
{ assert(current_task == 0);
current_task = pform_push_task_scope($2);
current_task = pform_push_task_scope($3);
FILE_NAME(current_task, @1);
}
'(' task_port_decl_list ')' ';'
block_item_decls_opt
statement_or_null
K_endtask
{ current_task->set_ports($5);
current_task->set_statement($9);
{ current_task->set_ports($6);
current_task->set_statement($10);
pform_pop_scope();
current_task = 0;
delete[]$2;
delete[]$3;
}
| K_task IDENTIFIER error K_endtask
| K_task automatic_opt IDENTIFIER error K_endtask
{
pform_pop_scope();
current_task = 0;
delete[]$2;
delete[]$3;
}

/* The function declaration rule matches the function declaration
header, then pushes the function scope. This causes the
definitions in the func_body to take on the scope of the function
instead of the module. */

| K_function function_range_or_type_opt IDENTIFIER ';'
| K_function automatic_opt function_range_or_type_opt IDENTIFIER ';'
{ assert(current_function == 0);
current_function = pform_push_function_scope($3);
current_function = pform_push_function_scope($4);
FILE_NAME(current_function, @1);
}
function_item_list statement
K_endfunction
{ current_function->set_ports($6);
current_function->set_statement($7);
current_function->set_return($2);
{ current_function->set_ports($7);
current_function->set_statement($8);
current_function->set_return($3);
pform_pop_scope();
current_function = 0;
delete[]$3;
delete[]$4;
}

| K_function function_range_or_type_opt IDENTIFIER
| K_function automatic_opt function_range_or_type_opt IDENTIFIER
{ assert(current_function == 0);
current_function = pform_push_function_scope($3);
current_function = pform_push_function_scope($4);
FILE_NAME(current_function, @1);
}
'(' task_port_decl_list ')' ';'
block_item_decls_opt
statement
K_endfunction
{ current_function->set_ports($6);
current_function->set_statement($10);
current_function->set_return($2);
{ current_function->set_ports($7);
current_function->set_statement($11);
current_function->set_return($3);
pform_pop_scope();
current_function = 0;
delete[]$3;
delete[]$4;
}
| K_function function_range_or_type_opt IDENTIFIER error K_endfunction
| K_function automatic_opt function_range_or_type_opt IDENTIFIER error K_endfunction
{
pform_pop_scope();
current_task = 0;
delete[]$3;
delete[]$4;
}

/* A generate region can contain further module items. Actually, it
Expand Down Expand Up @@ -2278,6 +2278,15 @@ module_item
{ yyerror(@1, "error: Malformed $attribute parameter list."); }
;

automatic_opt
: K_automatic
{ yyerror(@1, "sorry: automatic tasks/functions are not "
"currently supported.");
yyerrok;
}
| {}
;

generate_if : K_if '(' expression ')' { pform_start_generate_if(@1, $3); }

generate_case_items
Expand Down

0 comments on commit d3caa54

Please sign in to comment.