Comparing version 0.0.36 to 0.0.37
@@ -272,4 +272,12 @@ /** | ||
// Constant values: And(a=true, b=false) | ||
var constantValue = null; | ||
if (value.value === 'true' || value.value === '1') { | ||
constantValue = 1; | ||
} else if (value.value === 'false' || value.value === '0') { | ||
constantValue = 0; | ||
} | ||
// Create new (internal) pin, which is not part of inputs/outputs. | ||
var isInternalPin = !inputPinsMap.hasOwnProperty(value.value) && !outputPinsMap.hasOwnProperty(value.value); | ||
var isInternalPin = !inputPinsMap.hasOwnProperty(value.value) && !outputPinsMap.hasOwnProperty(value.value) && constantValue === null; | ||
if (isInternalPin && !internalPinsMap.hasOwnProperty(value.value)) { | ||
@@ -284,12 +292,7 @@ var internalPin = new Pin({ | ||
var constantValue = void 0; | ||
if (value.value === 'true' || value.value === '1') { | ||
constantValue = 1; | ||
} else if (value.value === 'false' || value.value === '0') { | ||
constantValue = 0; | ||
} | ||
// When main pins change, update all dependent inputs. | ||
if (pinInfo.kind === 'input') { | ||
// Set always fixed value. | ||
if (constantValue !== null) { | ||
pin.setValue(constantValue); | ||
} else if (pinInfo.kind === 'input') { | ||
// When main pins change, update all dependent inputs. | ||
var sourcePin = inputPinsMap[value.value] || outputPinsMap[value.value] || internalPinsMap[value.value]; | ||
@@ -304,6 +307,2 @@ sourcePin.on('change', createInputChangeHandler(pin, sourcePin, name, value)); | ||
pin.on('change', createOutputChangeHandler(destPin, pin, name, value)); | ||
// Set always fixed value. | ||
} else if (constantValue) { | ||
pin.setValue(constantValue); | ||
} | ||
@@ -310,0 +309,0 @@ } |
{ | ||
"name": "hdl-js", | ||
"version": "0.0.36", | ||
"version": "0.0.37", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Hardware definition language (HDL) and Hardware simulator", |
@@ -385,19 +385,19 @@ # hdl-js | ||
/** | ||
* The `size` is only available in input/output names. | ||
* The `size` is only available in the input/output names. | ||
* | ||
* Example: `IN a[16];`, the `size` is 16. | ||
*/ | ||
size: number, | ||
size?: number, | ||
/** | ||
* An index of a particular bit. The `index` property is | ||
* available only in the arguments. | ||
* only available in the arguments of a `ChipCall`. | ||
* | ||
* Example: `And(a=a[4], ...)`, the `index` is 4 here. | ||
*/ | ||
index: number, | ||
index?: number, | ||
/** | ||
* A range of the bits. The `range` property is | ||
* available only in arguments. | ||
* only available in arguments of a `ChipCall`/ | ||
* | ||
@@ -407,3 +407,3 @@ * Example: `Mux4Way16(..., sel=address[0..11])`, | ||
*/ | ||
range: { | ||
range?: { | ||
from: number, | ||
@@ -431,3 +431,3 @@ to: number, | ||
/** | ||
* The list of arguments to the call. The values in each [argument](#argument-ast-node) | ||
* The list of arguments to the call. The values in each argument | ||
* correspond to the inputs/outputs specification of a gate. | ||
@@ -441,2 +441,4 @@ */ | ||
Arguments appear as parts of the [ChipCall](#chipcall-ast-node) node types. An argument has the following properties: | ||
```js | ||
@@ -443,0 +445,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
266247
68
4973
1499