Add EX_NUMBER and ST_TRIGGER to dll-api.
This commit is contained in:
parent
cbe20e8bcf
commit
d6b43519a8
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: ivl_target.h,v 1.12 2000/09/24 15:46:00 steve Exp $"
|
#ident "$Id: ivl_target.h,v 1.13 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -146,6 +146,7 @@ typedef enum ivl_statement_type_e {
|
||||||
IVL_ST_DELAY,
|
IVL_ST_DELAY,
|
||||||
IVL_ST_DELAYX,
|
IVL_ST_DELAYX,
|
||||||
IVL_ST_STASK,
|
IVL_ST_STASK,
|
||||||
|
IVL_ST_TRIGGER,
|
||||||
IVL_ST_WAIT,
|
IVL_ST_WAIT,
|
||||||
IVL_ST_WHILE
|
IVL_ST_WHILE
|
||||||
} ivl_statement_type_t;
|
} ivl_statement_type_t;
|
||||||
|
|
@ -174,7 +175,9 @@ extern const char* ivl_get_root_name(ivl_design_t net);
|
||||||
*/
|
*/
|
||||||
extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net);
|
extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net);
|
||||||
|
|
||||||
|
extern const char* ivl_expr_bits(ivl_expr_t net);
|
||||||
extern const char* ivl_expr_name(ivl_expr_t net);
|
extern const char* ivl_expr_name(ivl_expr_t net);
|
||||||
|
extern int ivl_expr_signed(ivl_expr_t net);
|
||||||
extern const char* ivl_expr_string(ivl_expr_t net);
|
extern const char* ivl_expr_string(ivl_expr_t net);
|
||||||
extern unsigned ivl_expr_width(ivl_expr_t net);
|
extern unsigned ivl_expr_width(ivl_expr_t net);
|
||||||
|
|
||||||
|
|
@ -369,6 +372,9 @@ _END_DECL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: ivl_target.h,v $
|
* $Log: ivl_target.h,v $
|
||||||
|
* Revision 1.13 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.12 2000/09/24 15:46:00 steve
|
* Revision 1.12 2000/09/24 15:46:00 steve
|
||||||
* API access to signal type and port type.
|
* API access to signal type and port type.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
17
t-dll-api.cc
17
t-dll-api.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll-api.cc,v 1.6 2000/09/24 15:46:00 steve Exp $"
|
#ident "$Id: t-dll-api.cc,v 1.7 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "t-dll.h"
|
# include "t-dll.h"
|
||||||
|
|
@ -41,12 +41,24 @@ extern "C" const char*ivl_get_root_name(ivl_design_t des)
|
||||||
return ((const Design*)des)->find_root_scope()->name().c_str();
|
return ((const Design*)des)->find_root_scope()->name().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" const char* ivl_expr_bits(ivl_expr_t net)
|
||||||
|
{
|
||||||
|
assert(net && (net->type_ == IVL_EX_NUMBER));
|
||||||
|
return net->u_.number_.bits_;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" const char* ivl_expr_name(ivl_expr_t net)
|
extern "C" const char* ivl_expr_name(ivl_expr_t net)
|
||||||
{
|
{
|
||||||
assert(net->type_ == IVL_EX_SIGNAL);
|
assert(net->type_ == IVL_EX_SIGNAL);
|
||||||
return net->u_.subsig_.name_;
|
return net->u_.subsig_.name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" int ivl_expr_signed(ivl_expr_t net)
|
||||||
|
{
|
||||||
|
assert(net);
|
||||||
|
return net->signed_;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" const char* ivl_expr_string(ivl_expr_t net)
|
extern "C" const char* ivl_expr_string(ivl_expr_t net)
|
||||||
{
|
{
|
||||||
assert(net->type_ == IVL_EX_STRING);
|
assert(net->type_ == IVL_EX_STRING);
|
||||||
|
|
@ -263,6 +275,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-api.cc,v $
|
* $Log: t-dll-api.cc,v $
|
||||||
|
* Revision 1.7 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.6 2000/09/24 15:46:00 steve
|
* Revision 1.6 2000/09/24 15:46:00 steve
|
||||||
* API access to signal type and port type.
|
* API access to signal type and port type.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) & !defined(macintosh)
|
#if !defined(WINNT) & !defined(macintosh)
|
||||||
#ident "$Id: t-dll-expr.cc,v 1.2 2000/09/24 02:21:53 steve Exp $"
|
#ident "$Id: t-dll-expr.cc,v 1.3 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "t-dll.h"
|
# include "t-dll.h"
|
||||||
# include "netlist.h"
|
# include "netlist.h"
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
|
# include <malloc.h>
|
||||||
|
|
||||||
void dll_target::expr_const(const NetEConst*net)
|
void dll_target::expr_const(const NetEConst*net)
|
||||||
{
|
{
|
||||||
|
|
@ -38,8 +38,30 @@ void dll_target::expr_const(const NetEConst*net)
|
||||||
expr_->u_.string_.value_ =strdup(net->value().as_string().c_str());
|
expr_->u_.string_.value_ =strdup(net->value().as_string().c_str());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
verinum val = net->value();
|
||||||
|
unsigned idx;
|
||||||
|
char*bits;
|
||||||
expr_->type_ = IVL_EX_NUMBER;
|
expr_->type_ = IVL_EX_NUMBER;
|
||||||
expr_->width_= net->expr_width();
|
expr_->width_= net->expr_width();
|
||||||
|
expr_->signed_ = val.has_sign()? 1 : 0;
|
||||||
|
expr_->u_.number_.bits_ = bits = (char*)malloc(expr_->width_);
|
||||||
|
for (idx = 0 ; idx < expr_->width_ ; idx += 1)
|
||||||
|
switch (val.get(idx)) {
|
||||||
|
case verinum::V0:
|
||||||
|
bits[idx] = '0';
|
||||||
|
break;
|
||||||
|
case verinum::V1:
|
||||||
|
bits[idx] = '1';
|
||||||
|
break;
|
||||||
|
case verinum::Vx:
|
||||||
|
bits[idx] = 'x';
|
||||||
|
break;
|
||||||
|
case verinum::Vz:
|
||||||
|
bits[idx] = 'z';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +80,9 @@ void dll_target::expr_signal(const NetESignal*net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-expr.cc,v $
|
* $Log: t-dll-expr.cc,v $
|
||||||
|
* Revision 1.3 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.2 2000/09/24 02:21:53 steve
|
* Revision 1.2 2000/09/24 02:21:53 steve
|
||||||
* Add support for signal expressions.
|
* Add support for signal expressions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll-proc.cc,v 1.4 2000/09/23 05:15:07 steve Exp $"
|
#ident "$Id: t-dll-proc.cc,v 1.5 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "target.h"
|
# include "target.h"
|
||||||
|
|
@ -214,6 +214,15 @@ void dll_target::proc_stask(const NetSTask*net)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dll_target::proc_trigger(const NetEvTrig*net)
|
||||||
|
{
|
||||||
|
assert(stmt_cur_);
|
||||||
|
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||||
|
|
||||||
|
stmt_cur_->type_ = IVL_ST_TRIGGER;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool dll_target::proc_wait(const NetEvWait*net)
|
bool dll_target::proc_wait(const NetEvWait*net)
|
||||||
{
|
{
|
||||||
assert(stmt_cur_);
|
assert(stmt_cur_);
|
||||||
|
|
@ -254,6 +263,9 @@ void dll_target::proc_while(const NetWhile*net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-proc.cc,v $
|
* $Log: t-dll-proc.cc,v $
|
||||||
|
* Revision 1.5 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.4 2000/09/23 05:15:07 steve
|
* Revision 1.4 2000/09/23 05:15:07 steve
|
||||||
* Add enough tgt-verilog code to support hello world.
|
* Add enough tgt-verilog code to support hello world.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
18
t-dll.h
18
t-dll.h
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll.h,v 1.5 2000/09/24 02:21:53 steve Exp $"
|
#ident "$Id: t-dll.h,v 1.6 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "target.h"
|
# include "target.h"
|
||||||
|
|
@ -73,6 +73,7 @@ struct dll_target : public target_t, public expr_scan_t {
|
||||||
void proc_condit(const NetCondit*);
|
void proc_condit(const NetCondit*);
|
||||||
bool proc_delay(const NetPDelay*);
|
bool proc_delay(const NetPDelay*);
|
||||||
void proc_stask(const NetSTask*);
|
void proc_stask(const NetSTask*);
|
||||||
|
bool proc_trigger(const NetEvTrig*);
|
||||||
bool proc_wait(const NetEvWait*);
|
bool proc_wait(const NetEvWait*);
|
||||||
void proc_while(const NetWhile*);
|
void proc_while(const NetWhile*);
|
||||||
|
|
||||||
|
|
@ -93,9 +94,15 @@ struct dll_target : public target_t, public expr_scan_t {
|
||||||
*/
|
*/
|
||||||
struct ivl_expr_s {
|
struct ivl_expr_s {
|
||||||
ivl_expr_type_t type_;
|
ivl_expr_type_t type_;
|
||||||
unsigned width_;
|
|
||||||
|
unsigned width_ :24;
|
||||||
|
unsigned signed_ : 1;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
struct {
|
||||||
|
char*bits_;
|
||||||
|
} number_;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char*value_;
|
char*value_;
|
||||||
} string_;
|
} string_;
|
||||||
|
|
@ -154,6 +161,10 @@ struct ivl_statement_s {
|
||||||
ivl_expr_t*parms_;
|
ivl_expr_t*parms_;
|
||||||
} stask_;
|
} stask_;
|
||||||
|
|
||||||
|
struct { /* IVL_ST_TRIGGER */
|
||||||
|
ivl_net_event_t event_;
|
||||||
|
} trig_;
|
||||||
|
|
||||||
struct { /* IVL_ST_WAIT */
|
struct { /* IVL_ST_WAIT */
|
||||||
int cond_; /* XXXX */
|
int cond_; /* XXXX */
|
||||||
ivl_statement_t stmt_;
|
ivl_statement_t stmt_;
|
||||||
|
|
@ -168,6 +179,9 @@ struct ivl_statement_s {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll.h,v $
|
* $Log: t-dll.h,v $
|
||||||
|
* Revision 1.6 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.5 2000/09/24 02:21:53 steve
|
* Revision 1.5 2000/09/24 02:21:53 steve
|
||||||
* Add support for signal expressions.
|
* Add support for signal expressions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: stub.c,v 1.11 2000/09/24 15:46:00 steve Exp $"
|
#ident "$Id: stub.c,v 1.12 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -146,14 +146,34 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
||||||
const ivl_expr_type_t code = ivl_expr_type(net);
|
const ivl_expr_type_t code = ivl_expr_type(net);
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|
||||||
|
case IVL_EX_NUMBER: {
|
||||||
|
const char*bits = ivl_expr_bits(net);
|
||||||
|
unsigned width = ivl_expr_width(net);
|
||||||
|
unsigned idx;
|
||||||
|
|
||||||
|
fprintf(out, "%*s<number=%u'b", ind, "", width);
|
||||||
|
for (idx = width ; idx > 0 ; idx -= 1)
|
||||||
|
fprintf(out, "%c", bits[idx-1]);
|
||||||
|
|
||||||
|
fprintf(out, ", %s>\n", ivl_expr_signed(net)? "signed"
|
||||||
|
: "unsigned");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IVL_EX_STRING:
|
case IVL_EX_STRING:
|
||||||
fprintf(out, "%*s<string=%s, width=%u>\n", ind, "",
|
fprintf(out, "%*s<string=\"%s\", width=%u>\n", ind, "",
|
||||||
ivl_expr_string(net), ivl_expr_width(net));
|
ivl_expr_string(net), ivl_expr_width(net));
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
|
case IVL_EX_SIGNAL:
|
||||||
fprintf(out, "%*s<signal=%s, width=%u>\n", ind, "",
|
fprintf(out, "%*s<signal=%s, width=%u>\n", ind, "",
|
||||||
ivl_expr_name(net), ivl_expr_width(net));
|
ivl_expr_name(net), ivl_expr_width(net));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(out, "%*s<expr_type=%u>\n", ind, "", code);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,6 +234,11 @@ static void show_statement(ivl_statement_t net, unsigned ind)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IVL_ST_TRIGGER:
|
||||||
|
fprintf(out, "%*s-> ...\n", ind, "");
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case IVL_ST_WAIT:
|
case IVL_ST_WAIT:
|
||||||
fprintf(out, "%*s@(...)\n", ind, "");
|
fprintf(out, "%*s@(...)\n", ind, "");
|
||||||
show_statement(ivl_stmt_sub_stmt(net), ind+2);
|
show_statement(ivl_stmt_sub_stmt(net), ind+2);
|
||||||
|
|
@ -247,6 +272,9 @@ int target_process(ivl_process_t net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: stub.c,v $
|
* $Log: stub.c,v $
|
||||||
|
* Revision 1.12 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.11 2000/09/24 15:46:00 steve
|
* Revision 1.11 2000/09/24 15:46:00 steve
|
||||||
* API access to signal type and port type.
|
* API access to signal type and port type.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: verilog.c,v 1.3 2000/09/24 15:46:00 steve Exp $"
|
#ident "$Id: verilog.c,v 1.4 2000/09/26 00:30:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -120,6 +120,17 @@ static void show_expression(ivl_expr_t net)
|
||||||
|
|
||||||
switch (ivl_expr_type(net)) {
|
switch (ivl_expr_type(net)) {
|
||||||
|
|
||||||
|
case IVL_EX_NUMBER: {
|
||||||
|
int sigflag = ivl_expr_signed(net);
|
||||||
|
unsigned idx, width = ivl_expr_width(net);
|
||||||
|
const char*bits = ivl_expr_bits(net);
|
||||||
|
|
||||||
|
fprintf(out, "%u'%sb", width, sigflag? "s" : "");
|
||||||
|
for (idx = width ; idx > 0 ; idx -= 1)
|
||||||
|
fprintf(out, "%c", bits[idx-1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IVL_EX_STRING:
|
case IVL_EX_STRING:
|
||||||
fprintf(out, "\"%s\"", ivl_expr_string(net));
|
fprintf(out, "\"%s\"", ivl_expr_string(net));
|
||||||
break;
|
break;
|
||||||
|
|
@ -230,6 +241,9 @@ int target_process(ivl_process_t net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: verilog.c,v $
|
* $Log: verilog.c,v $
|
||||||
|
* Revision 1.4 2000/09/26 00:30:07 steve
|
||||||
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
||||||
|
*
|
||||||
* Revision 1.3 2000/09/24 15:46:00 steve
|
* Revision 1.3 2000/09/24 15:46:00 steve
|
||||||
* API access to signal type and port type.
|
* API access to signal type and port type.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue