Skip to content
This repository
Browse code

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...
commit a4e528f0c3701f824b608da9112811f8749cf9e1 1 parent c8d9ade
authored
58  ivl_target.h
@@ -19,7 +19,7 @@
19 19
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 20
  */
21 21
 #if !defined(WINNT) && !defined(macintosh)
22  
-#ident "$Id: ivl_target.h,v 1.36 2001/03/27 06:27:40 steve Exp $"
  22
+#ident "$Id: ivl_target.h,v 1.37 2001/03/28 06:07:39 steve Exp $"
23 23
 #endif
24 24
 
25 25
 #ifdef __cplusplus
@@ -61,6 +61,11 @@ _BEGIN_DECL
61 61
  *    This object represents the entire elaborated design. Various
62 62
  *    global properties and methods are available from this.
63 63
  *
  64
+ * ivl_event_t
  65
+ *    This object represents an event node. An event node stands for
  66
+ *    named events written explicitly in the Verilog, and net events
  67
+ *    that are implicit when @ statements are used.
  68
+ *
64 69
  * ivl_expr_t
65 70
  *    This object represents a node of an expression. If the
66 71
  *    expression has sub-expressions, they can be accessed from
@@ -123,12 +128,12 @@ _BEGIN_DECL
123 128
  * they include the instance name of the module that contains them.
124 129
  */
125 130
 typedef struct ivl_design_s   *ivl_design_t;
  131
+typedef struct ivl_event_s    *ivl_event_t;
126 132
 typedef struct ivl_expr_s     *ivl_expr_t;
127 133
 typedef struct ivl_lpm_s      *ivl_lpm_t;
128 134
 typedef struct ivl_lpm_ff_s   *ivl_lpm_ff_t;
129 135
 typedef struct ivl_lval_s     *ivl_lval_t;
130 136
 typedef struct ivl_net_const_s*ivl_net_const_t;
131  
-typedef struct ivl_net_event_s*ivl_net_event_t;
132 137
 typedef struct ivl_net_logic_s*ivl_net_logic_t;
133 138
 typedef struct ivl_net_probe_s*ivl_net_probe_t;
134 139
 typedef struct ivl_nexus_s    *ivl_nexus_t;
@@ -146,9 +151,10 @@ typedef struct ivl_statement_s*ivl_statement_t;
146 151
 
147 152
 
148 153
 typedef enum ivl_edge_type_e {
149  
-      IVL_EDGE_ANY = 0,
150  
-      IVL_EDGE_POS = 1,
151  
-      IVL_EDGE_NEG = 2
  154
+      IVL_EDGE_NONE = 0,
  155
+      IVL_EDGE_ANY  = 1,
  156
+      IVL_EDGE_POS  = 2,
  157
+      IVL_EDGE_NEG  = 3
152 158
 } ivl_edge_type_t;
153 159
 
154 160
 /* 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);
300 306
 extern unsigned    ivl_const_pins(ivl_net_const_t net);
301 307
 extern int         ivl_const_signed(ivl_net_const_t net);
302 308
 
  309
+/* EVENTS
  310
+ *
  311
+ * Events are a unification of named events and implicit events
  312
+ * generated by the @ statements.
  313
+ *
  314
+ * ivl_event_name
  315
+ * ivl_event_basename
  316
+ *
  317
+ * ivl_event_edge
  318
+ *    Return the edge type for the event. If this is a named event
  319
+ *    that has no network input, then the edge is IVL_EDGE_NONE.
  320
+ *
  321
+ * ivl_event_pins
  322
+ * ivl_event_pin
  323
+ *    Events of edge other then NONE have pins that are the connection
  324
+ *    of the event to the net.
  325
+ */
  326
+extern const char*     ivl_event_name(ivl_event_t net);
  327
+extern const char*     ivl_event_basename(ivl_event_t net);
  328
+extern ivl_edge_type_t ivl_event_edge(ivl_event_t net);
  329
+
  330
+extern unsigned    ivl_event_pins(ivl_event_t net);
  331
+extern ivl_nexus_t ivl_event_pin(ivl_event_t net, unsigned idx);
  332
+
  333
+
303 334
 /* EXPRESSIONS
304 335
  *
305 336
  * 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);
509 540
  *    If the scope has no children, this method will return 0 and
510 541
  *    otherwise do nothing.
511 542
  *
  543
+ * ivl_scope_event
  544
+ * ivl_scope_events
  545
+ *    Scopes have 0 or more event objects in them.
  546
+ *
512 547
  * ivl_scope_log
513 548
  * ivl_scope_logs
514 549
  *    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);
534 569
 
535 570
 extern int          ivl_scope_children(ivl_scope_t net,
536 571
 				       ivl_scope_f func, void*cd);
  572
+extern unsigned     ivl_scope_events(ivl_scope_t net);
  573
+extern ivl_event_t  ivl_scope_event(ivl_scope_t net, unsigned idx);
537 574
 extern unsigned     ivl_scope_logs(ivl_scope_t net);
538 575
 extern ivl_net_logic_t ivl_scope_log(ivl_scope_t net, unsigned idx);
539 576
 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);
635 672
 
636 673
   /* IVL_ST_BLOCK */
637 674
 extern unsigned ivl_stmt_block_count(ivl_statement_t net);
638  
-  /* IVL_ST_WAIT */
639  
-extern ivl_edge_type_t ivl_stmt_edge(ivl_statement_t net);
640 675
   /* IVL_ST_BLOCK */
641 676
 extern ivl_statement_t ivl_stmt_block_stmt(ivl_statement_t net, unsigned i);
642 677
   /* IVL_ST_CONDIT */
@@ -647,6 +682,8 @@ extern ivl_statement_t ivl_stmt_cond_false(ivl_statement_t net);
647 682
 extern ivl_statement_t ivl_stmt_cond_true(ivl_statement_t net);
648 683
   /* IVL_ST_DELAY */
649 684
 extern unsigned long ivl_stmt_delay_val(ivl_statement_t net);
  685
+  /* IVL_ST_WAIT */
  686
+extern ivl_event_t   ivl_stmt_event(ivl_statement_t net);
650 687
   /* IVL_ST_ASSIGN */
651 688
 extern ivl_lval_t ivl_stmt_lval(ivl_statement_t net, unsigned idx);
652 689
   /* IVL_ST_ASSIGN */
@@ -659,9 +696,6 @@ extern const char* ivl_stmt_name(ivl_statement_t net);
659 696
 extern ivl_expr_t ivl_stmt_parm(ivl_statement_t net, unsigned idx);
660 697
   /* IVL_ST_STASK */
661 698
 extern unsigned ivl_stmt_parm_count(ivl_statement_t net);
662  
-  /* IVL_ST_WAIT */
663  
-extern unsigned ivl_stmt_pins(ivl_statement_t net);
664  
-extern ivl_nexus_t ivl_stmt_pin(ivl_statement_t net, unsigned idx);
665 699
   /* IVL_ST_ASSIGN */
666 700
 extern ivl_expr_t ivl_stmt_rval(ivl_statement_t net);
667 701
   /* IVL_ST_DELAY, IVL_ST_WAIT, IVL_ST_WHILE */
@@ -685,6 +719,10 @@ _END_DECL
685 719
 
686 720
 /*
687 721
  * $Log: ivl_target.h,v $
  722
+ * Revision 1.37  2001/03/28 06:07:39  steve
  723
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  724
+ *  .event statements in vvp way ahead of the thread that uses it.
  725
+ *
688 726
  * Revision 1.36  2001/03/27 06:27:40  steve
689 727
  *  Generate code for simple @ statements.
690 728
  *
12  net_event.cc
@@ -17,7 +17,7 @@
17 17
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18
  */
19 19
 #if !defined(WINNT) && !defined(macintosh)
20  
-#ident "$Id: net_event.cc,v 1.12 2000/12/15 17:45:07 steve Exp $"
  20
+#ident "$Id: net_event.cc,v 1.13 2001/03/28 06:07:39 steve Exp $"
21 21
 #endif
22 22
 
23 23
 # include  "netlist.h"
@@ -58,6 +58,12 @@ string NetEvent::full_name() const
58 58
       return scope_->name() + "." + name_;
59 59
 }
60 60
 
  61
+const NetScope* NetEvent::scope() const
  62
+{
  63
+      assert(scope_);
  64
+      return scope_;
  65
+}
  66
+
61 67
 unsigned NetEvent::nprobe() const
62 68
 {
63 69
       unsigned cnt = 0;
@@ -433,6 +439,10 @@ NetProc* NetEvWait::statement()
433 439
 
434 440
 /*
435 441
  * $Log: net_event.cc,v $
  442
+ * Revision 1.13  2001/03/28 06:07:39  steve
  443
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  444
+ *  .event statements in vvp way ahead of the thread that uses it.
  445
+ *
436 446
  * Revision 1.12  2000/12/15 17:45:07  steve
437 447
  *  Remove limits from the similar events search.
438 448
  *
79  t-dll-api.cc
@@ -17,7 +17,7 @@
17 17
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18
  */
19 19
 #if !defined(WINNT) && !defined(macintosh)
20  
-#ident "$Id: t-dll-api.cc,v 1.23 2001/03/27 06:27:40 steve Exp $"
  20
+#ident "$Id: t-dll-api.cc,v 1.24 2001/03/28 06:07:39 steve Exp $"
21 21
 #endif
22 22
 
23 23
 # include  "t-dll.h"
@@ -85,6 +85,39 @@ extern "C" int ivl_const_signed(ivl_net_const_t net)
85 85
       return net->signed_ == 1;
86 86
 }
87 87
 
  88
+extern "C" const char* ivl_event_name(ivl_event_t net)
  89
+{
  90
+      return net->name;
  91
+}
  92
+
  93
+extern "C" const char* ivl_event_basename(ivl_event_t net)
  94
+{
  95
+      const char*nam = net->name;
  96
+      nam += strlen(ivl_scope_name(net->scope));
  97
+      assert(*nam == '.');
  98
+      nam += 1;
  99
+      return nam;
  100
+}
  101
+
  102
+extern "C" ivl_edge_type_t ivl_event_edge(ivl_event_t net)
  103
+{
  104
+      assert(net);
  105
+      return net->edge;
  106
+}
  107
+
  108
+extern "C" unsigned ivl_event_pins(ivl_event_t net)
  109
+{
  110
+      assert(net);
  111
+      return net->npins;
  112
+}
  113
+
  114
+extern "C" ivl_nexus_t ivl_event_pin(ivl_event_t net, unsigned idx)
  115
+{
  116
+      assert(net);
  117
+      assert(idx < net->npins);
  118
+      return net->pins[idx];
  119
+}
  120
+
88 121
 extern "C" const char* ivl_expr_bits(ivl_expr_t net)
89 122
 {
90 123
       assert(net && (net->type_ == IVL_EX_NUMBER));
@@ -385,6 +418,19 @@ extern "C" int ivl_scope_children(ivl_scope_t net,
385 418
       return 0;
386 419
 }
387 420
 
  421
+extern "C" unsigned ivl_scope_events(ivl_scope_t net)
  422
+{
  423
+      assert(net);
  424
+      return net->nevent_;
  425
+}
  426
+
  427
+extern "C" ivl_event_t ivl_scope_event(ivl_scope_t net, unsigned idx)
  428
+{
  429
+      assert(net);
  430
+      assert(idx < net->nevent_);
  431
+      return net->event_[idx];
  432
+}
  433
+
388 434
 extern "C" unsigned ivl_scope_logs(ivl_scope_t net)
389 435
 {
390 436
       assert(net);
@@ -547,10 +593,10 @@ extern "C" unsigned long ivl_stmt_delay_val(ivl_statement_t net)
547 593
       return net->u_.delay_.delay_;
548 594
 }
549 595
 
550  
-extern "C" ivl_edge_type_t ivl_stmt_edge(ivl_statement_t net)
  596
+extern "C" ivl_event_t ivl_stmt_event(ivl_statement_t net)
551 597
 {
552 598
       assert(net->type_ == IVL_ST_WAIT);
553  
-      return net->u_.wait_.edge_;
  599
+      return net->u_.wait_.event_;
554 600
 }
555 601
 
556 602
 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)
627 673
       return 0;
628 674
 }
629 675
 
630  
-extern "C" unsigned ivl_stmt_pins(ivl_statement_t net)
631  
-{
632  
-      switch (net->type_) {
633  
-	  case IVL_ST_WAIT:
634  
-	    return 1;
635  
-	  default:
636  
-	    assert(0);
637  
-      }
638  
-      return 0;
639  
-}
640  
-
641  
-extern "C" ivl_nexus_t ivl_stmt_pin(ivl_statement_t net, unsigned idx)
642  
-{
643  
-      switch (net->type_) {
644  
-	  case IVL_ST_WAIT:
645  
-	    assert(idx == 0);
646  
-	    return net->u_.wait_.cond_;
647  
-	  default:
648  
-	    assert(0);
649  
-      }
650  
-      return 0;
651  
-}
652  
-
653 676
 extern "C" ivl_expr_t ivl_stmt_rval(ivl_statement_t net)
654 677
 {
655 678
       switch (net->type_) {
@@ -680,6 +703,10 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
680 703
 
681 704
 /*
682 705
  * $Log: t-dll-api.cc,v $
  706
+ * Revision 1.24  2001/03/28 06:07:39  steve
  707
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  708
+ *  .event statements in vvp way ahead of the thread that uses it.
  709
+ *
683 710
  * Revision 1.23  2001/03/27 06:27:40  steve
684 711
  *  Generate code for simple @ statements.
685 712
  *
52  t-dll-proc.cc
@@ -18,7 +18,7 @@
18 18
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 19
  */
20 20
 #if !defined(WINNT) && !defined(macintosh)
21  
-#ident "$Id: t-dll-proc.cc,v 1.12 2001/03/27 06:27:40 steve Exp $"
  21
+#ident "$Id: t-dll-proc.cc,v 1.13 2001/03/28 06:07:39 steve Exp $"
22 22
 #endif
23 23
 
24 24
 # include  "target.h"
@@ -279,28 +279,36 @@ bool dll_target::proc_wait(const NetEvWait*net)
279 279
 	    return false;
280 280
       }
281 281
 
282  
-      NetEvent*ev = net->event(0);
283  
-      assert(ev->nprobe() == 1);
  282
+	/* Locate the event by name. Save the ivl_event_t in the
  283
+	   statement so that the generator can find it easily. */
  284
+      const NetEvent*ev = net->event(0);
  285
+      ivl_scope_t ev_scope = lookup_scope_(ev->scope());
284 286
 
285  
-      const NetEvProbe*pr = ev->probe(0);
286  
-      assert(pr->pin_count() == 1);
287  
-
288  
-      switch (pr->edge()) {
289  
-	  case NetEvProbe::ANYEDGE:
290  
-	    stmt_cur_->u_.wait_.edge_ = IVL_EDGE_ANY;
291  
-	    break;
292  
-	  case NetEvProbe::NEGEDGE:
293  
-	    stmt_cur_->u_.wait_.edge_ = IVL_EDGE_NEG;
294  
-	    break;
295  
-	  case NetEvProbe::POSEDGE:
296  
-	    stmt_cur_->u_.wait_.edge_ = IVL_EDGE_POS;
297  
-	    break;
  287
+      for (unsigned idx = 0 ;  idx < ev_scope->nevent_ ;  idx += 1) {
  288
+	    const char*ename = ivl_event_basename(ev_scope->event_[idx]);
  289
+	    if (strcmp(ev->name(), ename) == 0) {
  290
+		  stmt_cur_->u_.wait_.event_ = ev_scope->event_[idx];
  291
+		  break;
  292
+	    }
298 293
       }
299 294
 
300  
-      const Nexus*nex = pr->pin(0).nexus();
301  
-      assert(nex);
302  
-      assert(nex->t_cookie());
303  
-      stmt_cur_->u_.wait_.cond_ = (ivl_nexus_t) nex->t_cookie();
  295
+	/* If this is an event with a probe, then connect up the
  296
+	   pins. This wasn't done during the ::event method because
  297
+	   the signals weren't scanned yet. */
  298
+
  299
+      if (ev->nprobe() == 1) {
  300
+	    const NetEvProbe*pr = ev->probe(0);
  301
+	    ivl_event_t evnt = stmt_cur_->u_.wait_.event_;
  302
+
  303
+	    assert(pr->pin_count() == evnt->npins);
  304
+
  305
+	    for (unsigned idx = 0 ;  idx < evnt->npins ;  idx += 1) {
  306
+		  ivl_nexus_t nex = (ivl_nexus_t)
  307
+			pr->pin(idx).nexus()->t_cookie();
  308
+		  assert(nex);
  309
+		  evnt->pins[idx] = nex;
  310
+	    }
  311
+      }	    
304 312
 
305 313
       ivl_statement_t save_cur_ = stmt_cur_;
306 314
       stmt_cur_ = stmt_cur_->u_.wait_.stmt_;
@@ -333,6 +341,10 @@ void dll_target::proc_while(const NetWhile*net)
333 341
 
334 342
 /*
335 343
  * $Log: t-dll-proc.cc,v $
  344
+ * Revision 1.13  2001/03/28 06:07:39  steve
  345
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  346
+ *  .event statements in vvp way ahead of the thread that uses it.
  347
+ *
336 348
  * Revision 1.12  2001/03/27 06:27:40  steve
337 349
  *  Generate code for simple @ statements.
338 350
  *
61  t-dll.cc
@@ -17,7 +17,7 @@
17 17
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18
  */
19 19
 #if !defined(WINNT) && !defined(macintosh)
20  
-#ident "$Id: t-dll.cc,v 1.29 2001/03/27 03:31:06 steve Exp $"
  20
+#ident "$Id: t-dll.cc,v 1.30 2001/03/28 06:07:39 steve Exp $"
21 21
 #endif
22 22
 
23 23
 # include  "compiler.h"
@@ -160,6 +160,22 @@ void scope_add_logic(ivl_scope_t scope, ivl_net_logic_t net)
160 160
 
161 161
 }
162 162
 
  163
+void scope_add_event(ivl_scope_t scope, ivl_event_t net)
  164
+{
  165
+      if (scope->nevent_ == 0) {
  166
+	    scope->nevent_ = 1;
  167
+	    scope->event_ = (ivl_event_t*)malloc(sizeof(ivl_event_t));
  168
+	    scope->event_[0] = net;
  169
+
  170
+      } else {
  171
+	    scope->nevent_ += 1;
  172
+	    scope->event_ = (ivl_event_t*)
  173
+		  realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t));
  174
+	    scope->event_[scope->nevent_-1] = net;
  175
+      }
  176
+
  177
+}
  178
+
163 179
 static void scope_add_lpm(ivl_scope_t scope, ivl_lpm_t net)
164 180
 {
165 181
       if (scope->nlpm_ == 0) {
@@ -273,6 +289,45 @@ bool dll_target::bufz(const NetBUFZ*net)
273 289
 
274 290
 void dll_target::event(const NetEvent*net)
275 291
 {
  292
+      struct ivl_event_s *obj = new struct ivl_event_s;
  293
+
  294
+      ivl_scope_t scope = find_scope(des_.root_, net->scope());
  295
+      obj->name = strdup(net->full_name().c_str());
  296
+      obj->scope = scope;
  297
+      scope_add_event(scope, obj);
  298
+
  299
+      assert(net->nprobe() <= 1);
  300
+
  301
+      if (net->nprobe() == 1) {
  302
+	    const NetEvProbe*pr = net->probe(0);
  303
+	    switch (pr->edge()) {
  304
+		case NetEvProbe::ANYEDGE:
  305
+		  obj->edge = IVL_EDGE_ANY;
  306
+		  break;
  307
+		case NetEvProbe::NEGEDGE:
  308
+		  obj->edge = IVL_EDGE_NEG;
  309
+		  break;
  310
+		case NetEvProbe::POSEDGE:
  311
+		  obj->edge = IVL_EDGE_POS;
  312
+		  break;
  313
+	    }
  314
+
  315
+	    obj->npins = pr->pin_count();
  316
+	    obj->pins = (ivl_nexus_t*)calloc(obj->npins, sizeof(ivl_nexus_t));
  317
+#if 0
  318
+	    for (unsigned idx = 0 ;  idx < obj->npins ;  idx += 1) {
  319
+		  ivl_nexus_t nex = (ivl_nexus_t)
  320
+			pr->pin(idx).nexus()->t_cookie();
  321
+		  assert(nex);
  322
+		  obj->pins[idx] = nex;
  323
+	    }
  324
+#endif
  325
+      } else {
  326
+	    obj->npins = 0;
  327
+	    obj->pins  = 0;
  328
+	    obj->edge = IVL_EDGE_NONE;
  329
+      }
  330
+
276 331
 }
277 332
 
278 333
 void dll_target::logic(const NetLogic*net)
@@ -691,6 +746,10 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
691 746
 
692 747
 /*
693 748
  * $Log: t-dll.cc,v $
  749
+ * Revision 1.30  2001/03/28 06:07:39  steve
  750
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  751
+ *  .event statements in vvp way ahead of the thread that uses it.
  752
+ *
694 753
  * Revision 1.29  2001/03/27 03:31:06  steve
695 754
  *  Support error code from target_t::end_design method.
696 755
  *
22  t-dll.h
@@ -19,7 +19,7 @@
19 19
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 20
  */
21 21
 #if !defined(WINNT) && !defined(macintosh)
22  
-#ident "$Id: t-dll.h,v 1.24 2001/03/27 06:27:40 steve Exp $"
  22
+#ident "$Id: t-dll.h,v 1.25 2001/03/28 06:07:39 steve Exp $"
23 23
 #endif
24 24
 
25 25
 # include  "target.h"
@@ -100,6 +100,14 @@ struct dll_target  : public target_t, public expr_scan_t {
100 100
  * These are various private declarations used by the t-dll target.
101 101
  */
102 102
 
  103
+struct ivl_event_s {
  104
+      char*name;
  105
+      ivl_scope_t scope;
  106
+      ivl_edge_type_t edge;
  107
+      unsigned npins;
  108
+      ivl_nexus_t*pins;
  109
+};
  110
+
103 111
 /*
104 112
  * The ivl_expr_t is an opaque reference to one of these
105 113
  * structures. This structure holds all the information we need about
@@ -279,6 +287,9 @@ struct ivl_scope_s {
279 287
       unsigned nlog_;
280 288
       ivl_net_logic_t*log_;
281 289
 
  290
+      unsigned nevent_;
  291
+      ivl_event_t* event_;
  292
+
282 293
       unsigned nlpm_;
283 294
       ivl_lpm_t* lpm_;
284 295
 };
@@ -352,12 +363,11 @@ struct ivl_statement_s {
352 363
 	    } stask_;
353 364
 
354 365
 	    struct { /* IVL_ST_TRIGGER */
355  
-		  ivl_net_event_t event_;
  366
+		  ivl_event_t event_;
356 367
 	    } trig_;
357 368
 
358 369
 	    struct { /* IVL_ST_WAIT */
359  
-		  ivl_edge_type_t edge_;
360  
-		  ivl_nexus_t cond_;
  370
+		  ivl_event_t event_;
361 371
 		  ivl_statement_t stmt_;
362 372
 	    } wait_;
363 373
 
@@ -370,6 +380,10 @@ struct ivl_statement_s {
370 380
 
371 381
 /*
372 382
  * $Log: t-dll.h,v $
  383
+ * Revision 1.25  2001/03/28 06:07:39  steve
  384
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  385
+ *  .event statements in vvp way ahead of the thread that uses it.
  386
+ *
373 387
  * Revision 1.24  2001/03/27 06:27:40  steve
374 388
  *  Generate code for simple @ statements.
375 389
  *
48  tgt-stub/stub.c
@@ -17,7 +17,7 @@
17 17
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18
  */
19 19
 #if !defined(WINNT) && !defined(macintosh)
20  
-#ident "$Id: stub.c,v 1.29 2001/02/07 22:22:00 steve Exp $"
  20
+#ident "$Id: stub.c,v 1.30 2001/03/28 06:07:39 steve Exp $"
21 21
 #endif
22 22
 
23 23
 /*
@@ -144,7 +144,8 @@ static void show_statement(ivl_statement_t net, unsigned ind)
144 144
 		  fprintf(out, "}\n");
145 145
 	    }
146 146
 
147  
-	    show_expression(ivl_stmt_rval(net), ind+4);
  147
+	    if (ivl_stmt_rval(net))
  148
+		  show_expression(ivl_stmt_rval(net), ind+4);
148 149
 	    break;
149 150
 
150 151
 	  case IVL_ST_BLOCK: {
@@ -189,7 +190,8 @@ static void show_statement(ivl_statement_t net, unsigned ind)
189 190
 		fprintf(out, "%*sCall %s(%u parameters);\n", ind, "",
190 191
 			ivl_stmt_name(net), ivl_stmt_parm_count(net));
191 192
 		for (idx = 0 ;  idx < ivl_stmt_parm_count(net) ;  idx += 1)
192  
-		      show_expression(ivl_stmt_parm(net, idx), ind+4);
  193
+		      if (ivl_stmt_parm(net, idx))
  194
+			    show_expression(ivl_stmt_parm(net, idx), ind+4);
193 195
 		break;
194 196
 	  }
195 197
 
@@ -197,11 +199,11 @@ static void show_statement(ivl_statement_t net, unsigned ind)
197 199
 	    fprintf(out, "%*s-> ...\n", ind, "");
198 200
 	    break;
199 201
 
200  
-
201  
-	  case IVL_ST_WAIT:
202  
-	    fprintf(out, "%*s@(...)\n", ind, "");
203  
-	    show_statement(ivl_stmt_sub_stmt(net), ind+2);
204  
-	    break;
  202
+	  case IVL_ST_WAIT: {
  203
+		ivl_event_t evnt = ivl_stmt_event(net);
  204
+		fprintf(out, "%*s@(%s)\n", ind, "", ivl_event_name(evnt));
  205
+		break;
  206
+	  }
205 207
 
206 208
 	  case IVL_ST_WHILE:
207 209
 	    fprintf(out, "%*swhile (<?>)\n", ind, "");
@@ -229,6 +231,29 @@ static int show_process(ivl_process_t net, void*x)
229 231
       return 0;
230 232
 }
231 233
 
  234
+static void show_event(ivl_event_t net)
  235
+{
  236
+      ivl_edge_type_t edge = ivl_event_edge(net);
  237
+
  238
+      switch (edge) {
  239
+	  case IVL_EDGE_NONE:
  240
+	    fprintf(out, "  event %s;\n", ivl_event_name(net));
  241
+	    break;
  242
+
  243
+	  case IVL_EDGE_ANY:
  244
+	    fprintf(out, "  event %s @(", ivl_event_name(net));
  245
+	    fprintf(out, ");\n");
  246
+	    break;
  247
+	  case IVL_EDGE_NEG:
  248
+	    fprintf(out, "  event %s @(negedge ", ivl_event_name(net));
  249
+	    fprintf(out, ");\n");
  250
+	    break;
  251
+	  case IVL_EDGE_POS:
  252
+	    fprintf(out, "  event %s @(posedge ", ivl_event_name(net));
  253
+	    fprintf(out, ");\n");
  254
+	    break;
  255
+      }
  256
+}
232 257
 
233 258
 static void show_signal(ivl_signal_t net)
234 259
 {
@@ -372,6 +397,9 @@ static int show_scope(ivl_scope_t net, void*x)
372 397
 	    break;
373 398
       }
374 399
 
  400
+      for (idx = 0 ;  idx < ivl_scope_events(net) ;  idx += 1)
  401
+	    show_event(ivl_scope_event(net, idx));
  402
+
375 403
       for (idx = 0 ;  idx < ivl_scope_sigs(net) ;  idx += 1)
376 404
 	    show_signal(ivl_scope_sig(net, idx));
377 405
 
@@ -415,6 +443,10 @@ DECLARE_CYGWIN_DLL(DllMain);
415 443
 
416 444
 /*
417 445
  * $Log: stub.c,v $
  446
+ * Revision 1.30  2001/03/28 06:07:39  steve
  447
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  448
+ *  .event statements in vvp way ahead of the thread that uses it.
  449
+ *
418 450
  * Revision 1.29  2001/02/07 22:22:00  steve
419 451
  *  ivl_target header search path fixes.
420 452
  *
24  tgt-vvp/vvp_process.c
@@ -17,7 +17,7 @@
17 17
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18
  */
19 19
 #if !defined(WINNT)
20  
-#ident "$Id: vvp_process.c,v 1.9 2001/03/27 06:27:41 steve Exp $"
  20
+#ident "$Id: vvp_process.c,v 1.10 2001/03/28 06:07:40 steve Exp $"
21 21
 #endif
22 22
 
23 23
 # include  "vvp_priv.h"
@@ -195,12 +195,8 @@ static int show_stmt_noop(ivl_statement_t net)
195 195
 
196 196
 static int show_stmt_wait(ivl_statement_t net)
197 197
 {
198  
-      ivl_nexus_t nex;
199  
-
200  
-      assert(ivl_stmt_pins(net) == 1);
201  
-      nex = ivl_stmt_pin(net, 0);
202  
-
203  
-      fprintf(vvp_out, "    %%wait L_%s;\n", ivl_nexus_name(nex));
  198
+      ivl_event_t ev = ivl_stmt_event(net);
  199
+      fprintf(vvp_out, "    %%wait E_%s;\n", ivl_event_name(ev));
204 200
 
205 201
       return show_statement(ivl_stmt_sub_stmt(net));
206 202
 }
@@ -294,7 +290,7 @@ static int show_statement(ivl_statement_t net)
294 290
 
295 291
       return rc;
296 292
 }
297  
-
  293
+#if 0
298 294
 static void show_stmt_event_wait(ivl_statement_t net)
299 295
 {
300 296
       ivl_edge_type_t edge = ivl_stmt_edge(net);
@@ -322,7 +318,8 @@ static void show_stmt_event_wait(ivl_statement_t net)
322 318
       fprintf(vvp_out, ";\n");
323 319
 
324 320
 }
325  
-
  321
+#endif
  322
+#if 0
326 323
 static void show_stmt_events(ivl_statement_t net)
327 324
 {
328 325
       switch (ivl_statement_type(net)) {
@@ -336,6 +333,7 @@ static void show_stmt_events(ivl_statement_t net)
336 333
 	    return;
337 334
       }
338 335
 }
  336
+#endif
339 337
 
340 338
 /*
341 339
  * 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)
351 349
 
352 350
       local_count = 0;
353 351
       fprintf(vvp_out, "    .scope S_%s;\n", ivl_scope_name(scope));
354  
-
  352
+#if 0
355 353
 	/* Show any .event statements that are needed to support this
356 354
 	   thread. */
357 355
       show_stmt_events(stmt);
358  
-
  356
+#endif
359 357
 	/* Generate the entry label. Just give the thread a number so
360 358
 	   that we ar certain the label is unique. */
361 359
       fprintf(vvp_out, "T_%d\n", thread_count);
@@ -389,6 +387,10 @@ int draw_process(ivl_process_t net, void*x)
389 387
 
390 388
 /*
391 389
  * $Log: vvp_process.c,v $
  390
+ * Revision 1.10  2001/03/28 06:07:40  steve
  391
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  392
+ *  .event statements in vvp way ahead of the thread that uses it.
  393
+ *
392 394
  * Revision 1.9  2001/03/27 06:27:41  steve
393 395
  *  Generate code for simple @ statements.
394 396
  *
48  tgt-vvp/vvp_scope.c
@@ -17,7 +17,7 @@
17 17
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18
  */
19 19
 #if !defined(WINNT)
20  
-#ident "$Id: vvp_scope.c,v 1.6 2001/03/27 06:27:41 steve Exp $"
  20
+#ident "$Id: vvp_scope.c,v 1.7 2001/03/28 06:07:40 steve Exp $"
21 21
 #endif
22 22
 
23 23
 # include  "vvp_priv.h"
@@ -158,6 +158,43 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
158 158
       fprintf(vvp_out, ";\n");
159 159
 }
160 160
 
  161
+static void draw_event_in_scope(ivl_event_t obj)
  162
+{
  163
+      ivl_edge_type_t edge = ivl_event_edge(obj);
  164
+
  165
+      if (edge == IVL_EDGE_NONE) {
  166
+	    fprintf(vvp_out, "E_%s .event \"%s\";\n",
  167
+		    ivl_event_name(obj), ivl_event_basename(obj));
  168
+
  169
+      } else {
  170
+	    unsigned idx;
  171
+	    unsigned pins = ivl_event_pins(obj);
  172
+	    assert(pins < 4);
  173
+	    fprintf(vvp_out, "E_%s .event ", ivl_event_name(obj));
  174
+	    switch (edge) {
  175
+		case IVL_EDGE_POS:
  176
+		  fprintf(vvp_out, "posedge");
  177
+		  break;
  178
+		case IVL_EDGE_NEG:
  179
+		  fprintf(vvp_out, "posedge");
  180
+		  break;
  181
+		case IVL_EDGE_ANY:
  182
+		  fprintf(vvp_out, "edge");
  183
+		  break;
  184
+		case IVL_EDGE_NONE:
  185
+		  assert(0);
  186
+	    }
  187
+
  188
+	    for (idx = 0 ;  idx < pins ;  idx += 1) {
  189
+		  ivl_nexus_t nex = ivl_event_pin(obj, idx);
  190
+		  fprintf(vvp_out, ", ");
  191
+		  draw_nexus_input(nex);
  192
+	    }
  193
+
  194
+	    fprintf(vvp_out, ";\n");
  195
+      }
  196
+}
  197
+
161 198
 int draw_scope(ivl_scope_t net, ivl_scope_t parent)
162 199
 {
163 200
       unsigned idx;
@@ -197,12 +234,21 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
197 234
 	    }
198 235
       }
199 236
 
  237
+      for (idx = 0 ;  idx < ivl_scope_events(net) ;  idx += 1) {
  238
+	    ivl_event_t event = ivl_scope_event(net, idx);
  239
+	    draw_event_in_scope(event);
  240
+      }
  241
+
200 242
       ivl_scope_children(net, draw_scope, net);
201 243
       return 0;
202 244
 }
203 245
 
204 246
 /*
205 247
  * $Log: vvp_scope.c,v $
  248
+ * Revision 1.7  2001/03/28 06:07:40  steve
  249
+ *  Add the ivl_event_t to ivl_target, and use that to generate
  250
+ *  .event statements in vvp way ahead of the thread that uses it.
  251
+ *
206 252
  * Revision 1.6  2001/03/27 06:27:41  steve
207 253
  *  Generate code for simple @ statements.
208 254
  *

0 notes on commit a4e528f

Please sign in to comment.
Something went wrong with that request. Please try again.