1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
/*
|
2012-02-05 01:19:27 +01:00
|
|
|
* Copyright (c) 1998-2012 Stephen Williams (steve@icarus.com)
|
1998-11-04 00:28:49 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
|
2001-07-25 05:10:48 +02:00
|
|
|
# include "config.h"
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
# include "parse_misc.h"
|
2004-02-18 18:11:54 +01:00
|
|
|
# include "compiler.h"
|
1998-11-04 00:28:49 +01:00
|
|
|
# include "pform.h"
|
2005-12-05 22:21:18 +01:00
|
|
|
# include "Statement.h"
|
2007-02-12 02:52:21 +01:00
|
|
|
# include "PSpec.h"
|
2008-02-25 04:40:54 +01:00
|
|
|
# include <stack>
|
2008-01-05 00:23:47 +01:00
|
|
|
# include <cstring>
|
2003-02-08 00:16:09 +01:00
|
|
|
# include <sstream>
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2006-09-23 06:57:19 +02:00
|
|
|
class PSpecPath;
|
|
|
|
|
|
1998-11-23 01:20:22 +01:00
|
|
|
extern void lex_start_table();
|
|
|
|
|
extern void lex_end_table();
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2009-07-11 03:19:59 +02:00
|
|
|
bool have_timeunit_decl = false;
|
|
|
|
|
bool have_timeprec_decl = false;
|
|
|
|
|
|
2010-10-26 04:36:44 +02:00
|
|
|
static list<PExpr*>* param_active_range = 0;
|
2008-05-18 01:25:58 +02:00
|
|
|
static bool param_active_signed = false;
|
|
|
|
|
static ivl_variable_type_t param_active_type = IVL_VT_LOGIC;
|
2002-08-19 04:39:16 +02:00
|
|
|
|
2003-04-25 04:28:53 +02:00
|
|
|
/* Port declaration lists use this structure for context. */
|
|
|
|
|
static struct {
|
|
|
|
|
NetNet::Type port_net_type;
|
|
|
|
|
NetNet::PortType port_type;
|
2008-04-25 22:48:14 +02:00
|
|
|
ivl_variable_type_t var_type;
|
2003-04-25 04:28:53 +02:00
|
|
|
bool sign_flag;
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>* range;
|
2012-02-19 19:29:50 +01:00
|
|
|
data_type_t* data_type;
|
2008-04-25 22:48:14 +02:00
|
|
|
} port_declaration_context = {NetNet::NONE, NetNet::NOT_A_PORT,
|
2012-02-19 19:29:50 +01:00
|
|
|
IVL_VT_NO_TYPE, false, 0, 0};
|
2003-04-25 04:28:53 +02:00
|
|
|
|
2008-02-16 06:20:24 +01:00
|
|
|
/* The task and function rules need to briefly hold the pointer to the
|
|
|
|
|
task/function that is currently in progress. */
|
|
|
|
|
static PTask* current_task = 0;
|
|
|
|
|
static PFunction* current_function = 0;
|
2008-02-25 04:40:54 +01:00
|
|
|
static stack<PBlock*> current_block_stack;
|
2008-02-16 06:20:24 +01:00
|
|
|
|
2009-10-31 03:16:42 +01:00
|
|
|
/* This is used to keep track of the extra arguments after the notifier
|
|
|
|
|
* in the $setuphold and $recrem timing checks. This allows us to print
|
|
|
|
|
* a warning message that the delayed signals will not be created. We
|
|
|
|
|
* need to do this since not driving these signals creates real
|
|
|
|
|
* simulation issues. */
|
|
|
|
|
static unsigned args_after_notifier;
|
|
|
|
|
|
2002-12-10 06:49:51 +01:00
|
|
|
/* Later version of bison (including 1.35) will not compile in stack
|
|
|
|
|
extension if the output is compiled with C++ and either the YYSTYPE
|
|
|
|
|
or YYLTYPE are provided by the source code. However, I can get the
|
|
|
|
|
old behavior back by defining these symbols. */
|
|
|
|
|
# define YYSTYPE_IS_TRIVIAL 1
|
|
|
|
|
# define YYLTYPE_IS_TRIVIAL 1
|
|
|
|
|
|
2003-01-17 06:48:02 +01:00
|
|
|
/* Recent version of bison expect that the user supply a
|
|
|
|
|
YYLLOC_DEFAULT macro that makes up a yylloc value from existing
|
|
|
|
|
values. I need to supply an explicit version to account for the
|
|
|
|
|
text field, that otherwise won't be copied. */
|
2004-01-13 03:55:50 +01:00
|
|
|
# define YYLLOC_DEFAULT(Current, Rhs, N) do { \
|
|
|
|
|
(Current).first_line = (Rhs)[1].first_line; \
|
|
|
|
|
(Current).first_column = (Rhs)[1].first_column; \
|
|
|
|
|
(Current).last_line = (Rhs)[N].last_line; \
|
|
|
|
|
(Current).last_column = (Rhs)[N].last_column; \
|
|
|
|
|
(Current).text = (Rhs)[1].text; } while (0)
|
2003-01-17 06:48:02 +01:00
|
|
|
|
2000-05-08 07:30:19 +02:00
|
|
|
/*
|
2002-01-12 05:03:39 +01:00
|
|
|
* These are some common strength pairs that are used as defaults when
|
|
|
|
|
* the user is not otherwise specific.
|
2000-05-08 07:30:19 +02:00
|
|
|
*/
|
2010-11-02 22:38:25 +01:00
|
|
|
static const struct str_pair_t pull_strength = { IVL_DR_PULL, IVL_DR_PULL };
|
|
|
|
|
static const struct str_pair_t str_strength = { IVL_DR_STRONG, IVL_DR_STRONG };
|
2006-05-11 05:26:57 +02:00
|
|
|
|
2009-05-14 18:32:15 +02:00
|
|
|
static list<pair<perm_string,PExpr*> >* make_port_list(char*id, PExpr*expr)
|
|
|
|
|
{
|
|
|
|
|
list<pair<perm_string,PExpr*> >*tmp = new list<pair<perm_string,PExpr*> >;
|
|
|
|
|
tmp->push_back(make_pair(lex_strings.make(id), expr));
|
|
|
|
|
delete[]id;
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
static list<pair<perm_string,PExpr*> >* make_port_list(list<pair<perm_string,
|
|
|
|
|
PExpr*> >*tmp,
|
|
|
|
|
char*id, PExpr*expr)
|
|
|
|
|
{
|
|
|
|
|
tmp->push_back(make_pair(lex_strings.make(id), expr));
|
|
|
|
|
delete[]id;
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
list<PExpr*>* make_range_from_width(uint64_t wid)
|
2010-10-03 01:29:30 +02:00
|
|
|
{
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*range = new list<PExpr*>;
|
2010-10-03 01:29:30 +02:00
|
|
|
|
2010-10-26 04:36:44 +02:00
|
|
|
range->push_back(new PENumber(new verinum(wid-1, integer_width)));
|
|
|
|
|
range->push_back(new PENumber(new verinum((uint64_t)0, integer_width)));
|
2010-10-03 01:29:30 +02:00
|
|
|
|
|
|
|
|
return range;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-26 04:36:44 +02:00
|
|
|
/*
|
2011-09-30 04:34:23 +02:00
|
|
|
* Make a range vector from an existing pair of expressions.
|
2010-10-26 04:36:44 +02:00
|
|
|
*/
|
|
|
|
|
static vector<PExpr*>* make_range_vector(list<PExpr*>*that)
|
|
|
|
|
{
|
|
|
|
|
assert(that->size() == 2);
|
|
|
|
|
vector<PExpr*>*tmp = new vector<PExpr*> (2);
|
|
|
|
|
tmp->at(0) = that->front();
|
|
|
|
|
tmp->at(1) = that->back();
|
|
|
|
|
delete that;
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Make a range vector from a width. Generate the msb and lsb
|
|
|
|
|
* expressions to get the canonical range for the given width.
|
|
|
|
|
*/
|
|
|
|
|
static vector<PExpr*>* make_range_vector(uint64_t wid)
|
|
|
|
|
{
|
|
|
|
|
vector<PExpr*>*tmp = new vector<PExpr*> (2);
|
|
|
|
|
tmp->at(0) = new PENumber(new verinum(wid-1, integer_width));
|
|
|
|
|
tmp->at(1) = new PENumber(new verinum((uint64_t)0, integer_width));
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-11 05:26:57 +02:00
|
|
|
static list<perm_string>* list_from_identifier(char*id)
|
|
|
|
|
{
|
|
|
|
|
list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make(id));
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]id;
|
2006-05-11 05:26:57 +02:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
|
|
|
|
|
{
|
|
|
|
|
tmp->push_back(lex_strings.make(id));
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]id;
|
2006-05-11 05:26:57 +02:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-26 04:36:44 +02:00
|
|
|
static list<PExpr*>* copy_range(list<PExpr*>* orig)
|
2008-04-25 22:48:14 +02:00
|
|
|
{
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*copy = 0;
|
2008-04-25 22:48:14 +02:00
|
|
|
|
2010-10-26 04:36:44 +02:00
|
|
|
if (orig)
|
|
|
|
|
copy = new list<PExpr*> (*orig);
|
2008-04-25 22:48:14 +02:00
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-03 05:08:38 +01:00
|
|
|
template <class T> void append(vector<T>&out, const vector<T>&in)
|
|
|
|
|
{
|
|
|
|
|
for (size_t idx = 0 ; idx < in.size() ; idx += 1)
|
|
|
|
|
out.push_back(in[idx]);
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-04 03:05:51 +02:00
|
|
|
/*
|
|
|
|
|
* This is a shorthand for making a PECallFunction that takes a single
|
|
|
|
|
* arg. This is used by some of the code that detects built-ins.
|
|
|
|
|
*/
|
|
|
|
|
static PECallFunction*make_call_function(perm_string tn, PExpr*arg)
|
|
|
|
|
{
|
2010-10-26 04:36:44 +02:00
|
|
|
vector<PExpr*> parms(1);
|
2008-05-04 03:05:51 +02:00
|
|
|
parms[0] = arg;
|
|
|
|
|
PECallFunction*tmp = new PECallFunction(tn, parms);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2)
|
|
|
|
|
{
|
2010-10-26 04:36:44 +02:00
|
|
|
vector<PExpr*> parms(2);
|
2008-05-04 03:05:51 +02:00
|
|
|
parms[0] = arg1;
|
|
|
|
|
parms[1] = arg2;
|
|
|
|
|
PECallFunction*tmp = new PECallFunction(tn, parms);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-13 03:47:06 +01:00
|
|
|
static list<named_pexpr_t>* make_named_numbers(perm_string name, long first, long last, PExpr*val =0)
|
2010-10-24 20:21:17 +02:00
|
|
|
{
|
2010-11-13 03:47:06 +01:00
|
|
|
list<named_pexpr_t>*lst = new list<named_pexpr_t>;
|
|
|
|
|
named_pexpr_t tmp;
|
2011-07-21 05:46:27 +02:00
|
|
|
// We are counting up.
|
|
|
|
|
if (first <= last) {
|
|
|
|
|
for (long idx = first ; idx <= last ; idx += 1) {
|
|
|
|
|
ostringstream buf;
|
|
|
|
|
buf << name.str() << idx << ends;
|
|
|
|
|
tmp.name = lex_strings.make(buf.str());
|
|
|
|
|
tmp.parm = val;
|
|
|
|
|
val = 0;
|
|
|
|
|
lst->push_back(tmp);
|
|
|
|
|
}
|
|
|
|
|
// We are counting down.
|
|
|
|
|
} else {
|
|
|
|
|
for (long idx = first ; idx >= last ; idx -= 1) {
|
|
|
|
|
ostringstream buf;
|
|
|
|
|
buf << name.str() << idx << ends;
|
|
|
|
|
tmp.name = lex_strings.make(buf.str());
|
|
|
|
|
tmp.parm = val;
|
|
|
|
|
val = 0;
|
|
|
|
|
lst->push_back(tmp);
|
|
|
|
|
}
|
2010-11-10 06:05:47 +01:00
|
|
|
}
|
|
|
|
|
return lst;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-13 03:47:06 +01:00
|
|
|
static list<named_pexpr_t>* make_named_number(perm_string name, PExpr*val =0)
|
2010-11-10 06:05:47 +01:00
|
|
|
{
|
2010-11-13 03:47:06 +01:00
|
|
|
list<named_pexpr_t>*lst = new list<named_pexpr_t>;
|
|
|
|
|
named_pexpr_t tmp;
|
2010-11-10 06:05:47 +01:00
|
|
|
tmp.name = name;
|
|
|
|
|
tmp.parm = val;
|
|
|
|
|
lst->push_back(tmp);
|
|
|
|
|
return lst;
|
2010-10-24 20:21:17 +02:00
|
|
|
}
|
|
|
|
|
|
2011-07-21 05:46:27 +02:00
|
|
|
static long check_enum_seq_value(const YYLTYPE&loc, verinum *arg, bool zero_ok)
|
|
|
|
|
{
|
|
|
|
|
long value = 1;
|
|
|
|
|
// We can never have an undefined value in an enumeration name
|
|
|
|
|
// declaration sequence.
|
|
|
|
|
if (! arg->is_defined()) {
|
|
|
|
|
yyerror(loc, "error: undefined value used in enum name sequence.");
|
|
|
|
|
// We can never have a negative value in an enumeration name
|
|
|
|
|
// declaration sequence.
|
|
|
|
|
} else if (arg->is_negative()) {
|
|
|
|
|
yyerror(loc, "error: negative value used in enum name sequence.");
|
|
|
|
|
} else {
|
|
|
|
|
value = arg->as_ulong();
|
|
|
|
|
// We cannot have a zero enumeration name declaration count.
|
|
|
|
|
if (! zero_ok && (value == 0)) {
|
|
|
|
|
yyerror(loc, "error: zero count used in enum name sequence.");
|
|
|
|
|
value = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-06 19:07:43 +01:00
|
|
|
static void current_task_set_statement(vector<Statement*>*s)
|
|
|
|
|
{
|
2011-11-23 05:33:19 +01:00
|
|
|
assert(s && !s->empty());
|
2011-11-06 19:07:43 +01:00
|
|
|
if (s->size() == 1) {
|
|
|
|
|
current_task->set_statement((*s)[0]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PBlock*tmp = new PBlock(PBlock::BL_SEQ);
|
|
|
|
|
tmp->set_statement(*s);
|
|
|
|
|
current_task->set_statement(tmp);
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
%union {
|
2002-05-20 04:06:01 +02:00
|
|
|
bool flag;
|
|
|
|
|
|
1998-11-25 03:35:53 +01:00
|
|
|
char letter;
|
2010-10-03 01:29:30 +02:00
|
|
|
int int_val;
|
2002-05-20 04:06:01 +02:00
|
|
|
|
2000-10-31 18:00:04 +01:00
|
|
|
/* text items are C strings allocated by the lexor using
|
|
|
|
|
strdup. They can be put into lists with the texts type. */
|
1999-07-10 03:03:18 +02:00
|
|
|
char*text;
|
2004-03-08 01:10:29 +01:00
|
|
|
list<perm_string>*perm_strings;
|
2009-05-14 18:32:15 +02:00
|
|
|
|
|
|
|
|
list<pair<perm_string,PExpr*> >*port_list;
|
|
|
|
|
|
2007-05-24 06:07:11 +02:00
|
|
|
pform_name_t*pform_name;
|
2000-10-31 18:00:04 +01:00
|
|
|
|
2008-11-02 17:10:41 +01:00
|
|
|
ivl_discipline_t discipline;
|
2008-05-11 21:00:11 +02:00
|
|
|
|
2001-12-03 05:47:14 +01:00
|
|
|
hname_t*hier;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
list<string>*strings;
|
|
|
|
|
|
2000-05-06 17:41:56 +02:00
|
|
|
struct str_pair_t drive;
|
|
|
|
|
|
1999-02-03 05:20:11 +01:00
|
|
|
PCase::Item*citem;
|
1999-06-06 22:45:38 +02:00
|
|
|
svector<PCase::Item*>*citems;
|
1999-02-03 05:20:11 +01:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
lgate*gate;
|
1999-05-06 06:37:17 +02:00
|
|
|
svector<lgate>*gates;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
1999-08-03 06:14:49 +02:00
|
|
|
Module::port_t *mport;
|
2008-09-17 22:25:59 +02:00
|
|
|
LexicalScope::range_t* value_range;
|
2008-11-03 05:08:38 +01:00
|
|
|
vector<Module::port_t*>*mports;
|
1999-08-03 06:14:49 +02:00
|
|
|
|
2010-10-24 20:21:17 +02:00
|
|
|
named_number_t* named_number;
|
|
|
|
|
list<named_number_t>* named_numbers;
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
named_pexpr_t*named_pexpr;
|
2010-11-13 03:47:06 +01:00
|
|
|
list<named_pexpr_t>*named_pexprs;
|
2000-01-09 06:50:48 +01:00
|
|
|
struct parmvalue_t*parmvalue;
|
1999-05-29 04:36:17 +02:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
PExpr*expr;
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*exprs;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
1999-04-29 04:16:26 +02:00
|
|
|
svector<PEEvent*>*event_expr;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
NetNet::Type nettype;
|
|
|
|
|
PGBuiltin::Type gatetype;
|
|
|
|
|
NetNet::PortType porttype;
|
2005-07-07 18:22:49 +02:00
|
|
|
ivl_variable_type_t datatype;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
PWire*wire;
|
1999-06-12 22:35:27 +02:00
|
|
|
svector<PWire*>*wires;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
PEventStatement*event_statement;
|
|
|
|
|
Statement*statement;
|
2011-09-17 21:10:05 +02:00
|
|
|
vector<Statement*>*statement_list;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2004-06-01 01:34:36 +02:00
|
|
|
PTaskFuncArg function_type;
|
2001-12-07 06:03:13 +01:00
|
|
|
|
2001-11-29 18:37:51 +01:00
|
|
|
net_decl_assign_t*net_decl_assign;
|
2010-10-24 20:21:17 +02:00
|
|
|
enum_type_t*enum_type;
|
2001-11-29 18:37:51 +01:00
|
|
|
|
2011-12-04 02:16:01 +01:00
|
|
|
decl_assignment_t*decl_assignment;
|
|
|
|
|
list<decl_assignment_t*>*decl_assignments;
|
|
|
|
|
|
|
|
|
|
struct_member_t*struct_member;
|
|
|
|
|
list<struct_member_t*>*struct_members;
|
|
|
|
|
struct_type_t*struct_type;
|
|
|
|
|
|
2012-01-08 00:37:30 +01:00
|
|
|
data_type_t*data_type;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
verinum* number;
|
1999-06-15 04:50:02 +02:00
|
|
|
|
|
|
|
|
verireal* realtime;
|
2006-09-23 06:57:19 +02:00
|
|
|
|
|
|
|
|
PSpecPath* specpath;
|
2007-11-07 23:18:36 +01:00
|
|
|
list<index_component_t> *dimensions;
|
1998-11-04 00:28:49 +01:00
|
|
|
};
|
|
|
|
|
|
2012-01-16 02:29:18 +01:00
|
|
|
%token <text> IDENTIFIER SYSTEM_IDENTIFIER STRING TIME_LITERAL
|
|
|
|
|
%token <data_type> TYPE_IDENTIFIER
|
2008-05-11 21:00:11 +02:00
|
|
|
%token <discipline> DISCIPLINE_IDENTIFIER
|
2001-11-06 03:52:19 +01:00
|
|
|
%token <text> PATHPULSE_IDENTIFIER
|
2003-04-14 05:37:47 +02:00
|
|
|
%token <number> BASED_NUMBER DEC_NUMBER
|
1999-06-15 04:50:02 +02:00
|
|
|
%token <realtime> REALTIME
|
2011-08-06 23:54:38 +02:00
|
|
|
%token K_PLUS_EQ K_MINUS_EQ K_INCR K_DECR
|
2012-02-20 02:31:15 +01:00
|
|
|
%token K_LE K_GE K_EG K_EQ K_NE K_CEQ K_CNE K_LP K_LS K_RS K_RSS K_SG
|
2008-05-11 21:00:11 +02:00
|
|
|
/* K_CONTRIBUTE is <+, the contribution assign. */
|
|
|
|
|
%token K_CONTRIBUTE
|
2006-07-31 05:50:17 +02:00
|
|
|
%token K_PO_POS K_PO_NEG K_POW
|
2009-11-26 18:39:21 +01:00
|
|
|
%token K_PSTAR K_STARP K_DOTSTAR
|
1999-12-31 04:24:30 +01:00
|
|
|
%token K_LOR K_LAND K_NAND K_NOR K_NXOR K_TRIGGER
|
2009-06-02 02:19:56 +02:00
|
|
|
%token K_edge_descriptor
|
|
|
|
|
|
|
|
|
|
/* The base tokens from 1364-1995. */
|
|
|
|
|
%token K_always K_and K_assign K_begin K_buf K_bufif0 K_bufif1 K_case
|
|
|
|
|
%token K_casex K_casez K_cmos K_deassign K_default K_defparam K_disable
|
|
|
|
|
%token K_edge K_else K_end K_endcase K_endfunction K_endmodule
|
|
|
|
|
%token K_endprimitive K_endspecify K_endtable K_endtask K_event K_for
|
|
|
|
|
%token K_force K_forever K_fork K_function K_highz0 K_highz1 K_if
|
|
|
|
|
%token K_ifnone K_initial K_inout K_input K_integer K_join K_large
|
|
|
|
|
%token K_macromodule K_medium K_module K_nand K_negedge K_nmos K_nor
|
|
|
|
|
%token K_not K_notif0 K_notif1 K_or K_output K_parameter K_pmos K_posedge
|
|
|
|
|
%token K_primitive K_pull0 K_pull1 K_pulldown K_pullup K_rcmos K_real
|
|
|
|
|
%token K_realtime K_reg K_release K_repeat K_rnmos K_rpmos K_rtran
|
|
|
|
|
%token K_rtranif0 K_rtranif1 K_scalared K_small K_specify K_specparam
|
|
|
|
|
%token K_strong0 K_strong1 K_supply0 K_supply1 K_table K_task K_time
|
|
|
|
|
%token K_tran K_tranif0 K_tranif1 K_tri K_tri0 K_tri1 K_triand K_trior
|
|
|
|
|
%token K_trireg K_vectored K_wait K_wand K_weak0 K_weak1 K_while K_wire
|
|
|
|
|
%token K_wor K_xnor K_xor
|
|
|
|
|
|
2009-06-04 00:02:32 +02:00
|
|
|
%token K_Shold K_Snochange K_Speriod K_Srecovery K_Ssetup K_Ssetuphold
|
|
|
|
|
%token K_Sskew K_Swidth
|
2009-06-02 02:19:56 +02:00
|
|
|
|
|
|
|
|
/* Icarus specific tokens. */
|
|
|
|
|
%token KK_attribute K_bool K_logic
|
|
|
|
|
|
|
|
|
|
/* The new tokens from 1364-2001. */
|
|
|
|
|
%token K_automatic K_endgenerate K_generate K_genvar K_localparam
|
|
|
|
|
%token K_noshowcancelled K_pulsestyle_onevent K_pulsestyle_ondetect
|
|
|
|
|
%token K_showcancelled K_signed K_unsigned
|
|
|
|
|
|
2009-06-04 00:02:32 +02:00
|
|
|
%token K_Sfullskew K_Srecrem K_Sremoval K_Stimeskew
|
2009-06-02 02:19:56 +02:00
|
|
|
|
|
|
|
|
/* The 1364-2001 configuration tokens. */
|
|
|
|
|
%token K_cell K_config K_design K_endconfig K_incdir K_include K_instance
|
|
|
|
|
%token K_liblist K_library K_use
|
|
|
|
|
|
|
|
|
|
/* The new tokens from 1364-2005. */
|
|
|
|
|
%token K_wone K_uwire
|
|
|
|
|
|
2011-01-09 00:35:52 +01:00
|
|
|
/* The new tokens from 1800-2005. */
|
2010-01-19 04:06:01 +01:00
|
|
|
%token K_alias K_always_comb K_always_ff K_always_latch K_assert
|
|
|
|
|
%token K_assume K_before K_bind K_bins K_binsof K_bit K_break K_byte
|
|
|
|
|
%token K_chandle K_class K_clocking K_const K_constraint K_context
|
|
|
|
|
%token K_continue K_cover K_covergroup K_coverpoint K_cross K_dist K_do
|
|
|
|
|
%token K_endclass K_endclocking K_endgroup K_endinterface K_endpackage
|
|
|
|
|
%token K_endprogram K_endproperty K_endsequence K_enum K_expect K_export
|
|
|
|
|
%token K_extends K_extern K_final K_first_match K_foreach K_forkjoin
|
|
|
|
|
%token K_iff K_ignore_bins K_illegal_bins K_import K_inside K_int
|
|
|
|
|
/* Icarus already has defined "logic" above! */
|
|
|
|
|
%token K_interface K_intersect K_join_any K_join_none K_local
|
|
|
|
|
%token K_longint K_matches K_modport K_new K_null K_package K_packed
|
|
|
|
|
%token K_priority K_program K_property K_protected K_pure K_rand K_randc
|
|
|
|
|
%token K_randcase K_randsequence K_ref K_return K_sequence K_shortint
|
2010-01-21 02:35:38 +01:00
|
|
|
%token K_shortreal K_solve K_static K_string K_struct K_super
|
2010-01-19 04:06:01 +01:00
|
|
|
%token K_tagged K_this K_throughout K_timeprecision K_timeunit K_type
|
|
|
|
|
%token K_typedef K_union K_unique K_var K_virtual K_void K_wait_order
|
|
|
|
|
%token K_wildcard K_with K_within
|
2009-07-11 03:19:59 +02:00
|
|
|
/* Fake tokens that are passed once we have an initial token. */
|
|
|
|
|
%token K_timeprecision_check K_timeunit_check
|
2009-01-10 10:02:09 +01:00
|
|
|
|
2011-01-09 00:35:52 +01:00
|
|
|
/* The new tokens from 1800-2009. */
|
|
|
|
|
%token K_accept_on K_checker K_endchecker K_eventually K_global K_implies
|
|
|
|
|
%token K_let K_nexttime K_reject_on K_restrict K_s_always K_s_eventually
|
|
|
|
|
%token K_s_nexttime K_s_until K_s_until_with K_strong K_sync_accept_on
|
|
|
|
|
%token K_sync_reject_on K_unique0 K_until K_until_with K_untyped K_weak
|
|
|
|
|
|
2009-06-02 02:19:56 +02:00
|
|
|
/* The new tokens for Verilog-AMS 2.3. */
|
2010-01-21 02:35:38 +01:00
|
|
|
%token K_above K_abs K_absdelay K_abstol K_access K_acos K_acosh
|
|
|
|
|
/* 1800-2005 has defined "assert" above! */
|
|
|
|
|
%token K_ac_stim K_aliasparam K_analog K_analysis K_asin K_asinh
|
|
|
|
|
%token K_atan K_atan2 K_atanh K_branch K_ceil K_connect K_connectmodule
|
|
|
|
|
%token K_connectrules K_continuous K_cos K_cosh K_ddt K_ddt_nature K_ddx
|
|
|
|
|
%token K_discipline K_discrete K_domain K_driver_update K_endconnectrules
|
|
|
|
|
%token K_enddiscipline K_endnature K_endparamset K_exclude K_exp
|
|
|
|
|
%token K_final_step K_flicker_noise K_floor K_flow K_from K_ground
|
|
|
|
|
%token K_hypot K_idt K_idtmod K_idt_nature K_inf K_initial_step
|
|
|
|
|
%token K_laplace_nd K_laplace_np K_laplace_zd K_laplace_zp
|
|
|
|
|
%token K_last_crossing K_limexp K_ln K_log K_max K_merged K_min K_nature
|
|
|
|
|
%token K_net_resolution K_noise_table K_paramset K_potential K_pow
|
|
|
|
|
/* 1800-2005 has defined "string" above! */
|
|
|
|
|
%token K_resolveto K_sin K_sinh K_slew K_split K_sqrt K_tan K_tanh
|
|
|
|
|
%token K_timer K_transition K_units K_white_noise K_wreal
|
|
|
|
|
%token K_zi_nd K_zi_np K_zi_zd K_zi_zp
|
1998-11-23 01:20:22 +01:00
|
|
|
|
2008-05-13 06:26:38 +02:00
|
|
|
%type <flag> from_exclude
|
2011-07-21 05:46:27 +02:00
|
|
|
%type <number> number pos_neg_number
|
2011-12-04 02:16:01 +01:00
|
|
|
%type <flag> unsigned_signed_opt signed_unsigned_opt
|
2012-02-19 19:29:50 +01:00
|
|
|
%type <flag> K_automatic_opt K_packed_opt K_reg_opt K_virtual_opt
|
|
|
|
|
%type <flag> udp_reg_opt edge_operator
|
2000-05-06 17:41:56 +02:00
|
|
|
%type <drive> drive_strength drive_strength_opt dr_strength0 dr_strength1
|
1998-11-25 03:35:53 +01:00
|
|
|
%type <letter> udp_input_sym udp_output_sym
|
|
|
|
|
%type <text> udp_input_list udp_sequ_entry udp_comb_entry
|
2004-03-08 01:10:29 +01:00
|
|
|
%type <perm_strings> udp_input_declaration_list
|
1998-11-25 03:35:53 +01:00
|
|
|
%type <strings> udp_entry_list udp_comb_entry_list udp_sequ_entry_list
|
2008-02-25 04:40:54 +01:00
|
|
|
%type <strings> udp_body
|
|
|
|
|
%type <perm_strings> udp_port_list
|
1998-11-25 03:35:53 +01:00
|
|
|
%type <wires> udp_port_decl udp_port_decls
|
|
|
|
|
%type <statement> udp_initial udp_init_opt
|
2004-03-08 01:10:29 +01:00
|
|
|
%type <expr> udp_initial_expr_opt
|
1998-11-25 03:35:53 +01:00
|
|
|
|
2012-02-18 19:02:54 +01:00
|
|
|
%type <text> register_variable net_variable real_variable endname_opt
|
2009-05-14 18:32:15 +02:00
|
|
|
%type <perm_strings> register_variable_list net_variable_list
|
|
|
|
|
%type <perm_strings> real_variable_list list_of_identifiers
|
|
|
|
|
%type <port_list> list_of_port_identifiers
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2001-11-29 18:37:51 +01:00
|
|
|
%type <net_decl_assign> net_decl_assign net_decl_assigns
|
1999-06-02 04:56:29 +02:00
|
|
|
|
2003-02-08 00:16:09 +01:00
|
|
|
%type <mport> port port_opt port_reference port_reference_list
|
2003-04-25 04:28:53 +02:00
|
|
|
%type <mport> port_declaration
|
2009-02-24 01:37:34 +01:00
|
|
|
%type <mports> list_of_ports module_port_list_opt list_of_port_declarations module_attribute_foreign
|
2008-05-13 06:26:38 +02:00
|
|
|
%type <value_range> parameter_value_range parameter_value_ranges
|
|
|
|
|
%type <value_range> parameter_value_ranges_opt
|
2012-02-20 02:31:15 +01:00
|
|
|
%type <expr> tf_port_item_expr_opt value_range_expression
|
1999-08-03 06:14:49 +02:00
|
|
|
|
2010-11-13 03:47:06 +01:00
|
|
|
%type <named_pexprs> enum_name_list enum_name
|
2010-10-24 20:21:17 +02:00
|
|
|
%type <enum_type> enum_data_type
|
|
|
|
|
|
1999-07-24 04:11:19 +02:00
|
|
|
%type <wires> task_item task_item_list task_item_list_opt
|
2012-02-20 02:31:15 +01:00
|
|
|
%type <wires> task_port_item tf_port_item tf_port_list tf_port_list_opt
|
1999-07-31 21:14:47 +02:00
|
|
|
%type <wires> function_item function_item_list
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
%type <named_pexpr> port_name parameter_value_byname
|
|
|
|
|
%type <named_pexprs> port_name_list parameter_value_byname_list
|
|
|
|
|
|
|
|
|
|
%type <named_pexpr> attribute
|
2011-02-25 02:37:56 +01:00
|
|
|
%type <named_pexprs> attribute_list attribute_instance_list attribute_list_opt
|
1999-05-29 04:36:17 +02:00
|
|
|
|
1999-02-03 05:20:11 +01:00
|
|
|
%type <citem> case_item
|
|
|
|
|
%type <citems> case_items
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
%type <gate> gate_instance
|
|
|
|
|
%type <gates> gate_instance_list
|
|
|
|
|
|
2008-01-25 22:34:51 +01:00
|
|
|
%type <pform_name> hierarchy_identifier
|
2012-02-20 02:31:15 +01:00
|
|
|
%type <expr> assignment_pattern expression expr_primary expr_mintypmax
|
2012-02-20 03:54:58 +01:00
|
|
|
%type <expr> inc_or_dec_expression lpvalue
|
2008-07-27 23:22:19 +02:00
|
|
|
%type <expr> branch_probe_expression
|
2000-01-02 02:59:52 +01:00
|
|
|
%type <expr> delay_value delay_value_simple
|
2006-09-23 06:57:19 +02:00
|
|
|
%type <exprs> delay1 delay3 delay3_opt delay_value_list
|
2007-04-02 01:02:03 +02:00
|
|
|
%type <exprs> expression_list_with_nuls expression_list_proper
|
2007-04-21 06:45:36 +02:00
|
|
|
%type <exprs> cont_assign cont_assign_list
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2011-12-04 02:16:01 +01:00
|
|
|
%type <decl_assignment> variable_decl_assignment
|
|
|
|
|
%type <decl_assignments> list_of_variable_decl_assignments
|
|
|
|
|
|
2012-01-08 00:37:30 +01:00
|
|
|
%type <data_type> data_type
|
2011-12-04 02:16:01 +01:00
|
|
|
%type <struct_member> struct_union_member
|
|
|
|
|
%type <struct_members> struct_union_member_list
|
|
|
|
|
%type <struct_type> struct_data_type
|
|
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
%type <exprs> range range_opt variable_dimension
|
2007-11-14 05:49:05 +01:00
|
|
|
%type <dimensions> dimensions_opt dimensions
|
2003-02-08 00:16:09 +01:00
|
|
|
%type <nettype> net_type var_type net_type_opt
|
2010-07-14 01:12:03 +02:00
|
|
|
%type <gatetype> gatetype switchtype
|
2012-02-19 19:29:50 +01:00
|
|
|
%type <porttype> port_direction port_direction_opt
|
2011-07-07 15:41:22 +02:00
|
|
|
%type <datatype> primitive_type primitive_type_opt bit_logic
|
2000-01-09 06:50:48 +01:00
|
|
|
%type <parmvalue> parameter_value_opt
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2004-06-01 01:34:36 +02:00
|
|
|
%type <function_type> function_range_or_type_opt
|
1999-09-30 00:56:31 +02:00
|
|
|
%type <event_expr> event_expression_list
|
1999-04-29 04:16:26 +02:00
|
|
|
%type <event_expr> event_expression
|
|
|
|
|
%type <event_statement> event_control
|
2011-07-21 04:03:24 +02:00
|
|
|
%type <statement> statement statement_or_null compressed_statement
|
2012-02-25 18:28:20 +01:00
|
|
|
%type <statement> loop_statement for_step
|
2011-11-06 19:07:43 +01:00
|
|
|
%type <statement_list> statement_list statement_or_null_list
|
2011-11-23 05:33:19 +01:00
|
|
|
%type <statement_list> statement_list_or_null
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2008-10-23 06:56:00 +02:00
|
|
|
%type <statement> analog_statement
|
2008-07-27 21:02:09 +02:00
|
|
|
|
2003-02-27 07:45:11 +01:00
|
|
|
%type <letter> spec_polarity
|
2004-05-25 21:21:06 +02:00
|
|
|
%type <perm_strings> specify_path_identifiers
|
2003-02-27 07:45:11 +01:00
|
|
|
|
2006-09-23 06:57:19 +02:00
|
|
|
%type <specpath> specify_simple_path specify_simple_path_decl
|
2007-02-12 02:52:21 +01:00
|
|
|
%type <specpath> specify_edge_path specify_edge_path_decl
|
2006-09-23 06:57:19 +02:00
|
|
|
|
2010-10-03 01:29:30 +02:00
|
|
|
%type <int_val> atom2_type
|
2012-02-18 19:02:54 +01:00
|
|
|
%type <int_val> module_start module_end
|
2010-10-03 01:29:30 +02:00
|
|
|
|
2001-07-02 01:44:43 +02:00
|
|
|
%token K_TAND
|
2011-07-21 04:03:24 +02:00
|
|
|
%right K_PLUS_EQ K_MINUS_EQ K_MUL_EQ K_DIV_EQ K_MOD_EQ K_AND_EQ K_OR_EQ
|
|
|
|
|
%right K_XOR_EQ K_LS_EQ K_RS_EQ K_RSS_EQ
|
1999-09-30 00:56:31 +02:00
|
|
|
%right '?' ':'
|
1999-03-15 03:43:32 +01:00
|
|
|
%left K_LOR
|
1999-03-16 05:44:45 +01:00
|
|
|
%left K_LAND
|
|
|
|
|
%left '|'
|
1999-09-30 04:43:01 +02:00
|
|
|
%left '^' K_NXOR K_NOR
|
|
|
|
|
%left '&' K_NAND
|
1999-03-16 05:44:45 +01:00
|
|
|
%left K_EQ K_NE K_CEQ K_CNE
|
|
|
|
|
%left K_GE K_LE '<' '>'
|
2003-06-18 05:55:18 +02:00
|
|
|
%left K_LS K_RS K_RSS
|
1999-03-16 05:44:45 +01:00
|
|
|
%left '+' '-'
|
1999-05-16 07:08:42 +02:00
|
|
|
%left '*' '/' '%'
|
2006-07-31 05:50:17 +02:00
|
|
|
%left K_POW
|
1999-03-16 05:44:45 +01:00
|
|
|
%left UNARY_PREC
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2008-06-06 06:49:49 +02:00
|
|
|
|
2003-12-19 06:15:04 +01:00
|
|
|
/* to resolve dangling else ambiguity. */
|
1999-09-30 00:56:31 +02:00
|
|
|
%nonassoc less_than_K_else
|
|
|
|
|
%nonassoc K_else
|
|
|
|
|
|
2008-06-06 06:49:49 +02:00
|
|
|
/* to resolve exclude (... ambiguity */
|
|
|
|
|
%nonassoc '('
|
|
|
|
|
%nonassoc K_exclude
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
%%
|
|
|
|
|
|
1999-10-15 07:03:33 +02:00
|
|
|
/* A degenerate source file can be completely empty. */
|
|
|
|
|
main : source_file | ;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
source_file
|
|
|
|
|
: description
|
|
|
|
|
| source_file description
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
assignment_pattern /* IEEE1800-2005: A.6.7.1 */
|
|
|
|
|
: K_LP expression_list_proper '}'
|
|
|
|
|
{ PEVoid*tmp = new PEVoid;
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
yyerror(@1, "sorry: Assignment patterns (array literals) not supported.");
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_LP '}'
|
|
|
|
|
{ PEVoid*tmp = new PEVoid;
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
yyerror(@1, "sorry: Assignment patterns (array literals) not supported.");
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
class_declaration /* IEEE1800-2005: A.1.2 */
|
|
|
|
|
: K_virtual_opt K_class IDENTIFIER ';'
|
|
|
|
|
class_items_opt K_endclass endname_opt
|
|
|
|
|
{ // Process a class
|
|
|
|
|
if ($7 && strcmp($3,$7)!=0) {
|
|
|
|
|
yyerror(@7, "error: Class end name doesn't match class name.");
|
|
|
|
|
delete[]$7;
|
|
|
|
|
}
|
|
|
|
|
yyerror(@2, "sorry: Class declarations not supported yet.");
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
class_items_opt
|
|
|
|
|
: class_items
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
class_items
|
|
|
|
|
: class_items class_item
|
|
|
|
|
| class_item
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
class_item /* IEEE1800-2005: A.1.8 */
|
|
|
|
|
|
|
|
|
|
/* class_constructor_declaration */
|
2012-02-20 02:31:15 +01:00
|
|
|
: K_function K_new '(' tf_port_list_opt ')' ';'
|
|
|
|
|
statement_list_or_null
|
2012-02-19 19:29:50 +01:00
|
|
|
K_endfunction endnew_opt
|
2012-02-20 02:31:15 +01:00
|
|
|
{ yyerror(@1, "sorry: Class constructors not supported yet.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
2012-02-19 19:29:50 +01:00
|
|
|
|
|
|
|
|
/* Class properties... */
|
|
|
|
|
|
|
|
|
|
| data_type list_of_variable_decl_assignments ';'
|
|
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
|
|
|
|
|
/* Class methods... */
|
|
|
|
|
|
|
|
|
|
| task_declaration
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
/* Here are some error matching rules to help recover from various
|
|
|
|
|
syntax errors within a class declaration. */
|
|
|
|
|
|
|
|
|
|
| K_function K_new error K_endfunction endnew_opt
|
|
|
|
|
{ yyerror(@1, "error: I give up on this class constructor declaration.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
data_type /* IEEE1800-2005: A.2.2.1 */
|
|
|
|
|
: struct_data_type
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| enum_data_type
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| atom2_type signed_unsigned_opt
|
|
|
|
|
{ atom2_type_t*tmp = new atom2_type_t($1, $2);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| TYPE_IDENTIFIER
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| K_string
|
|
|
|
|
{ yyerror(@1, "sorry: String data type not supported.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
endnew_opt : ':' K_new | ;
|
|
|
|
|
|
2012-02-25 18:28:20 +01:00
|
|
|
for_step /* IEEE1800-2005: A.6.8 */
|
|
|
|
|
: lpvalue '=' expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1,$3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| inc_or_dec_expression
|
|
|
|
|
{ $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
|
|
|
|
|
| compressed_statement
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
implicit_class_handle /* IEEE1800-2005: A.8.4 */
|
|
|
|
|
: K_this
|
|
|
|
|
| K_super
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-20 03:54:58 +01:00
|
|
|
/* SystemVerilog adds support for the increment/decrement
|
|
|
|
|
expressions, which look like a++, --a, etc. These are primaries
|
|
|
|
|
but are in their own rules because they can also be
|
|
|
|
|
statements. Note that the operator can only take l-value
|
|
|
|
|
expressions. */
|
|
|
|
|
|
|
|
|
|
inc_or_dec_expression /* IEEE1800-2005: A.4.3 */
|
|
|
|
|
: K_INCR lpvalue %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('I', $2);
|
|
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_INCR %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('i', $1);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_DECR lpvalue %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('D', $2);
|
|
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_DECR %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('d', $1);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-25 18:28:20 +01:00
|
|
|
/* Loop statements are kinds of statements. */
|
|
|
|
|
|
|
|
|
|
loop_statement /* IEEE1800-2005: A.6.8 */
|
|
|
|
|
: K_for '(' lpvalue '=' expression ';' expression ';' for_step ')'
|
|
|
|
|
statement_or_null
|
|
|
|
|
{ PForStatement*tmp = new PForStatement($3, $5, $7, $9, $11);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')'
|
|
|
|
|
statement_or_null
|
|
|
|
|
{ $$ = 0;
|
|
|
|
|
yyerror(@3, "sorry: for_variable_declaration not supported");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_forever statement_or_null
|
|
|
|
|
{ PForever*tmp = new PForever($2);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_repeat '(' expression ')' statement_or_null
|
|
|
|
|
{ PRepeat*tmp = new PRepeat($3, $5);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_while '(' expression ')' statement_or_null
|
|
|
|
|
{ PWhile*tmp = new PWhile($3, $5);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Error forms for loop statements. */
|
|
|
|
|
|
|
|
|
|
| K_for '(' lpvalue '=' expression ';' expression ';' error ')'
|
|
|
|
|
statement_or_null
|
|
|
|
|
{ $$ = 0;
|
|
|
|
|
yyerror(@1, "error: Error in for loop step assignment.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_for '(' lpvalue '=' expression ';' error ';' for_step ')'
|
|
|
|
|
statement_or_null
|
|
|
|
|
{ $$ = 0;
|
|
|
|
|
yyerror(@1, "error: Error in for loop condition expression.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_for '(' error ')' statement_or_null
|
|
|
|
|
{ $$ = 0;
|
|
|
|
|
yyerror(@1, "error: Incomprehensible for loop.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_while '(' error ')' statement_or_null
|
|
|
|
|
{ $$ = 0;
|
|
|
|
|
yyerror(@1, "error: Error in while loop condition.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
2003-04-14 05:37:47 +02:00
|
|
|
number : BASED_NUMBER
|
2007-10-12 01:37:57 +02:00
|
|
|
{ $$ = $1; based_size = 0;}
|
2003-04-14 05:37:47 +02:00
|
|
|
| DEC_NUMBER
|
2007-10-12 01:37:57 +02:00
|
|
|
{ $$ = $1; based_size = 0;}
|
2003-04-14 05:37:47 +02:00
|
|
|
| DEC_NUMBER BASED_NUMBER
|
2007-10-12 01:37:57 +02:00
|
|
|
{ $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
|
|
|
|
|
based_size = 0; }
|
2003-04-14 05:37:47 +02:00
|
|
|
;
|
|
|
|
|
|
2008-09-04 18:41:51 +02:00
|
|
|
/* real and realtime are exactly the same so save some code
|
2008-08-09 03:12:52 +02:00
|
|
|
* with a common matching rule. */
|
|
|
|
|
real_or_realtime
|
|
|
|
|
: K_real
|
|
|
|
|
| K_realtime
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-25 18:28:20 +01:00
|
|
|
/* Many places where statements are allowed can actually take a
|
|
|
|
|
statement or a null statement marked with a naked semi-colon. */
|
|
|
|
|
|
|
|
|
|
statement_or_null /* IEEE1800-2005: A.6.4 */
|
|
|
|
|
: statement
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| ';'
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
/* The task declaration rule matches the task declaration
|
|
|
|
|
header, then pushes the function scope. This causes the
|
|
|
|
|
definitions in the task_body to take on the scope of the task
|
|
|
|
|
instead of the module. */
|
|
|
|
|
|
|
|
|
|
task_declaration /* IEEE1800-2005: A.2.7 */
|
|
|
|
|
|
|
|
|
|
: K_task K_automatic_opt IDENTIFIER ';'
|
|
|
|
|
{ assert(current_task == 0);
|
|
|
|
|
current_task = pform_push_task_scope(@1, $3, $2);
|
|
|
|
|
}
|
|
|
|
|
task_item_list_opt
|
|
|
|
|
statement_or_null_list
|
|
|
|
|
K_endtask
|
|
|
|
|
{ current_task->set_ports($6);
|
|
|
|
|
current_task_set_statement($7);
|
|
|
|
|
pform_pop_scope();
|
|
|
|
|
current_task = 0;
|
|
|
|
|
if ($7->size() > 1 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@7, "error: Task body with multiple statements requres SystemVerilog.");
|
|
|
|
|
}
|
|
|
|
|
delete $7;
|
|
|
|
|
}
|
2012-02-25 02:04:49 +01:00
|
|
|
endname_opt
|
|
|
|
|
{ // Last step: check any closing name. This is done late so
|
|
|
|
|
// that the parser can look ahead to detect the present
|
|
|
|
|
// endname_opt but still have the pform_endmodule() called
|
|
|
|
|
// early enough that the lexor can know we are outside the
|
|
|
|
|
// module.
|
|
|
|
|
if ($10 && (strcmp($3,$10) != 0)) {
|
|
|
|
|
yyerror(@10, "error: End name doesn't match module/program name");
|
|
|
|
|
}
|
|
|
|
|
if ($10 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@10, "error: Task end names require System Verilog.");
|
|
|
|
|
}
|
|
|
|
|
delete[]$3;
|
|
|
|
|
if ($10) delete[]$10;
|
|
|
|
|
}
|
2012-02-20 02:31:15 +01:00
|
|
|
|
|
|
|
|
| K_task K_automatic_opt IDENTIFIER '('
|
|
|
|
|
{ assert(current_task == 0);
|
|
|
|
|
current_task = pform_push_task_scope(@1, $3, $2);
|
|
|
|
|
}
|
|
|
|
|
tf_port_list ')' ';'
|
|
|
|
|
block_item_decls_opt
|
|
|
|
|
statement_or_null_list
|
|
|
|
|
K_endtask
|
|
|
|
|
{ current_task->set_ports($6);
|
|
|
|
|
current_task_set_statement($10);
|
|
|
|
|
pform_pop_scope();
|
|
|
|
|
current_task = 0;
|
|
|
|
|
if ($10->size() > 1 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@10, "error: Task body with multiple statements requres SystemVerilog.");
|
|
|
|
|
}
|
|
|
|
|
delete $10;
|
|
|
|
|
}
|
2012-02-25 02:04:49 +01:00
|
|
|
endname_opt
|
|
|
|
|
{ // Last step: check any closing name. This is done late so
|
|
|
|
|
// that the parser can look ahead to detect the present
|
|
|
|
|
// endname_opt but still have the pform_endmodule() called
|
|
|
|
|
// early enough that the lexor can know we are outside the
|
|
|
|
|
// module.
|
|
|
|
|
if ($13 && (strcmp($3,$13) != 0)) {
|
|
|
|
|
yyerror(@13, "error: End name doesn't match module/program name");
|
|
|
|
|
}
|
|
|
|
|
if ($13 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@13, "error: Task end names require System Verilog.");
|
|
|
|
|
}
|
|
|
|
|
delete[]$3;
|
|
|
|
|
if ($13) delete[]$13;
|
|
|
|
|
}
|
2012-02-20 02:31:15 +01:00
|
|
|
|
|
|
|
|
| K_task K_automatic_opt IDENTIFIER '(' ')' ';'
|
|
|
|
|
{ assert(current_task == 0);
|
|
|
|
|
current_task = pform_push_task_scope(@1, $3, $2);
|
|
|
|
|
}
|
|
|
|
|
block_item_decls_opt
|
|
|
|
|
statement_or_null_list
|
|
|
|
|
K_endtask
|
|
|
|
|
{ current_task->set_ports(0);
|
|
|
|
|
current_task_set_statement($9);
|
|
|
|
|
pform_pop_scope();
|
|
|
|
|
current_task = 0;
|
|
|
|
|
cerr << @3 << ": warning: task definition for \"" << $3
|
|
|
|
|
<< "\" has an empty port declaration list!" << endl;
|
|
|
|
|
if ($9->size() > 1 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@9, "error: Task body with multiple statements requres SystemVerilog.");
|
|
|
|
|
}
|
|
|
|
|
delete $9;
|
|
|
|
|
}
|
2012-02-25 02:04:49 +01:00
|
|
|
endname_opt
|
|
|
|
|
{ // Last step: check any closing name. This is done late so
|
|
|
|
|
// that the parser can look ahead to detect the present
|
|
|
|
|
// endname_opt but still have the pform_endmodule() called
|
|
|
|
|
// early enough that the lexor can know we are outside the
|
|
|
|
|
// module.
|
|
|
|
|
if ($12 && (strcmp($3,$12) != 0)) {
|
|
|
|
|
yyerror(@12, "error: End name doesn't match module/program name");
|
|
|
|
|
}
|
|
|
|
|
if ($12 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@12, "error: Task end names require System Verilog.");
|
|
|
|
|
}
|
|
|
|
|
delete[]$3;
|
|
|
|
|
if ($12) delete[]$12;
|
|
|
|
|
}
|
2012-02-20 02:31:15 +01:00
|
|
|
|
|
|
|
|
| K_task K_automatic_opt IDENTIFIER error K_endtask
|
|
|
|
|
{
|
|
|
|
|
assert(current_task == 0);
|
2012-02-25 02:04:49 +01:00
|
|
|
}
|
|
|
|
|
endname_opt
|
|
|
|
|
{ // Last step: check any closing name. This is done late so
|
|
|
|
|
// that the parser can look ahead to detect the present
|
|
|
|
|
// endname_opt but still have the pform_endmodule() called
|
|
|
|
|
// early enough that the lexor can know we are outside the
|
|
|
|
|
// module.
|
|
|
|
|
if ($7 && (strcmp($3,$7) != 0)) {
|
|
|
|
|
yyerror(@7, "error: End name doesn't match module/program name");
|
|
|
|
|
}
|
|
|
|
|
if ($7 && !gn_system_verilog()) {
|
|
|
|
|
yyerror(@7, "error: Task end names require System Verilog.");
|
|
|
|
|
}
|
2012-02-20 02:31:15 +01:00
|
|
|
delete[]$3;
|
2012-02-25 02:04:49 +01:00
|
|
|
if ($7) delete[]$7;
|
2012-02-20 02:31:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* These rules for tf_port_item are slightly expanded from the
|
|
|
|
|
strict rules in the LRM to help with LALR parsing.
|
|
|
|
|
|
|
|
|
|
NOTE: Some of these rules should be folded into the "data_type"
|
|
|
|
|
variant which uses the data_type rule to match data type
|
|
|
|
|
declarations. That some rules do not use the data_type production
|
|
|
|
|
is a consequence of legacy. */
|
|
|
|
|
|
|
|
|
|
tf_port_item /* IEEE1800-2005: A.2.7 */
|
|
|
|
|
|
|
|
|
|
: port_direction K_reg_opt unsigned_signed_opt range_opt IDENTIFIER range_opt tf_port_item_expr_opt
|
|
|
|
|
{ port_declaration_context.port_type = $1;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_LOGIC;
|
|
|
|
|
port_declaration_context.sign_flag = $3;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = copy_range($4);
|
|
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@5, $1, IVL_VT_LOGIC, $3,
|
|
|
|
|
$4, list_from_identifier($5));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if ($6) {
|
|
|
|
|
yyerror(@6, "sorry: Port variable dimensions not supported yet.");
|
|
|
|
|
delete $6;
|
|
|
|
|
}
|
|
|
|
|
if ($7) {
|
|
|
|
|
yyerror(@7, "sorry: Port default expressions not supported yet.");
|
|
|
|
|
delete $7;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| port_direction_opt bit_logic unsigned_signed_opt range_opt IDENTIFIER range_opt tf_port_item_expr_opt
|
|
|
|
|
{ port_declaration_context.port_type = $1;
|
|
|
|
|
port_declaration_context.var_type = $2;
|
|
|
|
|
port_declaration_context.sign_flag = $3;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = copy_range($4);
|
|
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@5, $1, $2, $3,
|
|
|
|
|
$4, list_from_identifier($5));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if ($6) {
|
|
|
|
|
yyerror(@6, "sorry: Port variable dimensions not supported yet.");
|
|
|
|
|
delete $6;
|
|
|
|
|
}
|
|
|
|
|
if ($7) {
|
|
|
|
|
yyerror(@7, "sorry: Port default expressions not supported yet.");
|
|
|
|
|
delete $7;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ports can be integer with a width of [31:0]. */
|
|
|
|
|
|
|
|
|
|
| port_direction_opt K_integer IDENTIFIER range_opt tf_port_item_expr_opt
|
|
|
|
|
{ list<PExpr*>*range_stub = make_range_from_width(integer_width);
|
|
|
|
|
port_declaration_context.port_type = $1;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_LOGIC;
|
|
|
|
|
port_declaration_context.sign_flag = true;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = copy_range(range_stub);
|
|
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@3, $1, IVL_VT_LOGIC, true,
|
|
|
|
|
range_stub,
|
|
|
|
|
list_from_identifier($3), true);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if ($4) {
|
|
|
|
|
yyerror(@4, "sorry: Port variable dimensions not supported yet.");
|
|
|
|
|
delete $4;
|
|
|
|
|
}
|
|
|
|
|
if ($5) {
|
|
|
|
|
yyerror(@5, "sorry: Port default expressions not supported yet.");
|
|
|
|
|
delete $5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ports can be time with a width of [63:0] (unsigned). */
|
|
|
|
|
|
|
|
|
|
| port_direction_opt K_time IDENTIFIER range_opt tf_port_item_expr_opt
|
|
|
|
|
{ list<PExpr*>*range_stub = make_range_from_width(64);
|
|
|
|
|
port_declaration_context.port_type = $1;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_LOGIC;
|
|
|
|
|
port_declaration_context.sign_flag = false;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = copy_range(range_stub);
|
|
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@3, $1, IVL_VT_LOGIC, false,
|
|
|
|
|
range_stub,
|
|
|
|
|
list_from_identifier($3));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if ($4) {
|
|
|
|
|
yyerror(@4, "sorry: Port variable dimensions not supported yet.");
|
|
|
|
|
delete $4;
|
|
|
|
|
}
|
|
|
|
|
if ($5) {
|
|
|
|
|
yyerror(@5, "sorry: Port default expressions not supported yet.");
|
|
|
|
|
delete $5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ports can be real or realtime. */
|
|
|
|
|
|
|
|
|
|
| port_direction_opt real_or_realtime IDENTIFIER range_opt tf_port_item_expr_opt
|
|
|
|
|
{ port_declaration_context.port_type = $1;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_REAL;
|
|
|
|
|
port_declaration_context.sign_flag = false;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = 0;
|
|
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@3, $1, IVL_VT_REAL, false,
|
|
|
|
|
0, list_from_identifier($3));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if ($4) {
|
|
|
|
|
yyerror(@4, "sorry: Port variable dimensions not supported yet.");
|
|
|
|
|
delete $4;
|
|
|
|
|
}
|
|
|
|
|
if ($5) {
|
|
|
|
|
yyerror(@5, "sorry: Port default expressions not supported yet.");
|
|
|
|
|
delete $5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| port_direction_opt data_type IDENTIFIER range_opt tf_port_item_expr_opt
|
|
|
|
|
{ port_declaration_context.port_type = $1;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_NO_TYPE;
|
|
|
|
|
port_declaration_context.sign_flag = false;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = 0;
|
|
|
|
|
port_declaration_context.data_type = $2;
|
|
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@3, $1, $2,
|
|
|
|
|
list_from_identifier($3));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if ($4) {
|
|
|
|
|
yyerror(@4, "sorry: Port variable dimensions not supported yet.");
|
|
|
|
|
delete $4;
|
|
|
|
|
}
|
|
|
|
|
if ($5) {
|
|
|
|
|
yyerror(@5, "sorry: Port default expressions not supported yet.");
|
|
|
|
|
delete $5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* This rule matches the [ = <expression> ] part of the tf_port_item rules. */
|
|
|
|
|
|
|
|
|
|
tf_port_item_expr_opt
|
|
|
|
|
: '=' expression { $$ = $2; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
tf_port_list /* IEEE1800-2005: A.2.7 */
|
|
|
|
|
|
|
|
|
|
: tf_port_list ',' tf_port_item
|
|
|
|
|
{ svector<PWire*>*tmp;
|
|
|
|
|
if ($3) {
|
|
|
|
|
tmp = new svector<PWire*>(*$1, *$3);
|
|
|
|
|
delete $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
} else {
|
|
|
|
|
tmp = $1;
|
|
|
|
|
}
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| tf_port_item
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
|
|
|
|
|
/* This rule handles the special case of a set of port items leading
|
|
|
|
|
an undecorated identifier. Undeconated identifiers in this case
|
|
|
|
|
pick up the details from the list to its lift. */
|
|
|
|
|
|
|
|
|
|
| tf_port_list ',' IDENTIFIER
|
|
|
|
|
{ // The declaration is already parsed, apply it to IDENTIFIER
|
|
|
|
|
svector<PWire*>*new_decl;
|
|
|
|
|
if (port_declaration_context.var_type == IVL_VT_NO_TYPE) {
|
|
|
|
|
assert(port_declaration_context.data_type);
|
|
|
|
|
new_decl = pform_make_task_ports(@3, port_declaration_context.port_type,
|
|
|
|
|
port_declaration_context.data_type,
|
|
|
|
|
list_from_identifier($3));
|
|
|
|
|
} else {
|
|
|
|
|
new_decl = pform_make_task_ports(@3, port_declaration_context.port_type,
|
|
|
|
|
port_declaration_context.var_type,
|
|
|
|
|
port_declaration_context.sign_flag,
|
|
|
|
|
copy_range(port_declaration_context.range),
|
|
|
|
|
list_from_identifier($3));
|
|
|
|
|
}
|
|
|
|
|
svector<PWire*>*tmp = new svector<PWire*>(*$1, *new_decl);
|
|
|
|
|
delete $1;
|
|
|
|
|
delete new_decl;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Rules to handle some errors in tf_port_list items. */
|
|
|
|
|
|
|
|
|
|
| error ',' tf_port_item
|
|
|
|
|
{ yyerror(@2, "error: Syntax error in task/function port declaration.");
|
|
|
|
|
$$ = $3;
|
|
|
|
|
}
|
|
|
|
|
| tf_port_list ','
|
|
|
|
|
{ yyerror(@2, "error: NULL port declarations are not allowed.");
|
|
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
| tf_port_list ';'
|
|
|
|
|
{ yyerror(@2, "error: ';' is an invalid port declaration separator.");
|
|
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
variable_dimension /* IEEE1800-2005: A.2.5 */
|
|
|
|
|
: '[' expression ':' expression ']'
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($2);
|
|
|
|
|
tmp->push_back($4);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '[' ']'
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back(0);
|
|
|
|
|
tmp->push_back(0);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
/* Verilog-2001 supports attribute lists, which can be attached to a
|
|
|
|
|
variety of different objects. The syntax inside the (* *) is a
|
|
|
|
|
comma separated list of names or names with assigned values. */
|
|
|
|
|
attribute_list_opt
|
2011-02-25 02:37:56 +01:00
|
|
|
: attribute_instance_list
|
2002-05-23 05:08:50 +02:00
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2011-02-25 02:37:56 +01:00
|
|
|
attribute_instance_list
|
|
|
|
|
: K_PSTAR K_STARP { $$ = 0; }
|
|
|
|
|
| K_PSTAR attribute_list K_STARP { $$ = $2; }
|
|
|
|
|
| attribute_instance_list K_PSTAR K_STARP { $$ = $1; }
|
|
|
|
|
| attribute_instance_list K_PSTAR attribute_list K_STARP
|
|
|
|
|
{ list<named_pexpr_t>*tmp = $1;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
tmp->splice(tmp->end(), *$3);
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
} else $$ = $3;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
attribute_list
|
2010-11-13 03:47:06 +01:00
|
|
|
: attribute_list ',' attribute
|
|
|
|
|
{ list<named_pexpr_t>*tmp = $1;
|
|
|
|
|
tmp->push_back(*$3);
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute
|
|
|
|
|
{ list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
|
|
|
|
|
tmp->push_back(*$1);
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
2002-05-23 05:08:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
attribute
|
|
|
|
|
: IDENTIFIER
|
|
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp->name = lex_strings.make($1);
|
2002-05-23 05:08:50 +02:00
|
|
|
tmp->parm = 0;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2002-05-23 05:08:50 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| IDENTIFIER '=' expression
|
|
|
|
|
{ PExpr*tmp = $3;
|
|
|
|
|
named_pexpr_t*tmp2 = new named_pexpr_t;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp2->name = lex_strings.make($1);
|
2002-05-23 05:08:50 +02:00
|
|
|
tmp2->parm = tmp;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2002-05-23 05:08:50 +02:00
|
|
|
$$ = tmp2;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
1999-09-30 03:22:37 +02:00
|
|
|
/* 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. */
|
2005-07-07 18:22:49 +02:00
|
|
|
|
1999-06-24 06:24:18 +02:00
|
|
|
block_item_decl
|
2005-07-07 18:22:49 +02:00
|
|
|
: attribute_list_opt K_reg
|
2010-10-20 04:34:17 +02:00
|
|
|
primitive_type_opt unsigned_signed_opt range
|
2005-07-07 18:22:49 +02:00
|
|
|
register_variable_list ';'
|
|
|
|
|
{ ivl_variable_type_t dtype = $3;
|
|
|
|
|
if (dtype == IVL_VT_NO_TYPE)
|
|
|
|
|
dtype = IVL_VT_LOGIC;
|
|
|
|
|
pform_set_net_range($6, $5, $4, dtype);
|
2004-09-14 20:24:56 +02:00
|
|
|
if ($1) delete $1;
|
1999-09-10 07:02:09 +02:00
|
|
|
}
|
2005-07-07 18:22:49 +02:00
|
|
|
|
|
|
|
|
/* This differs from the above pattern only in the absence of the
|
|
|
|
|
range. This is the rule for a scalar. */
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt K_reg
|
2010-10-20 04:34:17 +02:00
|
|
|
primitive_type_opt unsigned_signed_opt
|
2005-07-07 18:22:49 +02:00
|
|
|
register_variable_list ';'
|
|
|
|
|
{ ivl_variable_type_t dtype = $3;
|
|
|
|
|
if (dtype == IVL_VT_NO_TYPE)
|
|
|
|
|
dtype = IVL_VT_LOGIC;
|
|
|
|
|
pform_set_net_range($5, 0, $4, dtype);
|
2004-09-14 20:24:56 +02:00
|
|
|
if ($1) delete $1;
|
2000-04-02 06:25:39 +02:00
|
|
|
}
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2011-06-28 17:43:21 +02:00
|
|
|
| attribute_list_opt K_bit unsigned_signed_opt range_opt
|
|
|
|
|
register_variable_list ';'
|
|
|
|
|
{
|
|
|
|
|
pform_set_net_range($5, $4, $3, IVL_VT_BOOL);
|
|
|
|
|
if ($1) delete $1;
|
|
|
|
|
}
|
2011-06-28 15:59:02 +02:00
|
|
|
|
|
|
|
|
| attribute_list_opt K_logic unsigned_signed_opt range_opt
|
|
|
|
|
register_variable_list ';'
|
|
|
|
|
{
|
|
|
|
|
pform_set_net_range($5, $4, $3, IVL_VT_LOGIC);
|
|
|
|
|
if ($1) delete $1;
|
|
|
|
|
}
|
2010-10-02 19:13:11 +02:00
|
|
|
/* Integer atom declarations are simpler in that they do not have
|
|
|
|
|
all the trappings of a general variable declaration. All of that
|
|
|
|
|
is implicit in the "integer" of the declaration. */
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2010-10-19 04:23:02 +02:00
|
|
|
| attribute_list_opt K_integer signed_unsigned_opt register_variable_list ';'
|
|
|
|
|
{ pform_set_reg_integer($4);
|
2010-10-02 19:13:11 +02:00
|
|
|
if ($1) delete $1;
|
|
|
|
|
}
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2010-10-02 19:13:11 +02:00
|
|
|
| attribute_list_opt K_time register_variable_list ';'
|
|
|
|
|
{ pform_set_reg_time($3);
|
|
|
|
|
if ($1) delete $1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-09 02:51:18 +01:00
|
|
|
/* variable declarations. Note that data_type can be 0 if we are
|
|
|
|
|
recovering from an error. */
|
2011-12-04 02:16:01 +01:00
|
|
|
|
2012-01-08 00:37:30 +01:00
|
|
|
| attribute_list_opt data_type register_variable_list ';'
|
2012-01-09 02:51:18 +01:00
|
|
|
{ if ($2) pform_set_data_type(@2, $2, $3);
|
2011-12-04 02:16:01 +01:00
|
|
|
if ($1) delete $1;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-11 18:56:50 +02:00
|
|
|
/* real declarations are fairly simple as there is no range of
|
|
|
|
|
signed flag in the declaration. Create the real as a NetNet::REG
|
2008-06-12 19:04:29 +02:00
|
|
|
with real value. Note that real and realtime are interchangeable
|
2005-07-11 18:56:50 +02:00
|
|
|
in this context. */
|
|
|
|
|
|
2008-09-27 01:54:13 +02:00
|
|
|
| attribute_list_opt K_real real_variable_list ';'
|
|
|
|
|
{ delete $3; }
|
|
|
|
|
| attribute_list_opt K_realtime real_variable_list ';'
|
|
|
|
|
{ delete $3; }
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2008-09-17 22:25:59 +02:00
|
|
|
| K_event list_of_identifiers ';'
|
|
|
|
|
{ pform_make_events($2, @1.text, @1.first_line);
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-19 04:39:16 +02:00
|
|
|
| K_parameter parameter_assign_decl ';'
|
2004-08-26 06:02:03 +02:00
|
|
|
| K_localparam localparam_assign_decl ';'
|
2001-01-06 07:31:58 +01:00
|
|
|
|
2012-01-08 00:37:30 +01:00
|
|
|
/* Blocks can have type declarations. */
|
|
|
|
|
|
|
|
|
|
| type_declaration
|
|
|
|
|
|
2001-01-06 07:31:58 +01:00
|
|
|
/* Recover from errors that happen within variable lists. Use the
|
|
|
|
|
trailing semi-colon to resync the parser. */
|
|
|
|
|
|
2004-09-14 20:24:56 +02:00
|
|
|
| attribute_list_opt K_reg error ';'
|
|
|
|
|
{ yyerror(@2, "error: syntax error in reg variable list.");
|
2001-01-06 07:31:58 +01:00
|
|
|
yyerrok;
|
2004-09-14 20:24:56 +02:00
|
|
|
if ($1) delete $1;
|
2001-01-06 07:31:58 +01:00
|
|
|
}
|
2004-09-14 20:24:56 +02:00
|
|
|
| attribute_list_opt K_integer error ';'
|
|
|
|
|
{ yyerror(@2, "error: syntax error in integer variable list.");
|
2001-01-06 07:31:58 +01:00
|
|
|
yyerrok;
|
2004-09-14 20:24:56 +02:00
|
|
|
if ($1) delete $1;
|
2001-01-06 07:31:58 +01:00
|
|
|
}
|
2007-08-05 06:50:06 +02:00
|
|
|
| attribute_list_opt K_time error ';'
|
|
|
|
|
{ yyerror(@2, "error: syntax error in time variable list.");
|
2001-01-06 07:31:58 +01:00
|
|
|
yyerrok;
|
|
|
|
|
}
|
2007-08-05 06:50:06 +02:00
|
|
|
| attribute_list_opt K_real error ';'
|
|
|
|
|
{ yyerror(@2, "error: syntax error in real variable list.");
|
2001-01-06 07:31:58 +01:00
|
|
|
yyerrok;
|
|
|
|
|
}
|
2007-08-05 06:50:06 +02:00
|
|
|
| attribute_list_opt K_realtime error ';'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@2, "error: syntax error in realtime variable list.");
|
2001-01-06 07:31:58 +01:00
|
|
|
yyerrok;
|
|
|
|
|
}
|
2001-01-13 23:20:08 +01:00
|
|
|
| K_parameter error ';'
|
|
|
|
|
{ yyerror(@1, "error: syntax error in parameter list.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
| K_localparam error ';'
|
|
|
|
|
{ yyerror(@1, "error: syntax error localparam list.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
1999-06-24 06:24:18 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
block_item_decls
|
|
|
|
|
: block_item_decl
|
|
|
|
|
| block_item_decls block_item_decl
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
block_item_decls_opt
|
|
|
|
|
: block_item_decls
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
/* Type declarations are parsed here. The rule actions call pform
|
|
|
|
|
functions that add the declaration to the current lexical scope. */
|
2012-01-08 00:37:30 +01:00
|
|
|
type_declaration
|
|
|
|
|
: K_typedef data_type IDENTIFIER ';'
|
2012-01-09 02:51:18 +01:00
|
|
|
{ perm_string name = lex_strings.make($3);
|
|
|
|
|
pform_set_typedef(name, $2);
|
|
|
|
|
delete[]$3;
|
|
|
|
|
}
|
2012-02-19 19:29:50 +01:00
|
|
|
|
|
|
|
|
/* These are forward declarations... */
|
|
|
|
|
|
|
|
|
|
| K_typedef K_class IDENTIFIER ';'
|
|
|
|
|
{ yyerror(@1, "sorry: Class forward declarations not supported yet.") }
|
|
|
|
|
| K_typedef K_enum IDENTIFIER ';'
|
|
|
|
|
{ yyerror(@1, "sorry: Enum forward declarations not supported yet.") }
|
|
|
|
|
| K_typedef K_struct IDENTIFIER ';'
|
|
|
|
|
{ yyerror(@1, "sorry: Struct forward declarations not supported yet.") }
|
|
|
|
|
| K_typedef K_union IDENTIFIER ';'
|
|
|
|
|
{ yyerror(@1, "sorry: Union forward declarations not supported yet.") }
|
|
|
|
|
| K_typedef IDENTIFIER ';'
|
|
|
|
|
{ yyerror(@1, "sorry: Class forward declarations not supported yet.") }
|
2012-01-08 00:37:30 +01:00
|
|
|
;
|
|
|
|
|
|
2010-10-24 20:21:17 +02:00
|
|
|
/* The structure for an enumeration data type is the keyword "enum",
|
|
|
|
|
followed by the enumeration values in curly braces. Also allow
|
|
|
|
|
for an optional base type. The default base type is "int", but it
|
|
|
|
|
can be any of the integral or vector types. */
|
|
|
|
|
|
|
|
|
|
enum_data_type
|
|
|
|
|
: K_enum '{' enum_name_list '}'
|
|
|
|
|
{ enum_type_t*enum_type = new enum_type_t;
|
2012-01-08 00:37:30 +01:00
|
|
|
FILE_NAME(enum_type, @1);
|
2010-10-24 20:21:17 +02:00
|
|
|
enum_type->names .reset($3);
|
|
|
|
|
enum_type->base_type = IVL_VT_BOOL;
|
|
|
|
|
enum_type->signed_flag = true;
|
|
|
|
|
enum_type->range.reset( make_range_from_width(32) );
|
|
|
|
|
$$ = enum_type;
|
|
|
|
|
}
|
|
|
|
|
| K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}'
|
|
|
|
|
{ enum_type_t*enum_type = new enum_type_t;
|
2012-01-08 00:37:30 +01:00
|
|
|
FILE_NAME(enum_type, @1);
|
2010-10-24 20:21:17 +02:00
|
|
|
enum_type->names .reset($5);
|
|
|
|
|
enum_type->base_type = IVL_VT_BOOL;
|
|
|
|
|
enum_type->signed_flag = $3;
|
|
|
|
|
enum_type->range.reset( make_range_from_width($2) );
|
|
|
|
|
$$ = enum_type;
|
|
|
|
|
}
|
|
|
|
|
| K_enum K_integer signed_unsigned_opt '{' enum_name_list '}'
|
|
|
|
|
{ enum_type_t*enum_type = new enum_type_t;
|
2012-01-08 00:37:30 +01:00
|
|
|
FILE_NAME(enum_type, @1);
|
2010-10-24 20:21:17 +02:00
|
|
|
enum_type->names .reset($5);
|
|
|
|
|
enum_type->base_type = IVL_VT_LOGIC;
|
|
|
|
|
enum_type->signed_flag = $3;
|
|
|
|
|
enum_type->range.reset( make_range_from_width(integer_width) );
|
|
|
|
|
$$ = enum_type;
|
|
|
|
|
}
|
2011-09-01 23:29:40 +02:00
|
|
|
| K_enum K_logic unsigned_signed_opt range '{' enum_name_list '}'
|
2010-11-13 04:28:43 +01:00
|
|
|
{ enum_type_t*enum_type = new enum_type_t;
|
2012-01-08 00:37:30 +01:00
|
|
|
FILE_NAME(enum_type, @1);
|
2010-11-13 04:28:43 +01:00
|
|
|
enum_type->names .reset($6);
|
|
|
|
|
enum_type->base_type = IVL_VT_LOGIC;
|
2011-09-01 23:29:40 +02:00
|
|
|
enum_type->signed_flag = $3;
|
|
|
|
|
enum_type->range.reset( $4 );
|
2010-11-13 04:28:43 +01:00
|
|
|
$$ = enum_type;
|
|
|
|
|
}
|
2011-09-01 23:29:40 +02:00
|
|
|
| K_enum K_reg unsigned_signed_opt range '{' enum_name_list '}'
|
2010-11-13 04:28:43 +01:00
|
|
|
{ enum_type_t*enum_type = new enum_type_t;
|
2012-01-08 00:37:30 +01:00
|
|
|
FILE_NAME(enum_type, @1);
|
2010-11-13 04:28:43 +01:00
|
|
|
enum_type->names .reset($6);
|
|
|
|
|
enum_type->base_type = IVL_VT_LOGIC;
|
2011-09-01 23:29:40 +02:00
|
|
|
enum_type->signed_flag = $3;
|
|
|
|
|
enum_type->range.reset( $4 );
|
2010-11-13 04:28:43 +01:00
|
|
|
$$ = enum_type;
|
|
|
|
|
}
|
2011-09-01 23:29:40 +02:00
|
|
|
| K_enum K_bit unsigned_signed_opt range '{' enum_name_list '}'
|
2010-11-13 04:28:43 +01:00
|
|
|
{ enum_type_t*enum_type = new enum_type_t;
|
2012-01-08 00:37:30 +01:00
|
|
|
FILE_NAME(enum_type, @1);
|
2010-11-13 04:28:43 +01:00
|
|
|
enum_type->names .reset($6);
|
|
|
|
|
enum_type->base_type = IVL_VT_BOOL;
|
2011-09-01 23:29:40 +02:00
|
|
|
enum_type->signed_flag = $3;
|
|
|
|
|
enum_type->range.reset( $4 );
|
2010-11-13 04:28:43 +01:00
|
|
|
$$ = enum_type;
|
|
|
|
|
}
|
2010-10-24 20:21:17 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
enum_name_list
|
|
|
|
|
: enum_name
|
2010-11-10 06:05:47 +01:00
|
|
|
{ $$ = $1;
|
2010-10-24 20:21:17 +02:00
|
|
|
}
|
|
|
|
|
| enum_name_list ',' enum_name
|
2010-11-13 03:47:06 +01:00
|
|
|
{ list<named_pexpr_t>*lst = $1;
|
2010-11-10 06:05:47 +01:00
|
|
|
lst->splice(lst->end(), *$3);
|
2010-10-24 20:21:17 +02:00
|
|
|
delete $3;
|
|
|
|
|
$$ = lst;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2011-07-21 05:46:27 +02:00
|
|
|
pos_neg_number
|
|
|
|
|
: number
|
|
|
|
|
{ $$ = $1;
|
|
|
|
|
}
|
|
|
|
|
| '-' number
|
|
|
|
|
{ verinum tmp = v_not(*($2)) + verinum(1);
|
|
|
|
|
*($2) = tmp;
|
|
|
|
|
$$ = $2;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2010-10-24 20:21:17 +02:00
|
|
|
enum_name
|
|
|
|
|
: IDENTIFIER
|
|
|
|
|
{ perm_string name = lex_strings.make($1);
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = make_named_number(name);
|
|
|
|
|
}
|
2011-07-21 05:46:27 +02:00
|
|
|
| IDENTIFIER '[' pos_neg_number ']'
|
2010-11-10 06:05:47 +01:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
2011-07-21 05:46:27 +02:00
|
|
|
long count = check_enum_seq_value(@1, $3, false);
|
2010-11-10 06:05:47 +01:00
|
|
|
delete[]$1;
|
|
|
|
|
$$ = make_named_numbers(name, 0, count-1);
|
|
|
|
|
delete $3;
|
|
|
|
|
}
|
2011-07-21 05:46:27 +02:00
|
|
|
| IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']'
|
2010-11-10 06:05:47 +01:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
2011-07-21 05:46:27 +02:00
|
|
|
$$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
|
|
|
|
|
check_enum_seq_value(@1, $5, true));
|
2010-11-10 06:05:47 +01:00
|
|
|
delete[]$1;
|
|
|
|
|
delete $3;
|
|
|
|
|
delete $5;
|
|
|
|
|
}
|
2010-11-13 03:47:06 +01:00
|
|
|
| IDENTIFIER '=' expression
|
2010-10-24 20:21:17 +02:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
|
|
|
|
delete[]$1;
|
2010-11-13 03:47:06 +01:00
|
|
|
$$ = make_named_number(name, $3);
|
2010-10-24 20:21:17 +02:00
|
|
|
}
|
2011-07-21 05:46:27 +02:00
|
|
|
| IDENTIFIER '[' pos_neg_number ']' '=' expression
|
2010-11-10 06:05:47 +01:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
2011-07-21 05:46:27 +02:00
|
|
|
long count = check_enum_seq_value(@1, $3, false);
|
2010-11-10 06:05:47 +01:00
|
|
|
$$ = make_named_numbers(name, 0, count-1, $6);
|
|
|
|
|
delete[]$1;
|
|
|
|
|
delete $3;
|
|
|
|
|
}
|
2011-07-21 05:46:27 +02:00
|
|
|
| IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression
|
2010-11-10 06:05:47 +01:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
2011-07-21 05:46:27 +02:00
|
|
|
$$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
|
|
|
|
|
check_enum_seq_value(@1, $5, true), $8);
|
2010-11-10 06:05:47 +01:00
|
|
|
delete[]$1;
|
|
|
|
|
delete $3;
|
|
|
|
|
delete $5;
|
|
|
|
|
}
|
2010-10-24 20:21:17 +02:00
|
|
|
;
|
|
|
|
|
|
2011-12-04 02:16:01 +01:00
|
|
|
struct_data_type
|
|
|
|
|
: K_struct K_packed_opt '{' struct_union_member_list '}'
|
|
|
|
|
{ struct_type_t*tmp = new struct_type_t;
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
tmp->packed_flag = $2;
|
|
|
|
|
tmp->members .reset($4);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_struct K_packed_opt '{' error '}'
|
|
|
|
|
{ yyerror(@4, "error: Errors in struct/union member list.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
struct_type_t*tmp = new struct_type_t;
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
tmp->packed_flag = $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
struct_union_member_list
|
|
|
|
|
: struct_union_member_list struct_union_member
|
|
|
|
|
{ list<struct_member_t*>*tmp = $1;
|
|
|
|
|
tmp->push_back($2);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| struct_union_member
|
|
|
|
|
{ list<struct_member_t*>*tmp = new list<struct_member_t*>;
|
2011-12-11 19:28:04 +01:00
|
|
|
tmp->push_back($1);
|
2011-12-04 02:16:01 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
struct_union_member
|
|
|
|
|
: attribute_list_opt K_bit range_opt list_of_variable_decl_assignments ';'
|
|
|
|
|
{ struct_member_t*tmp = new struct_member_t;
|
|
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
tmp->type = IVL_VT_BOOL;
|
|
|
|
|
tmp->range .reset($3);
|
|
|
|
|
tmp->names .reset($4);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt K_logic range_opt list_of_variable_decl_assignments ';'
|
|
|
|
|
{ struct_member_t*tmp = new struct_member_t;
|
|
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
tmp->type = IVL_VT_LOGIC;
|
|
|
|
|
tmp->range .reset($3);
|
|
|
|
|
tmp->names .reset($4);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt atom2_type list_of_variable_decl_assignments ';'
|
|
|
|
|
{ struct_member_t*tmp = new struct_member_t;
|
|
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
tmp->type = IVL_VT_BOOL;
|
|
|
|
|
tmp->range .reset( make_range_from_width($2) );
|
|
|
|
|
tmp->names .reset($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1999-02-03 05:20:11 +01:00
|
|
|
case_item
|
2007-04-02 01:02:03 +02:00
|
|
|
: expression_list_proper ':' statement_or_null
|
1999-02-03 05:20:11 +01:00
|
|
|
{ PCase::Item*tmp = new PCase::Item;
|
1999-06-15 07:38:39 +02:00
|
|
|
tmp->expr = *$1;
|
1999-02-03 05:20:11 +01:00
|
|
|
tmp->stat = $3;
|
1999-06-15 07:38:39 +02:00
|
|
|
delete $1;
|
1999-02-03 05:20:11 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_default ':' statement_or_null
|
1999-02-03 05:20:11 +01:00
|
|
|
{ PCase::Item*tmp = new PCase::Item;
|
|
|
|
|
tmp->stat = $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_default statement_or_null
|
1999-02-03 05:20:11 +01:00
|
|
|
{ PCase::Item*tmp = new PCase::Item;
|
|
|
|
|
tmp->stat = $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| error ':' statement_or_null
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@2, "error: Incomprehensible case expression.");
|
1999-06-12 05:42:57 +02:00
|
|
|
yyerrok;
|
|
|
|
|
}
|
1999-02-03 05:20:11 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
case_items
|
|
|
|
|
: case_items case_item
|
1999-06-06 22:45:38 +02:00
|
|
|
{ svector<PCase::Item*>*tmp;
|
|
|
|
|
tmp = new svector<PCase::Item*>(*$1, $2);
|
|
|
|
|
delete $1;
|
1999-02-03 05:20:11 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| case_item
|
1999-06-06 22:45:38 +02:00
|
|
|
{ svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
|
|
|
|
|
(*tmp)[0] = $1;
|
1999-02-03 05:20:11 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1999-06-15 04:50:02 +02:00
|
|
|
charge_strength
|
|
|
|
|
: '(' K_small ')'
|
|
|
|
|
| '(' K_medium ')'
|
|
|
|
|
| '(' K_large ')'
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
charge_strength_opt
|
|
|
|
|
: charge_strength
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
1999-06-16 05:13:29 +02:00
|
|
|
defparam_assign
|
2008-01-25 22:34:51 +01:00
|
|
|
: hierarchy_identifier '=' expression
|
2008-10-04 16:30:34 +02:00
|
|
|
{ pform_set_defparam(*$1, $3);
|
1999-06-16 05:13:29 +02:00
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
defparam_assign_list
|
|
|
|
|
: defparam_assign
|
|
|
|
|
| range defparam_assign
|
2002-08-19 04:39:16 +02:00
|
|
|
{ yyerror(@1, "error: defparam may not include a range.");
|
1999-06-16 05:13:29 +02:00
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
| defparam_assign_list ',' defparam_assign
|
|
|
|
|
;
|
|
|
|
|
|
1999-12-31 04:24:30 +01:00
|
|
|
delay1
|
2000-01-02 02:59:52 +01:00
|
|
|
: '#' delay_value_simple
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($2);
|
1999-08-01 18:34:50 +02:00
|
|
|
$$ = tmp;
|
1999-05-30 05:12:56 +02:00
|
|
|
}
|
1999-12-31 18:39:00 +01:00
|
|
|
| '#' '(' delay_value ')'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($3);
|
1999-12-31 18:39:00 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-12-31 04:24:30 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
delay3
|
2000-01-02 02:59:52 +01:00
|
|
|
: '#' delay_value_simple
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($2);
|
1999-12-31 04:24:30 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '#' '(' delay_value ')'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($3);
|
1999-12-31 04:24:30 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '#' '(' delay_value ',' delay_value ')'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
tmp->push_back($5);
|
1999-12-31 04:24:30 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '#' '(' delay_value ',' delay_value ',' delay_value ')'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
tmp->push_back($5);
|
|
|
|
|
tmp->push_back($7);
|
1999-12-31 04:24:30 +01:00
|
|
|
$$ = tmp;
|
1999-05-30 05:12:56 +02:00
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1999-12-31 04:24:30 +01:00
|
|
|
delay3_opt
|
|
|
|
|
: delay3 { $$ = $1; }
|
|
|
|
|
| { $$ = 0; }
|
1999-05-30 05:12:56 +02:00
|
|
|
;
|
|
|
|
|
|
2006-09-23 06:57:19 +02:00
|
|
|
delay_value_list
|
2010-10-26 04:36:44 +02:00
|
|
|
: delay_value
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| delay_value_list ',' delay_value
|
|
|
|
|
{ list<PExpr*>*tmp = $1;
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
2006-09-23 06:57:19 +02:00
|
|
|
|
1999-05-30 05:12:56 +02:00
|
|
|
delay_value
|
2000-01-02 02:59:52 +01:00
|
|
|
: expression
|
|
|
|
|
{ PExpr*tmp = $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| expression ':' expression ':' expression
|
2000-07-29 19:58:20 +02:00
|
|
|
{ $$ = pform_select_mtm_expr($1, $3, $5); }
|
2000-01-02 02:59:52 +01:00
|
|
|
;
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2000-01-02 02:59:52 +01:00
|
|
|
|
|
|
|
|
delay_value_simple
|
2003-04-14 05:37:47 +02:00
|
|
|
: DEC_NUMBER
|
1999-05-30 05:12:56 +02:00
|
|
|
{ verinum*tmp = $1;
|
1999-03-16 05:44:45 +01:00
|
|
|
if (tmp == 0) {
|
1999-09-29 23:16:32 +02:00
|
|
|
yyerror(@1, "internal error: delay.");
|
1999-03-16 05:44:45 +01:00
|
|
|
$$ = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$$ = new PENumber(tmp);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME($$, @1);
|
1999-03-16 05:44:45 +01:00
|
|
|
}
|
2008-03-06 01:36:27 +01:00
|
|
|
based_size = 0;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2000-12-10 23:01:35 +01:00
|
|
|
| REALTIME
|
|
|
|
|
{ verireal*tmp = $1;
|
|
|
|
|
if (tmp == 0) {
|
|
|
|
|
yyerror(@1, "internal error: delay.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$$ = new PEFNumber(tmp);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME($$, @1);
|
2000-12-10 23:01:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
1999-05-30 05:12:56 +02:00
|
|
|
| IDENTIFIER
|
2007-05-24 06:07:11 +02:00
|
|
|
{ PEIdent*tmp = new PEIdent(lex_strings.make($1));
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-05-08 22:19:20 +02:00
|
|
|
$$ = tmp;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1999-05-20 06:31:45 +02:00
|
|
|
}
|
2011-07-05 19:11:56 +02:00
|
|
|
| TIME_LITERAL
|
2011-07-18 23:19:32 +02:00
|
|
|
{ int unit;
|
|
|
|
|
|
|
|
|
|
based_size = 0;
|
|
|
|
|
$$ = 0;
|
|
|
|
|
if ($1 == 0 || !get_time_unit($1, unit))
|
|
|
|
|
yyerror(@1, "internal error: delay.");
|
|
|
|
|
else {
|
|
|
|
|
double p = pow(10.0,
|
|
|
|
|
(double)(unit - pform_get_timeunit()));
|
|
|
|
|
double time = atof($1) * p;
|
|
|
|
|
|
|
|
|
|
verireal *v = new verireal(time);
|
|
|
|
|
$$ = new PEFNumber(v);
|
|
|
|
|
FILE_NAME($$, @1);
|
|
|
|
|
}
|
2011-07-05 19:11:56 +02:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
description
|
2008-05-10 19:37:33 +02:00
|
|
|
: module
|
|
|
|
|
| udp_primitive
|
2009-06-13 01:21:20 +02:00
|
|
|
| config_declaration
|
2008-05-10 19:37:33 +02:00
|
|
|
| nature_declaration
|
|
|
|
|
| discipline_declaration
|
|
|
|
|
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')'
|
|
|
|
|
{ perm_string tmp3 = lex_strings.make($3);
|
|
|
|
|
pform_set_type_attrib(tmp3, $5, $7);
|
2009-01-09 02:03:33 +01:00
|
|
|
delete[] $3;
|
|
|
|
|
delete[] $5;
|
2008-05-10 19:37:33 +02:00
|
|
|
}
|
2009-07-11 03:19:59 +02:00
|
|
|
| K_timeunit TIME_LITERAL ';'
|
|
|
|
|
{ pform_set_timeunit($2, false, false); }
|
|
|
|
|
| K_timeprecision TIME_LITERAL ';'
|
|
|
|
|
{ pform_set_timeprecision($2, false, false); }
|
2008-05-10 19:37:33 +02:00
|
|
|
;
|
|
|
|
|
|
2008-05-13 02:31:59 +02:00
|
|
|
/* The discipline and nature declarations used to take no ';' after
|
|
|
|
|
the identifier. The 2.3 LRM adds the ';', but since there are
|
|
|
|
|
programs written to the 2.1 and 2.2 standard that don't, we
|
|
|
|
|
choose to make the ';' optional in this context. */
|
|
|
|
|
optional_semicolon : ';' | ;
|
|
|
|
|
|
2008-05-10 19:37:33 +02:00
|
|
|
discipline_declaration
|
2008-05-13 02:31:59 +02:00
|
|
|
: K_discipline IDENTIFIER optional_semicolon
|
2008-05-11 21:00:11 +02:00
|
|
|
{ pform_start_discipline($2); }
|
|
|
|
|
discipline_items K_enddiscipline
|
|
|
|
|
{ pform_end_discipline(@1); delete[] $2; }
|
2008-05-10 19:37:33 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
discipline_items
|
|
|
|
|
: discipline_items discipline_item
|
|
|
|
|
| discipline_item
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
discipline_item
|
|
|
|
|
: K_domain K_discrete ';'
|
2008-11-02 17:10:41 +01:00
|
|
|
{ pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
|
2008-05-10 19:37:33 +02:00
|
|
|
| K_domain K_continuous ';'
|
2008-11-02 17:10:41 +01:00
|
|
|
{ pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
|
2008-05-10 19:37:33 +02:00
|
|
|
| K_potential IDENTIFIER ';'
|
2008-05-12 03:52:27 +02:00
|
|
|
{ pform_discipline_potential(@1, $2); delete[] $2; }
|
2008-05-10 19:37:33 +02:00
|
|
|
| K_flow IDENTIFIER ';'
|
2008-05-12 03:52:27 +02:00
|
|
|
{ pform_discipline_flow(@1, $2); delete[] $2; }
|
2008-05-10 19:37:33 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
nature_declaration
|
2008-05-13 02:31:59 +02:00
|
|
|
: K_nature IDENTIFIER optional_semicolon
|
2008-05-12 03:52:27 +02:00
|
|
|
{ pform_start_nature($2); }
|
2008-05-11 21:13:58 +02:00
|
|
|
nature_items
|
|
|
|
|
K_endnature
|
2008-05-12 03:52:27 +02:00
|
|
|
{ pform_end_nature(@1); delete[] $2; }
|
2008-05-10 19:37:33 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
nature_items
|
|
|
|
|
: nature_items nature_item
|
|
|
|
|
| nature_item
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
nature_item
|
|
|
|
|
: K_units '=' STRING ';'
|
|
|
|
|
{ delete[] $3; }
|
|
|
|
|
| K_abstol '=' expression ';'
|
|
|
|
|
| K_access '=' IDENTIFIER ';'
|
2008-05-12 03:52:27 +02:00
|
|
|
{ pform_nature_access(@1, $3); delete[] $3; }
|
2008-05-10 19:37:33 +02:00
|
|
|
| K_idt_nature '=' IDENTIFIER ';'
|
|
|
|
|
{ delete[] $3; }
|
|
|
|
|
| K_ddt_nature '=' IDENTIFIER ';'
|
|
|
|
|
{ delete[] $3; }
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2009-06-13 01:21:20 +02:00
|
|
|
config_declaration
|
|
|
|
|
: K_config IDENTIFIER ';'
|
|
|
|
|
K_design lib_cell_identifiers ';'
|
|
|
|
|
list_of_config_rule_statements
|
|
|
|
|
K_endconfig
|
|
|
|
|
{ cerr << @1 << ": sorry: config declarations are not supported and "
|
|
|
|
|
"will be skipped." << endl;
|
|
|
|
|
delete[] $2;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
lib_cell_identifiers
|
|
|
|
|
: /* The BNF implies this can be blank, but I'm not sure exactly what
|
|
|
|
|
* this means. */
|
|
|
|
|
| lib_cell_identifiers lib_cell_id
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
list_of_config_rule_statements
|
|
|
|
|
: /* config rules are optional. */
|
|
|
|
|
| list_of_config_rule_statements config_rule_statement
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
config_rule_statement
|
|
|
|
|
: K_default K_liblist list_of_libraries ';'
|
|
|
|
|
| K_instance hierarchy_identifier K_liblist list_of_libraries ';'
|
|
|
|
|
{ delete $2; }
|
|
|
|
|
| K_instance hierarchy_identifier K_use lib_cell_id opt_config ';'
|
|
|
|
|
{ delete $2; }
|
|
|
|
|
| K_cell lib_cell_id K_liblist list_of_libraries ';'
|
|
|
|
|
| K_cell lib_cell_id K_use lib_cell_id opt_config ';'
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
opt_config
|
|
|
|
|
: /* The use clause takse an optional :config. */
|
|
|
|
|
| ':' K_config
|
|
|
|
|
|
|
|
|
|
lib_cell_id
|
|
|
|
|
: IDENTIFIER
|
|
|
|
|
{ delete[] $1; }
|
|
|
|
|
| IDENTIFIER '.' IDENTIFIER
|
|
|
|
|
{ delete[] $1; delete[] $3; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
list_of_libraries
|
|
|
|
|
: /* A NULL library means use the parents cell library. */
|
|
|
|
|
| list_of_libraries IDENTIFIER
|
|
|
|
|
{ delete[] $2; }
|
|
|
|
|
|
1999-11-05 20:36:36 +01:00
|
|
|
drive_strength
|
|
|
|
|
: '(' dr_strength0 ',' dr_strength1 ')'
|
2000-05-06 17:41:56 +02:00
|
|
|
{ $$.str0 = $2.str0;
|
|
|
|
|
$$.str1 = $4.str1;
|
|
|
|
|
}
|
1999-11-05 20:36:36 +01:00
|
|
|
| '(' dr_strength1 ',' dr_strength0 ')'
|
2000-05-06 17:41:56 +02:00
|
|
|
{ $$.str0 = $4.str0;
|
|
|
|
|
$$.str1 = $2.str1;
|
|
|
|
|
}
|
1999-11-05 20:36:36 +01:00
|
|
|
| '(' dr_strength0 ',' K_highz1 ')'
|
2000-05-06 17:41:56 +02:00
|
|
|
{ $$.str0 = $2.str0;
|
2010-03-16 23:16:53 +01:00
|
|
|
$$.str1 = IVL_DR_HiZ;
|
2000-05-06 17:41:56 +02:00
|
|
|
}
|
1999-11-05 20:36:36 +01:00
|
|
|
| '(' dr_strength1 ',' K_highz0 ')'
|
2010-03-16 23:16:53 +01:00
|
|
|
{ $$.str0 = IVL_DR_HiZ;
|
2000-05-06 17:41:56 +02:00
|
|
|
$$.str1 = $2.str1;
|
|
|
|
|
}
|
1999-11-05 20:36:36 +01:00
|
|
|
| '(' K_highz1 ',' dr_strength0 ')'
|
2000-05-06 17:41:56 +02:00
|
|
|
{ $$.str0 = $4.str0;
|
2010-03-16 23:16:53 +01:00
|
|
|
$$.str1 = IVL_DR_HiZ;
|
2000-05-06 17:41:56 +02:00
|
|
|
}
|
1999-11-05 20:36:36 +01:00
|
|
|
| '(' K_highz0 ',' dr_strength1 ')'
|
2010-03-16 23:16:53 +01:00
|
|
|
{ $$.str0 = IVL_DR_HiZ;
|
2000-05-06 17:41:56 +02:00
|
|
|
$$.str1 = $4.str1;
|
|
|
|
|
}
|
1999-11-05 20:36:36 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
drive_strength_opt
|
2000-05-06 17:41:56 +02:00
|
|
|
: drive_strength { $$ = $1; }
|
2010-03-16 23:16:53 +01:00
|
|
|
| { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
|
1999-11-05 20:36:36 +01:00
|
|
|
;
|
|
|
|
|
|
2000-05-06 17:41:56 +02:00
|
|
|
dr_strength0
|
2010-03-16 23:16:53 +01:00
|
|
|
: K_supply0 { $$.str0 = IVL_DR_SUPPLY; }
|
|
|
|
|
| K_strong0 { $$.str0 = IVL_DR_STRONG; }
|
|
|
|
|
| K_pull0 { $$.str0 = IVL_DR_PULL; }
|
|
|
|
|
| K_weak0 { $$.str0 = IVL_DR_WEAK; }
|
2000-05-06 17:41:56 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
dr_strength1
|
2010-03-16 23:16:53 +01:00
|
|
|
: K_supply1 { $$.str1 = IVL_DR_SUPPLY; }
|
|
|
|
|
| K_strong1 { $$.str1 = IVL_DR_STRONG; }
|
|
|
|
|
| K_pull1 { $$.str1 = IVL_DR_PULL; }
|
|
|
|
|
| K_weak1 { $$.str1 = IVL_DR_WEAK; }
|
2000-05-06 17:41:56 +02:00
|
|
|
;
|
1999-11-05 20:36:36 +01:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
event_control
|
2008-01-25 22:34:51 +01:00
|
|
|
: '@' hierarchy_identifier
|
2002-11-02 04:27:51 +01:00
|
|
|
{ PEIdent*tmpi = new PEIdent(*$2);
|
2000-04-12 06:23:57 +02:00
|
|
|
PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
|
2000-04-01 21:31:57 +02:00
|
|
|
PEventStatement*tmps = new PEventStatement(tmpe);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmps, @1);
|
2000-04-01 21:31:57 +02:00
|
|
|
$$ = tmps;
|
2007-05-24 06:07:11 +02:00
|
|
|
delete $2;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
1999-09-30 00:56:31 +02:00
|
|
|
| '@' '(' event_expression_list ')'
|
1999-04-29 04:16:26 +02:00
|
|
|
{ PEventStatement*tmp = new PEventStatement(*$3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-04-29 04:16:26 +02:00
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '@' '(' error ')'
|
1999-09-29 23:16:32 +02:00
|
|
|
{ yyerror(@1, "error: Malformed event control expression.");
|
1999-04-29 04:16:26 +02:00
|
|
|
$$ = 0;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1999-09-30 00:56:31 +02:00
|
|
|
event_expression_list
|
|
|
|
|
: event_expression
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| event_expression_list K_or event_expression
|
|
|
|
|
{ svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
|
|
|
|
|
delete $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2000-04-15 21:51:30 +02:00
|
|
|
| event_expression_list ',' event_expression
|
|
|
|
|
{ svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
|
|
|
|
|
delete $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-09-30 00:56:31 +02:00
|
|
|
;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
event_expression
|
|
|
|
|
: K_posedge expression
|
2000-04-12 06:23:57 +02:00
|
|
|
{ PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-04-29 04:16:26 +02:00
|
|
|
svector<PEEvent*>*tl = new svector<PEEvent*>(1);
|
|
|
|
|
(*tl)[0] = tmp;
|
|
|
|
|
$$ = tl;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
|
|
|
|
| K_negedge expression
|
2000-04-12 06:23:57 +02:00
|
|
|
{ PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-04-29 04:16:26 +02:00
|
|
|
svector<PEEvent*>*tl = new svector<PEEvent*>(1);
|
|
|
|
|
(*tl)[0] = tmp;
|
|
|
|
|
$$ = tl;
|
|
|
|
|
}
|
|
|
|
|
| expression
|
2000-04-12 06:23:57 +02:00
|
|
|
{ PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-04-29 04:16:26 +02:00
|
|
|
svector<PEEvent*>*tl = new svector<PEEvent*>(1);
|
|
|
|
|
(*tl)[0] = tmp;
|
|
|
|
|
$$ = tl;
|
|
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
/* A branch probe expression applies a probe function (potential or
|
|
|
|
|
flow) to a branch. The branch may be implicit as a pair of nets
|
|
|
|
|
or explicit as a named branch. Elaboration will check that the
|
|
|
|
|
function name really is a nature attribute identifier. */
|
|
|
|
|
branch_probe_expression
|
|
|
|
|
: IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')'
|
2008-07-27 23:22:19 +02:00
|
|
|
{ $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
|
2008-05-11 21:00:11 +02:00
|
|
|
| IDENTIFIER '(' IDENTIFIER ')'
|
2008-07-27 23:22:19 +02:00
|
|
|
{ $$ = pform_make_branch_probe_expression(@1, $1, $3); }
|
2008-05-11 21:00:11 +02:00
|
|
|
;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
expression
|
|
|
|
|
: expr_primary
|
|
|
|
|
{ $$ = $1; }
|
2012-02-20 03:54:58 +01:00
|
|
|
| inc_or_dec_expression
|
|
|
|
|
{ $$ = $1; }
|
1999-05-20 06:31:45 +02:00
|
|
|
| '+' expr_primary %prec UNARY_PREC
|
1999-06-13 19:30:23 +02:00
|
|
|
{ $$ = $2; }
|
1999-05-20 06:31:45 +02:00
|
|
|
| '-' expr_primary %prec UNARY_PREC
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEUnary*tmp = new PEUnary('-', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-20 06:31:45 +02:00
|
|
|
}
|
|
|
|
|
| '~' expr_primary %prec UNARY_PREC
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEUnary*tmp = new PEUnary('~', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
1999-05-20 06:31:45 +02:00
|
|
|
| '&' expr_primary %prec UNARY_PREC
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEUnary*tmp = new PEUnary('&', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
1999-05-20 06:31:45 +02:00
|
|
|
| '!' expr_primary %prec UNARY_PREC
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEUnary*tmp = new PEUnary('!', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-03-15 03:43:32 +01:00
|
|
|
}
|
1999-05-20 06:31:45 +02:00
|
|
|
| '|' expr_primary %prec UNARY_PREC
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEUnary*tmp = new PEUnary('|', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-20 06:31:45 +02:00
|
|
|
}
|
|
|
|
|
| '^' expr_primary %prec UNARY_PREC
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEUnary*tmp = new PEUnary('^', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-20 06:31:45 +02:00
|
|
|
}
|
2009-05-20 18:14:39 +02:00
|
|
|
| '~' '&' expr_primary %prec UNARY_PREC
|
|
|
|
|
{ yyerror(@1, "error: '~' '&' is not a valid expression. "
|
|
|
|
|
"Please use operator '~&' instead.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
|
|
|
|
| '~' '|' expr_primary %prec UNARY_PREC
|
|
|
|
|
{ yyerror(@1, "error: '~' '|' is not a valid expression. "
|
|
|
|
|
"Please use operator '~|' instead.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
|
|
|
|
| '~' '^' expr_primary %prec UNARY_PREC
|
|
|
|
|
{ yyerror(@1, "error: '~' '^' is not a valid expression. "
|
|
|
|
|
"Please use operator '~^' instead.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
1999-06-13 19:30:23 +02:00
|
|
|
| K_NAND expr_primary %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('A', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-06-13 19:30:23 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_NOR expr_primary %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('N', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-06-13 19:30:23 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_NXOR expr_primary %prec UNARY_PREC
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('X', $2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-06-13 19:30:23 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2000-04-21 05:22:18 +02:00
|
|
|
| '!' error %prec UNARY_PREC
|
|
|
|
|
{ yyerror(@1, "error: Operand of unary ! "
|
|
|
|
|
"is not a primary expression.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
|
|
|
|
| '^' error %prec UNARY_PREC
|
|
|
|
|
{ yyerror(@1, "error: Operand of reduction ^ "
|
|
|
|
|
"is not a primary expression.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
| expression '^' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('^', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2006-07-31 05:50:17 +02:00
|
|
|
| expression K_POW expression
|
2008-11-28 23:40:25 +01:00
|
|
|
{ PEBinary*tmp = new PEBPower('p', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
2006-07-31 05:50:17 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-05-16 07:08:42 +02:00
|
|
|
| expression '*' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('*', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
|
|
|
|
| expression '/' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('/', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
|
|
|
|
| expression '%' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('%', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
| expression '+' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('+', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
1998-11-09 19:55:33 +01:00
|
|
|
| expression '-' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('-', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-09 19:55:33 +01:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
| expression '&' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('&', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
1999-03-15 03:43:32 +01:00
|
|
|
| expression '|' expression
|
1999-05-27 05:31:29 +02:00
|
|
|
{ PEBinary*tmp = new PEBinary('|', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-03-15 03:43:32 +01:00
|
|
|
}
|
2002-09-12 17:49:43 +02:00
|
|
|
| expression K_NAND expression
|
|
|
|
|
{ PEBinary*tmp = new PEBinary('A', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
2002-09-12 17:49:43 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-09-30 04:43:01 +02:00
|
|
|
| expression K_NOR expression
|
|
|
|
|
{ PEBinary*tmp = new PEBinary('O', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-09-30 04:43:01 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| expression K_NXOR expression
|
|
|
|
|
{ PEBinary*tmp = new PEBinary('X', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-09-30 04:43:01 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-05-08 22:19:20 +02:00
|
|
|
| expression '<' expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('<', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-08 22:19:20 +02:00
|
|
|
}
|
|
|
|
|
| expression '>' expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('>', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-08 22:19:20 +02:00
|
|
|
}
|
1999-05-16 07:08:42 +02:00
|
|
|
| expression K_LS expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBShift('l', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
|
|
|
|
| expression K_RS expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBShift('r', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
2003-06-18 05:55:18 +02:00
|
|
|
| expression K_RSS expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBShift('R', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
2003-06-18 05:55:18 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-07 18:05:05 +01:00
|
|
|
| expression K_EQ expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('e', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-07 18:05:05 +01:00
|
|
|
}
|
|
|
|
|
| expression K_CEQ expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('E', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-07 18:05:05 +01:00
|
|
|
}
|
1999-05-16 07:08:42 +02:00
|
|
|
| expression K_LE expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('L', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
|
|
|
|
| expression K_GE expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('G', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-05-16 07:08:42 +02:00
|
|
|
}
|
1998-11-07 18:05:05 +01:00
|
|
|
| expression K_NE expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('n', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-07 18:05:05 +01:00
|
|
|
}
|
|
|
|
|
| expression K_CNE expression
|
2006-10-30 06:44:49 +01:00
|
|
|
{ PEBinary*tmp = new PEBComp('N', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1998-11-07 18:05:05 +01:00
|
|
|
}
|
1999-03-15 03:43:32 +01:00
|
|
|
| expression K_LOR expression
|
2008-10-30 04:31:26 +01:00
|
|
|
{ PEBinary*tmp = new PEBLogic('o', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-03-15 03:43:32 +01:00
|
|
|
}
|
|
|
|
|
| expression K_LAND expression
|
2008-10-30 04:31:26 +01:00
|
|
|
{ PEBinary*tmp = new PEBLogic('a', $1, $3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-05-27 05:31:29 +02:00
|
|
|
$$ = tmp;
|
1999-03-15 03:43:32 +01:00
|
|
|
}
|
1999-05-20 06:31:45 +02:00
|
|
|
| expression '?' expression ':' expression
|
1999-06-10 06:03:52 +02:00
|
|
|
{ PETernary*tmp = new PETernary($1, $3, $5);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @2);
|
1999-06-10 06:03:52 +02:00
|
|
|
$$ = tmp;
|
1999-05-20 06:31:45 +02:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
2007-09-16 17:25:03 +02:00
|
|
|
expr_mintypmax
|
|
|
|
|
: expression
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| expression ':' expression ':' expression
|
|
|
|
|
{ switch (min_typ_max_flag) {
|
|
|
|
|
case MIN:
|
|
|
|
|
$$ = $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
delete $5;
|
|
|
|
|
break;
|
|
|
|
|
case TYP:
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = $3;
|
|
|
|
|
delete $5;
|
|
|
|
|
break;
|
|
|
|
|
case MAX:
|
|
|
|
|
delete $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = $5;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-11-21 20:07:40 +01:00
|
|
|
if (min_typ_max_warn > 0) {
|
2007-12-20 18:31:01 +01:00
|
|
|
cerr << $$->get_fileline() << ": warning: choosing ";
|
2007-11-21 20:07:40 +01:00
|
|
|
switch (min_typ_max_flag) {
|
|
|
|
|
case MIN:
|
|
|
|
|
cerr << "min";
|
|
|
|
|
break;
|
|
|
|
|
case TYP:
|
|
|
|
|
cerr << "typ";
|
|
|
|
|
break;
|
|
|
|
|
case MAX:
|
|
|
|
|
cerr << "max";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cerr << " expression." << endl;
|
|
|
|
|
min_typ_max_warn -= 1;
|
|
|
|
|
}
|
2007-09-16 17:25:03 +02:00
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-05-23 18:03:13 +02:00
|
|
|
/* Many contexts take a comma separated list of expressions. Null
|
|
|
|
|
expressions can happen anywhere in the list, so there are two
|
2007-04-02 01:02:03 +02:00
|
|
|
extra rules in expression_list_with_nuls for parsing and
|
|
|
|
|
installing those nulls.
|
|
|
|
|
|
|
|
|
|
The expression_list_proper rules do not allow null items in the
|
|
|
|
|
expression list, so can be used where nul expressions are not allowed. */
|
|
|
|
|
|
|
|
|
|
expression_list_with_nuls
|
2010-10-26 04:36:44 +02:00
|
|
|
: expression_list_with_nuls ',' expression
|
|
|
|
|
{ list<PExpr*>*tmp = $1;
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| expression
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back(0);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| expression_list_with_nuls ','
|
|
|
|
|
{ list<PExpr*>*tmp = $1;
|
|
|
|
|
tmp->push_back(0);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
2007-04-02 01:02:03 +02:00
|
|
|
expression_list_proper
|
2010-10-26 04:36:44 +02:00
|
|
|
: expression_list_proper ',' expression
|
|
|
|
|
{ list<PExpr*>*tmp = $1;
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| expression
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
expr_primary
|
2011-09-19 04:21:46 +02:00
|
|
|
: number
|
|
|
|
|
{ assert($1);
|
|
|
|
|
PENumber*tmp = new PENumber($1);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| REALTIME
|
|
|
|
|
{ PEFNumber*tmp = new PEFNumber($1);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| STRING
|
|
|
|
|
{ PEString*tmp = new PEString($1);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| SYSTEM_IDENTIFIER
|
|
|
|
|
{ perm_string tn = lex_strings.make($1);
|
|
|
|
|
PECallFunction*tmp = new PECallFunction(tn);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$1;
|
|
|
|
|
}
|
2006-02-02 03:43:57 +01:00
|
|
|
|
2008-01-25 22:34:51 +01:00
|
|
|
/* The hierarchy_identifier rule matches simple identifiers as well as
|
2007-05-24 06:07:11 +02:00
|
|
|
indexed arrays and part selects */
|
2005-10-04 06:09:25 +02:00
|
|
|
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier
|
2007-05-24 06:07:11 +02:00
|
|
|
{ PEIdent*tmp = new PEIdent(*$1);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2007-05-24 06:07:11 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
delete $1;
|
|
|
|
|
}
|
2005-10-04 06:09:25 +02:00
|
|
|
|
2008-01-29 21:19:59 +01:00
|
|
|
/* An identifier followed by an expression list in parentheses is a
|
2005-10-04 06:09:25 +02:00
|
|
|
function call. If a system identifier, then a system function
|
|
|
|
|
call. */
|
|
|
|
|
|
2008-05-04 03:05:51 +02:00
|
|
|
| hierarchy_identifier '(' expression_list_proper ')'
|
|
|
|
|
{ PECallFunction*tmp = new PECallFunction(*$1, *$3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| SYSTEM_IDENTIFIER '(' expression_list_proper ')'
|
|
|
|
|
{ perm_string tn = lex_strings.make($1);
|
|
|
|
|
PECallFunction*tmp = new PECallFunction(tn, *$3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2011-09-17 21:10:05 +02:00
|
|
|
| hierarchy_identifier '(' ')'
|
|
|
|
|
{ const vector<PExpr*> empty;
|
|
|
|
|
PECallFunction*tmp = new PECallFunction(*$1, empty);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if (!gn_system_verilog()) {
|
|
|
|
|
yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
|
2011-11-06 18:13:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| SYSTEM_IDENTIFIER '(' ')'
|
|
|
|
|
{ perm_string tn = lex_strings.make($1);
|
|
|
|
|
const vector<PExpr*>empty;
|
|
|
|
|
PECallFunction*tmp = new PECallFunction(tn, empty);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
if (!gn_system_verilog()) {
|
|
|
|
|
yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
|
2011-09-17 21:10:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
2008-05-04 03:05:51 +02:00
|
|
|
|
|
|
|
|
/* Many of the VAMS built-in functions are available as builtin
|
2008-06-10 18:02:24 +02:00
|
|
|
functions with $system_function equivalents. */
|
2008-05-04 03:05:51 +02:00
|
|
|
|
|
|
|
|
| K_acos '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$acos");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_acosh '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$acosh");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_asin '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$asin");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_asinh '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$asinh");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_atan '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$atan");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_atanh '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$atanh");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_atan2 '(' expression ',' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$atan2");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3, $5);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_ceil '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$ceil");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_cos '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$cos");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_cosh '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$cosh");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_exp '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$exp");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_floor '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$floor");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_hypot '(' expression ',' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$hypot");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3, $5);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_ln '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$ln");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_log '(' expression ')'
|
2008-05-04 03:29:52 +02:00
|
|
|
{ perm_string tn = perm_string::literal("$log10");
|
2008-05-04 03:05:51 +02:00
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_pow '(' expression ',' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$pow");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3, $5);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_sin '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$sin");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_sinh '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$sinh");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_sqrt '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$sqrt");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_tan '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$tan");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_tanh '(' expression ')'
|
|
|
|
|
{ perm_string tn = perm_string::literal("$tanh");
|
|
|
|
|
PECallFunction*tmp = make_call_function(tn, $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2005-10-04 06:09:25 +02:00
|
|
|
|
2008-05-04 06:54:42 +02:00
|
|
|
/* These mathematical functions are conveniently expressed as unary
|
|
|
|
|
and binary expressions. They behave much like unary/binary
|
|
|
|
|
operators, even though they are parsed as functions. */
|
|
|
|
|
|
|
|
|
|
| K_abs '(' expression ')'
|
|
|
|
|
{ PEUnary*tmp = new PEUnary('m', $3);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_max '(' expression ',' expression ')'
|
|
|
|
|
{ PEBinary*tmp = new PEBinary('M', $3, $5);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_min '(' expression ',' expression ')'
|
|
|
|
|
{ PEBinary*tmp = new PEBinary('m', $3, $5);
|
|
|
|
|
FILE_NAME(tmp,@1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-04 06:09:25 +02:00
|
|
|
/* Parenthesized expressions are primaries. */
|
|
|
|
|
|
2011-09-19 04:21:46 +02:00
|
|
|
| '(' expr_mintypmax ')'
|
|
|
|
|
{ $$ = $2; }
|
2005-10-04 06:09:25 +02:00
|
|
|
|
|
|
|
|
/* Various kinds of concatenation expressions. */
|
|
|
|
|
|
2011-09-19 04:21:46 +02:00
|
|
|
| '{' expression_list_proper '}'
|
|
|
|
|
{ PEConcat*tmp = new PEConcat(*$2);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '{' expression '{' expression_list_proper '}' '}'
|
|
|
|
|
{ PExpr*rep = $2;
|
|
|
|
|
PEConcat*tmp = new PEConcat(*$4, rep);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $4;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '{' expression '{' expression_list_proper '}' error '}'
|
|
|
|
|
{ PExpr*rep = $2;
|
|
|
|
|
PEConcat*tmp = new PEConcat(*$4, rep);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $4;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
yyerror(@5, "error: Syntax error between internal '}' "
|
|
|
|
|
"and closing '}' of repeat concatenation.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Cast expressions are primaries */
|
|
|
|
|
|
|
|
|
|
| DEC_NUMBER '\'' '(' expression ')'
|
|
|
|
|
{ PExpr*base = $4;
|
|
|
|
|
if (gn_system_verilog()) {
|
|
|
|
|
PECastSize*tmp = new PECastSize($1->as_ulong(), base);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
} else {
|
|
|
|
|
yyerror(@1, "error: Size cast requires SystemVerilog.");
|
|
|
|
|
$$ = base;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-20 02:31:15 +01:00
|
|
|
|
|
|
|
|
/* Aggregate literals are primaries. */
|
|
|
|
|
|
|
|
|
|
| assignment_pattern
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
|
2011-09-19 04:21:46 +02:00
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2008-04-19 06:33:03 +02:00
|
|
|
/* A function_item_list borrows the task_port_item run to match
|
|
|
|
|
declarations of ports. We check later to make sure there are no
|
|
|
|
|
output or inout ports actually used. */
|
1999-05-30 05:12:56 +02:00
|
|
|
function_item_list
|
|
|
|
|
: function_item
|
1999-07-31 21:14:47 +02:00
|
|
|
{ $$ = $1; }
|
1999-05-30 05:12:56 +02:00
|
|
|
| function_item_list function_item
|
1999-09-30 02:48:04 +02:00
|
|
|
{ if ($1 && $2) {
|
|
|
|
|
svector<PWire*>*tmp = new svector<PWire*>(*$1, *$2);
|
|
|
|
|
delete $1;
|
|
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
} else if ($1) {
|
|
|
|
|
$$ = $1;
|
|
|
|
|
} else {
|
|
|
|
|
$$ = $2;
|
|
|
|
|
}
|
1999-07-31 21:14:47 +02:00
|
|
|
}
|
1999-05-30 05:12:56 +02:00
|
|
|
;
|
|
|
|
|
|
2008-04-19 06:33:03 +02:00
|
|
|
function_item
|
|
|
|
|
: task_port_item
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| block_item_decl
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
1999-05-08 22:19:20 +02:00
|
|
|
/* 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. */
|
1998-11-04 00:28:49 +01:00
|
|
|
gate_instance
|
2007-04-02 01:02:03 +02:00
|
|
|
: IDENTIFIER '(' expression_list_with_nuls ')'
|
1998-11-04 00:28:49 +01:00
|
|
|
{ lgate*tmp = new lgate;
|
1999-08-02 01:25:51 +02:00
|
|
|
tmp->name = $1;
|
1998-11-04 00:28:49 +01:00
|
|
|
tmp->parms = $3;
|
1999-01-25 06:45:56 +01:00
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2000-05-23 18:03:13 +02:00
|
|
|
|
2007-04-02 01:02:03 +02:00
|
|
|
| IDENTIFIER range '(' expression_list_with_nuls ')'
|
1999-02-15 03:06:15 +01:00
|
|
|
{ lgate*tmp = new lgate;
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*rng = $2;
|
1999-08-02 01:25:51 +02:00
|
|
|
tmp->name = $1;
|
1999-02-15 03:06:15 +01:00
|
|
|
tmp->parms = $4;
|
2010-10-26 04:36:44 +02:00
|
|
|
tmp->range[0] = rng->front(); rng->pop_front();
|
|
|
|
|
tmp->range[1] = rng->front(); rng->pop_front();
|
|
|
|
|
assert(rng->empty());
|
1999-02-15 03:06:15 +01:00
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1999-02-15 03:06:15 +01:00
|
|
|
delete rng;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| '(' expression_list_with_nuls ')'
|
1998-11-04 00:28:49 +01:00
|
|
|
{ lgate*tmp = new lgate;
|
|
|
|
|
tmp->name = "";
|
|
|
|
|
tmp->parms = $2;
|
1999-01-25 06:45:56 +01:00
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2000-05-23 18:03:13 +02:00
|
|
|
|
2004-09-05 20:09:47 +02:00
|
|
|
/* Degenerate modules can have no ports. */
|
|
|
|
|
|
|
|
|
|
| IDENTIFIER range
|
|
|
|
|
{ lgate*tmp = new lgate;
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*rng = $2;
|
2004-09-05 20:09:47 +02:00
|
|
|
tmp->name = $1;
|
|
|
|
|
tmp->parms = 0;
|
2006-12-06 06:32:36 +01:00
|
|
|
tmp->parms_by_name = 0;
|
2010-10-26 04:36:44 +02:00
|
|
|
tmp->range[0] = rng->front(); rng->pop_front();
|
|
|
|
|
tmp->range[1] = rng->front(); rng->pop_front();
|
|
|
|
|
assert(rng->empty());
|
2004-09-05 20:09:47 +02:00
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2004-09-05 20:09:47 +02:00
|
|
|
delete rng;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-23 18:03:13 +02:00
|
|
|
/* Modules can also take ports by port-name expressions. */
|
|
|
|
|
|
1999-05-08 22:19:20 +02:00
|
|
|
| IDENTIFIER '(' port_name_list ')'
|
|
|
|
|
{ lgate*tmp = new lgate;
|
1999-08-02 01:25:51 +02:00
|
|
|
tmp->name = $1;
|
2006-12-06 06:32:36 +01:00
|
|
|
tmp->parms = 0;
|
1999-05-29 04:36:17 +02:00
|
|
|
tmp->parms_by_name = $3;
|
1999-05-08 22:19:20 +02:00
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1999-05-08 22:19:20 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2006-12-06 06:32:36 +01:00
|
|
|
|
|
|
|
|
| IDENTIFIER range '(' port_name_list ')'
|
|
|
|
|
{ lgate*tmp = new lgate;
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*rng = $2;
|
2006-12-06 06:32:36 +01:00
|
|
|
tmp->name = $1;
|
|
|
|
|
tmp->parms = 0;
|
|
|
|
|
tmp->parms_by_name = $4;
|
2010-10-26 04:36:44 +02:00
|
|
|
tmp->range[0] = rng->front(); rng->pop_front();
|
|
|
|
|
tmp->range[1] = rng->front(); rng->pop_front();
|
|
|
|
|
assert(rng->empty());
|
2006-12-06 06:32:36 +01:00
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2006-12-06 06:32:36 +01:00
|
|
|
delete rng;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-08-23 04:32:01 +02:00
|
|
|
|
|
|
|
|
| IDENTIFIER '(' error ')'
|
|
|
|
|
{ lgate*tmp = new lgate;
|
|
|
|
|
tmp->name = $1;
|
|
|
|
|
tmp->parms = 0;
|
|
|
|
|
tmp->parms_by_name = 0;
|
|
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
|
|
|
|
yyerror(@2, "error: Syntax error in instance port "
|
|
|
|
|
"expression(s).");
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| IDENTIFIER range '(' error ')'
|
|
|
|
|
{ lgate*tmp = new lgate;
|
|
|
|
|
tmp->name = $1;
|
|
|
|
|
tmp->parms = 0;
|
|
|
|
|
tmp->parms_by_name = 0;
|
|
|
|
|
tmp->file = @1.text;
|
|
|
|
|
tmp->lineno = @1.first_line;
|
|
|
|
|
yyerror(@3, "error: Syntax error in instance port "
|
|
|
|
|
"expression(s).");
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
gate_instance_list
|
|
|
|
|
: gate_instance_list ',' gate_instance
|
1999-05-06 06:37:17 +02:00
|
|
|
{ svector<lgate>*tmp1 = $1;
|
|
|
|
|
lgate*tmp2 = $3;
|
|
|
|
|
svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
|
|
|
|
|
delete tmp1;
|
|
|
|
|
delete tmp2;
|
|
|
|
|
$$ = out;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
|
|
|
|
| gate_instance
|
1999-05-06 06:37:17 +02:00
|
|
|
{ svector<lgate>*tmp = new svector<lgate>(1);
|
|
|
|
|
(*tmp)[0] = *$1;
|
1998-11-04 00:28:49 +01:00
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
gatetype
|
|
|
|
|
: K_and { $$ = PGBuiltin::AND; }
|
|
|
|
|
| K_nand { $$ = PGBuiltin::NAND; }
|
|
|
|
|
| K_or { $$ = PGBuiltin::OR; }
|
|
|
|
|
| K_nor { $$ = PGBuiltin::NOR; }
|
|
|
|
|
| K_xor { $$ = PGBuiltin::XOR; }
|
|
|
|
|
| K_xnor { $$ = PGBuiltin::XNOR; }
|
|
|
|
|
| K_buf { $$ = PGBuiltin::BUF; }
|
|
|
|
|
| K_bufif0 { $$ = PGBuiltin::BUFIF0; }
|
|
|
|
|
| K_bufif1 { $$ = PGBuiltin::BUFIF1; }
|
|
|
|
|
| K_not { $$ = PGBuiltin::NOT; }
|
|
|
|
|
| K_notif0 { $$ = PGBuiltin::NOTIF0; }
|
|
|
|
|
| K_notif1 { $$ = PGBuiltin::NOTIF1; }
|
2010-07-14 01:12:03 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
switchtype
|
|
|
|
|
: K_nmos { $$ = PGBuiltin::NMOS; }
|
1998-11-04 00:28:49 +01:00
|
|
|
| K_rnmos { $$ = PGBuiltin::RNMOS; }
|
|
|
|
|
| K_pmos { $$ = PGBuiltin::PMOS; }
|
|
|
|
|
| K_rpmos { $$ = PGBuiltin::RPMOS; }
|
|
|
|
|
| K_cmos { $$ = PGBuiltin::CMOS; }
|
|
|
|
|
| K_rcmos { $$ = PGBuiltin::RCMOS; }
|
|
|
|
|
| K_tran { $$ = PGBuiltin::TRAN; }
|
|
|
|
|
| K_rtran { $$ = PGBuiltin::RTRAN; }
|
|
|
|
|
| K_tranif0 { $$ = PGBuiltin::TRANIF0; }
|
|
|
|
|
| K_tranif1 { $$ = PGBuiltin::TRANIF1; }
|
|
|
|
|
| K_rtranif0 { $$ = PGBuiltin::RTRANIF0; }
|
|
|
|
|
| K_rtranif1 { $$ = PGBuiltin::RTRANIF1; }
|
|
|
|
|
;
|
|
|
|
|
|
2001-12-03 05:47:14 +01:00
|
|
|
|
|
|
|
|
/* A general identifier is a hierarchical name, with the right most
|
|
|
|
|
name the base of the identifier. This rule builds up a
|
2007-05-24 06:07:11 +02:00
|
|
|
hierarchical name from the left to the right, forming a list of
|
|
|
|
|
names. */
|
|
|
|
|
|
2008-01-25 22:34:51 +01:00
|
|
|
hierarchy_identifier
|
2007-05-24 06:07:11 +02:00
|
|
|
: IDENTIFIER
|
|
|
|
|
{ $$ = new pform_name_t;
|
|
|
|
|
$$->push_back(name_component_t(lex_strings.make($1)));
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2007-05-24 06:07:11 +02:00
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '.' IDENTIFIER
|
2007-05-24 06:07:11 +02:00
|
|
|
{ pform_name_t * tmp = $1;
|
|
|
|
|
tmp->push_back(name_component_t(lex_strings.make($3)));
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$3;
|
2007-05-24 06:07:11 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '[' expression ']'
|
2007-05-24 06:07:11 +02:00
|
|
|
{ pform_name_t * tmp = $1;
|
|
|
|
|
name_component_t&tail = tmp->back();
|
|
|
|
|
index_component_t itmp;
|
|
|
|
|
itmp.sel = index_component_t::SEL_BIT;
|
|
|
|
|
itmp.msb = $3;
|
|
|
|
|
tail.index.push_back(itmp);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '[' expression ':' expression ']'
|
2007-05-24 06:07:11 +02:00
|
|
|
{ pform_name_t * tmp = $1;
|
|
|
|
|
name_component_t&tail = tmp->back();
|
|
|
|
|
index_component_t itmp;
|
|
|
|
|
itmp.sel = index_component_t::SEL_PART;
|
|
|
|
|
itmp.msb = $3;
|
|
|
|
|
itmp.lsb = $5;
|
|
|
|
|
tail.index.push_back(itmp);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '[' expression K_PO_POS expression ']'
|
2007-05-24 06:07:11 +02:00
|
|
|
{ pform_name_t * tmp = $1;
|
|
|
|
|
name_component_t&tail = tmp->back();
|
|
|
|
|
index_component_t itmp;
|
|
|
|
|
itmp.sel = index_component_t::SEL_IDX_UP;
|
|
|
|
|
itmp.msb = $3;
|
|
|
|
|
itmp.lsb = $5;
|
|
|
|
|
tail.index.push_back(itmp);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '[' expression K_PO_NEG expression ']'
|
2007-05-24 06:07:11 +02:00
|
|
|
{ pform_name_t * tmp = $1;
|
|
|
|
|
name_component_t&tail = tmp->back();
|
|
|
|
|
index_component_t itmp;
|
|
|
|
|
itmp.sel = index_component_t::SEL_IDX_DO;
|
|
|
|
|
itmp.msb = $3;
|
|
|
|
|
itmp.lsb = $5;
|
|
|
|
|
tail.index.push_back(itmp);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
2006-02-02 03:43:57 +01:00
|
|
|
|
2002-05-20 01:37:28 +02:00
|
|
|
/* This is a list of identifiers. The result is a list of strings,
|
|
|
|
|
each one of the identifiers in the list. These are simple,
|
|
|
|
|
non-hierarchical names separated by ',' characters. */
|
|
|
|
|
list_of_identifiers
|
|
|
|
|
: IDENTIFIER
|
2006-05-11 05:26:57 +02:00
|
|
|
{ $$ = list_from_identifier($1); }
|
2002-05-20 01:37:28 +02:00
|
|
|
| list_of_identifiers ',' IDENTIFIER
|
2006-05-11 05:26:57 +02:00
|
|
|
{ $$ = list_from_identifier($1, $3); }
|
2002-05-20 01:37:28 +02:00
|
|
|
;
|
|
|
|
|
|
2009-05-14 18:32:15 +02:00
|
|
|
list_of_port_identifiers
|
|
|
|
|
: IDENTIFIER
|
|
|
|
|
{ $$ = make_port_list($1, 0); }
|
|
|
|
|
| IDENTIFIER '=' expression
|
|
|
|
|
{ $$ = make_port_list($1, $3); }
|
|
|
|
|
| list_of_port_identifiers ',' IDENTIFIER
|
|
|
|
|
{ $$ = make_port_list($1, $3, 0); }
|
|
|
|
|
| list_of_port_identifiers ',' IDENTIFIER '=' expression
|
|
|
|
|
{ $$ = make_port_list($1, $3, $5); }
|
|
|
|
|
;
|
|
|
|
|
|
2002-05-20 01:37:28 +02:00
|
|
|
|
|
|
|
|
/* The list_of_ports and list_of_port_declarations rules are the
|
2002-06-11 05:34:33 +02:00
|
|
|
port list formats for module ports. The list_of_ports_opt rule is
|
2002-05-20 01:37:28 +02:00
|
|
|
only used by the module start rule.
|
|
|
|
|
|
|
|
|
|
The first, the list_of_ports, is the 1364-1995 format, a list of
|
|
|
|
|
port names, including .name() syntax.
|
|
|
|
|
|
2002-06-11 05:34:33 +02:00
|
|
|
The list_of_port_declarations the 1364-2001 format, an in-line
|
2002-05-20 01:37:28 +02:00
|
|
|
declaration of the ports.
|
|
|
|
|
|
2002-06-11 05:34:33 +02:00
|
|
|
In both cases, the list_of_ports and list_of_port_declarations
|
2002-05-20 01:37:28 +02:00
|
|
|
returns an array of Module::port_t* items that include the name
|
|
|
|
|
of the port internally and externally. The actual creation of the
|
|
|
|
|
nets/variables is done in the declaration, whether internal to
|
|
|
|
|
the port list or in amongst the module items. */
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
list_of_ports
|
1999-09-17 04:06:25 +02:00
|
|
|
: port_opt
|
2008-11-03 05:08:38 +01:00
|
|
|
{ vector<Module::port_t*>*tmp
|
|
|
|
|
= new vector<Module::port_t*>(1);
|
1999-06-12 22:35:27 +02:00
|
|
|
(*tmp)[0] = $1;
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-09-17 04:06:25 +02:00
|
|
|
| list_of_ports ',' port_opt
|
2008-11-03 05:08:38 +01:00
|
|
|
{ vector<Module::port_t*>*tmp = $1;
|
|
|
|
|
tmp->push_back($3);
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2002-05-20 01:37:28 +02:00
|
|
|
list_of_port_declarations
|
|
|
|
|
: port_declaration
|
2008-11-03 05:08:38 +01:00
|
|
|
{ vector<Module::port_t*>*tmp
|
|
|
|
|
= new vector<Module::port_t*>(1);
|
2002-05-20 01:37:28 +02:00
|
|
|
(*tmp)[0] = $1;
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2002-05-20 01:37:28 +02:00
|
|
|
| list_of_port_declarations ',' port_declaration
|
2008-11-03 05:08:38 +01:00
|
|
|
{ vector<Module::port_t*>*tmp = $1;
|
|
|
|
|
tmp->push_back($3);
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2003-04-25 04:28:53 +02:00
|
|
|
| list_of_port_declarations ',' IDENTIFIER
|
|
|
|
|
{ Module::port_t*ptmp;
|
2008-02-25 04:40:54 +01:00
|
|
|
perm_string name = lex_strings.make($3);
|
|
|
|
|
ptmp = pform_module_port_reference(name, @3.text,
|
2003-04-25 04:28:53 +02:00
|
|
|
@3.first_line);
|
2008-11-03 05:08:38 +01:00
|
|
|
vector<Module::port_t*>*tmp = $1;
|
|
|
|
|
tmp->push_back(ptmp);
|
2003-04-25 04:28:53 +02:00
|
|
|
|
|
|
|
|
/* Get the port declaration details, the port type
|
|
|
|
|
and what not, from context data stored by the
|
|
|
|
|
last port_declaration rule. */
|
2008-02-25 04:40:54 +01:00
|
|
|
pform_module_define_port(@3, name,
|
2003-04-25 04:28:53 +02:00
|
|
|
port_declaration_context.port_type,
|
|
|
|
|
port_declaration_context.port_net_type,
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.var_type,
|
2003-04-25 04:28:53 +02:00
|
|
|
port_declaration_context.sign_flag,
|
2003-07-04 05:57:18 +02:00
|
|
|
port_declaration_context.range, 0);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$3;
|
2003-04-25 04:28:53 +02:00
|
|
|
$$ = tmp;
|
2003-02-08 00:16:09 +01:00
|
|
|
}
|
2007-12-29 08:47:20 +01:00
|
|
|
| list_of_port_declarations ','
|
|
|
|
|
{
|
|
|
|
|
yyerror(@2, "error: NULL port declarations are not "
|
|
|
|
|
"allowed.");
|
|
|
|
|
}
|
|
|
|
|
| list_of_port_declarations ';'
|
|
|
|
|
{
|
|
|
|
|
yyerror(@2, "error: ';' is an invalid port declaration "
|
|
|
|
|
"separator.");
|
|
|
|
|
}
|
2002-05-20 01:37:28 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
port_declaration
|
2008-02-25 04:40:54 +01:00
|
|
|
: attribute_list_opt
|
2010-10-20 04:34:17 +02:00
|
|
|
K_input net_type_opt primitive_type_opt unsigned_signed_opt range_opt IDENTIFIER
|
2008-02-25 04:40:54 +01:00
|
|
|
{ Module::port_t*ptmp;
|
2010-03-11 21:22:41 +01:00
|
|
|
perm_string name = lex_strings.make($7);
|
2008-02-25 04:40:54 +01:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::PINPUT,
|
2010-03-11 21:22:41 +01:00
|
|
|
$3, $4, $5, $6, $1);
|
2008-02-25 04:40:54 +01:00
|
|
|
port_declaration_context.port_type = NetNet::PINPUT;
|
|
|
|
|
port_declaration_context.port_net_type = $3;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.var_type = $4;
|
|
|
|
|
port_declaration_context.sign_flag = $5;
|
2008-04-25 22:48:14 +02:00
|
|
|
delete port_declaration_context.range;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.range = $6;
|
|
|
|
|
delete[]$7;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
K_input atom2_type signed_unsigned_opt IDENTIFIER
|
2010-10-19 04:23:02 +02:00
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($5);
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*use_range = make_range_from_width($3);
|
2010-10-19 04:23:02 +02:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::PINPUT,
|
|
|
|
|
NetNet::UNRESOLVED_WIRE, IVL_VT_BOOL,
|
2010-10-20 04:07:44 +02:00
|
|
|
$4, use_range, $1);
|
2010-10-19 04:23:02 +02:00
|
|
|
port_declaration_context.port_type = NetNet::PINPUT;
|
|
|
|
|
port_declaration_context.port_net_type = NetNet::UNRESOLVED_WIRE;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_BOOL;
|
|
|
|
|
port_declaration_context.sign_flag = $4;
|
|
|
|
|
delete port_declaration_context.range;
|
2010-10-20 04:07:44 +02:00
|
|
|
port_declaration_context.range = use_range;
|
2010-10-19 04:23:02 +02:00
|
|
|
delete[]$5;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2008-02-25 04:40:54 +01:00
|
|
|
| attribute_list_opt
|
2011-11-24 04:07:26 +01:00
|
|
|
K_input K_wreal IDENTIFIER
|
|
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($4);
|
|
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::PINPUT,
|
|
|
|
|
NetNet::WIRE, IVL_VT_REAL, true, 0, $1);
|
|
|
|
|
port_declaration_context.port_type = NetNet::PINPUT;
|
|
|
|
|
port_declaration_context.port_net_type = NetNet::WIRE;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_REAL;
|
|
|
|
|
port_declaration_context.sign_flag = true;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = 0;
|
|
|
|
|
delete[]$4;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt
|
|
|
|
|
K_inout net_type_opt primitive_type_opt unsigned_signed_opt range_opt IDENTIFIER
|
2008-02-25 04:40:54 +01:00
|
|
|
{ Module::port_t*ptmp;
|
2010-03-11 21:22:41 +01:00
|
|
|
perm_string name = lex_strings.make($7);
|
2008-02-25 04:40:54 +01:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::PINOUT,
|
2010-03-11 21:22:41 +01:00
|
|
|
$3, $4, $5, $6, $1);
|
2008-02-25 04:40:54 +01:00
|
|
|
port_declaration_context.port_type = NetNet::PINOUT;
|
|
|
|
|
port_declaration_context.port_net_type = $3;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.var_type = $4;
|
|
|
|
|
port_declaration_context.sign_flag = $5;
|
2008-04-25 22:48:14 +02:00
|
|
|
delete port_declaration_context.range;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.range = $6;
|
|
|
|
|
delete[]$7;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
K_inout K_wreal IDENTIFIER
|
|
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($4);
|
|
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::PINOUT,
|
|
|
|
|
NetNet::WIRE, IVL_VT_REAL, true, 0, $1);
|
|
|
|
|
port_declaration_context.port_type = NetNet::PINOUT;
|
|
|
|
|
port_declaration_context.port_net_type = NetNet::WIRE;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_REAL;
|
|
|
|
|
port_declaration_context.sign_flag = true;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = 0;
|
|
|
|
|
delete[]$4;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2008-02-25 04:40:54 +01:00
|
|
|
| attribute_list_opt
|
2010-10-20 04:34:17 +02:00
|
|
|
K_output net_type_opt primitive_type_opt unsigned_signed_opt range_opt IDENTIFIER
|
2008-02-25 04:40:54 +01:00
|
|
|
{ Module::port_t*ptmp;
|
2010-03-11 21:22:41 +01:00
|
|
|
perm_string name = lex_strings.make($7);
|
2008-02-25 04:40:54 +01:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
2011-11-26 02:18:27 +01:00
|
|
|
$3, $4, $5, $6, $1);
|
2008-02-25 04:40:54 +01:00
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
2011-11-26 02:18:27 +01:00
|
|
|
port_declaration_context.port_net_type = $3;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.var_type = $4;
|
|
|
|
|
port_declaration_context.sign_flag = $5;
|
2008-04-25 22:48:14 +02:00
|
|
|
delete port_declaration_context.range;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.range = $6;
|
|
|
|
|
delete[]$7;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt
|
2010-10-20 04:34:17 +02:00
|
|
|
K_output var_type primitive_type_opt unsigned_signed_opt range_opt IDENTIFIER
|
2008-02-25 04:40:54 +01:00
|
|
|
{ Module::port_t*ptmp;
|
2010-03-11 21:22:41 +01:00
|
|
|
perm_string name = lex_strings.make($7);
|
2008-02-25 04:40:54 +01:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
2010-03-11 21:22:41 +01:00
|
|
|
$3, $4, $5, $6, $1);
|
2008-02-25 04:40:54 +01:00
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
|
|
|
|
port_declaration_context.port_net_type = $3;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.var_type = $4;
|
|
|
|
|
port_declaration_context.sign_flag = $5;
|
2008-04-25 22:48:14 +02:00
|
|
|
delete port_declaration_context.range;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.range = $6;
|
|
|
|
|
delete[]$7;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt
|
2010-10-20 04:34:17 +02:00
|
|
|
K_output var_type primitive_type_opt unsigned_signed_opt range_opt IDENTIFIER '=' expression
|
2008-02-25 04:40:54 +01:00
|
|
|
{ Module::port_t*ptmp;
|
2010-03-11 21:22:41 +01:00
|
|
|
perm_string name = lex_strings.make($7);
|
2008-02-25 04:40:54 +01:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
2010-03-11 21:22:41 +01:00
|
|
|
$3, $4, $5, $6, $1);
|
2008-02-25 04:40:54 +01:00
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
|
|
|
|
port_declaration_context.port_net_type = $3;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.var_type = $4;
|
|
|
|
|
port_declaration_context.sign_flag = $5;
|
2008-04-25 22:48:14 +02:00
|
|
|
delete port_declaration_context.range;
|
2010-03-11 21:22:41 +01:00
|
|
|
port_declaration_context.range = $6;
|
2008-02-25 04:40:54 +01:00
|
|
|
|
2010-03-11 21:22:41 +01:00
|
|
|
pform_make_reginit(@7, name, $9);
|
2008-02-25 04:40:54 +01:00
|
|
|
|
2011-07-11 18:26:45 +02:00
|
|
|
delete[]$7;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt
|
|
|
|
|
K_output net_type_opt primitive_type_opt unsigned_signed_opt range_opt IDENTIFIER '=' expression
|
|
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($7);
|
2011-11-26 02:18:27 +01:00
|
|
|
NetNet::Type t = ($3 == NetNet::IMPLICIT) ? NetNet::IMPLICIT_REG : $3;
|
2011-07-11 18:26:45 +02:00
|
|
|
|
|
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
|
|
|
|
t, $4, $5, $6, $1);
|
|
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
|
|
|
|
port_declaration_context.port_net_type = t;
|
|
|
|
|
port_declaration_context.var_type = $4;
|
|
|
|
|
port_declaration_context.sign_flag = $5;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = $6;
|
|
|
|
|
|
|
|
|
|
pform_make_reginit(@7, name, $9);
|
|
|
|
|
|
2010-03-11 21:22:41 +01:00
|
|
|
delete[]$7;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
K_output atom2_type signed_unsigned_opt IDENTIFIER
|
2010-10-19 04:23:02 +02:00
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($5);
|
2010-10-26 04:36:44 +02:00
|
|
|
list<PExpr*>*use_range = make_range_from_width($3);
|
2010-10-19 04:23:02 +02:00
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
|
|
|
|
NetNet::IMPLICIT_REG, IVL_VT_BOOL,
|
2010-10-20 04:07:44 +02:00
|
|
|
$4, use_range, $1);
|
2010-10-19 04:23:02 +02:00
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
|
|
|
|
port_declaration_context.port_net_type = NetNet::IMPLICIT_REG;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_BOOL;
|
|
|
|
|
port_declaration_context.sign_flag = $4;
|
|
|
|
|
delete port_declaration_context.range;
|
2010-10-20 04:07:44 +02:00
|
|
|
port_declaration_context.range = use_range;
|
2010-10-19 04:23:02 +02:00
|
|
|
delete[]$5;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
K_output atom2_type signed_unsigned_opt IDENTIFIER '=' expression
|
2011-07-11 19:15:39 +02:00
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($5);
|
|
|
|
|
list<PExpr*>*use_range = make_range_from_width($3);
|
|
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
|
|
|
|
NetNet::IMPLICIT_REG, IVL_VT_BOOL,
|
|
|
|
|
$4, use_range, $1);
|
|
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
|
|
|
|
port_declaration_context.port_net_type = NetNet::IMPLICIT_REG;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_BOOL;
|
|
|
|
|
port_declaration_context.sign_flag = $4;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = use_range;
|
|
|
|
|
|
|
|
|
|
pform_make_reginit(@5, name, $7);
|
|
|
|
|
|
|
|
|
|
delete[]$5;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
K_output K_wreal IDENTIFIER
|
|
|
|
|
{ Module::port_t*ptmp;
|
|
|
|
|
perm_string name = lex_strings.make($4);
|
|
|
|
|
ptmp = pform_module_port_reference(name, @2.text,
|
|
|
|
|
@2.first_line);
|
|
|
|
|
pform_module_define_port(@2, name, NetNet::POUTPUT,
|
|
|
|
|
NetNet::WIRE, IVL_VT_REAL, true, 0, $1);
|
|
|
|
|
port_declaration_context.port_type = NetNet::POUTPUT;
|
|
|
|
|
port_declaration_context.port_net_type = NetNet::WIRE;
|
|
|
|
|
port_declaration_context.var_type = IVL_VT_REAL;
|
|
|
|
|
port_declaration_context.sign_flag = true;
|
|
|
|
|
delete port_declaration_context.range;
|
|
|
|
|
port_declaration_context.range = 0;
|
|
|
|
|
delete[]$4;
|
|
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
2008-02-25 04:40:54 +01:00
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2003-02-08 00:16:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
net_type_opt
|
|
|
|
|
: net_type { $$ = $1; }
|
|
|
|
|
| { $$ = NetNet::IMPLICIT; }
|
|
|
|
|
;
|
|
|
|
|
|
2010-10-02 19:13:11 +02:00
|
|
|
/*
|
|
|
|
|
* The signed_opt rule will return "true" if K_signed is present,
|
|
|
|
|
* for "false" otherwise. This rule corresponds to the declaration
|
|
|
|
|
* defaults for reg/bit/logic.
|
|
|
|
|
*
|
|
|
|
|
* The signed_unsigned_opt rule with match K_signed or K_unsigned
|
|
|
|
|
* and return true or false as appropriate. The default is
|
|
|
|
|
* "true". This corresponds to the declaration defaults for
|
|
|
|
|
* byte/shortint/int/longint.
|
|
|
|
|
*/
|
2010-10-20 04:34:17 +02:00
|
|
|
unsigned_signed_opt
|
|
|
|
|
: K_signed { $$ = true; }
|
|
|
|
|
| K_unsigned { $$ = false; }
|
|
|
|
|
| { $$ = false; }
|
2010-10-02 19:13:11 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
signed_unsigned_opt
|
|
|
|
|
: K_signed { $$ = true; }
|
|
|
|
|
| K_unsigned { $$ = false; }
|
|
|
|
|
| { $$ = true; }
|
|
|
|
|
;
|
2002-05-20 01:37:28 +02:00
|
|
|
|
2010-10-03 01:29:30 +02:00
|
|
|
/*
|
|
|
|
|
* In some places we can take any of the 4 2-value atom-type
|
|
|
|
|
* names. All the context needs to know if that type is its width.
|
|
|
|
|
*/
|
|
|
|
|
atom2_type
|
|
|
|
|
: K_byte { $$ = 8; }
|
|
|
|
|
| K_shortint { $$ = 16; }
|
|
|
|
|
| K_int { $$ = 32; }
|
|
|
|
|
| K_longint { $$ = 64; }
|
|
|
|
|
;
|
|
|
|
|
|
1999-05-07 06:26:49 +02:00
|
|
|
/* An lpvalue is the expression that can go on the left side of a
|
2006-02-02 03:43:57 +01:00
|
|
|
procedural assignment. This rule handles only procedural
|
2011-03-11 20:27:54 +01:00
|
|
|
assignments. It is more limited than the general expr_primary
|
2006-02-02 03:43:57 +01:00
|
|
|
rule to reflect the rules for assignment l-values. */
|
1999-05-07 06:26:49 +02:00
|
|
|
lpvalue
|
2012-02-19 19:29:50 +01:00
|
|
|
: hierarchy_identifier
|
|
|
|
|
{ PEIdent*tmp = new PEIdent(*$1);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| implicit_class_handle '.' hierarchy_identifier
|
|
|
|
|
{ yyerror(@1, "sorry: implicit class handles (this/super) not supported.");
|
|
|
|
|
PEIdent*tmp = new PEIdent(*$3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete $3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| '{' expression_list_proper '}'
|
|
|
|
|
{ PEConcat*tmp = new PEConcat(*$2);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2007-04-21 06:45:36 +02:00
|
|
|
|
|
|
|
|
/* Continuous assignments have a list of individual assignments. */
|
|
|
|
|
|
|
|
|
|
cont_assign
|
2010-10-26 04:36:44 +02:00
|
|
|
: lpvalue '=' expression
|
|
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($1);
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1999-08-27 17:08:37 +02:00
|
|
|
|
2007-04-21 06:45:36 +02:00
|
|
|
cont_assign_list
|
2010-10-26 04:36:44 +02:00
|
|
|
: cont_assign_list ',' cont_assign
|
|
|
|
|
{ list<PExpr*>*tmp = $1;
|
|
|
|
|
tmp->splice(tmp->end(), *$3);
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| cont_assign
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
;
|
1999-08-27 17:08:37 +02:00
|
|
|
|
2009-07-11 03:19:59 +02:00
|
|
|
/* We allow zero, one or two unique declarations. */
|
|
|
|
|
local_timeunit_prec_decl_opt
|
|
|
|
|
: /* Empty */
|
|
|
|
|
| local_timeunit_prec_decl
|
|
|
|
|
| local_timeunit_prec_decl local_timeunit_prec_decl
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* By setting the appropriate have_time???_decl we allow only
|
|
|
|
|
one declaration of each type in this module. */
|
|
|
|
|
local_timeunit_prec_decl
|
|
|
|
|
: K_timeunit TIME_LITERAL ';'
|
|
|
|
|
{ pform_set_timeunit($2, true, false);
|
|
|
|
|
have_timeunit_decl = true;
|
|
|
|
|
}
|
|
|
|
|
| K_timeprecision TIME_LITERAL ';'
|
|
|
|
|
{ pform_set_timeprecision($2, true, false);
|
|
|
|
|
have_timeprec_decl = true;
|
|
|
|
|
}
|
|
|
|
|
;
|
2002-05-20 01:37:28 +02:00
|
|
|
|
|
|
|
|
/* This is the global structure of a module. A module in a start
|
2002-06-11 05:34:33 +02:00
|
|
|
section, with optional ports, then an optional list of module
|
2002-05-20 01:37:28 +02:00
|
|
|
items, and finally an end marker. */
|
|
|
|
|
|
2012-02-18 19:02:54 +01:00
|
|
|
module
|
|
|
|
|
: attribute_list_opt module_start IDENTIFIER
|
|
|
|
|
{ pform_startmodule($3, @2.text, @2.first_line, $1); }
|
|
|
|
|
module_parameter_port_list_opt
|
|
|
|
|
module_port_list_opt
|
|
|
|
|
module_attribute_foreign ';'
|
|
|
|
|
{ pform_module_set_ports($6); }
|
|
|
|
|
local_timeunit_prec_decl_opt
|
|
|
|
|
{ have_timeunit_decl = true; // Every thing past here is
|
|
|
|
|
have_timeprec_decl = true; // a check!
|
|
|
|
|
pform_check_timeunit_prec();
|
|
|
|
|
}
|
|
|
|
|
module_item_list_opt
|
2012-02-19 19:29:50 +01:00
|
|
|
module_end
|
2012-02-18 19:02:54 +01:00
|
|
|
{ Module::UCDriveType ucd;
|
|
|
|
|
// The lexor detected `unconnected_drive directives and
|
|
|
|
|
// marked what it found in the uc_drive variable. Use that
|
|
|
|
|
// to generate a UCD flag for the module.
|
|
|
|
|
switch (uc_drive) {
|
|
|
|
|
case UCD_NONE:
|
|
|
|
|
default:
|
|
|
|
|
ucd = Module::UCD_NONE;
|
|
|
|
|
break;
|
|
|
|
|
case UCD_PULL0:
|
|
|
|
|
ucd = Module::UCD_PULL0;
|
|
|
|
|
break;
|
|
|
|
|
case UCD_PULL1:
|
|
|
|
|
ucd = Module::UCD_PULL1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// Check that program/endprogram and module/endmodule
|
|
|
|
|
// keywords match.
|
|
|
|
|
if ($2 != $13) {
|
|
|
|
|
switch ($2) {
|
|
|
|
|
case K_module:
|
|
|
|
|
yyerror(@13, "error: module not closed by endmodule.");
|
|
|
|
|
break;
|
|
|
|
|
case K_program:
|
|
|
|
|
yyerror(@13, "error: program not closed by endprogram.");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($2 == K_program) {
|
|
|
|
|
yyerror(@2, "sorry: Program blocks not supported yet.");
|
|
|
|
|
}
|
|
|
|
|
pform_endmodule($3, in_celldefine, ucd);
|
|
|
|
|
delete[]$3;
|
|
|
|
|
have_timeunit_decl = false; // We will allow decls again.
|
|
|
|
|
have_timeprec_decl = false;
|
|
|
|
|
}
|
2012-02-19 19:29:50 +01:00
|
|
|
endname_opt
|
|
|
|
|
{ // Last step: check any closing name. This is done late so
|
|
|
|
|
// that the parser can look ahead to detect the present
|
|
|
|
|
// endname_opt but still have the pform_endmodule() called
|
|
|
|
|
// early enough that the lexor can know we are outside the
|
|
|
|
|
// module.
|
|
|
|
|
if ($15 && (strcmp($3,$15) != 0)) {
|
|
|
|
|
yyerror(@15, "error: End name doesn't match module/program name");
|
|
|
|
|
}
|
|
|
|
|
if ($15) delete[]$15;
|
|
|
|
|
}
|
2012-02-18 19:02:54 +01:00
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2012-02-18 19:02:54 +01:00
|
|
|
/* Modules start with module/macromodule or program keyword, and end
|
|
|
|
|
with the endmodule or endprogram keyword. The syntax for modules
|
|
|
|
|
and programs is almost identical, so let semantics sort out the
|
|
|
|
|
differences. */
|
|
|
|
|
module_start
|
|
|
|
|
: K_module { $$ = K_module; }
|
|
|
|
|
| K_macromodule { $$ = K_module; }
|
|
|
|
|
| K_program { $$ = K_program; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
module_end
|
|
|
|
|
: K_endmodule { $$ = K_module; }
|
|
|
|
|
| K_endprogram { $$ = K_program; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
endname_opt
|
|
|
|
|
: ':' IDENTIFIER { $$ = $2; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
2001-06-23 02:31:06 +02:00
|
|
|
|
2009-02-24 01:37:34 +01:00
|
|
|
module_attribute_foreign
|
|
|
|
|
: K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP { $$ = 0; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2004-01-21 04:37:12 +01:00
|
|
|
module_port_list_opt
|
|
|
|
|
: '(' list_of_ports ')' { $$ = $2; }
|
|
|
|
|
| '(' list_of_port_declarations ')' { $$ = $2; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2008-01-29 21:19:59 +01:00
|
|
|
/* Module declarations include optional ANSI style module parameter
|
2003-12-19 06:15:04 +01:00
|
|
|
ports. These are simply advance ways to declare parameters, so
|
|
|
|
|
that the port declarations may use them. */
|
|
|
|
|
module_parameter_port_list_opt
|
|
|
|
|
:
|
|
|
|
|
| '#' '(' module_parameter_port_list ')'
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
module_parameter_port_list
|
|
|
|
|
: K_parameter parameter_assign
|
|
|
|
|
| module_parameter_port_list ',' parameter_assign
|
|
|
|
|
| module_parameter_port_list ',' K_parameter parameter_assign
|
|
|
|
|
;
|
2001-11-29 18:37:51 +01:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
module_item
|
2005-07-07 18:22:49 +02:00
|
|
|
|
|
|
|
|
/* This rule detects net declarations that possibly include a
|
|
|
|
|
primitive type, an optional vector range and signed flag. This
|
|
|
|
|
also includes an optional delay set. The values are then applied
|
|
|
|
|
to a list of names. If the primitive type is not specified, then
|
|
|
|
|
resort to the default type LOGIC. */
|
|
|
|
|
|
|
|
|
|
: attribute_list_opt net_type
|
2010-10-20 04:34:17 +02:00
|
|
|
primitive_type_opt unsigned_signed_opt range_opt
|
2005-07-07 18:22:49 +02:00
|
|
|
delay3_opt
|
2007-01-16 06:44:14 +01:00
|
|
|
net_variable_list ';'
|
2005-07-07 18:22:49 +02:00
|
|
|
|
|
|
|
|
{ ivl_variable_type_t dtype = $3;
|
|
|
|
|
if (dtype == IVL_VT_NO_TYPE)
|
|
|
|
|
dtype = IVL_VT_LOGIC;
|
|
|
|
|
pform_makewire(@2, $5, $4, $7, $2,
|
|
|
|
|
NetNet::NOT_A_PORT, dtype, $1);
|
|
|
|
|
if ($6 != 0) {
|
|
|
|
|
yyerror(@6, "sorry: net delays not supported.");
|
|
|
|
|
delete $6;
|
2002-05-24 06:36:23 +02:00
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt K_wreal delay3 net_variable_list ';'
|
|
|
|
|
{ pform_makewire(@2, 0, true, $4, NetNet::WIRE,
|
|
|
|
|
NetNet::NOT_A_PORT, IVL_VT_REAL, $1);
|
|
|
|
|
if ($3 != 0) {
|
|
|
|
|
yyerror(@3, "sorry: net delays not supported.");
|
|
|
|
|
delete $3;
|
|
|
|
|
}
|
|
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt K_wreal net_variable_list ';'
|
|
|
|
|
{ pform_makewire(@2, 0, true, $3, NetNet::WIRE,
|
|
|
|
|
NetNet::NOT_A_PORT, IVL_VT_REAL, $1);
|
|
|
|
|
delete $1;
|
2002-05-24 06:36:23 +02:00
|
|
|
}
|
2005-07-07 18:22:49 +02:00
|
|
|
|
|
|
|
|
/* Very similar to the rule above, but this takes a list of
|
|
|
|
|
net_decl_assigns, which are <name> = <expr> assignment
|
|
|
|
|
declarations. */
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt net_type
|
2010-10-20 04:34:17 +02:00
|
|
|
primitive_type_opt unsigned_signed_opt range_opt
|
2005-07-07 18:22:49 +02:00
|
|
|
delay3_opt net_decl_assigns ';'
|
|
|
|
|
|
|
|
|
|
{ ivl_variable_type_t dtype = $3;
|
|
|
|
|
if (dtype == IVL_VT_NO_TYPE)
|
|
|
|
|
dtype = IVL_VT_LOGIC;
|
|
|
|
|
pform_makewire(@2, $5, $4, $6,
|
|
|
|
|
str_strength, $7, $2, dtype);
|
2002-05-24 06:36:23 +02:00
|
|
|
if ($1) {
|
2005-07-07 18:22:49 +02:00
|
|
|
yyerror(@2, "sorry: Attributes not supported "
|
2002-05-24 06:36:23 +02:00
|
|
|
"on net declaration assignments.");
|
|
|
|
|
delete $1;
|
2001-11-29 18:37:51 +01:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2011-12-18 21:00:18 +01:00
|
|
|
/* Allow struct nets. */
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt net_type struct_data_type net_variable_list ';'
|
|
|
|
|
|
|
|
|
|
{ pform_makewire(@2, $3, NetNet::NOT_A_PORT, $4, $1);
|
|
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt net_type struct_data_type error ';'
|
|
|
|
|
|
|
|
|
|
{ yyerror(@5, "error: Errors in net variable list.");
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-07 18:22:49 +02:00
|
|
|
/* This form doesn't have the range, but does have strengths. This
|
|
|
|
|
gives strength to the assignment drivers. */
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt net_type
|
2010-10-20 04:34:17 +02:00
|
|
|
primitive_type_opt unsigned_signed_opt
|
2005-07-07 18:22:49 +02:00
|
|
|
drive_strength net_decl_assigns ';'
|
|
|
|
|
|
|
|
|
|
{ ivl_variable_type_t dtype = $3;
|
|
|
|
|
if (dtype == IVL_VT_NO_TYPE)
|
|
|
|
|
dtype = IVL_VT_LOGIC;
|
|
|
|
|
pform_makewire(@2, 0, $4, 0, $5, $6, $2, dtype);
|
2002-05-24 06:36:23 +02:00
|
|
|
if ($1) {
|
2005-07-07 18:22:49 +02:00
|
|
|
yyerror(@2, "sorry: Attributes not supported "
|
2002-05-24 06:36:23 +02:00
|
|
|
"on net declaration assignments.");
|
|
|
|
|
delete $1;
|
|
|
|
|
}
|
2000-05-08 07:30:19 +02:00
|
|
|
}
|
2011-11-24 04:07:26 +01:00
|
|
|
| attribute_list_opt K_wreal net_decl_assigns ';'
|
|
|
|
|
{ pform_makewire(@2, 0, true, 0, str_strength, $3,
|
|
|
|
|
NetNet::WIRE, IVL_VT_REAL);
|
|
|
|
|
if ($1) {
|
|
|
|
|
yyerror(@2, "sorry: Attributes not supported "
|
|
|
|
|
"on net declaration assignments.");
|
|
|
|
|
delete $1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-07 18:22:49 +02:00
|
|
|
|
|
|
|
|
| K_trireg charge_strength_opt range_opt delay3_opt list_of_identifiers ';'
|
1999-09-29 23:16:32 +02:00
|
|
|
{ yyerror(@1, "sorry: trireg nets not supported.");
|
2005-07-07 18:22:49 +02:00
|
|
|
delete $3;
|
|
|
|
|
delete $4;
|
1999-06-15 04:50:02 +02:00
|
|
|
}
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction unsigned_signed_opt range_opt delay3_opt list_of_identifiers ';'
|
2005-07-07 18:22:49 +02:00
|
|
|
{ pform_set_port_type(@1, $5, $3, $2, $1);
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2003-04-28 19:50:57 +02:00
|
|
|
|
|
|
|
|
/* The next two rules handle Verilog 2001 statements of the form:
|
|
|
|
|
input wire signed [h:l] <list>;
|
|
|
|
|
This creates the wire and sets the port type all at once. */
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction net_type unsigned_signed_opt range_opt list_of_identifiers ';'
|
2007-08-22 04:52:42 +02:00
|
|
|
{ pform_makewire(@1, $4, $3, $5, $2, $1, IVL_VT_NO_TYPE, 0,
|
|
|
|
|
SR_BOTH);
|
2003-04-28 19:50:57 +02:00
|
|
|
}
|
|
|
|
|
|
2010-10-20 04:34:17 +02:00
|
|
|
| K_output var_type unsigned_signed_opt range_opt list_of_port_identifiers ';'
|
2009-05-14 18:32:15 +02:00
|
|
|
{ list<pair<perm_string,PExpr*> >::const_iterator pp;
|
|
|
|
|
list<perm_string>*tmp = new list<perm_string>;
|
2010-10-23 23:57:59 +02:00
|
|
|
for (pp = $5->begin(); pp != $5->end(); ++ pp ) {
|
2009-05-14 18:32:15 +02:00
|
|
|
tmp->push_back((*pp).first);
|
|
|
|
|
}
|
|
|
|
|
pform_makewire(@1, $4, $3, tmp, $2, NetNet::POUTPUT,
|
|
|
|
|
IVL_VT_NO_TYPE, 0, SR_BOTH);
|
2010-10-23 23:57:59 +02:00
|
|
|
for (pp = $5->begin(); pp != $5->end(); ++ pp ) {
|
2009-05-14 18:32:15 +02:00
|
|
|
if ((*pp).second) {
|
|
|
|
|
pform_make_reginit(@1, (*pp).first, (*pp).second);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete $5;
|
2003-04-28 19:50:57 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction K_wreal list_of_identifiers ';'
|
2011-11-24 04:07:26 +01:00
|
|
|
{ pform_makewire(@1, 0, true, $3, NetNet::WIRE, $1,
|
|
|
|
|
IVL_VT_REAL, 0, SR_BOTH);
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-28 19:50:57 +02:00
|
|
|
/* var_type declaration (reg variables) cannot be input or output,
|
|
|
|
|
because the port declaration implies an external driver, which
|
|
|
|
|
cannot be attached to a reg. These rules catch that error early. */
|
|
|
|
|
|
2010-10-20 04:34:17 +02:00
|
|
|
| K_input var_type unsigned_signed_opt range_opt list_of_identifiers ';'
|
2005-07-07 18:22:49 +02:00
|
|
|
{ pform_makewire(@1, $4, $3, $5, $2, NetNet::PINPUT,
|
|
|
|
|
IVL_VT_NO_TYPE, 0);
|
2003-04-28 19:50:57 +02:00
|
|
|
yyerror(@2, "error: reg variables cannot be inputs.");
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-20 04:34:17 +02:00
|
|
|
| K_inout var_type unsigned_signed_opt range_opt list_of_identifiers ';'
|
2005-07-07 18:22:49 +02:00
|
|
|
{ pform_makewire(@1, $4, $3, $5, $2, NetNet::PINOUT,
|
|
|
|
|
IVL_VT_NO_TYPE, 0);
|
2003-04-28 19:50:57 +02:00
|
|
|
yyerror(@2, "error: reg variables cannot be inouts.");
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction unsigned_signed_opt range_opt delay3_opt error ';'
|
2006-03-30 07:22:34 +02:00
|
|
|
{ yyerror(@1, "error: Invalid variable list"
|
2000-09-13 18:32:26 +02:00
|
|
|
" in port declaration.");
|
2005-07-07 18:22:49 +02:00
|
|
|
if ($3) delete $3;
|
|
|
|
|
if ($4) delete $4;
|
2000-09-13 18:32:26 +02:00
|
|
|
yyerrok;
|
|
|
|
|
}
|
2003-04-28 19:50:57 +02:00
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
/* Maybe this is a discipline declaration? If so, then the lexor
|
|
|
|
|
will see the discipline name as an identifier. We match it to the
|
|
|
|
|
discipline or type name semantically. */
|
|
|
|
|
| DISCIPLINE_IDENTIFIER list_of_identifiers ';'
|
|
|
|
|
{ pform_attach_discipline(@1, $1, $2); }
|
|
|
|
|
|
2003-04-28 19:50:57 +02:00
|
|
|
/* block_item_decl rule is shared with task blocks and named
|
|
|
|
|
begin/end. */
|
|
|
|
|
|
1999-09-10 07:02:09 +02:00
|
|
|
| block_item_decl
|
2003-04-28 19:50:57 +02:00
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
1999-06-16 05:13:29 +02:00
|
|
|
| K_defparam defparam_assign_list ';'
|
2000-05-08 07:30:19 +02:00
|
|
|
|
|
|
|
|
/* Most gate types have an optional drive strength and optional
|
2010-07-14 01:12:03 +02:00
|
|
|
two/three-value delay. These rules handle the different cases.
|
|
|
|
|
We check that the actual number of delays is correct later. */
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
| attribute_list_opt gatetype gate_instance_list ';'
|
|
|
|
|
{ pform_makegates($2, str_strength, 0, $3, $1);
|
2000-05-08 07:30:19 +02:00
|
|
|
}
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
| attribute_list_opt gatetype delay3 gate_instance_list ';'
|
|
|
|
|
{ pform_makegates($2, str_strength, $3, $4, $1);
|
2000-05-08 07:30:19 +02:00
|
|
|
}
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
| attribute_list_opt gatetype drive_strength gate_instance_list ';'
|
|
|
|
|
{ pform_makegates($2, $3, 0, $4, $1);
|
2000-05-08 07:30:19 +02:00
|
|
|
}
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
| attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';'
|
|
|
|
|
{ pform_makegates($2, $3, $4, $5, $1);
|
2000-05-08 07:30:19 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-14 01:12:03 +02:00
|
|
|
/* The switch type gates do not support a strength. */
|
|
|
|
|
| attribute_list_opt switchtype gate_instance_list ';'
|
|
|
|
|
{ pform_makegates($2, str_strength, 0, $3, $1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| attribute_list_opt switchtype delay3 gate_instance_list ';'
|
|
|
|
|
{ pform_makegates($2, str_strength, $3, $4, $1);
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-08 07:30:19 +02:00
|
|
|
/* Pullup and pulldown devices cannot have delays, and their
|
|
|
|
|
strengths are limited. */
|
|
|
|
|
|
|
|
|
|
| K_pullup gate_instance_list ';'
|
2002-05-23 05:08:50 +02:00
|
|
|
{ pform_makegates(PGBuiltin::PULLUP, pull_strength, 0,
|
|
|
|
|
$2, 0);
|
2000-05-08 07:30:19 +02:00
|
|
|
}
|
|
|
|
|
| K_pulldown gate_instance_list ';'
|
2002-05-23 05:08:50 +02:00
|
|
|
{ pform_makegates(PGBuiltin::PULLDOWN, pull_strength,
|
|
|
|
|
0, $2, 0);
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2001-04-29 00:56:15 +02:00
|
|
|
| K_pullup '(' dr_strength1 ')' gate_instance_list ';'
|
2002-05-23 05:08:50 +02:00
|
|
|
{ pform_makegates(PGBuiltin::PULLUP, $3, 0, $5, 0);
|
2001-04-29 00:56:15 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-29 02:25:58 +01:00
|
|
|
| K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';'
|
|
|
|
|
{ pform_makegates(PGBuiltin::PULLUP, $3, 0, $7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';'
|
|
|
|
|
{ pform_makegates(PGBuiltin::PULLUP, $5, 0, $7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-29 00:56:15 +02:00
|
|
|
| K_pulldown '(' dr_strength0 ')' gate_instance_list ';'
|
2002-05-23 05:08:50 +02:00
|
|
|
{ pform_makegates(PGBuiltin::PULLDOWN, $3, 0, $5, 0);
|
2001-04-29 00:56:15 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-29 02:25:58 +01:00
|
|
|
| K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';'
|
|
|
|
|
{ pform_makegates(PGBuiltin::PULLDOWN, $5, 0, $7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';'
|
|
|
|
|
{ pform_makegates(PGBuiltin::PULLDOWN, $3, 0, $7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-08 07:30:19 +02:00
|
|
|
/* This rule handles instantiations of modules and user defined
|
|
|
|
|
primitives. These devices to not have delay lists or strengths,
|
|
|
|
|
but then can have parameter lists. */
|
|
|
|
|
|
2006-03-25 03:42:58 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
IDENTIFIER parameter_value_opt gate_instance_list ';'
|
|
|
|
|
{ perm_string tmp1 = lex_strings.make($2);
|
|
|
|
|
pform_make_modgates(tmp1, $3, $4);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
2006-03-25 03:42:58 +01:00
|
|
|
if ($1) delete $1;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2006-03-25 03:42:58 +01:00
|
|
|
| attribute_list_opt
|
|
|
|
|
IDENTIFIER parameter_value_opt error ';'
|
|
|
|
|
{ yyerror(@2, "error: Invalid module instantiation");
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
2006-03-25 03:42:58 +01:00
|
|
|
if ($1) delete $1;
|
2004-09-05 20:09:47 +02:00
|
|
|
}
|
|
|
|
|
|
2000-05-08 07:30:19 +02:00
|
|
|
/* Continuous assignment can have an optional drive strength, then
|
|
|
|
|
an optional delay3 that applies to all the assignments in the
|
2007-04-21 06:45:36 +02:00
|
|
|
cont_assign_list. */
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2007-04-21 06:45:36 +02:00
|
|
|
| K_assign drive_strength_opt delay3_opt cont_assign_list ';'
|
2000-05-06 17:41:56 +02:00
|
|
|
{ pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
|
2002-05-26 03:39:02 +02:00
|
|
|
|
|
|
|
|
/* Always and initial items are behavioral processes. */
|
|
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
| attribute_list_opt K_always statement
|
2008-10-22 07:15:49 +02:00
|
|
|
{ PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
|
2008-05-11 21:00:11 +02:00
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
}
|
|
|
|
|
| attribute_list_opt K_initial statement
|
2008-10-22 07:15:49 +02:00
|
|
|
{ PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
|
2008-05-11 21:00:11 +02:00
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
}
|
2011-03-30 08:42:26 +02:00
|
|
|
| attribute_list_opt K_final statement
|
|
|
|
|
{ PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
|
|
|
|
|
FILE_NAME(tmp, @2);
|
|
|
|
|
}
|
2008-05-11 21:00:11 +02:00
|
|
|
|
|
|
|
|
| attribute_list_opt K_analog analog_statement
|
2008-10-22 07:15:49 +02:00
|
|
|
{ pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| class_declaration
|
|
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
| task_declaration
|
2006-05-11 05:26:57 +02:00
|
|
|
|
2000-05-08 07:30:19 +02:00
|
|
|
/* 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. */
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| K_function K_automatic_opt function_range_or_type_opt IDENTIFIER ';'
|
2008-02-25 04:40:54 +01:00
|
|
|
{ assert(current_function == 0);
|
2009-04-25 04:07:48 +02:00
|
|
|
current_function = pform_push_function_scope(@1, $4, $2);
|
2008-02-25 04:40:54 +01:00
|
|
|
}
|
2011-09-17 21:10:05 +02:00
|
|
|
function_item_list statement_list
|
2008-02-16 06:20:24 +01:00
|
|
|
K_endfunction
|
2008-08-13 22:58:49 +02:00
|
|
|
{ current_function->set_ports($7);
|
|
|
|
|
current_function->set_return($3);
|
2011-09-17 21:10:05 +02:00
|
|
|
assert($8 && $8->size() > 0);
|
|
|
|
|
if ($8->size() == 1) {
|
|
|
|
|
current_function->set_statement((*$8)[0]);
|
|
|
|
|
delete $8;
|
|
|
|
|
} else {
|
|
|
|
|
PBlock*tmp = new PBlock(PBlock::BL_SEQ);
|
|
|
|
|
FILE_NAME(tmp, @8);
|
|
|
|
|
tmp->set_statement( *$8 );
|
|
|
|
|
current_function->set_statement(tmp);
|
|
|
|
|
delete $8;
|
|
|
|
|
if (!gn_system_verilog()) {
|
|
|
|
|
yyerror(@8, "error: Function body with multiple statements requres SystemVerilog.");
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-02-16 06:20:24 +01:00
|
|
|
pform_pop_scope();
|
|
|
|
|
current_function = 0;
|
2008-08-13 22:58:49 +02:00
|
|
|
delete[]$4;
|
2008-02-16 06:20:24 +01:00
|
|
|
}
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| K_function K_automatic_opt function_range_or_type_opt IDENTIFIER
|
2008-04-19 06:33:03 +02:00
|
|
|
{ assert(current_function == 0);
|
2009-04-25 04:07:48 +02:00
|
|
|
current_function = pform_push_function_scope(@1, $4, $2);
|
2008-04-19 06:33:03 +02:00
|
|
|
}
|
2012-02-20 02:31:15 +01:00
|
|
|
'(' tf_port_list_opt ')' ';'
|
2008-04-19 06:33:03 +02:00
|
|
|
block_item_decls_opt
|
2011-09-17 21:10:05 +02:00
|
|
|
statement_list
|
2008-04-19 06:33:03 +02:00
|
|
|
K_endfunction
|
2008-08-13 22:58:49 +02:00
|
|
|
{ current_function->set_ports($7);
|
|
|
|
|
current_function->set_return($3);
|
2011-09-17 21:10:05 +02:00
|
|
|
assert($11 && $11->size() > 0);
|
|
|
|
|
if ($11->size() == 1) {
|
|
|
|
|
current_function->set_statement((*$11)[0]);
|
|
|
|
|
delete $11;
|
|
|
|
|
} else {
|
|
|
|
|
PBlock*tmp = new PBlock(PBlock::BL_SEQ);
|
|
|
|
|
FILE_NAME(tmp, @11);
|
|
|
|
|
tmp->set_statement( *$11 );
|
|
|
|
|
current_function->set_statement(tmp);
|
|
|
|
|
delete $11;
|
|
|
|
|
if (!gn_system_verilog()) {
|
|
|
|
|
yyerror(@11, "error: Function body with multiple statements requres SystemVerilog.");
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-04-19 06:33:03 +02:00
|
|
|
pform_pop_scope();
|
|
|
|
|
current_function = 0;
|
2008-08-13 22:58:49 +02:00
|
|
|
delete[]$4;
|
2011-09-17 21:10:05 +02:00
|
|
|
if ($7==0 && !gn_system_verilog()) {
|
2012-01-10 04:11:36 +01:00
|
|
|
yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
|
2011-09-17 21:10:05 +02:00
|
|
|
}
|
2008-04-19 06:33:03 +02:00
|
|
|
}
|
2012-02-19 19:29:50 +01:00
|
|
|
| K_function K_automatic_opt function_range_or_type_opt IDENTIFIER error K_endfunction
|
2011-09-17 21:10:05 +02:00
|
|
|
{ /* */
|
|
|
|
|
if (current_function) {
|
|
|
|
|
pform_pop_scope();
|
|
|
|
|
current_function = 0;
|
|
|
|
|
}
|
2010-06-13 20:41:24 +02:00
|
|
|
assert(current_function == 0);
|
2011-09-17 21:10:05 +02:00
|
|
|
yyerror(@1, "error: Syntax error defining function.");
|
|
|
|
|
yyerrok;
|
2008-08-13 22:58:49 +02:00
|
|
|
delete[]$4;
|
2008-04-25 23:26:17 +02:00
|
|
|
}
|
2008-04-19 06:33:03 +02:00
|
|
|
|
2006-04-10 02:37:42 +02:00
|
|
|
/* A generate region can contain further module items. Actually, it
|
|
|
|
|
is supposed to be limited to certain kinds of module items, but
|
2010-03-12 01:06:02 +01:00
|
|
|
the semantic tests will check that for us. Do check that the
|
|
|
|
|
generate/endgenerate regions do not nest. Generate schemes nest,
|
|
|
|
|
but generate regions do not. */
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
| K_generate module_item_list_opt K_endgenerate
|
2010-03-12 01:06:02 +01:00
|
|
|
{ // Test for bad nesting. I understand it, but it is illegal.
|
|
|
|
|
if (pform_parent_generate()) {
|
|
|
|
|
cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
|
|
|
|
|
cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
|
|
|
|
|
cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
|
|
|
|
|
error_count += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
| K_genvar list_of_identifiers ';'
|
2008-05-06 04:46:30 +02:00
|
|
|
{ pform_genvars(@1, $2); }
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
| K_for '(' IDENTIFIER '=' expression ';'
|
|
|
|
|
expression ';'
|
|
|
|
|
IDENTIFIER '=' expression ')'
|
|
|
|
|
{ pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
|
|
|
|
|
generate_block
|
|
|
|
|
{ pform_endgenerate(); }
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
| generate_if
|
|
|
|
|
generate_block_opt
|
|
|
|
|
K_else
|
|
|
|
|
{ pform_start_generate_else(@1); }
|
|
|
|
|
generate_block
|
|
|
|
|
{ pform_endgenerate(); }
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
| generate_if
|
|
|
|
|
generate_block_opt %prec less_than_K_else
|
|
|
|
|
{ pform_endgenerate(); }
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2008-02-10 07:19:42 +01:00
|
|
|
| K_case '(' expression ')'
|
|
|
|
|
{ pform_start_generate_case(@1, $3); }
|
|
|
|
|
generate_case_items
|
|
|
|
|
K_endcase
|
|
|
|
|
{ pform_endgenerate(); }
|
|
|
|
|
|
2008-06-19 05:33:30 +02:00
|
|
|
/* Handle some anachronistic syntax cases. */
|
|
|
|
|
| K_generate K_begin module_item_list_opt K_end K_endgenerate
|
|
|
|
|
{ /* Detect and warn about anachronistic begin/end use */
|
|
|
|
|
if (generation_flag > GN_VER2001) {
|
|
|
|
|
warn_count += 1;
|
|
|
|
|
cerr << @2 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-11-15 03:35:39 +01:00
|
|
|
| K_generate K_begin ':' IDENTIFIER {
|
2009-04-25 04:07:48 +02:00
|
|
|
pform_start_generate_nblock(@2, $4);
|
2008-11-15 03:35:39 +01:00
|
|
|
} module_item_list_opt K_end K_endgenerate
|
|
|
|
|
{ /* Detect and warn about anachronistic named begin/end use */
|
|
|
|
|
if (generation_flag > GN_VER2001) {
|
|
|
|
|
warn_count += 1;
|
|
|
|
|
cerr << @2 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
|
|
|
|
|
}
|
|
|
|
|
pform_endgenerate();
|
|
|
|
|
}
|
2008-06-19 05:33:30 +02:00
|
|
|
|
2000-05-08 07:30:19 +02:00
|
|
|
/* specify blocks are parsed but ignored. */
|
|
|
|
|
|
2001-07-02 01:44:43 +02:00
|
|
|
| K_specify K_endspecify
|
|
|
|
|
{ /* empty lists are legal syntax. */ }
|
|
|
|
|
|
1999-06-12 05:42:57 +02:00
|
|
|
| K_specify specify_item_list K_endspecify
|
|
|
|
|
{
|
|
|
|
|
}
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2001-07-02 01:44:43 +02:00
|
|
|
| K_specify error K_endspecify
|
|
|
|
|
{ yyerror(@1, "error: syntax error in specify block");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-06 07:31:58 +01:00
|
|
|
/* These rules match various errors that the user can type into
|
|
|
|
|
module items. These rules try to catch them at a point where a
|
|
|
|
|
reasonable error message can be produced. */
|
2001-01-06 03:29:35 +01:00
|
|
|
|
2007-08-17 19:10:28 +02:00
|
|
|
| K_module error ';'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@1, "error: missing endmodule or attempt to "
|
2007-08-17 19:10:28 +02:00
|
|
|
"nest modules.");
|
|
|
|
|
pform_error_nested_modules();
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-29 22:18:34 +02:00
|
|
|
| error ';'
|
2005-07-07 18:22:49 +02:00
|
|
|
{ yyerror(@2, "error: invalid module item.");
|
2001-04-29 22:18:34 +02:00
|
|
|
yyerrok;
|
2001-01-06 03:29:35 +01:00
|
|
|
}
|
|
|
|
|
|
2001-01-06 07:31:58 +01:00
|
|
|
| K_assign error '=' expression ';'
|
|
|
|
|
{ yyerror(@1, "error: syntax error in left side "
|
|
|
|
|
"of continuous assignment.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| K_assign error ';'
|
|
|
|
|
{ yyerror(@1, "error: syntax error in "
|
|
|
|
|
"continuous assignment");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-13 23:20:08 +01:00
|
|
|
| K_function error K_endfunction
|
|
|
|
|
{ yyerror(@1, "error: I give up on this "
|
|
|
|
|
"function definition.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-11 05:34:33 +02:00
|
|
|
/* These rules are for the Icarus Verilog specific $attribute
|
2000-05-08 07:30:19 +02:00
|
|
|
extensions. Then catch the parameters of the $attribute keyword. */
|
|
|
|
|
|
1998-11-23 01:20:22 +01:00
|
|
|
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';'
|
2004-02-18 18:11:54 +01:00
|
|
|
{ perm_string tmp3 = lex_strings.make($3);
|
2004-02-20 19:53:33 +01:00
|
|
|
perm_string tmp5 = lex_strings.make($5);
|
|
|
|
|
pform_set_attrib(tmp3, tmp5, $7);
|
2009-01-09 02:03:33 +01:00
|
|
|
delete[] $3;
|
|
|
|
|
delete[] $5;
|
1998-11-23 01:20:22 +01:00
|
|
|
}
|
|
|
|
|
| KK_attribute '(' error ')' ';'
|
2002-06-11 05:34:33 +02:00
|
|
|
{ yyerror(@1, "error: Malformed $attribute parameter list."); }
|
2009-07-11 03:19:59 +02:00
|
|
|
|
|
|
|
|
| K_timeunit_check TIME_LITERAL ';'
|
|
|
|
|
{ pform_set_timeunit($2, true, true); }
|
|
|
|
|
| K_timeprecision_check TIME_LITERAL ';'
|
|
|
|
|
{ pform_set_timeprecision($2, true, true); }
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
generate_if : K_if '(' expression ')' { pform_start_generate_if(@1, $3); }
|
2000-05-08 07:30:19 +02:00
|
|
|
|
2008-02-10 07:19:42 +01:00
|
|
|
generate_case_items
|
|
|
|
|
: generate_case_items generate_case_item
|
|
|
|
|
| generate_case_item
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
generate_case_item
|
2008-11-28 04:45:22 +01:00
|
|
|
: expression_list_proper ':' { pform_generate_case_item(@1, $1); } generate_block_opt
|
2008-02-10 07:19:42 +01:00
|
|
|
{ pform_endgenerate(); }
|
2008-10-24 03:03:38 +02:00
|
|
|
| K_default ':' { pform_generate_case_item(@1, 0); } generate_block_opt
|
2008-02-10 07:19:42 +01:00
|
|
|
{ pform_endgenerate(); }
|
|
|
|
|
;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
module_item_list
|
|
|
|
|
: module_item_list module_item
|
|
|
|
|
| module_item
|
|
|
|
|
;
|
|
|
|
|
|
2002-05-20 01:37:28 +02:00
|
|
|
module_item_list_opt
|
|
|
|
|
: module_item_list
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
2006-04-10 02:37:42 +02:00
|
|
|
/* A generate block is the thing within a generate scheme. It may be
|
|
|
|
|
a single module item, an anonymous block of module items, or a
|
|
|
|
|
named module item. In all cases, the meat is in the module items
|
|
|
|
|
inside, and the processing is done by the module_item rules. We
|
|
|
|
|
only need to take note here of the scope name, if any. */
|
|
|
|
|
|
|
|
|
|
generate_block
|
|
|
|
|
: module_item
|
|
|
|
|
| K_begin module_item_list_opt K_end
|
|
|
|
|
| K_begin ':' IDENTIFIER module_item_list_opt K_end
|
|
|
|
|
{ pform_generate_block_name($3); }
|
|
|
|
|
;
|
|
|
|
|
|
2007-06-22 04:04:48 +02:00
|
|
|
generate_block_opt : generate_block | ';' ;
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2000-10-31 18:00:04 +01:00
|
|
|
|
1999-06-02 04:56:29 +02:00
|
|
|
/* A net declaration assignment allows the programmer to combine the
|
|
|
|
|
net declaration and the continuous assignment into a single
|
2000-10-31 18:00:04 +01:00
|
|
|
statement.
|
|
|
|
|
|
|
|
|
|
Note that the continuous assignment statement is generated as a
|
|
|
|
|
side effect, and all I pass up is the name of the l-value. */
|
|
|
|
|
|
1999-06-02 04:56:29 +02:00
|
|
|
net_decl_assign
|
2008-02-25 04:40:54 +01:00
|
|
|
: IDENTIFIER '=' expression
|
|
|
|
|
{ net_decl_assign_t*tmp = new net_decl_assign_t;
|
|
|
|
|
tmp->next = tmp;
|
|
|
|
|
tmp->name = lex_strings.make($1);
|
|
|
|
|
tmp->expr = $3;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1999-06-02 04:56:29 +02:00
|
|
|
|
|
|
|
|
net_decl_assigns
|
|
|
|
|
: net_decl_assigns ',' net_decl_assign
|
2001-11-29 18:37:51 +01:00
|
|
|
{ net_decl_assign_t*tmp = $1;
|
|
|
|
|
$3->next = tmp->next;
|
|
|
|
|
tmp->next = $3;
|
1999-06-02 04:56:29 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| net_decl_assign
|
2001-11-29 18:37:51 +01:00
|
|
|
{ $$ = $1;
|
1999-06-02 04:56:29 +02:00
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2005-07-07 18:22:49 +02:00
|
|
|
primitive_type
|
2010-10-03 01:29:30 +02:00
|
|
|
: K_logic { $$ = IVL_VT_LOGIC; }
|
|
|
|
|
| K_bool { $$ = IVL_VT_BOOL; /* Icarus Verilog xtypes */}
|
|
|
|
|
| K_bit { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
|
|
|
|
|
| K_real { $$ = IVL_VT_REAL; }
|
|
|
|
|
;
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2011-07-07 15:41:22 +02:00
|
|
|
bit_logic
|
|
|
|
|
: K_logic { $$ = IVL_VT_LOGIC; }
|
|
|
|
|
| K_bit { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
|
|
|
|
|
;
|
|
|
|
|
|
2005-07-07 18:22:49 +02:00
|
|
|
primitive_type_opt : primitive_type { $$ = $1; } | { $$ = IVL_VT_NO_TYPE; } ;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
net_type
|
|
|
|
|
: K_wire { $$ = NetNet::WIRE; }
|
|
|
|
|
| K_tri { $$ = NetNet::TRI; }
|
|
|
|
|
| K_tri1 { $$ = NetNet::TRI1; }
|
|
|
|
|
| K_supply0 { $$ = NetNet::SUPPLY0; }
|
|
|
|
|
| K_wand { $$ = NetNet::WAND; }
|
|
|
|
|
| K_triand { $$ = NetNet::TRIAND; }
|
|
|
|
|
| K_tri0 { $$ = NetNet::TRI0; }
|
|
|
|
|
| K_supply1 { $$ = NetNet::SUPPLY1; }
|
|
|
|
|
| K_wor { $$ = NetNet::WOR; }
|
|
|
|
|
| K_trior { $$ = NetNet::TRIOR; }
|
2010-10-08 05:13:11 +02:00
|
|
|
| K_wone { $$ = NetNet::UNRESOLVED_WIRE;
|
2009-06-02 02:19:56 +02:00
|
|
|
cerr << @1.text << ":" << @1.first_line << ": warning: "
|
|
|
|
|
"'wone' is deprecated, please use 'uwire' "
|
|
|
|
|
"instead." << endl;
|
|
|
|
|
}
|
2010-10-08 05:13:11 +02:00
|
|
|
| K_uwire { $$ = NetNet::UNRESOLVED_WIRE; }
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
2002-05-20 01:37:28 +02:00
|
|
|
var_type
|
|
|
|
|
: K_reg { $$ = NetNet::REG; }
|
|
|
|
|
;
|
|
|
|
|
|
2006-03-18 23:53:38 +01:00
|
|
|
/* In this rule we have matched the "parameter" keyword. The rule
|
|
|
|
|
generates a type (optional) and a list of assignments. */
|
1999-02-21 18:01:57 +01:00
|
|
|
|
2002-08-19 04:39:16 +02:00
|
|
|
parameter_assign_decl
|
2008-05-18 01:25:58 +02:00
|
|
|
: parameter_assign_list
|
|
|
|
|
| range
|
|
|
|
|
{ param_active_range = $1;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2011-12-03 13:11:28 +01:00
|
|
|
| K_signed
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-05-18 01:25:58 +02:00
|
|
|
| K_signed range
|
|
|
|
|
{ param_active_range = $2;
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
| K_integer
|
2010-10-26 04:36:44 +02:00
|
|
|
{ param_active_range = make_range_from_width(integer_width);
|
2008-05-18 01:25:58 +02:00
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-06-12 01:47:43 +02:00
|
|
|
| K_time
|
2010-10-26 04:36:44 +02:00
|
|
|
{ param_active_range = make_range_from_width(64);
|
2008-06-12 01:47:43 +02:00
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-08-09 03:12:52 +02:00
|
|
|
| real_or_realtime
|
2008-06-12 01:47:43 +02:00
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_REAL;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2012-01-16 20:04:02 +01:00
|
|
|
| atom2_type
|
|
|
|
|
{ param_active_range = make_range_from_width($1);
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_BOOL;
|
|
|
|
|
}
|
|
|
|
|
parameter_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-05-18 01:25:58 +02:00
|
|
|
;
|
2002-08-19 04:39:16 +02:00
|
|
|
|
1999-02-21 18:01:57 +01:00
|
|
|
parameter_assign_list
|
|
|
|
|
: parameter_assign
|
|
|
|
|
| parameter_assign_list ',' parameter_assign
|
|
|
|
|
;
|
|
|
|
|
|
2006-03-18 23:53:38 +01:00
|
|
|
parameter_assign
|
2008-05-13 06:26:38 +02:00
|
|
|
: IDENTIFIER '=' expression parameter_value_ranges_opt
|
|
|
|
|
{ PExpr*tmp = $3;
|
2008-05-18 01:25:58 +02:00
|
|
|
pform_set_parameter(@1, lex_strings.make($1), param_active_type,
|
|
|
|
|
param_active_signed, param_active_range, tmp, $4);
|
2008-05-13 06:26:38 +02:00
|
|
|
delete[]$1;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
parameter_value_ranges_opt : parameter_value_ranges { $$ = $1; } | { $$ = 0; } ;
|
|
|
|
|
|
|
|
|
|
parameter_value_ranges
|
|
|
|
|
: parameter_value_ranges parameter_value_range
|
|
|
|
|
{ $$ = $2; $$->next = $1; }
|
|
|
|
|
| parameter_value_range
|
|
|
|
|
{ $$ = $1; $$->next = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
parameter_value_range
|
|
|
|
|
: from_exclude '[' value_range_expression ':' value_range_expression ']'
|
|
|
|
|
{ $$ = pform_parameter_value_range($1, false, $3, false, $5); }
|
|
|
|
|
| from_exclude '[' value_range_expression ':' value_range_expression ')'
|
|
|
|
|
{ $$ = pform_parameter_value_range($1, false, $3, true, $5); }
|
|
|
|
|
| from_exclude '(' value_range_expression ':' value_range_expression ']'
|
|
|
|
|
{ $$ = pform_parameter_value_range($1, true, $3, false, $5); }
|
|
|
|
|
| from_exclude '(' value_range_expression ':' value_range_expression ')'
|
|
|
|
|
{ $$ = pform_parameter_value_range($1, true, $3, true, $5); }
|
2008-06-06 06:49:49 +02:00
|
|
|
| K_exclude expression
|
|
|
|
|
{ $$ = pform_parameter_value_range(true, false, $2, false, $2); }
|
2008-05-13 06:26:38 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
value_range_expression
|
|
|
|
|
: expression { $$ = $1; }
|
|
|
|
|
| K_inf { $$ = 0; }
|
|
|
|
|
| '+' K_inf { $$ = 0; }
|
|
|
|
|
| '-' K_inf { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
from_exclude : K_from { $$ = false; } | K_exclude { $$ = true; } ;
|
2000-01-02 00:47:58 +01:00
|
|
|
|
2002-06-11 05:34:33 +02:00
|
|
|
/* Localparam assignments and assignment lists are broken into
|
|
|
|
|
separate BNF so that I can call slightly different parameter
|
2000-03-12 18:09:40 +01:00
|
|
|
handling code. They parse the same as parameters, they just
|
|
|
|
|
behave differently when someone tries to override them. */
|
|
|
|
|
|
|
|
|
|
localparam_assign
|
2008-05-18 01:25:58 +02:00
|
|
|
: IDENTIFIER '=' expression
|
|
|
|
|
{ PExpr*tmp = $3;
|
|
|
|
|
pform_set_localparam(@1, lex_strings.make($1),
|
|
|
|
|
param_active_type,
|
|
|
|
|
param_active_signed,
|
|
|
|
|
param_active_range, tmp);
|
|
|
|
|
delete[]$1;
|
|
|
|
|
}
|
|
|
|
|
;
|
2000-03-12 18:09:40 +01:00
|
|
|
|
2004-08-26 06:02:03 +02:00
|
|
|
localparam_assign_decl
|
2008-05-18 01:25:58 +02:00
|
|
|
: localparam_assign_list
|
|
|
|
|
| range
|
|
|
|
|
{ param_active_range = $1;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
2008-07-16 22:58:16 +02:00
|
|
|
param_active_type = IVL_VT_LOGIC;
|
2008-05-18 01:25:58 +02:00
|
|
|
}
|
2011-12-03 13:11:28 +01:00
|
|
|
| K_signed
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-05-18 01:25:58 +02:00
|
|
|
| K_signed range
|
|
|
|
|
{ param_active_range = $2;
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
2008-06-05 23:38:56 +02:00
|
|
|
param_active_type = IVL_VT_LOGIC;
|
2008-05-18 01:25:58 +02:00
|
|
|
}
|
|
|
|
|
| K_integer
|
2010-10-26 04:36:44 +02:00
|
|
|
{ param_active_range = make_range_from_width(integer_width);
|
2008-05-18 01:25:58 +02:00
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
2008-06-05 23:38:56 +02:00
|
|
|
param_active_type = IVL_VT_LOGIC;
|
2008-05-18 01:25:58 +02:00
|
|
|
}
|
2008-06-12 01:47:43 +02:00
|
|
|
| K_time
|
2010-10-26 04:36:44 +02:00
|
|
|
{ param_active_range = make_range_from_width(64);
|
2008-06-12 01:47:43 +02:00
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
|
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-08-09 03:12:52 +02:00
|
|
|
| real_or_realtime
|
2008-06-12 01:47:43 +02:00
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_REAL;
|
|
|
|
|
}
|
2008-05-18 01:25:58 +02:00
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
2008-06-05 23:38:56 +02:00
|
|
|
param_active_type = IVL_VT_LOGIC;
|
2008-05-18 01:25:58 +02:00
|
|
|
}
|
2012-01-16 20:04:02 +01:00
|
|
|
| atom2_type
|
|
|
|
|
{ param_active_range = make_range_from_width($1);
|
|
|
|
|
param_active_signed = true;
|
|
|
|
|
param_active_type = IVL_VT_BOOL;
|
|
|
|
|
}
|
|
|
|
|
localparam_assign_list
|
|
|
|
|
{ param_active_range = 0;
|
|
|
|
|
param_active_signed = false;
|
|
|
|
|
param_active_type = IVL_VT_LOGIC;
|
|
|
|
|
}
|
2008-05-18 01:25:58 +02:00
|
|
|
;
|
2004-08-26 06:02:03 +02:00
|
|
|
|
2000-03-12 18:09:40 +01:00
|
|
|
localparam_assign_list
|
|
|
|
|
: localparam_assign
|
|
|
|
|
| localparam_assign_list ',' localparam_assign
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
2004-08-26 06:02:03 +02:00
|
|
|
|
2000-01-02 00:47:58 +01:00
|
|
|
/* The parameters of a module instance can be overridden by writing
|
2002-11-09 03:22:07 +01:00
|
|
|
a list of expressions in a syntax much like a delay list. (The
|
2000-01-02 00:47:58 +01:00
|
|
|
difference being the list can have any length.) The pform that
|
|
|
|
|
attaches the expression list to the module checks that the
|
2000-01-09 06:50:48 +01:00
|
|
|
expressions are constant.
|
|
|
|
|
|
|
|
|
|
Although the BNF in IEEE1364-1995 implies that parameter value
|
|
|
|
|
lists must be in parentheses, in practice most compilers will
|
|
|
|
|
accept simple expressions outside of parentheses if there is only
|
|
|
|
|
one value, so I'll accept simple numbers here.
|
|
|
|
|
|
|
|
|
|
The parameter value by name syntax is OVI enhancement BTF-B06 as
|
|
|
|
|
approved by WG1364 on 6/28/1998. */
|
2000-01-02 00:47:58 +01:00
|
|
|
|
|
|
|
|
parameter_value_opt
|
2007-04-02 01:02:03 +02:00
|
|
|
: '#' '(' expression_list_with_nuls ')'
|
2000-01-09 06:50:48 +01:00
|
|
|
{ struct parmvalue_t*tmp = new struct parmvalue_t;
|
|
|
|
|
tmp->by_order = $3;
|
|
|
|
|
tmp->by_name = 0;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '#' '(' parameter_value_byname_list ')'
|
|
|
|
|
{ struct parmvalue_t*tmp = new struct parmvalue_t;
|
|
|
|
|
tmp->by_order = 0;
|
|
|
|
|
tmp->by_name = $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2003-04-14 05:37:47 +02:00
|
|
|
| '#' DEC_NUMBER
|
2000-01-09 06:50:48 +01:00
|
|
|
{ assert($2);
|
|
|
|
|
PENumber*tmp = new PENumber($2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-01-09 06:50:48 +01:00
|
|
|
|
|
|
|
|
struct parmvalue_t*lst = new struct parmvalue_t;
|
2010-10-26 04:36:44 +02:00
|
|
|
lst->by_order = new list<PExpr*>;
|
|
|
|
|
lst->by_order->push_back(tmp);
|
2000-01-09 06:50:48 +01:00
|
|
|
lst->by_name = 0;
|
|
|
|
|
$$ = lst;
|
2008-03-06 01:36:27 +01:00
|
|
|
based_size = 0;
|
2000-01-09 06:50:48 +01:00
|
|
|
}
|
2000-01-02 02:59:52 +01:00
|
|
|
| '#' error
|
|
|
|
|
{ yyerror(@1, "error: syntax error in parameter value "
|
|
|
|
|
"assignment list.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
2000-01-02 00:47:58 +01:00
|
|
|
|
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2000-01-09 06:50:48 +01:00
|
|
|
parameter_value_byname
|
2001-12-03 05:47:14 +01:00
|
|
|
: '.' IDENTIFIER '(' expression ')'
|
2002-05-23 05:08:50 +02:00
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp->name = lex_strings.make($2);
|
2001-12-03 05:47:14 +01:00
|
|
|
tmp->parm = $4;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
2000-01-09 06:50:48 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2001-12-03 05:47:14 +01:00
|
|
|
| '.' IDENTIFIER '(' ')'
|
2002-05-23 05:08:50 +02:00
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp->name = lex_strings.make($2);
|
2000-01-09 06:50:48 +01:00
|
|
|
tmp->parm = 0;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
2000-01-09 06:50:48 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
parameter_value_byname_list
|
2010-11-13 03:47:06 +01:00
|
|
|
: parameter_value_byname
|
|
|
|
|
{ list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
|
|
|
|
|
tmp->push_back(*$1);
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| parameter_value_byname_list ',' parameter_value_byname
|
|
|
|
|
{ list<named_pexpr_t>*tmp = $1;
|
|
|
|
|
tmp->push_back(*$3);
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
2000-01-09 06:50:48 +01:00
|
|
|
|
2000-05-16 06:05:15 +02:00
|
|
|
|
2000-01-09 06:50:48 +01:00
|
|
|
/* The port (of a module) is a fairly complex item. Each port is
|
1999-08-03 06:14:49 +02:00
|
|
|
handled as a Module::port_t object. A simple port reference has a
|
2000-05-16 06:05:15 +02:00
|
|
|
name and a PExpr object, but more complex constructs are possible
|
1999-08-03 06:14:49 +02:00
|
|
|
where the name can be attached to a list of PWire objects.
|
|
|
|
|
|
|
|
|
|
The port_reference returns a Module::port_t, and so does the
|
|
|
|
|
port_reference_list. The port_reference_list may have built up a
|
|
|
|
|
list of PWires in the port_t object, but it is still a single
|
|
|
|
|
Module::port_t object.
|
|
|
|
|
|
|
|
|
|
The port rule below takes the built up Module::port_t object and
|
|
|
|
|
tweaks its name as needed. */
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
port
|
1999-08-03 06:14:49 +02:00
|
|
|
: port_reference
|
|
|
|
|
{ $$ = $1; }
|
2000-05-16 06:05:15 +02:00
|
|
|
|
|
|
|
|
/* This syntax attaches an external name to the port reference so
|
|
|
|
|
that the caller can bind by name to non-trivial port
|
|
|
|
|
references. The port_t object gets its PWire from the
|
2001-12-03 05:47:14 +01:00
|
|
|
port_reference, but its name from the IDENTIFIER. */
|
2000-05-16 06:05:15 +02:00
|
|
|
|
2001-12-03 05:47:14 +01:00
|
|
|
| '.' IDENTIFIER '(' port_reference ')'
|
|
|
|
|
{ Module::port_t*tmp = $4;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp->name = lex_strings.make($2);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
1999-08-03 06:14:49 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2000-05-16 06:05:15 +02:00
|
|
|
|
|
|
|
|
/* A port can also be a concatenation of port references. In this
|
|
|
|
|
case the port does not have a name available to the outside, only
|
|
|
|
|
positional parameter passing is possible here. */
|
|
|
|
|
|
1999-08-03 06:14:49 +02:00
|
|
|
| '{' port_reference_list '}'
|
|
|
|
|
{ Module::port_t*tmp = $2;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp->name = perm_string();
|
1999-08-03 06:14:49 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2000-05-16 06:05:15 +02:00
|
|
|
|
2002-06-11 05:34:33 +02:00
|
|
|
/* This attaches a name to a port reference concatenation list so
|
2000-05-16 06:05:15 +02:00
|
|
|
that parameter passing be name is possible. */
|
|
|
|
|
|
2001-12-03 05:47:14 +01:00
|
|
|
| '.' IDENTIFIER '(' '{' port_reference_list '}' ')'
|
|
|
|
|
{ Module::port_t*tmp = $5;
|
2004-02-20 07:22:56 +01:00
|
|
|
tmp->name = lex_strings.make($2);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
1999-08-03 06:14:49 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1999-09-17 04:06:25 +02:00
|
|
|
port_opt
|
|
|
|
|
: port { $$ = $1; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2010-11-13 03:47:06 +01:00
|
|
|
/* The port_name rule is used with a module is being *instantiated*,
|
|
|
|
|
and not when it is being declared. See the port rule if you are
|
|
|
|
|
looking for the ports of a module declaration. */
|
|
|
|
|
|
|
|
|
|
port_name
|
|
|
|
|
: '.' IDENTIFIER '(' expression ')'
|
|
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
|
|
|
|
tmp->name = lex_strings.make($2);
|
|
|
|
|
tmp->parm = $4;
|
|
|
|
|
delete[]$2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '.' IDENTIFIER '(' error ')'
|
|
|
|
|
{ yyerror(@3, "error: invalid port connection expression.");
|
|
|
|
|
named_pexpr_t*tmp = new named_pexpr_t;
|
|
|
|
|
tmp->name = lex_strings.make($2);
|
|
|
|
|
tmp->parm = 0;
|
|
|
|
|
delete[]$2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '.' IDENTIFIER '(' ')'
|
|
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
|
|
|
|
tmp->name = lex_strings.make($2);
|
|
|
|
|
tmp->parm = 0;
|
|
|
|
|
delete[]$2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '.' IDENTIFIER
|
|
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
|
|
|
|
tmp->name = lex_strings.make($2);
|
|
|
|
|
tmp->parm = new PEIdent(lex_strings.make($2), true);
|
|
|
|
|
FILE_NAME(tmp->parm, @1);
|
|
|
|
|
delete[]$2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2009-11-26 18:39:21 +01:00
|
|
|
| K_DOTSTAR
|
|
|
|
|
{ named_pexpr_t*tmp = new named_pexpr_t;
|
|
|
|
|
tmp->name = lex_strings.make("*");
|
|
|
|
|
tmp->parm = 0;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2010-11-13 03:47:06 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
port_name_list
|
|
|
|
|
: port_name_list ',' port_name
|
|
|
|
|
{ list<named_pexpr_t>*tmp = $1;
|
|
|
|
|
tmp->push_back(*$3);
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| port_name
|
|
|
|
|
{ list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
|
|
|
|
|
tmp->push_back(*$1);
|
|
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2000-05-16 06:05:15 +02:00
|
|
|
|
|
|
|
|
/* A port reference is an internal (to the module) name of the port,
|
|
|
|
|
possibly with a part of bit select to attach it to specific bits
|
|
|
|
|
of a signal fully declared inside the module.
|
|
|
|
|
|
|
|
|
|
The parser creates a PEIdent for every port reference, even if the
|
|
|
|
|
signal is bound to different ports. The elaboration figures out
|
|
|
|
|
the mess that this creates. The port_reference (and the
|
|
|
|
|
port_reference_list below) puts the port reference PEIdent into the
|
|
|
|
|
port_t object to pass it up to the module declaration code. */
|
|
|
|
|
|
1999-08-03 06:14:49 +02:00
|
|
|
port_reference
|
2000-05-16 06:05:15 +02:00
|
|
|
|
2007-05-24 06:07:11 +02:00
|
|
|
: IDENTIFIER
|
|
|
|
|
{ Module::port_t*ptmp;
|
2008-02-25 04:40:54 +01:00
|
|
|
perm_string name = lex_strings.make($1);
|
|
|
|
|
ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2007-05-24 06:07:11 +02:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| IDENTIFIER '[' expression ':' expression ']'
|
2008-10-04 16:30:34 +02:00
|
|
|
{ index_component_t itmp;
|
2007-05-24 06:07:11 +02:00
|
|
|
itmp.sel = index_component_t::SEL_PART;
|
|
|
|
|
itmp.msb = $3;
|
|
|
|
|
itmp.lsb = $5;
|
|
|
|
|
|
|
|
|
|
name_component_t ntmp (lex_strings.make($1));
|
|
|
|
|
ntmp.index.push_back(itmp);
|
|
|
|
|
|
|
|
|
|
pform_name_t pname;
|
|
|
|
|
pname.push_back(ntmp);
|
|
|
|
|
|
|
|
|
|
PEIdent*wtmp = new PEIdent(pname);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(wtmp, @1);
|
2007-05-24 06:07:11 +02:00
|
|
|
|
|
|
|
|
Module::port_t*ptmp = new Module::port_t;
|
|
|
|
|
ptmp->name = perm_string();
|
2008-11-03 05:08:38 +01:00
|
|
|
ptmp->expr.push_back(wtmp);
|
2007-05-24 06:07:11 +02:00
|
|
|
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2007-05-24 06:07:11 +02:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| IDENTIFIER '[' expression ']'
|
2008-10-04 16:30:34 +02:00
|
|
|
{ index_component_t itmp;
|
2007-05-24 06:07:11 +02:00
|
|
|
itmp.sel = index_component_t::SEL_BIT;
|
|
|
|
|
itmp.msb = $3;
|
|
|
|
|
itmp.lsb = 0;
|
|
|
|
|
|
|
|
|
|
name_component_t ntmp (lex_strings.make($1));
|
|
|
|
|
ntmp.index.push_back(itmp);
|
|
|
|
|
|
|
|
|
|
pform_name_t pname;
|
|
|
|
|
pname.push_back(ntmp);
|
|
|
|
|
|
|
|
|
|
PEIdent*tmp = new PEIdent(pname);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2007-05-24 06:07:11 +02:00
|
|
|
|
|
|
|
|
Module::port_t*ptmp = new Module::port_t;
|
|
|
|
|
ptmp->name = perm_string();
|
2008-11-03 05:08:38 +01:00
|
|
|
ptmp->expr.push_back(tmp);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2007-05-24 06:07:11 +02:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
| IDENTIFIER '[' error ']'
|
|
|
|
|
{ yyerror(@1, "error: invalid port bit select");
|
|
|
|
|
Module::port_t*ptmp = new Module::port_t;
|
|
|
|
|
PEIdent*wtmp = new PEIdent(lex_strings.make($1));
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(wtmp, @1);
|
2007-05-24 06:07:11 +02:00
|
|
|
ptmp->name = lex_strings.make($1);
|
2008-11-03 05:08:38 +01:00
|
|
|
ptmp->expr.push_back(wtmp);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2007-05-24 06:07:11 +02:00
|
|
|
$$ = ptmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-05-16 06:05:15 +02:00
|
|
|
|
1999-08-03 06:14:49 +02:00
|
|
|
port_reference_list
|
|
|
|
|
: port_reference
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
| port_reference_list ',' port_reference
|
|
|
|
|
{ Module::port_t*tmp = $1;
|
2008-11-03 05:08:38 +01:00
|
|
|
append(tmp->expr, $3->expr);
|
1999-08-03 06:14:49 +02:00
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
port_direction /* IEEE1800-2005 A.1.3 */
|
|
|
|
|
: K_input { $$ = NetNet::PINPUT; }
|
|
|
|
|
| K_output { $$ = NetNet::POUTPUT; }
|
|
|
|
|
| K_inout { $$ = NetNet::PINOUT; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
port_direction_opt
|
|
|
|
|
: port_direction { $$ = $1; }
|
|
|
|
|
| { $$ = NetNet::PINPUT; }
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
/* The range is a list of variable dimensions. */
|
1998-11-04 00:28:49 +01:00
|
|
|
range
|
2012-02-20 02:31:15 +01:00
|
|
|
: variable_dimension
|
|
|
|
|
| range variable_dimension
|
2012-02-05 01:19:27 +01:00
|
|
|
{ list<PExpr*>*tmp = $1;
|
2012-02-20 02:31:15 +01:00
|
|
|
if ($2) tmp->splice(tmp->end(), *$2);
|
2012-02-05 01:19:27 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2010-10-26 04:36:44 +02:00
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
range_opt
|
2012-02-05 01:19:27 +01:00
|
|
|
: range
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
2007-11-07 23:18:36 +01:00
|
|
|
dimensions_opt
|
|
|
|
|
: { $$ = 0; }
|
2007-11-14 05:49:05 +01:00
|
|
|
| dimensions { $$ = $1; }
|
|
|
|
|
|
|
|
|
|
dimensions
|
|
|
|
|
: '[' expression ':' expression ']'
|
2007-11-07 23:18:36 +01:00
|
|
|
{ list<index_component_t> *tmp = new list<index_component_t>;
|
|
|
|
|
index_component_t index;
|
|
|
|
|
index.msb = $2;
|
|
|
|
|
index.lsb = $4;
|
|
|
|
|
tmp->push_back(index);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2010-11-21 03:25:47 +01:00
|
|
|
| '[' expression ']'
|
|
|
|
|
{ if (generation_flag < GN_VER2005_SV) {
|
|
|
|
|
warn_count += 1;
|
|
|
|
|
cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
|
|
|
|
|
<< "Use at least -g2005-sv to remove this warning." << endl;
|
|
|
|
|
}
|
|
|
|
|
list<index_component_t> *tmp = new list<index_component_t>;
|
|
|
|
|
index_component_t index;
|
|
|
|
|
index.msb = new PENumber(new verinum((uint64_t)0, integer_width));
|
|
|
|
|
index.lsb = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
|
|
|
|
|
tmp->push_back(index);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-11-14 05:49:05 +01:00
|
|
|
| dimensions '[' expression ':' expression ']'
|
2007-11-07 23:18:36 +01:00
|
|
|
{ list<index_component_t> *tmp = $1;
|
|
|
|
|
index_component_t index;
|
|
|
|
|
index.msb = $3;
|
|
|
|
|
index.lsb = $5;
|
|
|
|
|
tmp->push_back(index);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2010-11-21 03:25:47 +01:00
|
|
|
| dimensions '[' expression ']'
|
|
|
|
|
{ if (generation_flag < GN_VER2005_SV) {
|
|
|
|
|
warn_count += 1;
|
|
|
|
|
cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
|
|
|
|
|
<< "Use at least -g2005-sv to remove this warning." << endl;
|
|
|
|
|
}
|
|
|
|
|
list<index_component_t> *tmp = $1;
|
|
|
|
|
index_component_t index;
|
|
|
|
|
index.msb = new PENumber(new verinum((uint64_t)0, integer_width));
|
|
|
|
|
index.lsb = new PEBinary('-', $3, new PENumber(new verinum((uint64_t)1, integer_width)));
|
|
|
|
|
tmp->push_back(index);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2001-12-07 06:03:13 +01:00
|
|
|
/* This is used to express the return type of a function. */
|
2004-06-01 01:34:36 +02:00
|
|
|
function_range_or_type_opt
|
2011-06-30 14:03:29 +02:00
|
|
|
: unsigned_signed_opt range_opt
|
|
|
|
|
{
|
|
|
|
|
/* the default type is reg unsigned and no range */
|
|
|
|
|
$$.type = PTF_REG;
|
|
|
|
|
$$.range = 0;
|
|
|
|
|
if ($1)
|
|
|
|
|
$$.type = PTF_REG_S;
|
|
|
|
|
if ($2)
|
|
|
|
|
$$.range = make_range_vector($2);
|
|
|
|
|
}
|
2011-06-29 14:40:04 +02:00
|
|
|
| K_reg unsigned_signed_opt range_opt
|
|
|
|
|
{
|
|
|
|
|
/* the default type is reg unsigned and no range */
|
|
|
|
|
$$.type = PTF_REG;
|
|
|
|
|
$$.range = 0;
|
|
|
|
|
if ($2)
|
|
|
|
|
$$.type = PTF_REG_S;
|
|
|
|
|
if ($3)
|
|
|
|
|
$$.range = make_range_vector($3);
|
|
|
|
|
}
|
2011-07-11 15:06:11 +02:00
|
|
|
| bit_logic unsigned_signed_opt range_opt
|
|
|
|
|
{
|
|
|
|
|
/* the default type is bit/logic unsigned and no range */
|
|
|
|
|
$$.type = PTF_REG;
|
|
|
|
|
$$.range = 0;
|
|
|
|
|
if ($2)
|
|
|
|
|
$$.type = PTF_REG_S;
|
|
|
|
|
if ($3)
|
|
|
|
|
$$.range = make_range_vector($3);
|
|
|
|
|
}
|
2010-10-03 01:29:30 +02:00
|
|
|
| K_integer { $$.range = 0; $$.type = PTF_INTEGER; }
|
|
|
|
|
| K_real { $$.range = 0; $$.type = PTF_REAL; }
|
|
|
|
|
| K_realtime { $$.range = 0; $$.type = PTF_REALTIME; }
|
|
|
|
|
| K_time { $$.range = 0; $$.type = PTF_TIME; }
|
2010-10-26 04:36:44 +02:00
|
|
|
| atom2_type { $$.range = make_range_vector($1); $$.type = PTF_ATOM2_S; }
|
|
|
|
|
| atom2_type K_signed { $$.range = make_range_vector($1); $$.type = PTF_ATOM2_S; }
|
|
|
|
|
| atom2_type K_unsigned { $$.range = make_range_vector($1); $$.type = PTF_ATOM2; }
|
2010-10-03 01:29:30 +02:00
|
|
|
;
|
2000-12-05 23:32:05 +01:00
|
|
|
|
1999-04-19 03:59:36 +02:00
|
|
|
/* The register_variable rule is matched only when I am parsing
|
|
|
|
|
variables in a "reg" definition. I therefore know that I am
|
|
|
|
|
creating registers and I do not need to let the containing rule
|
|
|
|
|
handle it. The register variable list simply packs them together
|
|
|
|
|
so that bit ranges can be assigned. */
|
1998-11-04 00:28:49 +01:00
|
|
|
register_variable
|
2008-02-25 04:40:54 +01:00
|
|
|
: IDENTIFIER dimensions_opt
|
|
|
|
|
{ perm_string ident_name = lex_strings.make($1);
|
|
|
|
|
pform_makewire(@1, ident_name, NetNet::REG,
|
|
|
|
|
NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
|
|
|
|
|
if ($2 != 0) {
|
|
|
|
|
index_component_t index;
|
|
|
|
|
if ($2->size() > 1) {
|
|
|
|
|
yyerror(@2, "sorry: only 1 dimensional arrays "
|
|
|
|
|
"are currently supported.");
|
|
|
|
|
}
|
|
|
|
|
index = $2->front();
|
|
|
|
|
pform_set_reg_idx(ident_name, index.msb, index.lsb);
|
|
|
|
|
delete $2;
|
|
|
|
|
}
|
|
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
| IDENTIFIER '=' expression
|
|
|
|
|
{ perm_string ident_name = lex_strings.make($1);
|
|
|
|
|
pform_makewire(@1, ident_name, NetNet::REG,
|
|
|
|
|
NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
|
|
|
|
|
pform_make_reginit(@1, ident_name, $3);
|
|
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
;
|
1999-04-19 03:59:36 +02:00
|
|
|
|
|
|
|
|
register_variable_list
|
|
|
|
|
: register_variable
|
2004-05-25 21:21:06 +02:00
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($1));
|
1999-04-19 03:59:36 +02:00
|
|
|
$$ = tmp;
|
2004-05-25 21:21:06 +02:00
|
|
|
delete[]$1;
|
1999-04-19 03:59:36 +02:00
|
|
|
}
|
|
|
|
|
| register_variable_list ',' register_variable
|
2004-05-25 21:21:06 +02:00
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($3));
|
1999-04-19 03:59:36 +02:00
|
|
|
$$ = tmp;
|
2004-05-25 21:21:06 +02:00
|
|
|
delete[]$3;
|
1999-04-19 03:59:36 +02:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
;
|
|
|
|
|
|
2011-12-04 02:16:01 +01:00
|
|
|
/* TODO: Replace register_variable_list with list_of_variable_decl_assignments. */
|
|
|
|
|
list_of_variable_decl_assignments
|
|
|
|
|
: variable_decl_assignment
|
|
|
|
|
{ list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
|
|
|
|
|
tmp->push_back($1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| list_of_variable_decl_assignments ',' variable_decl_assignment
|
|
|
|
|
{ list<decl_assignment_t*>*tmp = $1;
|
|
|
|
|
tmp->push_back($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
variable_decl_assignment
|
|
|
|
|
: IDENTIFIER dimensions_opt
|
|
|
|
|
{ decl_assignment_t*tmp = new decl_assignment_t;
|
|
|
|
|
tmp->name = lex_strings.make($1);
|
|
|
|
|
if ($2) {
|
|
|
|
|
tmp->index = *$2;
|
|
|
|
|
delete $2;
|
|
|
|
|
}
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| IDENTIFIER '=' expression
|
|
|
|
|
{ decl_assignment_t*tmp = new decl_assignment_t;
|
|
|
|
|
tmp->name = lex_strings.make($1);
|
|
|
|
|
tmp->expr .reset($3);
|
|
|
|
|
delete[]$1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2007-08-05 06:50:06 +02:00
|
|
|
real_variable
|
2007-11-07 23:18:36 +01:00
|
|
|
: IDENTIFIER dimensions_opt
|
2008-02-25 04:40:54 +01:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
|
|
|
|
pform_makewire(@1, name, NetNet::REG, NetNet::NOT_A_PORT, IVL_VT_REAL, 0);
|
2007-11-07 23:18:36 +01:00
|
|
|
if ($2 != 0) {
|
2008-11-02 04:44:03 +01:00
|
|
|
index_component_t index;
|
|
|
|
|
if ($2->size() > 1) {
|
|
|
|
|
yyerror(@2, "sorry: only 1 dimensional arrays "
|
|
|
|
|
"are currently supported.");
|
|
|
|
|
}
|
|
|
|
|
index = $2->front();
|
|
|
|
|
pform_set_reg_idx(name, index.msb, index.lsb);
|
2008-02-25 04:40:54 +01:00
|
|
|
delete $2;
|
2007-11-07 23:18:36 +01:00
|
|
|
}
|
2007-08-05 06:50:06 +02:00
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
| IDENTIFIER '=' expression
|
2008-02-25 04:40:54 +01:00
|
|
|
{ perm_string name = lex_strings.make($1);
|
|
|
|
|
pform_makewire(@1, name, NetNet::REG, NetNet::NOT_A_PORT, IVL_VT_REAL, 0);
|
|
|
|
|
pform_make_reginit(@1, name, $3);
|
2007-08-05 06:50:06 +02:00
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
real_variable_list
|
|
|
|
|
: real_variable
|
|
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($1));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$1;
|
|
|
|
|
}
|
|
|
|
|
| real_variable_list ',' real_variable
|
|
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($3));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$3;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
net_variable
|
2008-02-25 04:40:54 +01:00
|
|
|
: IDENTIFIER dimensions_opt
|
|
|
|
|
{ perm_string name = lex_strings.make($1);
|
|
|
|
|
pform_makewire(@1, name, NetNet::IMPLICIT,
|
|
|
|
|
NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
|
|
|
|
|
if ($2 != 0) {
|
|
|
|
|
index_component_t index;
|
|
|
|
|
if ($2->size() > 1) {
|
|
|
|
|
yyerror(@2, "sorry: only 1 dimensional arrays "
|
|
|
|
|
"are currently supported.");
|
|
|
|
|
}
|
|
|
|
|
index = $2->front();
|
|
|
|
|
pform_set_reg_idx(name, index.msb, index.lsb);
|
|
|
|
|
delete $2;
|
|
|
|
|
}
|
|
|
|
|
$$ = $1;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
net_variable_list
|
|
|
|
|
: net_variable
|
|
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($1));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$1;
|
|
|
|
|
}
|
|
|
|
|
| net_variable_list ',' net_variable
|
|
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($3));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$3;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1999-06-12 05:42:57 +02:00
|
|
|
specify_item
|
|
|
|
|
: K_specparam specparam_list ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
| specify_simple_path_decl ';'
|
2006-09-23 06:57:19 +02:00
|
|
|
{ pform_module_specify_path($1);
|
2001-07-02 01:44:43 +02:00
|
|
|
}
|
|
|
|
|
| specify_edge_path_decl ';'
|
2007-02-12 02:52:21 +01:00
|
|
|
{ pform_module_specify_path($1);
|
2000-09-23 05:04:10 +02:00
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
| K_if '(' expression ')' specify_simple_path_decl ';'
|
2007-02-12 02:52:21 +01:00
|
|
|
{ PSpecPath*tmp = $5;
|
2007-03-01 07:19:38 +01:00
|
|
|
if (tmp) {
|
|
|
|
|
tmp->conditional = true;
|
|
|
|
|
tmp->condition = $3;
|
|
|
|
|
}
|
2007-02-12 02:52:21 +01:00
|
|
|
pform_module_specify_path(tmp);
|
1999-06-19 05:21:21 +02:00
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
| K_if '(' expression ')' specify_edge_path_decl ';'
|
2007-02-12 02:52:21 +01:00
|
|
|
{ PSpecPath*tmp = $5;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
tmp->conditional = true;
|
|
|
|
|
tmp->condition = $3;
|
|
|
|
|
}
|
|
|
|
|
pform_module_specify_path(tmp);
|
2001-07-02 01:44:43 +02:00
|
|
|
}
|
2006-04-17 06:35:49 +02:00
|
|
|
| K_ifnone specify_simple_path_decl ';'
|
2007-02-12 02:52:21 +01:00
|
|
|
{ PSpecPath*tmp = $2;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
tmp->conditional = true;
|
|
|
|
|
tmp->condition = 0;
|
|
|
|
|
}
|
|
|
|
|
pform_module_specify_path(tmp);
|
2006-04-17 06:35:49 +02:00
|
|
|
}
|
2010-12-15 00:35:16 +01:00
|
|
|
| K_ifnone specify_edge_path_decl ';'
|
|
|
|
|
{ yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
|
|
|
|
|
"not supported.");
|
|
|
|
|
yyerrok;
|
|
|
|
|
}
|
2009-06-04 00:02:32 +02:00
|
|
|
| K_Sfullskew '(' spec_reference_event ',' spec_reference_event
|
|
|
|
|
',' delay_value ',' delay_value spec_notifier_opt ')' ';'
|
|
|
|
|
{ delete $7;
|
|
|
|
|
delete $9;
|
|
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
| K_Shold '(' spec_reference_event ',' spec_reference_event
|
2005-07-27 16:54:51 +02:00
|
|
|
',' delay_value spec_notifier_opt ')' ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
{ delete $7;
|
|
|
|
|
}
|
2009-06-04 00:02:32 +02:00
|
|
|
| K_Snochange '(' spec_reference_event ',' spec_reference_event
|
|
|
|
|
',' delay_value ',' delay_value spec_notifier_opt ')' ';'
|
|
|
|
|
{ delete $7;
|
|
|
|
|
delete $9;
|
|
|
|
|
}
|
2004-09-05 23:01:51 +02:00
|
|
|
| K_Speriod '(' spec_reference_event ',' delay_value
|
2001-10-26 05:22:56 +02:00
|
|
|
spec_notifier_opt ')' ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
{ delete $5;
|
|
|
|
|
}
|
|
|
|
|
| K_Srecovery '(' spec_reference_event ',' spec_reference_event
|
2005-07-27 16:54:51 +02:00
|
|
|
',' delay_value spec_notifier_opt ')' ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
{ delete $7;
|
|
|
|
|
}
|
2009-06-04 00:02:32 +02:00
|
|
|
| K_Srecrem '(' spec_reference_event ',' spec_reference_event
|
|
|
|
|
',' delay_value ',' delay_value spec_notifier_opt ')' ';'
|
|
|
|
|
{ delete $7;
|
|
|
|
|
delete $9;
|
|
|
|
|
}
|
|
|
|
|
| K_Sremoval '(' spec_reference_event ',' spec_reference_event
|
|
|
|
|
',' delay_value spec_notifier_opt ')' ';'
|
|
|
|
|
{ delete $7;
|
|
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
| K_Ssetup '(' spec_reference_event ',' spec_reference_event
|
2005-07-27 16:54:51 +02:00
|
|
|
',' delay_value spec_notifier_opt ')' ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
{ delete $7;
|
|
|
|
|
}
|
2001-10-26 05:22:56 +02:00
|
|
|
| K_Ssetuphold '(' spec_reference_event ',' spec_reference_event
|
2003-09-21 23:16:05 +02:00
|
|
|
',' delay_value ',' delay_value spec_notifier_opt ')' ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
{ delete $7;
|
|
|
|
|
delete $9;
|
|
|
|
|
}
|
2009-06-04 00:02:32 +02:00
|
|
|
| K_Sskew '(' spec_reference_event ',' spec_reference_event
|
|
|
|
|
',' delay_value spec_notifier_opt ')' ';'
|
|
|
|
|
{ delete $7;
|
|
|
|
|
}
|
|
|
|
|
| K_Stimeskew '(' spec_reference_event ',' spec_reference_event
|
|
|
|
|
',' delay_value spec_notifier_opt ')' ';'
|
2003-08-31 23:14:28 +02:00
|
|
|
{ delete $7;
|
|
|
|
|
}
|
2003-09-21 23:16:05 +02:00
|
|
|
| K_Swidth '(' spec_reference_event ',' delay_value ',' expression
|
2001-10-26 05:22:56 +02:00
|
|
|
spec_notifier_opt ')' ';'
|
2001-07-02 01:44:43 +02:00
|
|
|
{ delete $5;
|
|
|
|
|
delete $7;
|
|
|
|
|
}
|
2005-07-27 16:54:51 +02:00
|
|
|
| K_Swidth '(' spec_reference_event ',' delay_value ')' ';'
|
2001-10-14 04:03:51 +02:00
|
|
|
{ delete $5;
|
|
|
|
|
}
|
2009-06-06 01:12:17 +02:00
|
|
|
| K_pulsestyle_onevent specify_path_identifiers ';'
|
|
|
|
|
{ delete $2;
|
|
|
|
|
}
|
|
|
|
|
| K_pulsestyle_ondetect specify_path_identifiers ';'
|
|
|
|
|
{ delete $2;
|
|
|
|
|
}
|
|
|
|
|
| K_showcancelled specify_path_identifiers ';'
|
|
|
|
|
{ delete $2;
|
|
|
|
|
}
|
|
|
|
|
| K_noshowcancelled specify_path_identifiers ';'
|
|
|
|
|
{ delete $2;
|
|
|
|
|
}
|
1999-06-12 05:42:57 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
specify_item_list
|
|
|
|
|
: specify_item
|
|
|
|
|
| specify_item_list specify_item
|
|
|
|
|
;
|
|
|
|
|
|
2001-07-02 01:44:43 +02:00
|
|
|
specify_edge_path_decl
|
2006-09-23 06:57:19 +02:00
|
|
|
: specify_edge_path '=' '(' delay_value_list ')'
|
2007-02-12 02:52:21 +01:00
|
|
|
{ $$ = pform_assign_path_delay($1, $4); }
|
2002-11-26 04:56:10 +01:00
|
|
|
| specify_edge_path '=' delay_value_simple
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($3);
|
2007-02-12 02:52:21 +01:00
|
|
|
$$ = pform_assign_path_delay($1, tmp);
|
|
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
;
|
|
|
|
|
|
2007-02-12 02:52:21 +01:00
|
|
|
edge_operator : K_posedge { $$ = true; } | K_negedge { $$ = false; } ;
|
|
|
|
|
|
2001-07-02 01:44:43 +02:00
|
|
|
specify_edge_path
|
2007-04-13 04:34:35 +02:00
|
|
|
: '(' specify_path_identifiers spec_polarity
|
2007-02-12 02:52:21 +01:00
|
|
|
K_EG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
2007-04-13 04:34:35 +02:00
|
|
|
{ int edge_flag = 0;
|
|
|
|
|
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
|
2007-02-12 02:52:21 +01:00
|
|
|
| '(' edge_operator specify_path_identifiers spec_polarity
|
2007-04-13 04:34:35 +02:00
|
|
|
K_EG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
|
|
|
|
{ int edge_flag = $2? 1 : -1;
|
|
|
|
|
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
|
|
|
|
|
| '(' specify_path_identifiers spec_polarity
|
|
|
|
|
K_SG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
|
|
|
|
{ int edge_flag = 0;
|
|
|
|
|
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
|
2007-02-12 02:52:21 +01:00
|
|
|
| '(' edge_operator specify_path_identifiers spec_polarity
|
|
|
|
|
K_SG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
2007-04-13 04:34:35 +02:00
|
|
|
{ int edge_flag = $2? 1 : -1;
|
|
|
|
|
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
|
2001-08-31 23:08:35 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
polarity_operator
|
|
|
|
|
: K_PO_POS
|
|
|
|
|
| K_PO_NEG
|
|
|
|
|
| ':'
|
2001-07-02 01:44:43 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
specify_simple_path_decl
|
2006-09-23 06:57:19 +02:00
|
|
|
: specify_simple_path '=' '(' delay_value_list ')'
|
|
|
|
|
{ $$ = pform_assign_path_delay($1, $4); }
|
2001-07-02 01:44:43 +02:00
|
|
|
| specify_simple_path '=' delay_value_simple
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*tmp = new list<PExpr*>;
|
|
|
|
|
tmp->push_back($3);
|
2006-09-23 06:57:19 +02:00
|
|
|
$$ = pform_assign_path_delay($1, tmp);
|
|
|
|
|
}
|
2001-12-01 03:42:39 +01:00
|
|
|
| specify_simple_path '=' '(' error ')'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@3, "Syntax error in delay value list.");
|
2001-12-01 03:42:39 +01:00
|
|
|
yyerrok;
|
2006-09-23 06:57:19 +02:00
|
|
|
$$ = 0;
|
2001-12-01 03:42:39 +01:00
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
;
|
|
|
|
|
|
1999-06-19 05:21:21 +02:00
|
|
|
specify_simple_path
|
2003-02-27 07:45:11 +01:00
|
|
|
: '(' specify_path_identifiers spec_polarity
|
|
|
|
|
K_EG specify_path_identifiers ')'
|
2006-09-23 06:57:19 +02:00
|
|
|
{ $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
|
2003-02-27 07:45:11 +01:00
|
|
|
| '(' specify_path_identifiers spec_polarity
|
|
|
|
|
K_SG specify_path_identifiers ')'
|
2006-09-23 06:57:19 +02:00
|
|
|
{ $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
|
2001-12-01 03:42:39 +01:00
|
|
|
| '(' error ')'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@1, "Invalid simple path");
|
2001-12-01 03:42:39 +01:00
|
|
|
yyerrok;
|
|
|
|
|
}
|
2001-04-21 02:55:46 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
specify_path_identifiers
|
2003-02-27 07:45:11 +01:00
|
|
|
: IDENTIFIER
|
2004-05-25 21:21:06 +02:00
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($1));
|
2003-02-27 07:45:11 +01:00
|
|
|
$$ = tmp;
|
2004-05-25 21:21:06 +02:00
|
|
|
delete[]$1;
|
2003-02-27 07:45:11 +01:00
|
|
|
}
|
|
|
|
|
| IDENTIFIER '[' expr_primary ']'
|
2004-05-25 21:21:06 +02:00
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($1));
|
2003-02-27 07:45:11 +01:00
|
|
|
$$ = tmp;
|
2004-05-25 21:21:06 +02:00
|
|
|
delete[]$1;
|
2003-02-27 07:45:11 +01:00
|
|
|
}
|
|
|
|
|
| specify_path_identifiers ',' IDENTIFIER
|
2004-05-25 21:21:06 +02:00
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($3));
|
2003-02-27 07:45:11 +01:00
|
|
|
$$ = tmp;
|
2004-05-25 21:21:06 +02:00
|
|
|
delete[]$3;
|
2003-02-27 07:45:11 +01:00
|
|
|
}
|
|
|
|
|
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']'
|
2004-05-25 21:21:06 +02:00
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($3));
|
2003-02-27 07:45:11 +01:00
|
|
|
$$ = tmp;
|
2004-05-25 21:21:06 +02:00
|
|
|
delete[]$3;
|
2003-02-27 07:45:11 +01:00
|
|
|
}
|
1999-06-19 05:21:21 +02:00
|
|
|
;
|
|
|
|
|
|
1999-06-12 05:42:57 +02:00
|
|
|
specparam
|
|
|
|
|
: IDENTIFIER '=' expression
|
2003-02-27 07:45:11 +01:00
|
|
|
{ PExpr*tmp = $3;
|
2007-02-13 05:39:25 +01:00
|
|
|
pform_set_specparam(lex_strings.make($1), tmp);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1999-06-12 05:42:57 +02:00
|
|
|
}
|
2001-07-02 01:44:43 +02:00
|
|
|
| IDENTIFIER '=' expression ':' expression ':' expression
|
2007-02-13 05:39:25 +01:00
|
|
|
{ PExpr*tmp = 0;
|
|
|
|
|
switch (min_typ_max_flag) {
|
|
|
|
|
case MIN:
|
|
|
|
|
tmp = $3;
|
|
|
|
|
delete $5;
|
|
|
|
|
delete $7;
|
|
|
|
|
break;
|
|
|
|
|
case TYP:
|
|
|
|
|
delete $3;
|
|
|
|
|
tmp = $5;
|
|
|
|
|
delete $7;
|
|
|
|
|
break;
|
|
|
|
|
case MAX:
|
|
|
|
|
delete $3;
|
|
|
|
|
delete $5;
|
|
|
|
|
tmp = $7;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-11-21 20:07:40 +01:00
|
|
|
if (min_typ_max_warn > 0) {
|
2007-12-20 18:31:01 +01:00
|
|
|
cerr << tmp->get_fileline() << ": warning: choosing ";
|
2007-11-21 20:07:40 +01:00
|
|
|
switch (min_typ_max_flag) {
|
|
|
|
|
case MIN:
|
|
|
|
|
cerr << "min";
|
|
|
|
|
break;
|
|
|
|
|
case TYP:
|
|
|
|
|
cerr << "typ";
|
|
|
|
|
break;
|
|
|
|
|
case MAX:
|
|
|
|
|
cerr << "max";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cerr << " expression." << endl;
|
|
|
|
|
min_typ_max_warn -= 1;
|
|
|
|
|
}
|
2007-02-13 05:39:25 +01:00
|
|
|
pform_set_specparam(lex_strings.make($1), tmp);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2001-07-02 01:44:43 +02:00
|
|
|
}
|
2002-11-21 18:40:11 +01:00
|
|
|
| PATHPULSE_IDENTIFIER '=' expression
|
2008-03-28 04:30:53 +01:00
|
|
|
{ delete[]$1;
|
2002-11-21 18:40:11 +01:00
|
|
|
delete $3;
|
2001-11-06 03:52:19 +01:00
|
|
|
}
|
|
|
|
|
| PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')'
|
2008-03-28 04:30:53 +01:00
|
|
|
{ delete[]$1;
|
2001-11-06 03:52:19 +01:00
|
|
|
delete $4;
|
|
|
|
|
delete $6;
|
|
|
|
|
}
|
1999-06-12 05:42:57 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
specparam_list
|
|
|
|
|
: specparam
|
|
|
|
|
| specparam_list ',' specparam
|
|
|
|
|
;
|
|
|
|
|
|
2003-02-27 07:45:11 +01:00
|
|
|
spec_polarity
|
|
|
|
|
: '+' { $$ = '+'; }
|
|
|
|
|
| '-' { $$ = '-'; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
1999-06-19 05:21:21 +02:00
|
|
|
|
2001-07-02 01:44:43 +02:00
|
|
|
spec_reference_event
|
2007-06-14 05:50:00 +02:00
|
|
|
: K_posedge expression
|
|
|
|
|
{ delete $2; }
|
|
|
|
|
| K_negedge expression
|
|
|
|
|
{ delete $2; }
|
|
|
|
|
| K_posedge expr_primary K_TAND expression
|
|
|
|
|
{ delete $2;
|
|
|
|
|
delete $4;
|
|
|
|
|
}
|
|
|
|
|
| K_negedge expr_primary K_TAND expression
|
|
|
|
|
{ delete $2;
|
|
|
|
|
delete $4;
|
|
|
|
|
}
|
2008-01-10 02:06:01 +01:00
|
|
|
| K_edge '[' edge_descriptor_list ']' expr_primary
|
|
|
|
|
{ delete $5; }
|
2007-06-14 05:50:00 +02:00
|
|
|
| K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression
|
|
|
|
|
{ delete $5;
|
|
|
|
|
delete $7;
|
|
|
|
|
}
|
|
|
|
|
| expr_primary K_TAND expression
|
|
|
|
|
{ delete $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
}
|
|
|
|
|
| expr_primary
|
|
|
|
|
{ delete $1; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* The edge_descriptor is detected by the lexor as the various
|
|
|
|
|
2-letter edge sequences that are supported here. For now, we
|
|
|
|
|
don't care what they are, because we do not yet support specify
|
|
|
|
|
edge events. */
|
|
|
|
|
edge_descriptor_list
|
|
|
|
|
: edge_descriptor_list ',' K_edge_descriptor
|
|
|
|
|
| K_edge_descriptor
|
|
|
|
|
;
|
2001-10-26 05:22:56 +02:00
|
|
|
|
|
|
|
|
spec_notifier_opt
|
|
|
|
|
: /* empty */
|
2001-12-03 05:47:14 +01:00
|
|
|
{ }
|
2001-10-26 05:22:56 +02:00
|
|
|
| spec_notifier
|
2001-12-03 05:47:14 +01:00
|
|
|
{ }
|
2001-10-26 05:22:56 +02:00
|
|
|
;
|
|
|
|
|
spec_notifier
|
|
|
|
|
: ','
|
2009-10-31 03:16:42 +01:00
|
|
|
{ args_after_notifier = 0; }
|
2008-01-25 22:34:51 +01:00
|
|
|
| ',' hierarchy_identifier
|
2009-10-31 03:16:42 +01:00
|
|
|
{ args_after_notifier = 0; delete $2; }
|
2004-10-04 03:10:51 +02:00
|
|
|
| spec_notifier ','
|
2009-10-31 03:16:42 +01:00
|
|
|
{ args_after_notifier += 1; }
|
2008-01-25 22:34:51 +01:00
|
|
|
| spec_notifier ',' hierarchy_identifier
|
2009-10-31 03:16:42 +01:00
|
|
|
{ args_after_notifier += 1;
|
|
|
|
|
if (args_after_notifier >= 3) {
|
|
|
|
|
cerr << @3 << ": warning: timing checks are not supported "
|
|
|
|
|
"and delayed signal \"" << *$3
|
|
|
|
|
<< "\" will not be driven." << endl;
|
|
|
|
|
}
|
|
|
|
|
delete $3; }
|
|
|
|
|
/* How do we match this path? */
|
2001-10-09 20:11:58 +02:00
|
|
|
| IDENTIFIER
|
2009-10-31 03:16:42 +01:00
|
|
|
{ args_after_notifier = 0; delete[]$1; }
|
2001-07-02 01:44:43 +02:00
|
|
|
;
|
2000-05-12 01:37:26 +02:00
|
|
|
|
2001-10-26 05:22:56 +02:00
|
|
|
|
2012-02-20 03:54:58 +01:00
|
|
|
statement /* This is roughly statement_item in the LRM */
|
2000-05-12 01:37:26 +02:00
|
|
|
|
|
|
|
|
/* assign and deassign statements are procedural code to do
|
|
|
|
|
structural assignments, and to turn that structural assignment
|
2011-03-11 20:27:54 +01:00
|
|
|
off. This is stronger than any other assign, but weaker than the
|
2000-05-12 01:37:26 +02:00
|
|
|
force assignments. */
|
|
|
|
|
|
2006-02-02 03:43:57 +01:00
|
|
|
: K_assign lpvalue '=' expression ';'
|
2000-05-12 01:37:26 +02:00
|
|
|
{ PCAssign*tmp = new PCAssign($2, $4);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-05-12 01:37:26 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-02 03:43:57 +01:00
|
|
|
| K_deassign lpvalue ';'
|
2000-05-12 01:37:26 +02:00
|
|
|
{ PDeassign*tmp = new PDeassign($2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-05-12 01:37:26 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Force and release statements are similar to assignments,
|
|
|
|
|
syntactically, but they will be elaborated differently. */
|
|
|
|
|
|
2006-02-02 03:43:57 +01:00
|
|
|
| K_force lpvalue '=' expression ';'
|
2000-05-12 01:37:26 +02:00
|
|
|
{ PForce*tmp = new PForce($2, $4);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-05-12 01:37:26 +02:00
|
|
|
$$ = tmp;
|
1999-05-30 05:12:56 +02:00
|
|
|
}
|
2006-02-02 03:43:57 +01:00
|
|
|
| K_release lpvalue ';'
|
2000-05-12 01:37:26 +02:00
|
|
|
{ PRelease*tmp = new PRelease($2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-05-12 01:37:26 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* begin-end blocks come in a variety of forms, including named and
|
|
|
|
|
anonymous. The named blocks can also carry their own reg
|
|
|
|
|
variables, which are placed in the scope created by the block
|
2011-03-11 20:27:54 +01:00
|
|
|
name. These are handled by pushing the scope name, then matching
|
2000-05-12 01:37:26 +02:00
|
|
|
the declarations. The scope is popped at the end of the block. */
|
|
|
|
|
|
2011-11-23 05:33:19 +01:00
|
|
|
| K_begin K_end
|
|
|
|
|
{ PBlock*tmp = new PBlock(PBlock::BL_SEQ);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-02-16 06:20:24 +01:00
|
|
|
| K_begin statement_list K_end
|
|
|
|
|
{ PBlock*tmp = new PBlock(PBlock::BL_SEQ);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
tmp->set_statement(*$2);
|
|
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_begin ':' IDENTIFIER
|
2008-02-25 04:40:54 +01:00
|
|
|
{ PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
current_block_stack.push(tmp);
|
2008-02-16 06:20:24 +01:00
|
|
|
}
|
|
|
|
|
block_item_decls_opt
|
2011-11-23 05:33:19 +01:00
|
|
|
statement_list_or_null K_end
|
2008-02-16 06:20:24 +01:00
|
|
|
{ pform_pop_scope();
|
2008-02-25 04:40:54 +01:00
|
|
|
assert(! current_block_stack.empty());
|
|
|
|
|
PBlock*tmp = current_block_stack.top();
|
|
|
|
|
current_block_stack.pop();
|
2011-11-23 05:33:19 +01:00
|
|
|
if ($6) tmp->set_statement(*$6);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$3;
|
2008-02-16 06:20:24 +01:00
|
|
|
delete $6;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = tmp;
|
2008-02-16 06:20:24 +01:00
|
|
|
}
|
|
|
|
|
| K_begin error K_end
|
|
|
|
|
{ yyerrok; }
|
2000-05-12 01:37:26 +02:00
|
|
|
|
|
|
|
|
/* fork-join blocks are very similar to begin-end blocks. In fact,
|
|
|
|
|
from the parser's perspective there is no real difference. All we
|
|
|
|
|
need to do is remember that this is a parallel block so that the
|
|
|
|
|
code generator can do the right thing. */
|
|
|
|
|
|
2011-11-23 05:33:19 +01:00
|
|
|
| K_fork K_join
|
|
|
|
|
{ PBlock*tmp = new PBlock(PBlock::BL_PAR);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_fork statement_list K_join
|
|
|
|
|
{ PBlock*tmp = new PBlock(PBlock::BL_PAR);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
tmp->set_statement(*$2);
|
|
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-02-16 06:20:24 +01:00
|
|
|
| K_fork ':' IDENTIFIER
|
2008-02-25 04:40:54 +01:00
|
|
|
{ PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
current_block_stack.push(tmp);
|
2008-02-16 06:20:24 +01:00
|
|
|
}
|
|
|
|
|
block_item_decls_opt
|
2011-11-23 05:33:19 +01:00
|
|
|
statement_list_or_null K_join
|
2008-02-16 06:20:24 +01:00
|
|
|
{ pform_pop_scope();
|
2008-02-25 04:40:54 +01:00
|
|
|
assert(! current_block_stack.empty());
|
|
|
|
|
PBlock*tmp = current_block_stack.top();
|
|
|
|
|
current_block_stack.pop();
|
2011-11-23 05:33:19 +01:00
|
|
|
if ($6) tmp->set_statement(*$6);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$3;
|
2008-02-16 06:20:24 +01:00
|
|
|
delete $6;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = tmp;
|
2008-02-16 06:20:24 +01:00
|
|
|
}
|
2011-11-23 05:33:19 +01:00
|
|
|
| K_fork error K_join
|
|
|
|
|
{ yyerrok; }
|
2000-05-12 01:37:26 +02:00
|
|
|
|
2008-01-25 22:34:51 +01:00
|
|
|
| K_disable hierarchy_identifier ';'
|
2001-12-03 05:47:14 +01:00
|
|
|
{ PDisable*tmp = new PDisable(*$2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-05-12 01:37:26 +02:00
|
|
|
delete $2;
|
2000-07-26 07:08:07 +02:00
|
|
|
$$ = tmp;
|
2000-05-12 01:37:26 +02:00
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| K_TRIGGER hierarchy_identifier ';'
|
2002-12-07 03:49:24 +01:00
|
|
|
{ PTrigger*tmp = new PTrigger(*$2);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2000-07-26 07:08:07 +02:00
|
|
|
delete $2;
|
2000-05-12 01:37:26 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2012-02-25 18:28:20 +01:00
|
|
|
|
|
|
|
|
| loop_statement { $$ = $1; }
|
|
|
|
|
|
1999-02-03 05:20:11 +01:00
|
|
|
| K_case '(' expression ')' case_items K_endcase
|
1999-09-29 20:36:02 +02:00
|
|
|
{ PCase*tmp = new PCase(NetCase::EQ, $3, $5);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-02-03 05:20:11 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-06-10 06:03:52 +02:00
|
|
|
| K_casex '(' expression ')' case_items K_endcase
|
1999-09-29 20:36:02 +02:00
|
|
|
{ PCase*tmp = new PCase(NetCase::EQX, $3, $5);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-06-10 06:03:52 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| K_casez '(' expression ')' case_items K_endcase
|
1999-09-29 20:36:02 +02:00
|
|
|
{ PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-06-10 06:03:52 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-06-12 05:42:57 +02:00
|
|
|
| K_case '(' expression ')' error K_endcase
|
|
|
|
|
{ yyerrok; }
|
|
|
|
|
| K_casex '(' expression ')' error K_endcase
|
|
|
|
|
{ yyerrok; }
|
|
|
|
|
| K_casez '(' expression ')' error K_endcase
|
|
|
|
|
{ yyerrok; }
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_if '(' expression ')' statement_or_null %prec less_than_K_else
|
1998-11-07 18:05:05 +01:00
|
|
|
{ PCondit*tmp = new PCondit($3, $5, 0);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1998-11-07 18:05:05 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_if '(' expression ')' statement_or_null K_else statement_or_null
|
1998-11-07 18:05:05 +01:00
|
|
|
{ PCondit*tmp = new PCondit($3, $5, $7);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1998-11-07 18:05:05 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_if '(' error ')' statement_or_null %prec less_than_K_else
|
1999-09-29 23:16:32 +02:00
|
|
|
{ yyerror(@1, "error: Malformed conditional expression.");
|
1998-11-07 18:05:05 +01:00
|
|
|
$$ = $5;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_if '(' error ')' statement_or_null K_else statement_or_null
|
1999-09-29 23:16:32 +02:00
|
|
|
{ yyerror(@1, "error: Malformed conditional expression.");
|
1998-11-07 18:05:05 +01:00
|
|
|
$$ = $5;
|
|
|
|
|
}
|
2012-02-20 03:54:58 +01:00
|
|
|
/* SytemVerilog adds the compressed_statement */
|
|
|
|
|
|
|
|
|
|
| compressed_statement ';'
|
|
|
|
|
{ $$ = $1; }
|
|
|
|
|
|
|
|
|
|
/* increment/decrement expressions can also be statements. When used
|
|
|
|
|
as statements, we can rewrite a++ as a += 1, and so on. */
|
|
|
|
|
|
|
|
|
|
| inc_or_dec_expression ';'
|
|
|
|
|
{ $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
|
|
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
|
|
| delay1 statement_or_null
|
|
|
|
|
{ PExpr*del = $1->front();
|
|
|
|
|
assert($1->size() == 1);
|
|
|
|
|
delete $1;
|
|
|
|
|
PDelayStatement*tmp = new PDelayStatement(del, $2);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-05 06:27:21 +02:00
|
|
|
| event_control attribute_list_opt statement_or_null
|
|
|
|
|
{ PEventStatement*tmp = $1;
|
|
|
|
|
if (tmp == 0) {
|
|
|
|
|
yyerror(@1, "error: Invalid event control.");
|
|
|
|
|
$$ = 0;
|
|
|
|
|
} else {
|
|
|
|
|
if ($3) pform_bind_attributes($3->attributes,$2);
|
|
|
|
|
tmp->set_statement($3);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| '@' '*' attribute_list_opt statement_or_null
|
|
|
|
|
{ PEventStatement*tmp = new PEventStatement;
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
if ($4) pform_bind_attributes($4->attributes,$3);
|
|
|
|
|
tmp->set_statement($4);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| '@' '(' '*' ')' attribute_list_opt statement_or_null
|
|
|
|
|
{ PEventStatement*tmp = new PEventStatement;
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
if ($6) pform_bind_attributes($6->attributes,$5);
|
|
|
|
|
tmp->set_statement($6);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2012-02-20 03:54:58 +01:00
|
|
|
|
|
|
|
|
/* Various assignment statements */
|
|
|
|
|
|
2011-11-27 20:16:39 +01:00
|
|
|
| lpvalue '=' expression ';'
|
|
|
|
|
{ PAssign*tmp = new PAssign($1,$3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2006-02-02 03:43:57 +01:00
|
|
|
| error '=' expression ';'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@2, "Syntax in assignment statement l-value.");
|
2006-02-02 03:43:57 +01:00
|
|
|
yyerrok;
|
|
|
|
|
$$ = new PNoop;
|
|
|
|
|
}
|
1999-05-07 06:26:49 +02:00
|
|
|
| lpvalue K_LE expression ';'
|
1999-06-06 22:45:38 +02:00
|
|
|
{ PAssignNB*tmp = new PAssignNB($1,$3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-05-10 02:16:57 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2006-02-02 03:43:57 +01:00
|
|
|
| error K_LE expression ';'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@2, "Syntax in assignment statement l-value.");
|
2006-02-02 03:43:57 +01:00
|
|
|
yyerrok;
|
|
|
|
|
$$ = new PNoop;
|
|
|
|
|
}
|
1999-12-31 04:24:30 +01:00
|
|
|
| lpvalue '=' delay1 expression ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ PExpr*del = $3->front(); $3->pop_front();
|
|
|
|
|
assert($3->empty());
|
1999-08-01 18:34:50 +02:00
|
|
|
PAssign*tmp = new PAssign($1,del,$4);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-05-10 02:16:57 +02:00
|
|
|
$$ = tmp;
|
1999-05-08 22:19:20 +02:00
|
|
|
}
|
1999-12-31 04:24:30 +01:00
|
|
|
| lpvalue K_LE delay1 expression ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ PExpr*del = $3->front(); $3->pop_front();
|
|
|
|
|
assert($3->empty());
|
1999-09-02 03:59:27 +02:00
|
|
|
PAssignNB*tmp = new PAssignNB($1,del,$4);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-09-22 04:00:48 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue '=' event_control expression ';'
|
2008-09-04 01:05:12 +02:00
|
|
|
{ PAssign*tmp = new PAssign($1,0,$3,$4);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-09-22 04:00:48 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-12-31 04:24:30 +01:00
|
|
|
| lpvalue '=' K_repeat '(' expression ')' event_control expression ';'
|
2008-09-04 01:05:12 +02:00
|
|
|
{ PAssign*tmp = new PAssign($1,$5,$7,$8);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp,@1);
|
1999-12-31 04:24:30 +01:00
|
|
|
tmp->set_lineno(@1.first_line);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-09-22 04:00:48 +02:00
|
|
|
| lpvalue K_LE event_control expression ';'
|
2008-09-04 01:05:12 +02:00
|
|
|
{ PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-12-31 04:24:30 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_LE K_repeat '(' expression ')' event_control expression ';'
|
2008-09-04 01:05:12 +02:00
|
|
|
{ PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-09-02 03:59:27 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2012-02-20 03:54:58 +01:00
|
|
|
|
|
|
|
|
|
2007-04-02 01:02:03 +02:00
|
|
|
| K_wait '(' expression ')' statement_or_null
|
1998-11-09 19:55:33 +01:00
|
|
|
{ PEventStatement*tmp;
|
2000-04-12 06:23:57 +02:00
|
|
|
PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
|
1999-04-29 04:16:26 +02:00
|
|
|
tmp = new PEventStatement(etmp);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp,@1);
|
1998-11-09 19:55:33 +01:00
|
|
|
tmp->set_statement($5);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
| SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';'
|
2007-05-24 06:07:11 +02:00
|
|
|
{ PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp,@1);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1999-07-03 04:12:51 +02:00
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
|
|
|
|
| SYSTEM_IDENTIFIER ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>pt;
|
2007-05-24 06:07:11 +02:00
|
|
|
PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp,@1);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1999-07-03 04:12:51 +02:00
|
|
|
$$ = tmp;
|
1998-11-04 00:28:49 +01:00
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '(' expression_list_proper ')' ';'
|
2001-12-03 05:47:14 +01:00
|
|
|
{ PCallTask*tmp = new PCallTask(*$1, *$3);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-07-03 04:12:51 +02:00
|
|
|
delete $1;
|
|
|
|
|
delete $3;
|
|
|
|
|
$$ = tmp;
|
1999-06-16 05:13:29 +02:00
|
|
|
}
|
2007-04-02 01:02:03 +02:00
|
|
|
|
|
|
|
|
/* NOTE: The standard doesn't really support an empty argument list
|
|
|
|
|
between parentheses, but it seems natural, and people commonly
|
|
|
|
|
want it. So accept it explicitly. */
|
|
|
|
|
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier '(' ')' ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>pt;
|
2007-04-02 01:02:03 +02:00
|
|
|
PCallTask*tmp = new PCallTask(*$1, pt);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
2007-04-02 01:02:03 +02:00
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2008-01-25 22:34:51 +01:00
|
|
|
| hierarchy_identifier ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>pt;
|
2001-12-03 05:47:14 +01:00
|
|
|
PCallTask*tmp = new PCallTask(*$1, pt);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(tmp, @1);
|
1999-07-03 04:12:51 +02:00
|
|
|
delete $1;
|
|
|
|
|
$$ = tmp;
|
1999-05-08 22:19:20 +02:00
|
|
|
}
|
1998-11-04 00:28:49 +01:00
|
|
|
| error ';'
|
2007-12-03 21:31:34 +01:00
|
|
|
{ yyerror(@2, "error: malformed statement");
|
1999-06-12 05:42:57 +02:00
|
|
|
yyerrok;
|
1998-11-04 00:28:49 +01:00
|
|
|
$$ = new PNoop;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2011-07-21 04:03:24 +02:00
|
|
|
compressed_statement
|
2011-11-27 20:16:39 +01:00
|
|
|
: lpvalue K_PLUS_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '+', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_MINUS_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '-', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_MUL_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '*', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_DIV_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '/', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_MOD_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '%', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_AND_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '&', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_OR_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '|', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_XOR_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, '^', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_LS_EQ expression
|
|
|
|
|
{ PAssign *tmp = new PAssign($1, 'l', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_RS_EQ expression
|
|
|
|
|
{ PAssign*tmp = new PAssign($1, 'r', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| lpvalue K_RSS_EQ expression
|
|
|
|
|
{ PAssign *tmp = new PAssign($1, 'R', $3);
|
|
|
|
|
FILE_NAME(tmp, @1);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2011-07-21 04:03:24 +02:00
|
|
|
;
|
|
|
|
|
|
2011-11-23 05:33:19 +01:00
|
|
|
statement_list_or_null
|
|
|
|
|
: statement_list_or_null statement
|
|
|
|
|
{ vector<Statement*>*tmp = $1;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
tmp->push_back($2);
|
|
|
|
|
} else {
|
|
|
|
|
tmp = new vector<Statement*>(1);
|
|
|
|
|
tmp->at(0) = $2;
|
|
|
|
|
}
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
statement_list
|
2011-09-17 21:10:05 +02:00
|
|
|
: statement_list statement
|
|
|
|
|
{ vector<Statement*>*tmp = $1;
|
|
|
|
|
tmp->push_back($2);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| statement
|
|
|
|
|
{ vector<Statement*>*tmp = new vector<Statement*>(1);
|
|
|
|
|
tmp->at(0) = $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2011-11-06 19:07:43 +01:00
|
|
|
statement_or_null_list
|
|
|
|
|
: statement_or_null_list statement_or_null
|
|
|
|
|
{ vector<Statement*>*tmp = $1;
|
|
|
|
|
tmp->push_back($2);
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| statement_or_null
|
|
|
|
|
{ vector<Statement*>*tmp = new vector<Statement*>(1);
|
|
|
|
|
tmp->at(0) = $1;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
analog_statement
|
|
|
|
|
: branch_probe_expression K_CONTRIBUTE expression ';'
|
2008-09-05 06:27:21 +02:00
|
|
|
{ $$ = pform_contribution_statement(@2, $1, $3); }
|
2008-05-11 21:00:11 +02:00
|
|
|
;
|
|
|
|
|
|
2007-03-22 17:08:14 +01:00
|
|
|
/* Task items are, other than the statement, task port items and
|
2006-05-11 05:26:57 +02:00
|
|
|
other block items. */
|
1999-05-30 05:12:56 +02:00
|
|
|
task_item
|
2006-05-11 05:26:57 +02:00
|
|
|
: block_item_decl { $$ = new svector<PWire*>(0); }
|
|
|
|
|
| task_port_item { $$ = $1; }
|
|
|
|
|
;
|
2006-03-30 07:22:34 +02:00
|
|
|
|
2006-05-11 05:26:57 +02:00
|
|
|
task_port_item
|
2012-02-19 19:29:50 +01:00
|
|
|
: port_direction K_reg_opt unsigned_signed_opt range_opt list_of_identifiers ';'
|
2012-02-20 02:31:15 +01:00
|
|
|
{ svector<PWire*>*tmp = pform_make_task_ports(@1, $1,
|
2011-01-27 04:33:49 +01:00
|
|
|
$2 ? IVL_VT_LOGIC :
|
|
|
|
|
IVL_VT_NO_TYPE,
|
2012-02-20 02:31:15 +01:00
|
|
|
$3, $4, $5);
|
2010-10-20 04:34:17 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2006-03-30 07:22:34 +02:00
|
|
|
|
|
|
|
|
/* When the port is an integer, infer a signed vector of the integer
|
2008-08-09 03:12:52 +02:00
|
|
|
shape. Generate a range ([31:0]) to make it work. */
|
2006-03-30 07:22:34 +02:00
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction K_integer list_of_identifiers ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*range_stub = make_range_from_width(integer_width);
|
2012-02-20 02:31:15 +01:00
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
|
|
|
|
|
range_stub, $3, true);
|
2010-10-26 04:36:44 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2006-03-30 07:22:34 +02:00
|
|
|
|
2008-08-09 03:12:52 +02:00
|
|
|
/* Ports can be time with a width of [63:0] (unsigned). */
|
|
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction K_time list_of_identifiers ';'
|
2010-10-26 04:36:44 +02:00
|
|
|
{ list<PExpr*>*range_stub = make_range_from_width(64);
|
2012-02-20 02:31:15 +01:00
|
|
|
svector<PWire*>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
|
|
|
|
|
range_stub, $3);
|
2010-10-26 04:36:44 +02:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
2006-03-30 07:22:34 +02:00
|
|
|
|
2008-08-09 03:12:52 +02:00
|
|
|
/* Ports can be real or realtime. */
|
2006-03-30 07:22:34 +02:00
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
| port_direction real_or_realtime list_of_identifiers ';'
|
2012-02-20 02:31:15 +01:00
|
|
|
{ svector<PWire*>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, false,
|
|
|
|
|
0, $3);
|
2012-02-19 19:29:50 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;
|
1999-05-30 05:12:56 +02:00
|
|
|
|
|
|
|
|
task_item_list
|
|
|
|
|
: task_item_list task_item
|
1999-07-24 04:11:19 +02:00
|
|
|
{ svector<PWire*>*tmp = new svector<PWire*>(*$1, *$2);
|
|
|
|
|
delete $1;
|
|
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1999-05-30 05:12:56 +02:00
|
|
|
| task_item
|
1999-07-24 04:11:19 +02:00
|
|
|
{ $$ = $1; }
|
1999-05-30 05:12:56 +02:00
|
|
|
;
|
|
|
|
|
|
1999-06-12 05:42:57 +02:00
|
|
|
task_item_list_opt
|
|
|
|
|
: task_item_list
|
1999-07-24 04:11:19 +02:00
|
|
|
{ $$ = $1; }
|
1999-06-12 05:42:57 +02:00
|
|
|
|
|
1999-07-24 04:11:19 +02:00
|
|
|
{ $$ = 0; }
|
1999-06-12 05:42:57 +02:00
|
|
|
;
|
2006-05-11 05:26:57 +02:00
|
|
|
|
2012-02-20 02:31:15 +01:00
|
|
|
tf_port_list_opt
|
|
|
|
|
: tf_port_list { $$ = $1; }
|
2011-09-17 21:10:05 +02:00
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
1998-11-23 01:20:22 +01:00
|
|
|
udp_body
|
|
|
|
|
: K_table { lex_start_table(); }
|
1998-11-25 03:35:53 +01:00
|
|
|
udp_entry_list
|
|
|
|
|
K_endtable { lex_end_table(); $$ = $3; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_entry_list
|
|
|
|
|
: udp_comb_entry_list
|
|
|
|
|
| udp_sequ_entry_list
|
1998-11-23 01:20:22 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_comb_entry
|
|
|
|
|
: udp_input_list ':' udp_output_sym ';'
|
1999-07-10 03:03:18 +02:00
|
|
|
{ char*tmp = new char[strlen($1)+3];
|
|
|
|
|
strcpy(tmp, $1);
|
|
|
|
|
char*tp = tmp+strlen(tmp);
|
|
|
|
|
*tp++ = ':';
|
|
|
|
|
*tp++ = $3;
|
|
|
|
|
*tp++ = 0;
|
|
|
|
|
delete[]$1;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-23 01:20:22 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_comb_entry_list
|
|
|
|
|
: udp_comb_entry
|
1998-11-25 03:35:53 +01:00
|
|
|
{ list<string>*tmp = new list<string>;
|
1999-07-10 03:03:18 +02:00
|
|
|
tmp->push_back($1);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-23 01:20:22 +01:00
|
|
|
| udp_comb_entry_list udp_comb_entry
|
1998-11-25 03:35:53 +01:00
|
|
|
{ list<string>*tmp = $1;
|
1999-07-10 03:03:18 +02:00
|
|
|
tmp->push_back($2);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_sequ_entry_list
|
|
|
|
|
: udp_sequ_entry
|
|
|
|
|
{ list<string>*tmp = new list<string>;
|
1999-07-10 03:03:18 +02:00
|
|
|
tmp->push_back($1);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| udp_sequ_entry_list udp_sequ_entry
|
|
|
|
|
{ list<string>*tmp = $1;
|
1999-07-10 03:03:18 +02:00
|
|
|
tmp->push_back($2);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_sequ_entry
|
|
|
|
|
: udp_input_list ':' udp_input_sym ':' udp_output_sym ';'
|
1999-07-10 03:03:18 +02:00
|
|
|
{ char*tmp = new char[strlen($1)+5];
|
|
|
|
|
strcpy(tmp, $1);
|
|
|
|
|
char*tp = tmp+strlen(tmp);
|
|
|
|
|
*tp++ = ':';
|
|
|
|
|
*tp++ = $3;
|
|
|
|
|
*tp++ = ':';
|
|
|
|
|
*tp++ = $5;
|
|
|
|
|
*tp++ = 0;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_initial
|
2003-04-14 05:37:47 +02:00
|
|
|
: K_initial IDENTIFIER '=' number ';'
|
1998-11-25 03:35:53 +01:00
|
|
|
{ PExpr*etmp = new PENumber($4);
|
2007-05-24 06:07:11 +02:00
|
|
|
PEIdent*itmp = new PEIdent(lex_strings.make($2));
|
1999-05-10 02:16:57 +02:00
|
|
|
PAssign*atmp = new PAssign(itmp, etmp);
|
2007-12-20 18:31:01 +01:00
|
|
|
FILE_NAME(atmp, @2);
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = atmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_init_opt
|
|
|
|
|
: udp_initial { $$ = $1; }
|
|
|
|
|
| { $$ = 0; }
|
1998-11-23 01:20:22 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_input_list
|
|
|
|
|
: udp_input_sym
|
1999-07-10 03:03:18 +02:00
|
|
|
{ char*tmp = new char[2];
|
|
|
|
|
tmp[0] = $1;
|
|
|
|
|
tmp[1] = 0;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-23 01:20:22 +01:00
|
|
|
| udp_input_list udp_input_sym
|
1999-07-10 03:03:18 +02:00
|
|
|
{ char*tmp = new char[strlen($1)+2];
|
|
|
|
|
strcpy(tmp, $1);
|
|
|
|
|
char*tp = tmp+strlen(tmp);
|
|
|
|
|
*tp++ = $2;
|
|
|
|
|
*tp++ = 0;
|
|
|
|
|
delete[]$1;
|
1998-11-25 03:35:53 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_input_sym
|
|
|
|
|
: '0' { $$ = '0'; }
|
|
|
|
|
| '1' { $$ = '1'; }
|
|
|
|
|
| 'x' { $$ = 'x'; }
|
|
|
|
|
| '?' { $$ = '?'; }
|
|
|
|
|
| 'b' { $$ = 'b'; }
|
|
|
|
|
| '*' { $$ = '*'; }
|
2000-03-05 19:26:51 +01:00
|
|
|
| '%' { $$ = '%'; }
|
1998-11-25 03:35:53 +01:00
|
|
|
| 'f' { $$ = 'f'; }
|
2000-03-05 19:26:51 +01:00
|
|
|
| 'F' { $$ = 'F'; }
|
2001-06-18 02:51:23 +02:00
|
|
|
| 'l' { $$ = 'l'; }
|
2011-02-07 04:47:11 +01:00
|
|
|
| 'h' { $$ = 'h'; }
|
2001-06-18 02:51:23 +02:00
|
|
|
| 'B' { $$ = 'B'; }
|
1998-12-14 03:01:34 +01:00
|
|
|
| 'r' { $$ = 'r'; }
|
2000-03-05 19:26:51 +01:00
|
|
|
| 'R' { $$ = 'R'; }
|
2001-06-18 02:51:23 +02:00
|
|
|
| 'M' { $$ = 'M'; }
|
1998-12-18 06:16:25 +01:00
|
|
|
| 'n' { $$ = 'n'; }
|
2000-03-05 19:26:51 +01:00
|
|
|
| 'N' { $$ = 'N'; }
|
1998-12-18 06:16:25 +01:00
|
|
|
| 'p' { $$ = 'p'; }
|
2000-03-05 19:26:51 +01:00
|
|
|
| 'P' { $$ = 'P'; }
|
2001-06-18 02:51:23 +02:00
|
|
|
| 'Q' { $$ = 'Q'; }
|
2003-03-18 02:36:14 +01:00
|
|
|
| 'q' { $$ = 'q'; }
|
1998-12-18 06:16:25 +01:00
|
|
|
| '_' { $$ = '_'; }
|
2000-03-05 19:26:51 +01:00
|
|
|
| '+' { $$ = '+'; }
|
1998-11-23 01:20:22 +01:00
|
|
|
;
|
|
|
|
|
|
1998-11-25 03:35:53 +01:00
|
|
|
udp_output_sym
|
|
|
|
|
: '0' { $$ = '0'; }
|
|
|
|
|
| '1' { $$ = '1'; }
|
|
|
|
|
| 'x' { $$ = 'x'; }
|
|
|
|
|
| '-' { $$ = '-'; }
|
|
|
|
|
;
|
1998-11-23 01:20:22 +01:00
|
|
|
|
2007-05-24 06:07:11 +02:00
|
|
|
/* Port declarations create wires for the inputs and the output. The
|
|
|
|
|
makes for these ports are scoped within the UDP, so there is no
|
2008-01-25 22:34:51 +01:00
|
|
|
hierarchy involved. */
|
1998-11-23 01:20:22 +01:00
|
|
|
udp_port_decl
|
2008-02-25 04:40:54 +01:00
|
|
|
: K_input list_of_identifiers ';'
|
|
|
|
|
{ $$ = pform_make_udp_input_ports($2); }
|
|
|
|
|
| K_output IDENTIFIER ';'
|
|
|
|
|
{ perm_string pname = lex_strings.make($2);
|
|
|
|
|
PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
|
|
|
|
|
svector<PWire*>*tmp = new svector<PWire*>(1);
|
|
|
|
|
(*tmp)[0] = pp;
|
|
|
|
|
$$ = tmp;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
2008-02-25 04:40:54 +01:00
|
|
|
}
|
|
|
|
|
| K_reg IDENTIFIER ';'
|
|
|
|
|
{ perm_string pname = lex_strings.make($2);
|
|
|
|
|
PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
|
|
|
|
|
svector<PWire*>*tmp = new svector<PWire*>(1);
|
|
|
|
|
(*tmp)[0] = pp;
|
|
|
|
|
$$ = tmp;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$2;
|
2008-02-25 04:40:54 +01:00
|
|
|
}
|
|
|
|
|
| K_reg K_output IDENTIFIER ';'
|
|
|
|
|
{ perm_string pname = lex_strings.make($3);
|
|
|
|
|
PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
|
|
|
|
|
svector<PWire*>*tmp = new svector<PWire*>(1);
|
|
|
|
|
(*tmp)[0] = pp;
|
|
|
|
|
$$ = tmp;
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$3;
|
2008-02-25 04:40:54 +01:00
|
|
|
}
|
2007-05-24 06:07:11 +02:00
|
|
|
;
|
1998-11-23 01:20:22 +01:00
|
|
|
|
|
|
|
|
udp_port_decls
|
|
|
|
|
: udp_port_decl
|
1998-11-25 03:35:53 +01:00
|
|
|
{ $$ = $1; }
|
1998-11-23 01:20:22 +01:00
|
|
|
| udp_port_decls udp_port_decl
|
1999-06-12 22:35:27 +02:00
|
|
|
{ svector<PWire*>*tmp = new svector<PWire*>(*$1, *$2);
|
|
|
|
|
delete $1;
|
1998-11-25 03:35:53 +01:00
|
|
|
delete $2;
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
1998-11-23 01:20:22 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_port_list
|
2008-02-25 04:40:54 +01:00
|
|
|
: IDENTIFIER
|
|
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($1));
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$1;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
| udp_port_list ',' IDENTIFIER
|
|
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($3));
|
2008-03-28 04:30:53 +01:00
|
|
|
delete[]$3;
|
2008-02-25 04:40:54 +01:00
|
|
|
$$ = tmp;
|
|
|
|
|
}
|
|
|
|
|
;
|
1998-11-23 01:20:22 +01:00
|
|
|
|
2004-03-08 01:10:29 +01:00
|
|
|
udp_reg_opt: K_reg { $$ = true; } | { $$ = false; };
|
|
|
|
|
|
|
|
|
|
udp_initial_expr_opt
|
|
|
|
|
: '=' expression { $$ = $2; }
|
|
|
|
|
| { $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
udp_input_declaration_list
|
|
|
|
|
: K_input IDENTIFIER
|
|
|
|
|
{ list<perm_string>*tmp = new list<perm_string>;
|
|
|
|
|
tmp->push_back(lex_strings.make($2));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$2;
|
|
|
|
|
}
|
|
|
|
|
| udp_input_declaration_list ',' K_input IDENTIFIER
|
|
|
|
|
{ list<perm_string>*tmp = $1;
|
|
|
|
|
tmp->push_back(lex_strings.make($4));
|
|
|
|
|
$$ = tmp;
|
|
|
|
|
delete[]$4;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
1998-11-23 01:20:22 +01:00
|
|
|
udp_primitive
|
2004-03-08 01:10:29 +01:00
|
|
|
/* This is the syntax for primitives that uses the IEEE1364-1995
|
|
|
|
|
format. The ports are simply names in the port list, and the
|
|
|
|
|
declarations are in the body. */
|
|
|
|
|
|
1998-11-23 01:20:22 +01:00
|
|
|
: K_primitive IDENTIFIER '(' udp_port_list ')' ';'
|
|
|
|
|
udp_port_decls
|
1998-11-25 03:35:53 +01:00
|
|
|
udp_init_opt
|
1998-11-23 01:20:22 +01:00
|
|
|
udp_body
|
|
|
|
|
K_endprimitive
|
2004-03-08 01:10:29 +01:00
|
|
|
|
2004-02-18 18:11:54 +01:00
|
|
|
{ perm_string tmp2 = lex_strings.make($2);
|
|
|
|
|
pform_make_udp(tmp2, $4, $7, $9, $8,
|
2001-10-21 03:55:24 +02:00
|
|
|
@2.text, @2.first_line);
|
1999-07-10 03:03:18 +02:00
|
|
|
delete[]$2;
|
|
|
|
|
}
|
2004-03-08 01:10:29 +01:00
|
|
|
|
|
|
|
|
/* This is the syntax for IEEE1364-2001 format definitions. The port
|
|
|
|
|
names and declarations are all in the parameter list. */
|
|
|
|
|
|
|
|
|
|
| K_primitive IDENTIFIER
|
|
|
|
|
'(' K_output udp_reg_opt IDENTIFIER udp_initial_expr_opt ','
|
|
|
|
|
udp_input_declaration_list ')' ';'
|
|
|
|
|
udp_body
|
|
|
|
|
K_endprimitive
|
|
|
|
|
|
|
|
|
|
{ perm_string tmp2 = lex_strings.make($2);
|
|
|
|
|
perm_string tmp6 = lex_strings.make($6);
|
|
|
|
|
pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
|
|
|
|
|
@2.text, @2.first_line);
|
|
|
|
|
delete[]$2;
|
|
|
|
|
delete[]$6;
|
|
|
|
|
}
|
1998-11-23 01:20:22 +01:00
|
|
|
;
|
2011-12-04 02:16:01 +01:00
|
|
|
|
2012-02-19 19:29:50 +01:00
|
|
|
/* Many keywords can be optional in the syntax, although their
|
|
|
|
|
presence is significant. This is a fairly common pattern so
|
|
|
|
|
collect those rules here. */
|
|
|
|
|
|
|
|
|
|
K_automatic_opt: K_automatic { $$ = true; } | { $$ = false;} ;
|
|
|
|
|
K_packed_opt : K_packed { $$ = true; } | { $$ = false; } ;
|
|
|
|
|
K_reg_opt : K_reg { $$ = true; } | { $$ = false; } ;
|
|
|
|
|
K_virtual_opt : K_virtual { $$ = true; } | { $$ = false; } ;
|