Handle declaration of integers (including scope) in functions.
This commit is contained in:
parent
6e486e9bcf
commit
b37fcf3593
14
parse.y
14
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.71 1999/09/30 00:48:04 steve Exp $"
|
#ident "$Id: parse.y,v 1.72 1999/09/30 01:22:37 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -169,6 +169,11 @@ source_file
|
||||||
| source_file description
|
| source_file description
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* The block_item_decl is used in function definitions, task
|
||||||
|
definitions, module definitions and named blocks. Wherever a new
|
||||||
|
scope is entered, the source may declare new registers and
|
||||||
|
integers. This rule matches those declarations. The containing
|
||||||
|
rule has presumably set up the scope. */
|
||||||
block_item_decl
|
block_item_decl
|
||||||
: K_reg range register_variable_list ';'
|
: K_reg range register_variable_list ';'
|
||||||
{ pform_set_net_range($3, $2);
|
{ pform_set_net_range($3, $2);
|
||||||
|
|
@ -697,6 +702,9 @@ func_body
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* A function_item is either a block item (i.e. a reg or integer
|
||||||
|
declaration) or an input declaration. There are no output or
|
||||||
|
inout ports. */
|
||||||
function_item
|
function_item
|
||||||
: K_input range_opt list_of_variables ';'
|
: K_input range_opt list_of_variables ';'
|
||||||
{ svector<PWire*>*tmp
|
{ svector<PWire*>*tmp
|
||||||
|
|
@ -706,9 +714,7 @@ function_item
|
||||||
delete $3;
|
delete $3;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| K_reg range_opt list_of_variables ';'
|
| block_item_decl
|
||||||
{ $$ = 0; }
|
|
||||||
| K_integer list_of_variables ';'
|
|
||||||
{ $$ = 0; }
|
{ $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
11
pform.cc
11
pform.cc
|
|
@ -17,7 +17,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: pform.cc,v 1.45 1999/09/21 00:58:33 steve Exp $"
|
#ident "$Id: pform.cc,v 1.46 1999/09/30 01:22:37 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "compiler.h"
|
# include "compiler.h"
|
||||||
|
|
@ -42,7 +42,9 @@ static Module*pform_cur_module = 0;
|
||||||
/*
|
/*
|
||||||
* The scope stack and the following functions handle the processing
|
* The scope stack and the following functions handle the processing
|
||||||
* of scope. As I enter a scope, the push function is called, and as I
|
* of scope. As I enter a scope, the push function is called, and as I
|
||||||
* leave a scope the opo function is called.
|
* leave a scope the pop function is called.
|
||||||
|
*
|
||||||
|
* The top module is not included in the scope list.
|
||||||
*/
|
*/
|
||||||
struct scope_name_t {
|
struct scope_name_t {
|
||||||
string name;
|
string name;
|
||||||
|
|
@ -640,7 +642,7 @@ static void pform_set_reg_integer(const string&nm)
|
||||||
string name = scoped_name(nm);
|
string name = scoped_name(nm);
|
||||||
PWire*cur = pform_cur_module->get_wire(name);
|
PWire*cur = pform_cur_module->get_wire(name);
|
||||||
if (cur == 0) {
|
if (cur == 0) {
|
||||||
cur = new PWire(nm, NetNet::INTEGER, NetNet::NOT_A_PORT);
|
cur = new PWire(name, NetNet::INTEGER, NetNet::NOT_A_PORT);
|
||||||
pform_cur_module->add_wire(cur);
|
pform_cur_module->add_wire(cur);
|
||||||
} else {
|
} else {
|
||||||
bool rc = cur->set_wire_type(NetNet::INTEGER);
|
bool rc = cur->set_wire_type(NetNet::INTEGER);
|
||||||
|
|
@ -712,6 +714,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: pform.cc,v $
|
* $Log: pform.cc,v $
|
||||||
|
* Revision 1.46 1999/09/30 01:22:37 steve
|
||||||
|
* Handle declaration of integers (including scope) in functions.
|
||||||
|
*
|
||||||
* Revision 1.45 1999/09/21 00:58:33 steve
|
* Revision 1.45 1999/09/21 00:58:33 steve
|
||||||
* Get scope right when setting the net range.
|
* Get scope right when setting the net range.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue