wyatt-howe/macro-circuit-assembler

XOR in casm causes error

Opened this issue · 3 comments

Hi, I was trying a simple circuit in test.casm

1 3
1 2
1 1

2 1 0 1 2 XOR

compiling it with nodejs casm.js test.casm test.txt gave me an error:

inputPath /home/default2/Desktop/jigg/jigg/macro-circuit-assembler
circuit { wires: 3,
gates: 1,
inputs: [ 0, 1 ],
outputs: [ 2 ],
gate: [ { inputs: [Array], outputs: [Array], type: 'XOR' } ],
inputLine: [ '1', '2' ],
outputLine: [ '1', '1' ] }
currentDir /home/default2/Desktop/jigg/jigg/macro-circuit-assembler
fs.js:114
throw err;
^

Error: ENOENT: no such file or directory, open '/home/default2/Desktop/jigg/jigg/macro-circuit-assembler/XOR'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at assemble (/home/default2/Desktop/jigg/jigg/macro-circuit-assembler/casm.js:32:32)
at parseAndAssemble (/home/default2/Desktop/jigg/jigg/macro-circuit-assembler/casm.js:57:28)
at Object. (/home/default2/Desktop/jigg/jigg/macro-circuit-assembler/casm.js:66:27)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)

if I change XOR to AND, it compiles well.
Please help me understand if I am missing something obvious.
Thank you.

Hi @wyatt-howe , looking at the code here:

let plainGates = ['AND', 'OR', 'INV'];

it seems like XOR is not listed as a valid gate. Is that a typo?

FWIW, changing OR to XOR on that line made the error go away.

@wyatt-howe , any progress on this?