示例#1
0
void On_time_step(double pTime)
//*****************************
// The analysis at the given time has finished. DO NOT place further actions
// on pins (unless they are delayed). Pins values are stable at this point.
{
   // Check the initial pin state (at time 0) here since On_digial_in_edge()
   // doesn't get called at the beginning of the simulation.
   if(pTime == 0) {
      Check_trigger(0);
   }

   // If the CANCEL pin is asserted, clear any pending BREAK() */
   if(GET_LOGIC(CANCEL) == 1) {
      VAR(Edge_time) = -1;
   }
   
   // Trigger any previously scheduled breakpoints if their time has arrived
   if(VAR(Edge_time) != -1 && pTime >= VAR(Edge_time) + VAR(Break_delay)) {
      char strBuffer[MAXBUF];
      
      snprintf(strBuffer, MAXBUF, "Triggered at %.2f ms",
         VAR(Edge_time) * 1000);
      BREAK(strBuffer);
      
      // Clear pending breakpoint so Check_trigger() can schedule new ones
      VAR(Edge_time) = -1;
   }
}
示例#2
0
void set_output() {
   //SET_LOGIC(SIG_OUT, 1);
   //SET_LOGIC(SIG_OUT, !(GET_LOGIC(SIG_IN1) && GET_LOGIC(SIG_IN2)));
   SET_LOGIC(SIG_OUT,
      !( GET_LOGIC(SIG_IN1)
      && GET_LOGIC(SIG_IN2)
      && GET_LOGIC(SIG_IN3)
      && GET_LOGIC(SIG_IN4)
      && GET_LOGIC(SIG_IN5)
      && GET_LOGIC(SIG_IN6)
      && GET_LOGIC(SIG_IN7)
      && GET_LOGIC(SIG_IN8)
      )
    ); // Initializes output
}
示例#3
0
void Check_trigger(double pTime)
//********************
// Called from On_digital_in_edge().and On_time_step() to check the state
// of the TRIGGER pin. If the pin became high, set VAR(Edge_time) to schedule
// a pending breakpoint.
{
   // If a break condition is already pending, do not schedule any further
   // breakpoints and ignore the TRIGGER input until the currently pending
   // BREAK() occurs.
   if(GET_LOGIC(TRIGGER) == 1) {
      if(VAR(Edge_time) == -1) {
         VAR(Edge_time) = pTime;
      }
   }
}