Example #1
0
uint32_t Port::computeSteadyStateInputShiftReg()
{
    Signal current = getEffectiveDataPortInputPinsValue();
    assert(!current.isClock());
    uint32_t val = current.getValue(time);
    unsigned width = shiftRegEntries;
    unsigned shift = getPortWidth();
    while (width > 1) {
        val = (val << shift) | val;
        width >>= 1;
        shift *= 2;
    }
    val &= makeMask(getTransferWidth());
    return val;
}
Example #2
0
void ClockBlock::
setValue(const Signal &newValue, ticks_t time)
{
  if (newValue == value)
    return;
  if (isFixedFrequency() || newValue.isClock())
    updateAttachedPorts(time);
  uint32_t oldValue = value.getValue(time);
  value = newValue;
  if (!running)
    return;
  if (value.getValue(time) != oldValue) {
    seeEdgeOnAttachedPorts(oldValue == 0 ? Edge::RISING : Edge::FALLING, time);
  }
  if (isFixedFrequency()) {
    seeChangeOnAttachedPorts(time);
  }
}
Example #3
0
void LCDScreen::seeCLKChange(const Signal &newSignal, ticks_t time)
{
  CLKSignal = newSignal;
  uint32_t newValue = CLKSignal.getValue(time);
  if (newValue != CLKValue) {
    CLKValue = newValue;
    if (CLKValue)
      seeSamplingEdge(time);
  }
  if (CLKSignal.isClock()) {
    EdgeIterator nextEdge = CLKSignal.getEdgeIterator(time);
    if (nextEdge->type != Edge::RISING)
      ++nextEdge;
    scheduleSamplingEdge(nextEdge->time);
  } else if (scheduleReason != SCHEDULE_POLL_FOR_EVENTS) {
    schedulePollForEvents(time + minUpdateTicks);
  }
}
Example #4
0
void LCDScreen::run(ticks_t time)
{
  switch (scheduleReason) {
  case SCHEDULE_SAMPLING_EDGE:
    assert(CLKSignal.isClock());
    seeSamplingEdge(time);
    if (time - lastPollForEvents >= minUpdateTicks) {
      if (screen.pollForEvents()) {
        throw ExitException(time, 0);
      }
      lastPollForEvents = time;
    }
    scheduleSamplingEdge(time + CLKSignal.getPeriod());
    break;
  case SCHEDULE_POLL_FOR_EVENTS:
    if (screen.pollForEvents()) {
      throw ExitException(time, 0);
    }
    schedulePollForEvents(time + minUpdateTicks);
    lastPollForEvents = time;
    break;
  }
}