18 struct {int B0; int B1;} t_range;
19 struct chain *t_chain;
25 %token _STD_LOGIC_VECTOR
34 %token <t_pchar> _IDENTIFIER
36 %token <t_long> _NUMBER
43 %type <t_long> direction
45 %type <t_chain> idlist;
52 entity : _ENTITY _IDENTIFIER {if (!strcasecmp ($2, DESIGN_NAME)) right_entity = 1;} _IS gen_decl port_decl _END
55 gen_decl : _GENERIC '(' gen_list gen ')' ';'
56 | _GENERIC '(' ')' ';'
60 gen_list : gen_list gen ';'
63 gen : idlist ':' _INTEGER
68 port_decl : _PORT '(' port_list port ')' ';'
72 port_list : port_list port ';'
76 port : idlist ':' direction type range
79 for (ch = reverse ($1); ch; ch = ch->NEXT) {
81 HEAD_PORT = (t_port*)mbkalloc (sizeof (struct t_port));
82 HEAD_PORT->NAME = (char*)ch->DATA;
83 HEAD_PORT->NEXT = NULL;
85 HEAD_PORT->VALUE = NULL;
86 HEAD_PORT->DIRECTION = $3;
87 HEAD_PORT->B0 = $5.B0;
88 HEAD_PORT->B1 = $5.B1;
91 port->NEXT = (t_port*)mbkalloc (sizeof (struct t_port));
96 port->NAME = (char*)ch->DATA;
106 idlist : idlist ',' _IDENTIFIER
108 $$ = addchain ($$, $3);
112 $$ = addchain (NULL, $1);
130 type : _STD_LOGIC_VECTOR
134 range : '(' bound _TO bound ')'
139 | '(' bound _DOWNTO bound ')'
157 long val = gethtitem (GENERICS_HT, namealloc ($1));
158 if (val == EMPTYHT) {
159 fprintf (stderr, "Please provide a value for %s\n", $1);
164 /* Arithmetic operation */
181 | '-' bound %prec NEG
194 fprintf (stderr, "syntax error line %d\n", LINE);