Permalink
Browse files

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.
  • Loading branch information...
1 parent c8d9ade commit a4e528f0c3701f824b608da9112811f8749cf9e1 steve committed Mar 28, 2001
Showing with 322 additions and 82 deletions.
  1. +48 −10 ivl_target.h
  2. +11 −1 net_event.cc
  3. +53 −26 t-dll-api.cc
  4. +32 −20 t-dll-proc.cc
  5. +60 −1 t-dll.cc
  6. +18 −4 t-dll.h
  7. +40 −8 tgt-stub/stub.c
  8. +13 −11 tgt-vvp/vvp_process.c
  9. +47 −1 tgt-vvp/vvp_scope.c
View
58 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.36 2001/03/27 06:27:40 steve Exp $"
+#ident "$Id: ivl_target.h,v 1.37 2001/03/28 06:07:39 steve Exp $"
#endif
#ifdef __cplusplus
@@ -61,6 +61,11 @@ _BEGIN_DECL
* This object represents the entire elaborated design. Various
* global properties and methods are available from this.
*
+ * ivl_event_t
+ * This object represents an event node. An event node stands for
+ * named events written explicitly in the Verilog, and net events
+ * that are implicit when @ statements are used.
+ *
* ivl_expr_t
* This object represents a node of an expression. If the
* expression has sub-expressions, they can be accessed from
@@ -123,12 +128,12 @@ _BEGIN_DECL
* they include the instance name of the module that contains them.
*/
typedef struct ivl_design_s *ivl_design_t;
+typedef struct ivl_event_s *ivl_event_t;
typedef struct ivl_expr_s *ivl_expr_t;
typedef struct ivl_lpm_s *ivl_lpm_t;
typedef struct ivl_lpm_ff_s *ivl_lpm_ff_t;
typedef struct ivl_lval_s *ivl_lval_t;
typedef struct ivl_net_const_s*ivl_net_const_t;
-typedef struct ivl_net_event_s*ivl_net_event_t;
typedef struct ivl_net_logic_s*ivl_net_logic_t;
typedef struct ivl_net_probe_s*ivl_net_probe_t;
typedef struct ivl_nexus_s *ivl_nexus_t;
@@ -146,9 +151,10 @@ typedef struct ivl_statement_s*ivl_statement_t;
typedef enum ivl_edge_type_e {
- IVL_EDGE_ANY = 0,
- IVL_EDGE_POS = 1,
- IVL_EDGE_NEG = 2
+ IVL_EDGE_NONE = 0,
+ IVL_EDGE_ANY = 1,
+ IVL_EDGE_POS = 2,
+ IVL_EDGE_NEG = 3
} ivl_edge_type_t;
/* This is the type of an ivl_expr_t object. */
@@ -300,6 +306,31 @@ extern ivl_nexus_t ivl_const_pin(ivl_net_const_t net, unsigned idx);
extern unsigned ivl_const_pins(ivl_net_const_t net);
extern int ivl_const_signed(ivl_net_const_t net);
+/* EVENTS
+ *
+ * Events are a unification of named events and implicit events
+ * generated by the @ statements.
+ *
+ * ivl_event_name
+ * ivl_event_basename
+ *
+ * ivl_event_edge
+ * Return the edge type for the event. If this is a named event
+ * that has no network input, then the edge is IVL_EDGE_NONE.
+ *
+ * ivl_event_pins
+ * ivl_event_pin
+ * Events of edge other then NONE have pins that are the connection
+ * of the event to the net.
+ */
+extern const char* ivl_event_name(ivl_event_t net);
+extern const char* ivl_event_basename(ivl_event_t net);
+extern ivl_edge_type_t ivl_event_edge(ivl_event_t net);
+
+extern unsigned ivl_event_pins(ivl_event_t net);
+extern ivl_nexus_t ivl_event_pin(ivl_event_t net, unsigned idx);
+
+
/* EXPRESSIONS
*
* These methods operate on expression objects from the
@@ -509,6 +540,10 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
* If the scope has no children, this method will return 0 and
* otherwise do nothing.
*
+ * ivl_scope_event
+ * ivl_scope_events
+ * Scopes have 0 or more event objects in them.
+ *
* ivl_scope_log
* ivl_scope_logs
* Scopes have 0 or more logic devices in them. A logic device is
@@ -534,6 +569,8 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
extern int ivl_scope_children(ivl_scope_t net,
ivl_scope_f func, void*cd);
+extern unsigned ivl_scope_events(ivl_scope_t net);
+extern ivl_event_t ivl_scope_event(ivl_scope_t net, unsigned idx);
extern unsigned ivl_scope_logs(ivl_scope_t net);
extern ivl_net_logic_t ivl_scope_log(ivl_scope_t net, unsigned idx);
extern unsigned ivl_scope_lpms(ivl_scope_t net);
@@ -635,8 +672,6 @@ extern ivl_statement_type_t ivl_statement_type(ivl_statement_t net);
/* IVL_ST_BLOCK */
extern unsigned ivl_stmt_block_count(ivl_statement_t net);
- /* IVL_ST_WAIT */
-extern ivl_edge_type_t ivl_stmt_edge(ivl_statement_t net);
/* IVL_ST_BLOCK */
extern ivl_statement_t ivl_stmt_block_stmt(ivl_statement_t net, unsigned i);
/* IVL_ST_CONDIT */
@@ -647,6 +682,8 @@ extern ivl_statement_t ivl_stmt_cond_false(ivl_statement_t net);
extern ivl_statement_t ivl_stmt_cond_true(ivl_statement_t net);
/* IVL_ST_DELAY */
extern unsigned long ivl_stmt_delay_val(ivl_statement_t net);
+ /* IVL_ST_WAIT */
+extern ivl_event_t ivl_stmt_event(ivl_statement_t net);
/* IVL_ST_ASSIGN */
extern ivl_lval_t ivl_stmt_lval(ivl_statement_t net, unsigned idx);
/* IVL_ST_ASSIGN */
@@ -659,9 +696,6 @@ extern const char* ivl_stmt_name(ivl_statement_t net);
extern ivl_expr_t ivl_stmt_parm(ivl_statement_t net, unsigned idx);
/* IVL_ST_STASK */
extern unsigned ivl_stmt_parm_count(ivl_statement_t net);
- /* IVL_ST_WAIT */
-extern unsigned ivl_stmt_pins(ivl_statement_t net);
-extern ivl_nexus_t ivl_stmt_pin(ivl_statement_t net, unsigned idx);
/* IVL_ST_ASSIGN */
extern ivl_expr_t ivl_stmt_rval(ivl_statement_t net);
/* IVL_ST_DELAY, IVL_ST_WAIT, IVL_ST_WHILE */
@@ -685,6 +719,10 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
+ * 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.
+ *
* Revision 1.36 2001/03/27 06:27:40 steve
* Generate code for simple @ statements.
*
View
12 net_event.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: net_event.cc,v 1.12 2000/12/15 17:45:07 steve Exp $"
+#ident "$Id: net_event.cc,v 1.13 2001/03/28 06:07:39 steve Exp $"
#endif
# include "netlist.h"
@@ -58,6 +58,12 @@ string NetEvent::full_name() const
return scope_->name() + "." + name_;
}
+const NetScope* NetEvent::scope() const
+{
+ assert(scope_);
+ return scope_;
+}
+
unsigned NetEvent::nprobe() const
{
unsigned cnt = 0;
@@ -433,6 +439,10 @@ NetProc* NetEvWait::statement()
/*
* $Log: net_event.cc,v $
+ * Revision 1.13 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.
+ *
* Revision 1.12 2000/12/15 17:45:07 steve
* Remove limits from the similar events search.
*
View
79 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.23 2001/03/27 06:27:40 steve Exp $"
+#ident "$Id: t-dll-api.cc,v 1.24 2001/03/28 06:07:39 steve Exp $"
#endif
# include "t-dll.h"
@@ -85,6 +85,39 @@ extern "C" int ivl_const_signed(ivl_net_const_t net)
return net->signed_ == 1;
}
+extern "C" const char* ivl_event_name(ivl_event_t net)
+{
+ return net->name;
+}
+
+extern "C" const char* ivl_event_basename(ivl_event_t net)
+{
+ const char*nam = net->name;
+ nam += strlen(ivl_scope_name(net->scope));
+ assert(*nam == '.');
+ nam += 1;
+ return nam;
+}
+
+extern "C" ivl_edge_type_t ivl_event_edge(ivl_event_t net)
+{
+ assert(net);
+ return net->edge;
+}
+
+extern "C" unsigned ivl_event_pins(ivl_event_t net)
+{
+ assert(net);
+ return net->npins;
+}
+
+extern "C" ivl_nexus_t ivl_event_pin(ivl_event_t net, unsigned idx)
+{
+ assert(net);
+ assert(idx < net->npins);
+ return net->pins[idx];
+}
+
extern "C" const char* ivl_expr_bits(ivl_expr_t net)
{
assert(net && (net->type_ == IVL_EX_NUMBER));
@@ -385,6 +418,19 @@ extern "C" int ivl_scope_children(ivl_scope_t net,
return 0;
}
+extern "C" unsigned ivl_scope_events(ivl_scope_t net)
+{
+ assert(net);
+ return net->nevent_;
+}
+
+extern "C" ivl_event_t ivl_scope_event(ivl_scope_t net, unsigned idx)
+{
+ assert(net);
+ assert(idx < net->nevent_);
+ return net->event_[idx];
+}
+
extern "C" unsigned ivl_scope_logs(ivl_scope_t net)
{
assert(net);
@@ -547,10 +593,10 @@ extern "C" unsigned long ivl_stmt_delay_val(ivl_statement_t net)
return net->u_.delay_.delay_;
}
-extern "C" ivl_edge_type_t ivl_stmt_edge(ivl_statement_t net)
+extern "C" ivl_event_t ivl_stmt_event(ivl_statement_t net)
{
assert(net->type_ == IVL_ST_WAIT);
- return net->u_.wait_.edge_;
+ return net->u_.wait_.event_;
}
extern "C" ivl_lval_t ivl_stmt_lval(ivl_statement_t net, unsigned idx)
@@ -627,29 +673,6 @@ extern "C" unsigned ivl_stmt_parm_count(ivl_statement_t net)
return 0;
}
-extern "C" unsigned ivl_stmt_pins(ivl_statement_t net)
-{
- switch (net->type_) {
- case IVL_ST_WAIT:
- return 1;
- default:
- assert(0);
- }
- return 0;
-}
-
-extern "C" ivl_nexus_t ivl_stmt_pin(ivl_statement_t net, unsigned idx)
-{
- switch (net->type_) {
- case IVL_ST_WAIT:
- assert(idx == 0);
- return net->u_.wait_.cond_;
- default:
- assert(0);
- }
- return 0;
-}
-
extern "C" ivl_expr_t ivl_stmt_rval(ivl_statement_t net)
{
switch (net->type_) {
@@ -680,6 +703,10 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/*
* $Log: t-dll-api.cc,v $
+ * 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.
+ *
* Revision 1.23 2001/03/27 06:27:40 steve
* Generate code for simple @ statements.
*
View
52 t-dll-proc.cc
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: t-dll-proc.cc,v 1.12 2001/03/27 06:27:40 steve Exp $"
+#ident "$Id: t-dll-proc.cc,v 1.13 2001/03/28 06:07:39 steve Exp $"
#endif
# include "target.h"
@@ -279,28 +279,36 @@ bool dll_target::proc_wait(const NetEvWait*net)
return false;
}
- NetEvent*ev = net->event(0);
- assert(ev->nprobe() == 1);
+ /* Locate the event by name. Save the ivl_event_t in the
+ statement so that the generator can find it easily. */
+ const NetEvent*ev = net->event(0);
+ ivl_scope_t ev_scope = lookup_scope_(ev->scope());
- const NetEvProbe*pr = ev->probe(0);
- assert(pr->pin_count() == 1);
-
- switch (pr->edge()) {
- case NetEvProbe::ANYEDGE:
- stmt_cur_->u_.wait_.edge_ = IVL_EDGE_ANY;
- break;
- case NetEvProbe::NEGEDGE:
- stmt_cur_->u_.wait_.edge_ = IVL_EDGE_NEG;
- break;
- case NetEvProbe::POSEDGE:
- stmt_cur_->u_.wait_.edge_ = IVL_EDGE_POS;
- break;
+ for (unsigned idx = 0 ; idx < ev_scope->nevent_ ; idx += 1) {
+ const char*ename = ivl_event_basename(ev_scope->event_[idx]);
+ if (strcmp(ev->name(), ename) == 0) {
+ stmt_cur_->u_.wait_.event_ = ev_scope->event_[idx];
+ break;
+ }
}
- const Nexus*nex = pr->pin(0).nexus();
- assert(nex);
- assert(nex->t_cookie());
- stmt_cur_->u_.wait_.cond_ = (ivl_nexus_t) nex->t_cookie();
+ /* If this is an event with a probe, then connect up the
+ pins. This wasn't done during the ::event method because
+ the signals weren't scanned yet. */
+
+ if (ev->nprobe() == 1) {
+ const NetEvProbe*pr = ev->probe(0);
+ ivl_event_t evnt = stmt_cur_->u_.wait_.event_;
+
+ assert(pr->pin_count() == evnt->npins);
+
+ for (unsigned idx = 0 ; idx < evnt->npins ; idx += 1) {
+ ivl_nexus_t nex = (ivl_nexus_t)
+ pr->pin(idx).nexus()->t_cookie();
+ assert(nex);
+ evnt->pins[idx] = nex;
+ }
+ }
ivl_statement_t save_cur_ = stmt_cur_;
stmt_cur_ = stmt_cur_->u_.wait_.stmt_;
@@ -333,6 +341,10 @@ void dll_target::proc_while(const NetWhile*net)
/*
* $Log: t-dll-proc.cc,v $
+ * Revision 1.13 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.
+ *
* Revision 1.12 2001/03/27 06:27:40 steve
* Generate code for simple @ statements.
*
View
61 t-dll.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.cc,v 1.29 2001/03/27 03:31:06 steve Exp $"
+#ident "$Id: t-dll.cc,v 1.30 2001/03/28 06:07:39 steve Exp $"
#endif
# include "compiler.h"
@@ -160,6 +160,22 @@ void scope_add_logic(ivl_scope_t scope, ivl_net_logic_t net)
}
+void scope_add_event(ivl_scope_t scope, ivl_event_t net)
+{
+ if (scope->nevent_ == 0) {
+ scope->nevent_ = 1;
+ scope->event_ = (ivl_event_t*)malloc(sizeof(ivl_event_t));
+ scope->event_[0] = net;
+
+ } else {
+ scope->nevent_ += 1;
+ scope->event_ = (ivl_event_t*)
+ realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t));
+ scope->event_[scope->nevent_-1] = net;
+ }
+
+}
+
static void scope_add_lpm(ivl_scope_t scope, ivl_lpm_t net)
{
if (scope->nlpm_ == 0) {
@@ -273,6 +289,45 @@ bool dll_target::bufz(const NetBUFZ*net)
void dll_target::event(const NetEvent*net)
{
+ struct ivl_event_s *obj = new struct ivl_event_s;
+
+ ivl_scope_t scope = find_scope(des_.root_, net->scope());
+ obj->name = strdup(net->full_name().c_str());
+ obj->scope = scope;
+ scope_add_event(scope, obj);
+
+ assert(net->nprobe() <= 1);
+
+ if (net->nprobe() == 1) {
+ const NetEvProbe*pr = net->probe(0);
+ switch (pr->edge()) {
+ case NetEvProbe::ANYEDGE:
+ obj->edge = IVL_EDGE_ANY;
+ break;
+ case NetEvProbe::NEGEDGE:
+ obj->edge = IVL_EDGE_NEG;
+ break;
+ case NetEvProbe::POSEDGE:
+ obj->edge = IVL_EDGE_POS;
+ break;
+ }
+
+ obj->npins = pr->pin_count();
+ obj->pins = (ivl_nexus_t*)calloc(obj->npins, sizeof(ivl_nexus_t));
+#if 0
+ for (unsigned idx = 0 ; idx < obj->npins ; idx += 1) {
+ ivl_nexus_t nex = (ivl_nexus_t)
+ pr->pin(idx).nexus()->t_cookie();
+ assert(nex);
+ obj->pins[idx] = nex;
+ }
+#endif
+ } else {
+ obj->npins = 0;
+ obj->pins = 0;
+ obj->edge = IVL_EDGE_NONE;
+ }
+
}
void dll_target::logic(const NetLogic*net)
@@ -691,6 +746,10 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
+ * 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.
+ *
* Revision 1.29 2001/03/27 03:31:06 steve
* Support error code from target_t::end_design method.
*
View
22 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.24 2001/03/27 06:27:40 steve Exp $"
+#ident "$Id: t-dll.h,v 1.25 2001/03/28 06:07:39 steve Exp $"
#endif
# include "target.h"
@@ -100,6 +100,14 @@ struct dll_target : public target_t, public expr_scan_t {
* These are various private declarations used by the t-dll target.
*/
+struct ivl_event_s {
+ char*name;
+ ivl_scope_t scope;
+ ivl_edge_type_t edge;
+ unsigned npins;
+ ivl_nexus_t*pins;
+};
+
/*
* The ivl_expr_t is an opaque reference to one of these
* structures. This structure holds all the information we need about
@@ -279,6 +287,9 @@ struct ivl_scope_s {
unsigned nlog_;
ivl_net_logic_t*log_;
+ unsigned nevent_;
+ ivl_event_t* event_;
+
unsigned nlpm_;
ivl_lpm_t* lpm_;
};
@@ -352,12 +363,11 @@ struct ivl_statement_s {
} stask_;
struct { /* IVL_ST_TRIGGER */
- ivl_net_event_t event_;
+ ivl_event_t event_;
} trig_;
struct { /* IVL_ST_WAIT */
- ivl_edge_type_t edge_;
- ivl_nexus_t cond_;
+ ivl_event_t event_;
ivl_statement_t stmt_;
} wait_;
@@ -370,6 +380,10 @@ struct ivl_statement_s {
/*
* $Log: t-dll.h,v $
+ * 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.
+ *
* Revision 1.24 2001/03/27 06:27:40 steve
* Generate code for simple @ statements.
*
View
48 tgt-stub/stub.c
@@ -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.29 2001/02/07 22:22:00 steve Exp $"
+#ident "$Id: stub.c,v 1.30 2001/03/28 06:07:39 steve Exp $"
#endif
/*
@@ -144,7 +144,8 @@ static void show_statement(ivl_statement_t net, unsigned ind)
fprintf(out, "}\n");
}
- show_expression(ivl_stmt_rval(net), ind+4);
+ if (ivl_stmt_rval(net))
+ show_expression(ivl_stmt_rval(net), ind+4);
break;
case IVL_ST_BLOCK: {
@@ -189,19 +190,20 @@ static void show_statement(ivl_statement_t net, unsigned ind)
fprintf(out, "%*sCall %s(%u parameters);\n", ind, "",
ivl_stmt_name(net), ivl_stmt_parm_count(net));
for (idx = 0 ; idx < ivl_stmt_parm_count(net) ; idx += 1)
- show_expression(ivl_stmt_parm(net, idx), ind+4);
+ if (ivl_stmt_parm(net, idx))
+ show_expression(ivl_stmt_parm(net, idx), ind+4);
break;
}
case IVL_ST_TRIGGER:
fprintf(out, "%*s-> ...\n", ind, "");
break;
-
- case IVL_ST_WAIT:
- fprintf(out, "%*s@(...)\n", ind, "");
- show_statement(ivl_stmt_sub_stmt(net), ind+2);
- break;
+ case IVL_ST_WAIT: {
+ ivl_event_t evnt = ivl_stmt_event(net);
+ fprintf(out, "%*s@(%s)\n", ind, "", ivl_event_name(evnt));
+ break;
+ }
case IVL_ST_WHILE:
fprintf(out, "%*swhile (<?>)\n", ind, "");
@@ -229,6 +231,29 @@ static int show_process(ivl_process_t net, void*x)
return 0;
}
+static void show_event(ivl_event_t net)
+{
+ ivl_edge_type_t edge = ivl_event_edge(net);
+
+ switch (edge) {
+ case IVL_EDGE_NONE:
+ fprintf(out, " event %s;\n", ivl_event_name(net));
+ break;
+
+ case IVL_EDGE_ANY:
+ fprintf(out, " event %s @(", ivl_event_name(net));
+ fprintf(out, ");\n");
+ break;
+ case IVL_EDGE_NEG:
+ fprintf(out, " event %s @(negedge ", ivl_event_name(net));
+ fprintf(out, ");\n");
+ break;
+ case IVL_EDGE_POS:
+ fprintf(out, " event %s @(posedge ", ivl_event_name(net));
+ fprintf(out, ");\n");
+ break;
+ }
+}
static void show_signal(ivl_signal_t net)
{
@@ -372,6 +397,9 @@ static int show_scope(ivl_scope_t net, void*x)
break;
}
+ for (idx = 0 ; idx < ivl_scope_events(net) ; idx += 1)
+ show_event(ivl_scope_event(net, idx));
+
for (idx = 0 ; idx < ivl_scope_sigs(net) ; idx += 1)
show_signal(ivl_scope_sig(net, idx));
@@ -415,6 +443,10 @@ DECLARE_CYGWIN_DLL(DllMain);
/*
* $Log: stub.c,v $
+ * 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.
+ *
* Revision 1.29 2001/02/07 22:22:00 steve
* ivl_target header search path fixes.
*
View
24 tgt-vvp/vvp_process.c
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: vvp_process.c,v 1.9 2001/03/27 06:27:41 steve Exp $"
+#ident "$Id: vvp_process.c,v 1.10 2001/03/28 06:07:40 steve Exp $"
#endif
# include "vvp_priv.h"
@@ -195,12 +195,8 @@ static int show_stmt_noop(ivl_statement_t net)
static int show_stmt_wait(ivl_statement_t net)
{
- ivl_nexus_t nex;
-
- assert(ivl_stmt_pins(net) == 1);
- nex = ivl_stmt_pin(net, 0);
-
- fprintf(vvp_out, " %%wait L_%s;\n", ivl_nexus_name(nex));
+ ivl_event_t ev = ivl_stmt_event(net);
+ fprintf(vvp_out, " %%wait E_%s;\n", ivl_event_name(ev));
return show_statement(ivl_stmt_sub_stmt(net));
}
@@ -294,7 +290,7 @@ static int show_statement(ivl_statement_t net)
return rc;
}
-
+#if 0
static void show_stmt_event_wait(ivl_statement_t net)
{
ivl_edge_type_t edge = ivl_stmt_edge(net);
@@ -322,7 +318,8 @@ static void show_stmt_event_wait(ivl_statement_t net)
fprintf(vvp_out, ";\n");
}
-
+#endif
+#if 0
static void show_stmt_events(ivl_statement_t net)
{
switch (ivl_statement_type(net)) {
@@ -336,6 +333,7 @@ static void show_stmt_events(ivl_statement_t net)
return;
}
}
+#endif
/*
* The process as a whole is surrounded by this code. We generate a
@@ -351,11 +349,11 @@ int draw_process(ivl_process_t net, void*x)
local_count = 0;
fprintf(vvp_out, " .scope S_%s;\n", ivl_scope_name(scope));
-
+#if 0
/* Show any .event statements that are needed to support this
thread. */
show_stmt_events(stmt);
-
+#endif
/* Generate the entry label. Just give the thread a number so
that we ar certain the label is unique. */
fprintf(vvp_out, "T_%d\n", thread_count);
@@ -389,6 +387,10 @@ int draw_process(ivl_process_t net, void*x)
/*
* $Log: vvp_process.c,v $
+ * Revision 1.10 2001/03/28 06:07:40 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.
+ *
* Revision 1.9 2001/03/27 06:27:41 steve
* Generate code for simple @ statements.
*
View
48 tgt-vvp/vvp_scope.c
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: vvp_scope.c,v 1.6 2001/03/27 06:27:41 steve Exp $"
+#ident "$Id: vvp_scope.c,v 1.7 2001/03/28 06:07:40 steve Exp $"
#endif
# include "vvp_priv.h"
@@ -158,6 +158,43 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
fprintf(vvp_out, ";\n");
}
+static void draw_event_in_scope(ivl_event_t obj)
+{
+ ivl_edge_type_t edge = ivl_event_edge(obj);
+
+ if (edge == IVL_EDGE_NONE) {
+ fprintf(vvp_out, "E_%s .event \"%s\";\n",
+ ivl_event_name(obj), ivl_event_basename(obj));
+
+ } else {
+ unsigned idx;
+ unsigned pins = ivl_event_pins(obj);
+ assert(pins < 4);
+ fprintf(vvp_out, "E_%s .event ", ivl_event_name(obj));
+ switch (edge) {
+ case IVL_EDGE_POS:
+ fprintf(vvp_out, "posedge");
+ break;
+ case IVL_EDGE_NEG:
+ fprintf(vvp_out, "posedge");
+ break;
+ case IVL_EDGE_ANY:
+ fprintf(vvp_out, "edge");
+ break;
+ case IVL_EDGE_NONE:
+ assert(0);
+ }
+
+ for (idx = 0 ; idx < pins ; idx += 1) {
+ ivl_nexus_t nex = ivl_event_pin(obj, idx);
+ fprintf(vvp_out, ", ");
+ draw_nexus_input(nex);
+ }
+
+ fprintf(vvp_out, ";\n");
+ }
+}
+
int draw_scope(ivl_scope_t net, ivl_scope_t parent)
{
unsigned idx;
@@ -197,12 +234,21 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
}
}
+ for (idx = 0 ; idx < ivl_scope_events(net) ; idx += 1) {
+ ivl_event_t event = ivl_scope_event(net, idx);
+ draw_event_in_scope(event);
+ }
+
ivl_scope_children(net, draw_scope, net);
return 0;
}
/*
* $Log: vvp_scope.c,v $
+ * Revision 1.7 2001/03/28 06:07:40 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.
+ *
* Revision 1.6 2001/03/27 06:27:41 steve
* Generate code for simple @ statements.
*

0 comments on commit a4e528f

Please sign in to comment.