Comparing version 0.0.58 to 0.0.59
@@ -237,9 +237,6 @@ /** | ||
function getConstantValue(value) { | ||
var constantValue = null; | ||
if (value.value === 'true' || value.value === '1') { | ||
constantValue = 1; | ||
} else if (value.value === 'false' || value.value === '0') { | ||
constantValue = 0; | ||
if (value.type !== 'Constant') { | ||
return null; | ||
} | ||
return constantValue; | ||
return value.value; | ||
} | ||
@@ -246,0 +243,0 @@ |
@@ -195,2 +195,30 @@ /** | ||
}; | ||
}], [20, 1, function (_1, _1loc) { | ||
__loc = yyloc(_1loc, _1loc);__ = _1; | ||
}], [20, 1, function (_1, _1loc) { | ||
__loc = yyloc(_1loc, _1loc); | ||
var constName = null; | ||
if (_1.value === 'true') { | ||
constName = 1; | ||
} else if (_1.value === 'false') { | ||
constName = 0; | ||
} | ||
if (constName !== null) { | ||
__ = { | ||
type: 'Constant', | ||
value: constName, | ||
raw: _1.value | ||
}; | ||
} else { | ||
// Other name: | ||
__ = _1; | ||
} | ||
}], [21, 1, function (_1, _1loc) { | ||
__loc = yyloc(_1loc, _1loc); | ||
__ = { | ||
type: 'Constant', | ||
value: Number(_1), | ||
raw: _1 | ||
}; | ||
}]]; | ||
@@ -201,3 +229,3 @@ | ||
*/ | ||
var tokens = { "CHIP": "20", "IN": "21", "OUT": "22", "PARTS": "23", "BUILTIN": "24", "CLOCKED": "25", "NUMBER": "26", "ID": "27", "'{'": "28", "'}'": "29", "';'": "30", "':'": "31", "','": "32", "'['": "33", "']'": "34", "'.'": "35", "'('": "36", "')'": "37", "'='": "38", "$": "39" }; | ||
var tokens = { "CHIP": "22", "IN": "23", "OUT": "24", "PARTS": "25", "BUILTIN": "26", "CLOCKED": "27", "NUMBER": "28", "ID": "29", "'{'": "30", "'}'": "31", "';'": "32", "':'": "33", "','": "34", "'['": "35", "']'": "36", "'.'": "37", "'('": "38", "')'": "39", "'='": "40", "$": "41" }; | ||
@@ -207,3 +235,3 @@ /** | ||
*/ | ||
var table = [{ "0": 60, "20": "s1" }, { "14": 2, "27": "s61" }, { "28": "s3" }, { "1": 4, "2": 5, "3": 6, "4": 7, "5": 8, "6": 9, "7": 10, "21": "s11", "22": "s12", "23": "s13", "24": "s14", "25": "s15" }, { "2": 16, "3": 6, "4": 7, "5": 8, "6": 9, "7": 10, "21": "s11", "22": "s12", "23": "s13", "24": "s14", "25": "s15", "29": "s62" }, { "21": "r2", "22": "r2", "23": "r2", "24": "r2", "25": "r2", "29": "r2" }, { "21": "r4", "22": "r4", "23": "r4", "24": "r4", "25": "r4", "29": "r4" }, { "21": "r5", "22": "r5", "23": "r5", "24": "r5", "25": "r5", "29": "r5" }, { "21": "r6", "22": "r6", "23": "r6", "24": "r6", "25": "r6", "29": "r6" }, { "21": "r7", "22": "r7", "23": "r7", "24": "r7", "25": "r7", "29": "r7" }, { "21": "r8", "22": "r8", "23": "r8", "24": "r8", "25": "r8", "29": "r8" }, { "8": 17, "9": 18, "13": 19, "15": 21, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "8": 39, "9": 18, "13": 19, "15": 21, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "31": "s41" }, { "8": 56, "9": 18, "13": 19, "15": 21, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "8": 58, "9": 18, "13": 19, "15": 21, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "21": "r3", "22": "r3", "23": "r3", "24": "r3", "25": "r3", "29": "r3" }, { "30": "s28", "32": "s29" }, { "30": "r14", "32": "r14" }, { "10": 31, "11": 32, "30": "r18", "32": "r18", "33": "s33", "37": "r18", "38": "r18" }, { "30": "r22", "32": "r22", "33": "r22", "37": "r22", "38": "r22" }, { "30": "r23", "32": "r23", "33": "r23", "37": "r23", "38": "r23" }, { "30": "r25", "32": "r25", "33": "r25", "37": "r25", "38": "r25" }, { "30": "r26", "32": "r26", "33": "r26", "37": "r26", "38": "r26" }, { "30": "r27", "32": "r27", "33": "r27", "37": "r27", "38": "r27" }, { "30": "r28", "32": "r28", "33": "r28", "37": "r28", "38": "r28" }, { "30": "r29", "32": "r29", "33": "r29", "37": "r29", "38": "r29" }, { "30": "r30", "32": "r30", "33": "r30", "37": "r30", "38": "r30" }, { "21": "r9", "22": "r9", "23": "r9", "24": "r9", "25": "r9", "29": "r9" }, { "9": 30, "13": 19, "15": 21, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "30": "r15", "32": "r15" }, { "30": "r16", "32": "r16", "37": "r16", "38": "r16" }, { "30": "r17", "32": "r17", "37": "r17", "38": "r17" }, { "12": 34, "26": "s35" }, { "34": "s36" }, { "34": "r20", "35": "s37" }, { "30": "r19", "32": "r19", "37": "r19", "38": "r19" }, { "35": "s38" }, { "26": "s63" }, { "30": "s40", "32": "s29" }, { "21": "r10", "22": "r10", "23": "r10", "24": "r10", "25": "r10", "29": "r10" }, { "14": 44, "16": 42, "17": 43, "27": "s61" }, { "14": 44, "17": 45, "21": "r11", "22": "r11", "23": "r11", "24": "r11", "25": "r11", "27": "s61", "29": "r11" }, { "21": "r31", "22": "r31", "23": "r31", "24": "r31", "25": "r31", "27": "r31", "29": "r31" }, { "36": "s46" }, { "21": "r32", "22": "r32", "23": "r32", "24": "r32", "25": "r32", "27": "r32", "29": "r32" }, { "9": 49, "13": 19, "15": 21, "18": 47, "19": 48, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "32": "s51", "37": "s50" }, { "32": "r34", "37": "r34" }, { "38": "s54" }, { "30": "s52" }, { "9": 49, "13": 19, "15": 21, "19": 53, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "21": "r33", "22": "r33", "23": "r33", "24": "r33", "25": "r33", "27": "r33", "29": "r33" }, { "32": "r35", "37": "r35" }, { "9": 55, "13": 19, "15": 21, "20": "s22", "21": "s23", "22": "s24", "23": "s25", "24": "s26", "25": "s27", "27": "s20" }, { "32": "r36", "37": "r36" }, { "30": "s57", "32": "s29" }, { "21": "r12", "22": "r12", "23": "r12", "24": "r12", "25": "r12", "29": "r12" }, { "30": "s59", "32": "s29" }, { "21": "r13", "22": "r13", "23": "r13", "24": "r13", "25": "r13", "29": "r13" }, { "39": "acc" }, { "28": "r24", "36": "r24" }, { "39": "r1" }, { "34": "r21" }]; | ||
var table = [{ "0": 63, "22": "s1" }, { "14": 2, "29": "s64" }, { "30": "s3" }, { "1": 4, "2": 5, "3": 6, "4": 7, "5": 8, "6": 9, "7": 10, "23": "s11", "24": "s12", "25": "s13", "26": "s14", "27": "s15" }, { "2": 16, "3": 6, "4": 7, "5": 8, "6": 9, "7": 10, "23": "s11", "24": "s12", "25": "s13", "26": "s14", "27": "s15", "31": "s65" }, { "23": "r2", "24": "r2", "25": "r2", "26": "r2", "27": "r2", "31": "r2" }, { "23": "r4", "24": "r4", "25": "r4", "26": "r4", "27": "r4", "31": "r4" }, { "23": "r5", "24": "r5", "25": "r5", "26": "r5", "27": "r5", "31": "r5" }, { "23": "r6", "24": "r6", "25": "r6", "26": "r6", "27": "r6", "31": "r6" }, { "23": "r7", "24": "r7", "25": "r7", "26": "r7", "27": "r7", "31": "r7" }, { "23": "r8", "24": "r8", "25": "r8", "26": "r8", "27": "r8", "31": "r8" }, { "8": 17, "9": 18, "13": 19, "15": 21, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "8": 39, "9": 18, "13": 19, "15": 21, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "33": "s41" }, { "8": 59, "9": 18, "13": 19, "15": 21, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "8": 61, "9": 18, "13": 19, "15": 21, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "23": "r3", "24": "r3", "25": "r3", "26": "r3", "27": "r3", "31": "r3" }, { "32": "s28", "34": "s29" }, { "32": "r14", "34": "r14" }, { "10": 31, "11": 32, "32": "r18", "34": "r18", "35": "s33", "39": "r18", "40": "r18" }, { "32": "r22", "34": "r22", "35": "r22", "39": "r22", "40": "r22" }, { "32": "r23", "34": "r23", "35": "r23", "39": "r23", "40": "r23" }, { "32": "r25", "34": "r25", "35": "r25", "39": "r25", "40": "r25" }, { "32": "r26", "34": "r26", "35": "r26", "39": "r26", "40": "r26" }, { "32": "r27", "34": "r27", "35": "r27", "39": "r27", "40": "r27" }, { "32": "r28", "34": "r28", "35": "r28", "39": "r28", "40": "r28" }, { "32": "r29", "34": "r29", "35": "r29", "39": "r29", "40": "r29" }, { "32": "r30", "34": "r30", "35": "r30", "39": "r30", "40": "r30" }, { "23": "r9", "24": "r9", "25": "r9", "26": "r9", "27": "r9", "31": "r9" }, { "9": 30, "13": 19, "15": 21, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "32": "r15", "34": "r15" }, { "32": "r16", "34": "r16", "39": "r16", "40": "r16" }, { "32": "r17", "34": "r17", "39": "r17", "40": "r17" }, { "12": 34, "28": "s35" }, { "36": "s36" }, { "36": "r20", "37": "s37" }, { "32": "r19", "34": "r19", "39": "r19", "40": "r19" }, { "37": "s38" }, { "28": "s66" }, { "32": "s40", "34": "s29" }, { "23": "r10", "24": "r10", "25": "r10", "26": "r10", "27": "r10", "31": "r10" }, { "14": 44, "16": 42, "17": 43, "29": "s64" }, { "14": 44, "17": 45, "23": "r11", "24": "r11", "25": "r11", "26": "r11", "27": "r11", "29": "s64", "31": "r11" }, { "23": "r31", "24": "r31", "25": "r31", "26": "r31", "27": "r31", "29": "r31", "31": "r31" }, { "38": "s46" }, { "23": "r32", "24": "r32", "25": "r32", "26": "r32", "27": "r32", "29": "r32", "31": "r32" }, { "9": 49, "13": 19, "15": 21, "18": 47, "19": 48, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "34": "s51", "39": "s50" }, { "34": "r34", "39": "r34" }, { "40": "s54" }, { "32": "s52" }, { "9": 49, "13": 19, "15": 21, "19": 53, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "29": "s20" }, { "23": "r33", "24": "r33", "25": "r33", "26": "r33", "27": "r33", "29": "r33", "31": "r33" }, { "34": "r35", "39": "r35" }, { "9": 57, "13": 19, "15": 21, "20": 55, "21": 56, "22": "s22", "23": "s23", "24": "s24", "25": "s25", "26": "s26", "27": "s27", "28": "s58", "29": "s20" }, { "34": "r36", "39": "r36" }, { "34": "r37", "39": "r37" }, { "34": "r38", "39": "r38" }, { "34": "r39", "39": "r39" }, { "32": "s60", "34": "s29" }, { "23": "r12", "24": "r12", "25": "r12", "26": "r12", "27": "r12", "31": "r12" }, { "32": "s62", "34": "s29" }, { "23": "r13", "24": "r13", "25": "r13", "26": "r13", "27": "r13", "31": "r13" }, { "41": "acc" }, { "30": "r24", "38": "r24" }, { "41": "r1" }, { "36": "r21" }]; | ||
@@ -210,0 +238,0 @@ /** |
{ | ||
"name": "hdl-js", | ||
"version": "0.0.58", | ||
"version": "0.0.59", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Hardware definition language (HDL) and Hardware simulator", |
@@ -10,3 +10,2 @@ # hdl-js | ||
- [Installation](#installation) | ||
- [Online tool](#online-tool) | ||
- [Development](#development) | ||
@@ -20,2 +19,3 @@ - [Usage as a CLI](#usage-as-a-cli) | ||
- [Emulator](#emulator) | ||
- [Online tool](#online-tool) | ||
- [Built-in gates](#built-in-gates) | ||
@@ -63,12 +63,2 @@ - [Viewing gate specification](#viewing-gate-specification) | ||
## Online tool | ||
The [Hardware Emulator](#emulator) module is exposed as a UI tool, where you can design your chips in HDL, introspect built-in gates, and check the gate evaluation result. | ||
<a href="http://dmitrysoshnikov.com/hdl-hardware-simulator/">Try it out here!</a> | ||
<p align="center"> | ||
<img src="http://dmitrysoshnikov.com/wp-content/uploads/2018/03/hdl-hardward-simulator-screen-1024x518.png" alt="Hardware simulator UI tool" /> | ||
<p/> | ||
## Development | ||
@@ -477,6 +467,26 @@ | ||
*/ | ||
value: Name, | ||
value: Constant | Name, | ||
} | ||
``` | ||
#### `Constant` AST node | ||
Constants can be used as _input_ values for pins. These are _numbers_, and two special names, `false`, and `true`, which correspond respectively to `0`, and `1` values. | ||
```js | ||
{ | ||
type: 'Constant', | ||
/** | ||
* The number value of the constant. | ||
*/ | ||
value: NUMBER, | ||
/** | ||
* The value as it appears in the source code. | ||
*/ | ||
raw: 'true' | 'false' | NUMBER | ||
} | ||
``` | ||
## Emulator | ||
@@ -486,2 +496,12 @@ | ||
### Online tool | ||
The emulator module is exposed as a UI tool, where you can design chips in HDL, introspect built-in gates, and check the results of gates evaluation. | ||
<a href="http://dmitrysoshnikov.com/hdl-hardware-simulator/" target="_blank">Try it out here!</a> | ||
<p align="center"> | ||
<img src="http://dmitrysoshnikov.com/wp-content/uploads/2018/03/hdl-hardward-simulator-screen-1024x518.png" alt="Hardware simulator UI tool" /> | ||
<p/> | ||
### Built-in gates | ||
@@ -488,0 +508,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
307065
5727
1890