Add unary ~ operator to tgt-vvp.
This commit is contained in:
parent
ad8565f8a6
commit
522d0ec864
10
ivl_target.h
10
ivl_target.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: ivl_target.h,v 1.37 2001/03/28 06:07:39 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.38 2001/03/29 02:52:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -167,6 +167,7 @@ typedef enum ivl_expr_type_e {
|
|||
IVL_EX_SIGNAL,
|
||||
IVL_EX_STRING,
|
||||
IVL_EX_SUBSIG,
|
||||
IVL_EX_UNARY
|
||||
} ivl_expr_type_t;
|
||||
|
||||
/* This is the type code for an ivl_net_logic_t object. */
|
||||
|
|
@ -361,9 +362,9 @@ extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net);
|
|||
extern const char* ivl_expr_bits(ivl_expr_t net);
|
||||
/* IVL_EX_SIGNAL, IVL_EX_SFUNC */
|
||||
extern const char* ivl_expr_name(ivl_expr_t net);
|
||||
/* IVL_EX_BINARY */
|
||||
/* IVL_EX_BINARY IVL_EX_UNARY */
|
||||
extern char ivl_expr_opcode(ivl_expr_t net);
|
||||
/* IVL_EX_BINARY */
|
||||
/* IVL_EX_BINARY IVL_EX_UNARY */
|
||||
extern ivl_expr_t ivl_expr_oper1(ivl_expr_t net);
|
||||
/* IVL_EX_BINARY */
|
||||
extern ivl_expr_t ivl_expr_oper2(ivl_expr_t net);
|
||||
|
|
@ -719,6 +720,9 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.38 2001/03/29 02:52:39 steve
|
||||
* Add unary ~ operator to tgt-vvp.
|
||||
*
|
||||
* Revision 1.37 2001/03/28 06:07:39 steve
|
||||
* Add the ivl_event_t to ivl_target, and use that to generate
|
||||
* .event statements in vvp way ahead of the thread that uses it.
|
||||
|
|
|
|||
11
t-dll-api.cc
11
t-dll-api.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: t-dll-api.cc,v 1.24 2001/03/28 06:07:39 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.25 2001/03/29 02:52:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "t-dll.h"
|
||||
|
|
@ -147,6 +147,9 @@ extern "C" char ivl_expr_opcode(ivl_expr_t net)
|
|||
case IVL_EX_BINARY:
|
||||
return net->u_.binary_.op_;
|
||||
|
||||
case IVL_EX_UNARY:
|
||||
return net->u_.unary_.op_;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
|
@ -160,6 +163,9 @@ extern "C" ivl_expr_t ivl_expr_oper1(ivl_expr_t net)
|
|||
case IVL_EX_BINARY:
|
||||
return net->u_.binary_.lef_;
|
||||
|
||||
case IVL_EX_UNARY:
|
||||
return net->u_.unary_.sub_;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
|
@ -703,6 +709,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.25 2001/03/29 02:52:39 steve
|
||||
* Add unary ~ operator to tgt-vvp.
|
||||
*
|
||||
* Revision 1.24 2001/03/28 06:07:39 steve
|
||||
* Add the ivl_event_t to ivl_target, and use that to generate
|
||||
* .event statements in vvp way ahead of the thread that uses it.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) & !defined(macintosh)
|
||||
#ident "$Id: t-dll-expr.cc,v 1.7 2000/10/28 22:32:34 steve Exp $"
|
||||
#ident "$Id: t-dll-expr.cc,v 1.8 2001/03/29 02:52:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "t-dll.h"
|
||||
|
|
@ -144,8 +144,27 @@ void dll_target::expr_signal(const NetESignal*net)
|
|||
expr_->u_.subsig_.name_ = strdup(net->name().c_str());
|
||||
}
|
||||
|
||||
void dll_target::expr_unary(const NetEUnary*net)
|
||||
{
|
||||
assert(expr_ == 0);
|
||||
|
||||
net->expr()->expr_scan(this);
|
||||
assert(expr_);
|
||||
|
||||
ivl_expr_t sub = expr_;
|
||||
|
||||
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
|
||||
expr_->type_ = IVL_EX_UNARY;
|
||||
expr_->width_= net->expr_width();
|
||||
expr_->u_.unary_.op_ = net->op();
|
||||
expr_->u_.unary_.sub_ = sub;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: t-dll-expr.cc,v $
|
||||
* Revision 1.8 2001/03/29 02:52:39 steve
|
||||
* Add unary ~ operator to tgt-vvp.
|
||||
*
|
||||
* Revision 1.7 2000/10/28 22:32:34 steve
|
||||
* API for concatenation expressions.
|
||||
*
|
||||
|
|
|
|||
12
t-dll.h
12
t-dll.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: t-dll.h,v 1.25 2001/03/28 06:07:39 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.26 2001/03/29 02:52:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -91,6 +91,7 @@ struct dll_target : public target_t, public expr_scan_t {
|
|||
void expr_concat(const NetEConcat*);
|
||||
void expr_const(const NetEConst*);
|
||||
void expr_sfunc(const NetESFunc*);
|
||||
void expr_unary(const NetEUnary*);
|
||||
void expr_signal(const NetESignal*);
|
||||
|
||||
ivl_scope_t lookup_scope_(const NetScope*scope);
|
||||
|
|
@ -150,6 +151,12 @@ struct ivl_expr_s {
|
|||
ivl_expr_t msb_;
|
||||
ivl_expr_t lsb_;
|
||||
} subsig_;
|
||||
|
||||
struct {
|
||||
char op_;
|
||||
ivl_expr_t sub_;
|
||||
} unary_;
|
||||
|
||||
} u_;
|
||||
};
|
||||
|
||||
|
|
@ -380,6 +387,9 @@ struct ivl_statement_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.26 2001/03/29 02:52:39 steve
|
||||
* Add unary ~ operator to tgt-vvp.
|
||||
*
|
||||
* Revision 1.25 2001/03/28 06:07:39 steve
|
||||
* Add the ivl_event_t to ivl_target, and use that to generate
|
||||
* .event statements in vvp way ahead of the thread that uses it.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: stub.c,v 1.30 2001/03/28 06:07:39 steve Exp $"
|
||||
#ident "$Id: stub.c,v 1.31 2001/03/29 02:52:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -82,6 +82,11 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
ivl_expr_name(net), width, sign);
|
||||
break;
|
||||
|
||||
case IVL_EX_UNARY:
|
||||
fprintf(out, "%*s<unary \"%c\" width=%u, %s>\n", ind, "",
|
||||
ivl_expr_opcode(net), width, sign);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(out, "%*s<expr_type=%u>\n", ind, "", code);
|
||||
break;
|
||||
|
|
@ -202,6 +207,7 @@ static void show_statement(ivl_statement_t net, unsigned ind)
|
|||
case IVL_ST_WAIT: {
|
||||
ivl_event_t evnt = ivl_stmt_event(net);
|
||||
fprintf(out, "%*s@(%s)\n", ind, "", ivl_event_name(evnt));
|
||||
show_statement(ivl_stmt_sub_stmt(net), ind+4);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -443,6 +449,9 @@ DECLARE_CYGWIN_DLL(DllMain);
|
|||
|
||||
/*
|
||||
* $Log: stub.c,v $
|
||||
* Revision 1.31 2001/03/29 02:52:39 steve
|
||||
* Add unary ~ operator to tgt-vvp.
|
||||
*
|
||||
* Revision 1.30 2001/03/28 06:07:39 steve
|
||||
* Add the ivl_event_t to ivl_target, and use that to generate
|
||||
* .event statements in vvp way ahead of the thread that uses it.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: eval_expr.c,v 1.3 2001/03/27 06:43:27 steve Exp $"
|
||||
#ident "$Id: eval_expr.c,v 1.4 2001/03/29 02:52:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -267,6 +267,26 @@ static struct vector_info draw_signal_expr(ivl_expr_t exp, unsigned wid)
|
|||
return res;
|
||||
}
|
||||
|
||||
static struct vector_info draw_unary_expr(ivl_expr_t exp, unsigned wid)
|
||||
{
|
||||
struct vector_info res;
|
||||
ivl_expr_t sub = ivl_expr_oper1(exp);
|
||||
res = draw_eval_expr_wid(sub, wid);
|
||||
|
||||
switch (ivl_expr_opcode(exp)) {
|
||||
case '~':
|
||||
fprintf(vvp_out, " %%inv %u, %u;\n", res.base, res.wid);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "vvp error: unhandled unary: %c\n",
|
||||
ivl_expr_opcode(exp));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
struct vector_info draw_eval_expr_wid(ivl_expr_t exp, unsigned wid)
|
||||
{
|
||||
struct vector_info res;
|
||||
|
|
@ -290,6 +310,10 @@ struct vector_info draw_eval_expr_wid(ivl_expr_t exp, unsigned wid)
|
|||
case IVL_EX_SIGNAL:
|
||||
res = draw_signal_expr(exp, wid);
|
||||
break;
|
||||
|
||||
case IVL_EX_UNARY:
|
||||
res = draw_unary_expr(exp, wid);
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -302,6 +326,9 @@ struct vector_info draw_eval_expr(ivl_expr_t exp)
|
|||
|
||||
/*
|
||||
* $Log: eval_expr.c,v $
|
||||
* Revision 1.4 2001/03/29 02:52:39 steve
|
||||
* Add unary ~ operator to tgt-vvp.
|
||||
*
|
||||
* Revision 1.3 2001/03/27 06:43:27 steve
|
||||
* Evaluate === and !==
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue