next up previous contents
Next: About this document ... Up: The wait_info Class Previous: wait_info Class Variables

wait_info Class Methods

Besides of the methods internally used by the simulation kernel the following constructors are required

Methods Description
wait_info(sigacl_list &salist) The parameter ``salist'' is a list object of variable size. The elements are ``sig''-''acl'' pairs where ``sig'' is a pointer to the info structure of a signal the process is sensitive on while ``acl'' defines which part of the (composite) signal ``sig'' is addressed by the wait statement.
   

``sigacl_list'' is a list class to store ``sig''-''acl'' pairs. It is described in Section [*]10.1. ``acl'' objects are used to reference a specific scalar element or set of scalar elements of an composite signal. The definition and usage of the ``acl'' objects is described in Section 4.3.

Example:

SIGNAL a, b : BIT_VECTOR(0 TO 3);
...
WAIT; -- wait forever. Wait statement 1
WAIT ON a, b;  -- wait statement 2
WAIT ON a, b(2);  -- wait statement 3
The constructor calls to build the wait_info objects are
{ 
  sigacl_list salist(0); // create an empty sigacl_list object
  wait_info(salist, this);  // wait statement 1
}
{ 
  sigacl_list salist(2); // create an new sigacl_list for 2 entry's
  salist.add(arch->S1a); // add ``A'' to the list
  salist.add(arch->S1b); // add ``B'' to the list
  wait_info(salist, this); // Wait statement 2
}
{ 
  sigacl_list salist(2); // create an new sigacl_list for 2 entry's
  salist.add(arch->S1a); // add ``A'' to the list
  salist.add(arch->S1b, &(*new(1) acl << 2)); // add ``B(2)'' to the 
                         // list
  wait_info(salist, this); // Wait statement 3
}

Note, arch->S1a and arch->S1b are pointing to the signal information objects of signal ``a'' and ``b''.

If a wait condition is specified in the VHDL source the corresponding C++ process functions is called each time a signal in the implicit or explicit sensitivity list changes. The condition is then tested by the process. If it is not met then the process function exits immediately returning ``false''. Otherwise it continues execution until it suspend again returning ``true''. This informs the kernel that the wait condition was met.

Example:

SIGNAL int : INTEGER;
...
P:PROCESS
BEGIN
   WAIT ON int UNTIL int = 1;
   ...
END PROCESS;
The conditional expression is tested by the process:
bool  
L3lib_E8myentity_A4arch_P1p::execute() {
   switch (jmp) {
   case 1: goto lab1;
   case 2: goto lab2;
   ...
   };
  lab1:
   jmp = 2; // Next time jump to label ``lab2''
   kernel.wait_conditional(winfo[0]);
   return true;  // suspend execution
  lab2:
   // Now test the condition and return false if the
   // wait condition is NOT met!
   if (!(int == 1)) return false;
   ...
}

Further, for each wait statement with a timeout clause an additional label is inserted into the process code. Execution is continued from this label if the timeout condition becomes active. The label number as well as the timeout time value is passed to the kernel via a special ``wait_timeout'' kernel method.

Example:

SIGNAL int : INTEGER;
...
P:PROCESS
BEGIN
   WAIT ON int UNTIL int = 1 FOR 10 ns;
   ...
END PROCESS;
The conditional is tested by the process
bool  
L3lib_E8myentity_A4arch_P1p::execute() {
   switch (jmp) {
   case 1: goto lab1;
   case 2: goto lab2;
   case 3: goto lab3;
   ...
   };
  lab1:
   jmp = 2;  
   kernel.wait_conditional(winfo[0]);
   // Further, inform the kernel at which label execution shall 
   // continue if the timeout condition becomes active.
   kernel.wait_timeout(winfo[0], time(10, 2), 3);
   return true;  // Suspend execution
  lab2:
   // Now test the condition and return false if the
   // wait condition is NOT met!
   if (!(int == 1)) return false;
  lab3:  // If the timeout condition is met then continue here
   ...
}


next up previous contents
Next: About this document ... Up: The wait_info Class Previous: wait_info Class Variables

1998-11-17