当前位置: 首页>>代码示例>>Java>>正文


Java StdAttr.TRIG_FALLING属性代码示例

本文整理汇总了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() : '?');
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:25,代码来源:Tty.java

示例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;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:ClockState.java

示例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);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:31,代码来源:Keyboard.java


注:本文中的com.cburch.logisim.instance.StdAttr.TRIG_FALLING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。