本文整理汇总了Java中com.cburch.logisim.instance.StdAttr.TRIG_FALLING属性的典型用法代码示例。如果您正苦于以下问题:Java StdAttr.TRIG_FALLING属性的具体用法?Java StdAttr.TRIG_FALLING怎么用?Java StdAttr.TRIG_FALLING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.cburch.logisim.instance.StdAttr
的用法示例。
在下文中一共展示了StdAttr.TRIG_FALLING属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propagate
@Override
public void propagate(InstanceState circState) {
Object trigger = circState.getAttributeValue(StdAttr.EDGE_TRIGGER);
TtyState state = getTtyState(circState);
Value clear = circState.getPort(CLR);
Value clock = circState.getPort(CK);
Value enable = circState.getPort(WE);
Value in = circState.getPort(IN);
synchronized (state) {
Value lastClock = state.setLastClock(clock);
if (clear == Value.TRUE) {
state.clear();
} else if (enable != Value.FALSE) {
boolean go;
if (trigger == StdAttr.TRIG_FALLING) {
go = lastClock == Value.TRUE && clock == Value.FALSE;
} else {
go = lastClock == Value.FALSE && clock == Value.TRUE;
}
if (go)
state.add(in.isFullyDefined() ? (char) in.toIntValue() : '?');
}
}
}
示例2: updateClock
public boolean updateClock(Value newClock, Object trigger) {
Value oldClock = lastClock;
lastClock = newClock;
if (trigger == null || trigger == StdAttr.TRIG_RISING) {
return oldClock == Value.FALSE && newClock == Value.TRUE;
} else if (trigger == StdAttr.TRIG_FALLING) {
return oldClock == Value.TRUE && newClock == Value.FALSE;
} else if (trigger == StdAttr.TRIG_HIGH) {
return newClock == Value.TRUE;
} else if (trigger == StdAttr.TRIG_LOW) {
return newClock == Value.FALSE;
} else {
return oldClock == Value.FALSE && newClock == Value.TRUE;
}
}
示例3: propagate
@Override
public void propagate(InstanceState circState) {
Object trigger = circState.getAttributeValue(StdAttr.EDGE_TRIGGER);
KeyboardData state = getKeyboardState(circState);
Value clear = circState.getPort(CLR);
Value clock = circState.getPort(CK);
Value enable = circState.getPort(RE);
char c;
synchronized (state) {
Value lastClock = state.setLastClock(clock);
if (clear == Value.TRUE) {
state.clear();
} else if (enable != Value.FALSE) {
boolean go;
if (trigger == StdAttr.TRIG_FALLING) {
go = lastClock == Value.TRUE && clock == Value.FALSE;
} else {
go = lastClock == Value.FALSE && clock == Value.TRUE;
}
if (go)
state.dequeue();
}
c = state.getChar(0);
}
boolean ascii = circState.getAttributeValue(CHAR_BITS) == B7;
Value out = Value.createKnown(BitWidth.create(ascii ? 7 : 16), ascii ? c & 0x7F : c);
circState.setPort(OUT, out, DELAY0);
circState.setPort(AVL, c != '\0' ? Value.TRUE : Value.FALSE, DELAY1);
}