Comparing version 0.0.15 to 0.0.16
{ | ||
"name": "hdl-js", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Hardware definition language (HDL) and Hardware simulator", |
@@ -288,4 +288,7 @@ /** | ||
expect(order).toEqual(['eval', 'clockUp', 'clockDown', 'eval']); | ||
Gate.setClockValue(+3); | ||
expect(Gate.getClockValue()).toBe(+3); | ||
}); | ||
}); |
@@ -19,3 +19,3 @@ /** | ||
function isNegativeZero(value) { | ||
return 1 / value === -Infinity; | ||
return value === 0 && (1 / value === -Infinity); | ||
} | ||
@@ -58,2 +58,3 @@ | ||
this._buildNamesToPinsMap(); | ||
this.init(); | ||
} | ||
@@ -202,3 +203,7 @@ | ||
if (this.getClass().isClocked()) { | ||
Gate.isClockDown() ? this.tick() : this.tock(); | ||
// The -0 is a setup row, don't execute on it. | ||
if (!isNegativeZero(row[Pin.CLOCK])) { | ||
Gate.isClockDown() ? this.tick() : this.tock(); | ||
this.getPin(Pin.CLOCK).setValue(Gate.getClockValue()); | ||
} | ||
} else { | ||
@@ -451,6 +456,13 @@ this.eval(); | ||
static resetClock() { | ||
Gate._clockValue = -0; | ||
Gate.setClockValue(-0); | ||
} | ||
/** | ||
* Sets clock value. | ||
*/ | ||
static setClockValue(value) { | ||
Gate._clockValue = value; | ||
} | ||
/** | ||
* Returns clock value. | ||
@@ -457,0 +469,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140500
80
3835