isPosedge static method

bool isPosedge(
  1. LogicValue previousValue,
  2. LogicValue newValue,
  3. {bool ignoreInvalid = false}
)

Returns true iff the transition represents a positive edge.

Only returns true from 0 -> 1. If previousValue or newValue is invalid, an Exception will be thrown, unless ignoreInvalid is set to true.

Implementation

static bool isPosedge(LogicValue previousValue, LogicValue newValue,
    {bool ignoreInvalid = false}) {
  _assertSingleBit(previousValue);
  _assertSingleBit(newValue);

  if (!ignoreInvalid && (!previousValue.isValid | !newValue.isValid)) {
    throw Exception(
        'Edge detection on invalid value from $previousValue to $newValue.');
  }
  return previousValue == LogicValue.zero && newValue == LogicValue.one;
}