0.4.11: Copy and Paste, added PRE and CLR (active low) inputs to flipflops
This commit is contained in:
parent
7d0807d30c
commit
d04fc3bb91
@ -16,7 +16,8 @@ LZ-String, Copyright 2013 pieroxy under MIT license https://github.com/pieroxy/l
|
|||||||
|
|
||||||
### 0.4.11
|
### 0.4.11
|
||||||
|
|
||||||
* Copy and Paste
|
* Copy and Paste, note that Paste in the menu may not work on some browsers because of security permissions, but standard keyboard shortcuts will work.
|
||||||
|
* Added !PRE and !CLR to flipflops, these are ACTIVE LOW inputs so you must make them high to use the flipflop.
|
||||||
|
|
||||||
### 0.4.10
|
### 0.4.10
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
class FlipFlopJK extends Element {
|
class FlipFlopJK extends Element {
|
||||||
constructor(_Container, RestoreData = null, logicengine) {
|
constructor(_Container, RestoreData = null, logicengine) {
|
||||||
super(_Container, RestoreData,logicengine,3);
|
super(_Container, RestoreData,logicengine,5);
|
||||||
this.Name = "JK-FF";
|
this.Name = "JK-FF";
|
||||||
this.Outputs = new Array(2);
|
this.Outputs = new Array(2);
|
||||||
this.InputLabels = new Array("J","CLK","K");
|
this.InputLabels = new Array("J","CLK","K","!PRE", "!CLR");
|
||||||
this.OutputLabels = new Array("Q","~Q");
|
this.OutputLabels = new Array("Q","~Q");
|
||||||
this.removeProperty("Inputs");
|
this.removeProperty("Inputs");
|
||||||
this.Height = 80;
|
this.Height = 140;
|
||||||
|
|
||||||
if (RestoreData) {
|
if (RestoreData) {
|
||||||
this.Outputs = RestoreData.OutputStates;
|
this.Outputs = RestoreData.OutputStates;
|
||||||
@ -43,6 +43,14 @@ class FlipFlopJK extends Element {
|
|||||||
this.Outputs[1] = !this.Outputs[0];
|
this.Outputs[1] = !this.Outputs[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this.Inputs[3]) {
|
||||||
|
this.Outputs[0] = true;
|
||||||
|
this.Outputs[1] = false;
|
||||||
|
}
|
||||||
|
if (!this.Inputs[4]) {
|
||||||
|
this.Outputs[0] = false;
|
||||||
|
this.Outputs[1] = true;
|
||||||
|
}
|
||||||
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
||||||
this.setConnections();
|
this.setConnections();
|
||||||
}
|
}
|
||||||
@ -71,13 +79,13 @@ ElementCategory_FlipFlop.addElement(ElementCatalog_JKFlipFlop);
|
|||||||
|
|
||||||
class FlipFlopSR extends Element {
|
class FlipFlopSR extends Element {
|
||||||
constructor(_Container, RestoreData = null, logicengine) {
|
constructor(_Container, RestoreData = null, logicengine) {
|
||||||
super(_Container, RestoreData,logicengine,3);
|
super(_Container, RestoreData,logicengine,5);
|
||||||
this.Name = "SR-FF";
|
this.Name = "SR-FF";
|
||||||
this.Outputs = new Array(2);
|
this.Outputs = new Array(2);
|
||||||
this.InputLabels = new Array("S","CLK","R");
|
this.InputLabels = new Array("S","CLK","R","!PRE", "!CLR");
|
||||||
this.OutputLabels = new Array("Q","~Q");
|
this.OutputLabels = new Array("Q","~Q");
|
||||||
this.removeProperty("Inputs");
|
this.removeProperty("Inputs");
|
||||||
this.Height = 80;
|
this.Height = 140;
|
||||||
|
|
||||||
if (RestoreData) {
|
if (RestoreData) {
|
||||||
this.Outputs = RestoreData.OutputStates;
|
this.Outputs = RestoreData.OutputStates;
|
||||||
@ -111,6 +119,15 @@ class FlipFlopSR extends Element {
|
|||||||
this.Outputs[1] = false;
|
this.Outputs[1] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.Inputs[3]) {
|
||||||
|
this.Outputs[0] = true;
|
||||||
|
this.Outputs[1] = false;
|
||||||
|
}
|
||||||
|
if (!this.Inputs[4]) {
|
||||||
|
this.Outputs[0] = false;
|
||||||
|
this.Outputs[1] = true;
|
||||||
|
}
|
||||||
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
||||||
this.setConnections();
|
this.setConnections();
|
||||||
}
|
}
|
||||||
@ -139,13 +156,13 @@ ElementCategory_FlipFlop.addElement(ElementCatalog_SRFlipFlop);
|
|||||||
|
|
||||||
class FlipFlopT extends Element {
|
class FlipFlopT extends Element {
|
||||||
constructor(_Container, RestoreData = null, logicengine) {
|
constructor(_Container, RestoreData = null, logicengine) {
|
||||||
super(_Container, RestoreData,logicengine,2);
|
super(_Container, RestoreData,logicengine,4);
|
||||||
this.Name = "T-FF";
|
this.Name = "T-FF";
|
||||||
this.Outputs = new Array(2);
|
this.Outputs = new Array(2);
|
||||||
this.InputLabels = new Array("T","CLK");
|
this.InputLabels = new Array("T","CLK","!PRE","!CLR");
|
||||||
this.OutputLabels = new Array("Q","~Q");
|
this.OutputLabels = new Array("Q","~Q");
|
||||||
this.removeProperty("Inputs");
|
this.removeProperty("Inputs");
|
||||||
this.Height = 80;
|
this.Height = 120;
|
||||||
|
|
||||||
if (RestoreData) {
|
if (RestoreData) {
|
||||||
this.Outputs = RestoreData.OutputStates;
|
this.Outputs = RestoreData.OutputStates;
|
||||||
@ -172,6 +189,16 @@ class FlipFlopT extends Element {
|
|||||||
this.Outputs[0] = !this.Outputs[0];
|
this.Outputs[0] = !this.Outputs[0];
|
||||||
this.Outputs[1] = !this.Outputs[0];
|
this.Outputs[1] = !this.Outputs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.Inputs[2]) {
|
||||||
|
this.Outputs[0] = true;
|
||||||
|
this.Outputs[1] = false;
|
||||||
|
}
|
||||||
|
if (!this.Inputs[3]) {
|
||||||
|
this.Outputs[0] = false;
|
||||||
|
this.Outputs[1] = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
||||||
this.setConnections();
|
this.setConnections();
|
||||||
}
|
}
|
||||||
@ -200,13 +227,13 @@ ElementCategory_FlipFlop.addElement(ElementCatalog_TFlipFlop);
|
|||||||
|
|
||||||
class FlipFlopD extends Element {
|
class FlipFlopD extends Element {
|
||||||
constructor(_Container, RestoreData = null, logicengine) {
|
constructor(_Container, RestoreData = null, logicengine) {
|
||||||
super(_Container, RestoreData,logicengine,2);
|
super(_Container, RestoreData,logicengine,4);
|
||||||
this.Name = "D-FF";
|
this.Name = "D-FF";
|
||||||
this.Outputs = new Array(2);
|
this.Outputs = new Array(2);
|
||||||
this.InputLabels = new Array("D","CLK");
|
this.InputLabels = new Array("D","CLK","!PRE","!CLR");
|
||||||
this.OutputLabels = new Array("Q","~Q");
|
this.OutputLabels = new Array("Q","~Q");
|
||||||
this.removeProperty("Inputs");
|
this.removeProperty("Inputs");
|
||||||
this.Height = 80;
|
this.Height = 120;
|
||||||
|
|
||||||
if (RestoreData) {
|
if (RestoreData) {
|
||||||
this.Outputs = RestoreData.OutputStates;
|
this.Outputs = RestoreData.OutputStates;
|
||||||
@ -234,6 +261,14 @@ class FlipFlopD extends Element {
|
|||||||
this.Outputs[0] = this.Inputs[0];
|
this.Outputs[0] = this.Inputs[0];
|
||||||
this.Outputs[1] = !this.Outputs[0];
|
this.Outputs[1] = !this.Outputs[0];
|
||||||
}
|
}
|
||||||
|
if (!this.Inputs[2]) {
|
||||||
|
this.Outputs[0] = true;
|
||||||
|
this.Outputs[1] = false;
|
||||||
|
}
|
||||||
|
if (!this.Inputs[3]) {
|
||||||
|
this.Outputs[0] = false;
|
||||||
|
this.Outputs[1] = true;
|
||||||
|
}
|
||||||
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
if (oldOutput != this.getOutput(0) || oldOutput2 != this.getOutput(1)) {
|
||||||
this.setConnections();
|
this.setConnections();
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ class LogicEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mouse_Down(evt) {
|
Mouse_Down(evt) {
|
||||||
if (evt.which === 1) {
|
if (evt.which === 1 && !this.MultiSelectStart.InProgress) {
|
||||||
let mousePos = getMousePos(this.Canvas, evt);
|
let mousePos = getMousePos(this.Canvas, evt);
|
||||||
this.MouseDownTime = performance.now();
|
this.MouseDownTime = performance.now();
|
||||||
let element = this.ActiveContainer.checkMouseBounds(mousePos);
|
let element = this.ActiveContainer.checkMouseBounds(mousePos);
|
||||||
|
Loading…
Reference in New Issue
Block a user