2001-03-11 01:29:38 +01:00
|
|
|
|
|
|
|
|
%{
|
2001-03-20 03:48:40 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
|
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
#if !defined(WINNT)
|
2001-05-20 02:46:12 +02:00
|
|
|
#ident "$Id: parse.y,v 1.27 2001/05/20 00:46:12 steve Exp $"
|
2001-03-20 03:48:40 +01:00
|
|
|
#endif
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
# include "parse_misc.h"
|
|
|
|
|
# include "compile.h"
|
|
|
|
|
# include <stdio.h>
|
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
# include <assert.h>
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* These are bits in the lexor.
|
|
|
|
|
*/
|
|
|
|
|
extern FILE*yyin;
|
|
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
%union {
|
|
|
|
|
char*text;
|
2001-04-24 04:23:58 +02:00
|
|
|
char **table;
|
2001-03-20 03:45:25 +01:00
|
|
|
long numb;
|
2001-03-20 07:16:23 +01:00
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
comp_operands_t opa;
|
2001-03-18 05:35:18 +01:00
|
|
|
|
2001-03-20 07:16:23 +01:00
|
|
|
struct symb_s symb;
|
|
|
|
|
struct symbv_s symbv;
|
|
|
|
|
|
2001-05-03 01:16:50 +02:00
|
|
|
struct numbv_s numbv;
|
|
|
|
|
|
2001-04-04 06:33:08 +02:00
|
|
|
struct symb_s vect;
|
|
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
struct argv_s argv;
|
|
|
|
|
vpiHandle vpi;
|
2001-03-11 01:29:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2001-05-09 04:53:25 +02:00
|
|
|
%token K_EVENT K_EVENT_OR K_FUNCTOR K_NET K_NET_S K_RESOLV K_SCOPE K_THREAD
|
2001-04-24 04:23:58 +02:00
|
|
|
%token K_UDP K_UDP_C K_UDP_S
|
2001-05-01 03:09:39 +02:00
|
|
|
%token K_MEM K_MEM_P K_MEM_I
|
2001-05-20 02:46:12 +02:00
|
|
|
%token K_VAR K_VAR_S K_vpi_call K_vpi_func K_disable K_fork
|
2001-03-23 03:40:22 +01:00
|
|
|
%token K_vpi_module
|
2001-03-11 01:29:38 +01:00
|
|
|
|
|
|
|
|
%token <text> T_INSTR
|
|
|
|
|
%token <text> T_LABEL
|
|
|
|
|
%token <numb> T_NUMBER
|
2001-03-16 02:44:34 +01:00
|
|
|
%token <text> T_STRING
|
2001-03-11 01:29:38 +01:00
|
|
|
%token <text> T_SYMBOL
|
2001-04-04 06:33:08 +02:00
|
|
|
%token <vect> T_VECTOR
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-04-23 02:37:58 +02:00
|
|
|
%type <symb> symbol symbol_opt
|
2001-05-03 01:16:50 +02:00
|
|
|
%type <symbv> symbols symbols_net
|
|
|
|
|
%type <numbv> numbers
|
2001-03-18 05:35:18 +01:00
|
|
|
%type <text> label_opt
|
|
|
|
|
%type <opa> operand operands operands_opt
|
2001-04-24 04:23:58 +02:00
|
|
|
%type <table> udp_table
|
2001-03-18 05:35:18 +01:00
|
|
|
|
|
|
|
|
%type <argv> argument_opt argument_list
|
|
|
|
|
%type <vpi> argument
|
2001-03-11 01:29:38 +01:00
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
2001-03-23 03:40:22 +01:00
|
|
|
source_file : header_lines_opt program ;
|
|
|
|
|
|
|
|
|
|
header_lines_opt : header_lines | ;
|
|
|
|
|
|
|
|
|
|
header_lines
|
|
|
|
|
: header_line
|
|
|
|
|
| header_lines header_line
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
header_line
|
|
|
|
|
: K_vpi_module T_STRING ';'
|
|
|
|
|
{ compile_load_vpi_module($2); }
|
|
|
|
|
;
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
/* A program is simply a list of statements. No other structure. */
|
|
|
|
|
program
|
|
|
|
|
: statement
|
|
|
|
|
| program statement
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* A statement can be any of the following. In all cases, the
|
|
|
|
|
statment is terminated by a semi-colon. In general, a statement
|
|
|
|
|
has a label, an opcode of some source, and operands. The
|
|
|
|
|
structure of the operands depends on the opcode. */
|
|
|
|
|
|
|
|
|
|
statement
|
|
|
|
|
|
|
|
|
|
/* Functor statements define functors. The functor must have a
|
|
|
|
|
label and a type name, and may have operands. */
|
|
|
|
|
|
2001-05-02 06:05:16 +02:00
|
|
|
: T_LABEL K_FUNCTOR T_SYMBOL ',' symbols ';'
|
|
|
|
|
{ struct symbv_s obj = $5;
|
|
|
|
|
compile_functor($1, $3, obj.cnt, obj.vect);
|
2001-03-11 01:29:38 +01:00
|
|
|
}
|
2001-05-02 06:05:16 +02:00
|
|
|
|
2001-03-11 23:42:11 +01:00
|
|
|
| T_LABEL K_FUNCTOR T_SYMBOL',' T_NUMBER ';'
|
2001-05-02 06:05:16 +02:00
|
|
|
{ compile_functor($1, $3, 0, 0); }
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-04-24 04:23:58 +02:00
|
|
|
|
|
|
|
|
/* UDP statements define or instantiate UDPs. Definitions take a
|
|
|
|
|
label (UDP type id) a name (string), the number of inputs, and
|
|
|
|
|
for sequentioal UDPs the initial value. */
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_UDP_S T_STRING ',' T_NUMBER ',' T_NUMBER ',' udp_table ';'
|
|
|
|
|
{ compile_udp_def(1, $1, $3, $5, $7, $9); }
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_UDP_C T_STRING ',' T_NUMBER ',' udp_table ';'
|
|
|
|
|
{ compile_udp_def(0, $1, $3, $5, 0, $7); }
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_UDP T_SYMBOL ',' symbols ';'
|
|
|
|
|
{ compile_udp_functor($1, $3, $5.cnt, $5.vect); }
|
|
|
|
|
|
|
|
|
|
|
2001-05-01 03:09:39 +02:00
|
|
|
/* Memory. Definition, port, initialization */
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_MEM T_STRING ',' T_NUMBER ',' T_NUMBER ',' numbers ';'
|
|
|
|
|
{ compile_memory($1, $3, $5, $7, $9.cnt, $9.nvec); }
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_MEM_P T_SYMBOL ',' T_NUMBER ',' T_NUMBER ',' symbols ';'
|
|
|
|
|
{ compile_memory_port($1, $3, $5, $7, $9.cnt, $9.vect); }
|
|
|
|
|
|
|
|
|
|
| mem_init_stmt
|
|
|
|
|
|
|
|
|
|
|
2001-05-09 04:53:25 +02:00
|
|
|
/* Resolver statements are very much like functors. They are
|
|
|
|
|
compiled to functors of a different mode. */
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_RESOLV T_SYMBOL ',' symbols ';'
|
|
|
|
|
{ struct symbv_s obj = $5;
|
|
|
|
|
compile_resolver($1, $3, obj.cnt, obj.vect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-03-26 06:00:39 +02:00
|
|
|
/* Event statements take a label, a type (the first T_SYMBOL) and a
|
2001-03-29 05:46:36 +02:00
|
|
|
list of inputs. If the type is instead a string, then we have a
|
|
|
|
|
named event instead. */
|
2001-03-26 06:00:39 +02:00
|
|
|
|
|
|
|
|
| T_LABEL K_EVENT T_SYMBOL ',' symbols ';'
|
|
|
|
|
{ struct symbv_s obj = $5;
|
|
|
|
|
compile_event($1, $3, obj.cnt, obj.vect);
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-29 05:46:36 +02:00
|
|
|
| T_LABEL K_EVENT T_STRING ';'
|
|
|
|
|
{ compile_named_event($1, $3); }
|
|
|
|
|
|
2001-04-14 07:10:56 +02:00
|
|
|
| T_LABEL K_EVENT_OR symbols ';'
|
|
|
|
|
{ struct symbv_s obj = $3;
|
|
|
|
|
compile_event_or($1, obj.cnt, obj.vect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
/* Instructions may have a label, and have zero or more
|
|
|
|
|
operands. The meaning of and restrictions on the operands depends
|
|
|
|
|
on the specific instruction. */
|
|
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
| label_opt T_INSTR operands_opt ';'
|
2001-04-01 08:40:44 +02:00
|
|
|
{ compile_code($1, $2, $3); }
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-04-01 08:40:44 +02:00
|
|
|
| T_LABEL ';'
|
|
|
|
|
{ compile_codelabel($1); }
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
/* %vpi_call statements are instructions that have unusual operand
|
2001-05-20 02:46:12 +02:00
|
|
|
requirements so are handled by their own rules. The %vpi_func
|
|
|
|
|
statement is a variant of %vpi_call that includes a thread vector
|
|
|
|
|
after the name, and is used for function calls. */
|
2001-03-16 02:44:34 +01:00
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
| label_opt K_vpi_call T_STRING argument_opt ';'
|
|
|
|
|
{ compile_vpi_call($1, $3, $4.argc, $4.argv); }
|
2001-03-16 02:44:34 +01:00
|
|
|
|
2001-05-20 02:46:12 +02:00
|
|
|
| label_opt K_vpi_func T_STRING ','
|
|
|
|
|
T_NUMBER ',' T_NUMBER argument_opt ';'
|
|
|
|
|
{ compile_vpi_func_call($1, $3, $5, $7, $8.argc, $8.argv); }
|
|
|
|
|
|
2001-04-18 06:21:23 +02:00
|
|
|
/* %disable statements are instructions that takes a scope reference
|
|
|
|
|
as an operand. It therefore is parsed uniquely. */
|
|
|
|
|
|
|
|
|
|
| label_opt K_disable symbol ';'
|
|
|
|
|
{ compile_disable($1, $3); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| label_opt K_fork symbol ',' symbol ';'
|
|
|
|
|
{ compile_fork($1, $3, $5); }
|
|
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
|
2001-03-18 01:37:55 +01:00
|
|
|
/* Scope statements come in two forms. There are the scope
|
|
|
|
|
declaration and the scope recall. */
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_SCOPE T_STRING ';'
|
|
|
|
|
{ compile_scope_decl($1, $3, 0); }
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_SCOPE T_STRING ',' T_SYMBOL ';'
|
|
|
|
|
{ compile_scope_decl($1, $3, $5); }
|
|
|
|
|
|
|
|
|
|
| K_SCOPE T_SYMBOL ';'
|
|
|
|
|
{ compile_scope_recall($2); }
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
/* Thread statements declare a thread with its starting address. The
|
|
|
|
|
starting address must already be defined. */
|
|
|
|
|
|
|
|
|
|
| K_THREAD T_SYMBOL ';'
|
|
|
|
|
{ compile_thread($2); }
|
|
|
|
|
|
|
|
|
|
/* Var statements declare a bit of a variable. This also implicitly
|
|
|
|
|
creates a functor with the same name that acts as the output of
|
|
|
|
|
the variable in the netlist. */
|
|
|
|
|
|
2001-03-20 07:16:23 +01:00
|
|
|
| T_LABEL K_VAR T_STRING ',' T_NUMBER ',' T_NUMBER ';'
|
2001-04-05 03:34:26 +02:00
|
|
|
{ compile_variable($1, $3, $5, $7, false); }
|
|
|
|
|
|
|
|
|
|
| T_LABEL K_VAR_S T_STRING ',' T_NUMBER ',' T_NUMBER ';'
|
|
|
|
|
{ compile_variable($1, $3, $5, $7, true); }
|
2001-03-18 05:37:16 +01:00
|
|
|
|
2001-03-25 01:35:35 +01:00
|
|
|
/* Net statements are similar to .var statements, except that they
|
|
|
|
|
declare nets, and they have an input list. */
|
|
|
|
|
|
2001-04-23 02:37:58 +02:00
|
|
|
| T_LABEL K_NET T_STRING ',' T_NUMBER ',' T_NUMBER ',' symbols_net ';'
|
2001-04-05 03:34:26 +02:00
|
|
|
{ compile_net($1, $3, $5, $7, false, $9.cnt, $9.vect); }
|
|
|
|
|
|
2001-04-23 02:37:58 +02:00
|
|
|
| T_LABEL K_NET_S T_STRING ',' T_NUMBER ',' T_NUMBER ',' symbols_net ';'
|
2001-04-05 03:34:26 +02:00
|
|
|
{ compile_net($1, $3, $5, $7, true, $9.cnt, $9.vect); }
|
2001-03-25 01:35:35 +01:00
|
|
|
|
2001-03-18 05:37:16 +01:00
|
|
|
/* Oh and by the way, empty statements are OK as well. */
|
|
|
|
|
|
|
|
|
|
| ';'
|
2001-03-11 01:29:38 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
/* There are a few places where the label is optional. This rule
|
|
|
|
|
returns the label value if present, or 0 if not. */
|
|
|
|
|
|
|
|
|
|
label_opt
|
|
|
|
|
: T_LABEL { $$ = $1; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
operands_opt
|
|
|
|
|
: operands { $$ = $1; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
operands
|
|
|
|
|
: operands ',' operand
|
|
|
|
|
{ comp_operands_t opa = $1;
|
|
|
|
|
assert(opa->argc < 3);
|
|
|
|
|
assert($3->argc == 1);
|
|
|
|
|
opa->argv[opa->argc] = $3->argv[0];
|
|
|
|
|
opa->argc += 1;
|
|
|
|
|
free($3);
|
|
|
|
|
$$ = opa;
|
|
|
|
|
}
|
|
|
|
|
| operand
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
operand
|
2001-03-20 07:16:23 +01:00
|
|
|
: symbol
|
2001-03-11 01:29:38 +01:00
|
|
|
{ comp_operands_t opa = (comp_operands_t)
|
|
|
|
|
calloc(1, sizeof(struct comp_operands_s));
|
|
|
|
|
opa->argc = 1;
|
2001-03-20 07:16:23 +01:00
|
|
|
opa->argv[0].ltype = L_SYMB;
|
|
|
|
|
opa->argv[0].symb = $1;
|
2001-03-11 01:29:38 +01:00
|
|
|
$$ = opa;
|
|
|
|
|
}
|
|
|
|
|
| T_NUMBER
|
|
|
|
|
{ comp_operands_t opa = (comp_operands_t)
|
|
|
|
|
calloc(1, sizeof(struct comp_operands_s));
|
|
|
|
|
opa->argc = 1;
|
|
|
|
|
opa->argv[0].ltype = L_NUMB;
|
|
|
|
|
opa->argv[0].numb = $1;
|
|
|
|
|
$$ = opa;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
|
|
|
|
|
/* The argument_list is a list of vpiHandle objects that can be
|
|
|
|
|
passed to a %vpi_call statement (and hence built into a
|
|
|
|
|
vpiCallSysTask handle). We build up an arbitrary sized list with
|
2001-03-21 06:13:03 +01:00
|
|
|
the struct argv_s type.
|
|
|
|
|
|
|
|
|
|
Each argument of the call is represented as a vpiHandle
|
|
|
|
|
object. If the argument is a symbol, it is located in the sym_vpi
|
|
|
|
|
symbol table. if it is someother supported object, the necessary
|
|
|
|
|
vpiHandle object is created to support it. */
|
2001-03-18 05:35:18 +01:00
|
|
|
|
|
|
|
|
argument_opt
|
|
|
|
|
: ',' argument_list
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
|
|
|
|
|
|
{ struct argv_s tmp;
|
|
|
|
|
argv_init(&tmp);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
argument_list
|
|
|
|
|
: argument
|
|
|
|
|
{ struct argv_s tmp;
|
|
|
|
|
argv_init(&tmp);
|
|
|
|
|
argv_add(&tmp, $1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| argument_list ',' argument
|
|
|
|
|
{ struct argv_s tmp = $1;
|
|
|
|
|
argv_add(&tmp, $3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
argument
|
|
|
|
|
: T_STRING
|
|
|
|
|
{ $$ = vpip_make_string_const($1); }
|
2001-03-21 06:13:03 +01:00
|
|
|
| T_SYMBOL
|
2001-04-02 02:24:30 +02:00
|
|
|
{ $$ = compile_vpi_lookup($1); free($1); }
|
2001-04-04 06:33:08 +02:00
|
|
|
| T_VECTOR
|
|
|
|
|
{ $$ = vpip_make_binary_const($1.idx, $1.text); }
|
2001-03-18 05:35:18 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
/* functor operands can only be a list of symbols. */
|
|
|
|
|
symbols
|
2001-03-20 07:16:23 +01:00
|
|
|
: symbol
|
|
|
|
|
{ struct symbv_s obj;
|
|
|
|
|
symbv_init(&obj);
|
|
|
|
|
symbv_add(&obj, $1);
|
2001-03-11 01:29:38 +01:00
|
|
|
$$ = obj;
|
|
|
|
|
}
|
2001-03-20 07:16:23 +01:00
|
|
|
| symbols ',' symbol
|
|
|
|
|
{ struct symbv_s obj = $1;
|
|
|
|
|
symbv_add(&obj, $3);
|
2001-03-11 01:29:38 +01:00
|
|
|
$$ = obj;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2001-03-20 07:16:23 +01:00
|
|
|
|
2001-05-01 03:09:39 +02:00
|
|
|
numbers
|
|
|
|
|
: T_NUMBER
|
|
|
|
|
{ struct numbv_s obj;
|
|
|
|
|
numbv_init(&obj);
|
|
|
|
|
numbv_add(&obj, $1);
|
|
|
|
|
$$ = obj;
|
|
|
|
|
}
|
|
|
|
|
| numbers ',' T_NUMBER
|
|
|
|
|
{ struct numbv_s obj = $1;
|
|
|
|
|
numbv_add(&obj, $3);
|
|
|
|
|
$$ = obj;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
2001-04-23 02:37:58 +02:00
|
|
|
symbols_net
|
|
|
|
|
: symbol_opt
|
|
|
|
|
{ struct symbv_s obj;
|
|
|
|
|
symbv_init(&obj);
|
|
|
|
|
symbv_add(&obj, $1);
|
|
|
|
|
$$ = obj;
|
|
|
|
|
}
|
|
|
|
|
| symbols_net ',' symbol_opt
|
|
|
|
|
{ struct symbv_s obj = $1;
|
|
|
|
|
symbv_add(&obj, $3);
|
|
|
|
|
$$ = obj;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2001-03-20 07:16:23 +01:00
|
|
|
/* In some cases, simple pointer arithmetic is allowed. In
|
|
|
|
|
particular, functor vectors can be indexed with the [] syntax,
|
|
|
|
|
with values from 0 up. */
|
|
|
|
|
|
|
|
|
|
symbol
|
|
|
|
|
: T_SYMBOL
|
|
|
|
|
{ $$.text = $1;
|
|
|
|
|
$$.idx = 0;
|
|
|
|
|
}
|
|
|
|
|
| T_SYMBOL '[' T_NUMBER ']'
|
|
|
|
|
{ $$.text = $1;
|
|
|
|
|
$$.idx = $3;
|
|
|
|
|
}
|
2001-04-23 02:37:58 +02:00
|
|
|
|
|
|
|
|
symbol_opt
|
|
|
|
|
: symbol
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
|
|
|
|
|
|
{ $$.text = 0;
|
|
|
|
|
$$.idx = 0;
|
|
|
|
|
}
|
2001-05-01 03:09:39 +02:00
|
|
|
;
|
2001-03-20 07:16:23 +01:00
|
|
|
|
2001-04-24 04:23:58 +02:00
|
|
|
udp_table
|
|
|
|
|
: T_STRING
|
|
|
|
|
{ $$ = compile_udp_table(0x0, $1); }
|
|
|
|
|
| udp_table ',' T_STRING
|
|
|
|
|
{ $$ = compile_udp_table($1, $3); }
|
|
|
|
|
;
|
|
|
|
|
|
2001-05-01 03:09:39 +02:00
|
|
|
mem_init_stmt
|
|
|
|
|
: K_MEM_I symbol ',' T_NUMBER o_komma
|
|
|
|
|
{ compile_memory_init($2.text, $2.idx, $4); }
|
|
|
|
|
| mem_init_stmt T_NUMBER o_komma
|
|
|
|
|
{ compile_memory_init(0x0, 0, $2); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
o_komma
|
|
|
|
|
: /* empty */
|
|
|
|
|
| ','
|
|
|
|
|
;
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
int compile_design(const char*path)
|
|
|
|
|
{
|
|
|
|
|
yypath = path;
|
|
|
|
|
yyline = 1;
|
|
|
|
|
yyin = fopen(path, "r");
|
2001-04-04 06:33:08 +02:00
|
|
|
if (yyin == 0) {
|
|
|
|
|
fprintf(stderr, "%s: Unable to open input file.\n", path);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
int rc = yyparse();
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
2001-03-20 03:48:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* $Log: parse.y,v $
|
2001-05-20 02:46:12 +02:00
|
|
|
* Revision 1.27 2001/05/20 00:46:12 steve
|
|
|
|
|
* Add support for system function calls.
|
|
|
|
|
*
|
2001-05-09 04:53:25 +02:00
|
|
|
* Revision 1.26 2001/05/09 02:53:25 steve
|
|
|
|
|
* Implement the .resolv syntax.
|
|
|
|
|
*
|
2001-05-03 01:16:50 +02:00
|
|
|
* Revision 1.25 2001/05/02 23:16:50 steve
|
|
|
|
|
* Document memory related opcodes,
|
|
|
|
|
* parser uses numbv_s structures instead of the
|
|
|
|
|
* symbv_s and a mess of unions,
|
|
|
|
|
* Add the %is/sub instruction.
|
|
|
|
|
* (Stephan Boettcher)
|
|
|
|
|
*
|
2001-05-02 06:05:16 +02:00
|
|
|
* Revision 1.24 2001/05/02 04:05:17 steve
|
|
|
|
|
* Remove the init parameter of functors, and instead use
|
|
|
|
|
* the special C<?> symbols to initialize inputs. This is
|
|
|
|
|
* clearer and more regular.
|
|
|
|
|
*
|
2001-05-01 03:09:39 +02:00
|
|
|
* Revision 1.23 2001/05/01 01:09:39 steve
|
|
|
|
|
* Add support for memory objects. (Stephan Boettcher)
|
|
|
|
|
*
|
2001-04-24 04:23:58 +02:00
|
|
|
* Revision 1.22 2001/04/24 02:23:59 steve
|
|
|
|
|
* Support for UDP devices in VVP (Stephen Boettcher)
|
|
|
|
|
*
|
2001-04-23 02:37:58 +02:00
|
|
|
* Revision 1.21 2001/04/23 00:37:58 steve
|
|
|
|
|
* Support unconnected .net objects.
|
|
|
|
|
*
|
2001-04-18 06:21:23 +02:00
|
|
|
* Revision 1.20 2001/04/18 04:21:23 steve
|
|
|
|
|
* Put threads into scopes.
|
|
|
|
|
*
|
2001-04-14 07:10:56 +02:00
|
|
|
* Revision 1.19 2001/04/14 05:10:56 steve
|
|
|
|
|
* support the .event/or statement.
|
|
|
|
|
*
|
2001-04-05 03:34:26 +02:00
|
|
|
* Revision 1.18 2001/04/05 01:34:26 steve
|
|
|
|
|
* Add the .var/s and .net/s statements for VPI support.
|
|
|
|
|
*
|
2001-04-04 06:33:08 +02:00
|
|
|
* Revision 1.17 2001/04/04 04:33:08 steve
|
|
|
|
|
* Take vector form as parameters to vpi_call.
|
|
|
|
|
*
|
2001-04-02 02:24:30 +02:00
|
|
|
* Revision 1.16 2001/04/02 00:24:30 steve
|
|
|
|
|
* Take numbers as system task parameters.
|
|
|
|
|
*
|
2001-04-01 08:40:44 +02:00
|
|
|
* Revision 1.15 2001/04/01 06:40:45 steve
|
|
|
|
|
* Support empty statements for hanging labels.
|
|
|
|
|
*
|
2001-03-29 05:46:36 +02:00
|
|
|
* Revision 1.14 2001/03/29 03:46:36 steve
|
|
|
|
|
* Support named events as mode 2 functors.
|
|
|
|
|
*
|
2001-03-26 06:00:39 +02:00
|
|
|
* Revision 1.13 2001/03/26 04:00:39 steve
|
|
|
|
|
* Add the .event statement and the %wait instruction.
|
|
|
|
|
*
|
2001-03-25 01:35:35 +01:00
|
|
|
* Revision 1.12 2001/03/25 00:35:35 steve
|
|
|
|
|
* Add the .net statement.
|
|
|
|
|
*
|
2001-03-23 03:40:22 +01:00
|
|
|
* Revision 1.11 2001/03/23 02:40:22 steve
|
|
|
|
|
* Add the :module header statement.
|
|
|
|
|
*
|
2001-03-21 06:13:03 +01:00
|
|
|
* Revision 1.10 2001/03/21 05:13:03 steve
|
|
|
|
|
* Allow var objects as vpiHandle arguments to %vpi_call.
|
|
|
|
|
*
|
2001-03-20 07:16:23 +01:00
|
|
|
* Revision 1.9 2001/03/20 06:16:24 steve
|
|
|
|
|
* Add support for variable vectors.
|
|
|
|
|
*
|
2001-03-20 03:48:40 +01:00
|
|
|
* Revision 1.8 2001/03/20 02:48:40 steve
|
|
|
|
|
* Copyright notices.
|
|
|
|
|
*
|
|
|
|
|
*/
|