parse functions and tasks and delay value lists.
This commit is contained in:
parent
982cce6086
commit
0ca5a282e5
129
parse.y
129
parse.y
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: parse.y,v 1.29 1999/05/29 02:36:17 steve Exp $"
|
#ident "$Id: parse.y,v 1.30 1999/05/30 03:12:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -108,7 +108,8 @@ extern void lex_end_table();
|
||||||
%type <gate> gate_instance
|
%type <gate> gate_instance
|
||||||
%type <gates> gate_instance_list
|
%type <gates> gate_instance_list
|
||||||
|
|
||||||
%type <expr> delay delay_opt expression expr_primary
|
%type <expr> delay delay_opt delay_value delay_value_list
|
||||||
|
%type <expr> expression expr_primary
|
||||||
%type <expr> lavalue lpvalue
|
%type <expr> lavalue lpvalue
|
||||||
%type <exprs> expression_list
|
%type <exprs> expression_list
|
||||||
|
|
||||||
|
|
@ -177,30 +178,10 @@ case_items
|
||||||
;
|
;
|
||||||
|
|
||||||
delay
|
delay
|
||||||
: '#' NUMBER
|
: '#' delay_value
|
||||||
{ verinum*tmp = $2;
|
{ $$ = $2;
|
||||||
if (tmp == 0) {
|
|
||||||
yyerror(@2, "XXXX internal error: delay.");
|
|
||||||
$$ = 0;
|
|
||||||
} else {
|
|
||||||
$$ = new PENumber(tmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
| '#' IDENTIFIER
|
| '#' '(' delay_value_list ')'
|
||||||
{ PEIdent*tmp = new PEIdent(*$2);
|
|
||||||
tmp->set_file(@2.text);
|
|
||||||
tmp->set_lineno(@2.first_line);
|
|
||||||
$$ = tmp;
|
|
||||||
delete $2;
|
|
||||||
}
|
|
||||||
| '#' '(' IDENTIFIER ')'
|
|
||||||
{ PEIdent*tmp = new PEIdent(*$3);
|
|
||||||
tmp->set_file(@1.text);
|
|
||||||
tmp->set_lineno(@1.first_line);
|
|
||||||
$$ = tmp;
|
|
||||||
delete $3;
|
|
||||||
}
|
|
||||||
| '#' '(' expression ')'
|
|
||||||
{ $$ = $3;
|
{ $$ = $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
@ -210,6 +191,35 @@ delay_opt
|
||||||
| { $$ = 0; }
|
| { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
delay_value
|
||||||
|
: NUMBER
|
||||||
|
{ verinum*tmp = $1;
|
||||||
|
if (tmp == 0) {
|
||||||
|
yyerror(@1, "XXXX internal error: delay.");
|
||||||
|
$$ = 0;
|
||||||
|
} else {
|
||||||
|
$$ = new PENumber(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| IDENTIFIER
|
||||||
|
{ PEIdent*tmp = new PEIdent(*$1);
|
||||||
|
tmp->set_file(@1.text);
|
||||||
|
tmp->set_lineno(@1.first_line);
|
||||||
|
$$ = tmp;
|
||||||
|
delete $1;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
delay_value_list
|
||||||
|
: delay_value
|
||||||
|
{ $$ = $1; }
|
||||||
|
| delay_value_list ',' delay_value
|
||||||
|
{ yyerror(@1, "Sorry, delay value lists not supported.");
|
||||||
|
$$ = $1;
|
||||||
|
delete $3;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
description
|
description
|
||||||
: module
|
: module
|
||||||
| udp_primitive
|
| udp_primitive
|
||||||
|
|
@ -448,9 +458,20 @@ expression
|
||||||
{ yyerror(@2, "Sorry, ?: operator not supported.");
|
{ yyerror(@2, "Sorry, ?: operator not supported.");
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
|
| '(' expression ':' expression ':' expression ')'
|
||||||
|
{ yyerror(@2, "Sorry, (min:typ:max) not supported.");
|
||||||
|
$$ = $4;
|
||||||
|
delete $2;
|
||||||
|
delete $6;
|
||||||
|
}
|
||||||
|
| IDENTIFIER '(' expression_list ')'
|
||||||
|
{ yyerror(@2, "Sorry, function calls not supported.");
|
||||||
|
$$ = 0;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
expression_list
|
expression_list
|
||||||
: expression_list ',' expression
|
: expression_list ',' expression
|
||||||
{ svector<PExpr*>*tmp = new svector<PExpr*>(*$1, $3);
|
{ svector<PExpr*>*tmp = new svector<PExpr*>(*$1, $3);
|
||||||
|
|
@ -522,6 +543,21 @@ expr_primary
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
func_body
|
||||||
|
: function_item_list statement
|
||||||
|
;
|
||||||
|
|
||||||
|
function_item
|
||||||
|
: K_input range_opt list_of_variables ';'
|
||||||
|
| K_reg range_opt list_of_variables ';'
|
||||||
|
;
|
||||||
|
|
||||||
|
function_item_list
|
||||||
|
: function_item
|
||||||
|
| function_item_list function_item
|
||||||
|
;
|
||||||
|
|
||||||
/* A gate_instance is a module instantiation or a built in part
|
/* A gate_instance is a module instantiation or a built in part
|
||||||
type. In any case, the gate has a set of connections to ports. */
|
type. In any case, the gate has a set of connections to ports. */
|
||||||
gate_instance
|
gate_instance
|
||||||
|
|
@ -534,6 +570,15 @@ gate_instance
|
||||||
delete $1;
|
delete $1;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
|
| IDENTIFIER '(' ')'
|
||||||
|
{ lgate*tmp = new lgate;
|
||||||
|
tmp->name = *$1;
|
||||||
|
tmp->parms = 0;
|
||||||
|
tmp->file = @1.text;
|
||||||
|
tmp->lineno = @1.first_line;
|
||||||
|
delete $1;
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
| IDENTIFIER range '(' expression_list ')'
|
| IDENTIFIER range '(' expression_list ')'
|
||||||
{ lgate*tmp = new lgate;
|
{ lgate*tmp = new lgate;
|
||||||
svector<PExpr*>*rng = $2;
|
svector<PExpr*>*rng = $2;
|
||||||
|
|
@ -775,9 +820,13 @@ module_item
|
||||||
| gatetype delay_opt gate_instance_list ';'
|
| gatetype delay_opt gate_instance_list ';'
|
||||||
{ pform_makegates($1, $2, $3);
|
{ pform_makegates($1, $2, $3);
|
||||||
}
|
}
|
||||||
| IDENTIFIER gate_instance_list ';'
|
| IDENTIFIER delay_opt gate_instance_list ';'
|
||||||
{ pform_make_modgates(*$1, $2);
|
{ pform_make_modgates(*$1, $3);
|
||||||
delete $1;
|
delete $1;
|
||||||
|
if ($2) {
|
||||||
|
yyerror(@2, "Sorry, parameter override not supported.");
|
||||||
|
delete $2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| K_assign lavalue '=' expression ';'
|
| K_assign lavalue '=' expression ';'
|
||||||
{ PGAssign*tmp = pform_make_pgassign($2, $4);
|
{ PGAssign*tmp = pform_make_pgassign($2, $4);
|
||||||
|
|
@ -795,10 +844,10 @@ module_item
|
||||||
tmp->set_file(@1.text);
|
tmp->set_file(@1.text);
|
||||||
tmp->set_lineno(@1.first_line);
|
tmp->set_lineno(@1.first_line);
|
||||||
}
|
}
|
||||||
| K_task IDENTIFIER ';' statement K_endtask
|
| K_task IDENTIFIER ';' task_body K_endtask
|
||||||
{ yyerror(@1, "Sorry, task declarations not supported.");
|
{ yyerror(@1, "Sorry, task declarations not supported.");
|
||||||
}
|
}
|
||||||
| K_function range_or_type_opt IDENTIFIER ';' statement K_endfunction
|
| K_function range_or_type_opt IDENTIFIER ';' func_body K_endfunction
|
||||||
{ yyerror(@1, "Sorry, function declarations not supported.");
|
{ yyerror(@1, "Sorry, function declarations not supported.");
|
||||||
}
|
}
|
||||||
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';'
|
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';'
|
||||||
|
|
@ -1000,7 +1049,11 @@ register_variable_list
|
||||||
;
|
;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: K_begin statement_list K_end
|
: K_assign lavalue '=' expression ';'
|
||||||
|
{ yyerror(@1, "Sorry, proceedural continuous assign not supported.");
|
||||||
|
$$ = 0;
|
||||||
|
}
|
||||||
|
| K_begin statement_list K_end
|
||||||
{ $$ = pform_make_block(PBlock::BL_SEQ, $2); }
|
{ $$ = pform_make_block(PBlock::BL_SEQ, $2); }
|
||||||
| K_fork statement_list K_join
|
| K_fork statement_list K_join
|
||||||
{ $$ = pform_make_block(PBlock::BL_PAR, $2); }
|
{ $$ = pform_make_block(PBlock::BL_PAR, $2); }
|
||||||
|
|
@ -1137,6 +1190,22 @@ statement_opt
|
||||||
| ';' { $$ = 0; }
|
| ';' { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
task_body
|
||||||
|
: task_item_list statement
|
||||||
|
;
|
||||||
|
|
||||||
|
task_item
|
||||||
|
: K_input range_opt list_of_variables ';'
|
||||||
|
| K_output range_opt list_of_variables ';'
|
||||||
|
| K_inout range_opt list_of_variables ';'
|
||||||
|
| K_reg range_opt list_of_variables ';'
|
||||||
|
;
|
||||||
|
|
||||||
|
task_item_list
|
||||||
|
: task_item_list task_item
|
||||||
|
| task_item
|
||||||
|
;
|
||||||
|
|
||||||
udp_body
|
udp_body
|
||||||
: K_table { lex_start_table(); }
|
: K_table { lex_start_table(); }
|
||||||
udp_entry_list
|
udp_entry_list
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue