diff --git a/bin/build.js b/bin/build.js index 710bbfb..d94ba6a 100755 --- a/bin/build.js +++ b/bin/build.js @@ -233,13 +233,13 @@ const generate = cb => { .match(spaces, timeSpan.end(simulation)) .skipTo(simulationTime); - const onDigit = p.code.mulAdd('value', {base: 2, signed: false}); + // const onDigit = p.code.mulAdd('value', {base: 2, signed: false}); simulationVector .select( {0: 0, 1: 1, x: 2, z: 3}, p.invoke( - onDigit, + p.code.value('onDigit'), {1: p.error(1, 'Content-Length overflow')}, simulationVector ) diff --git a/test/dump.js b/test/dump.js index 5548023..0a4382a 100644 --- a/test/dump.js +++ b/test/dump.js @@ -25,6 +25,7 @@ describe('dump', () => { expect(dump).to.deep.eq([ { id: '"}G', time: 100, cmd: 14, value: 0n, mask: 0n }, { id: '"}G', time: 200, cmd: 15, value: 1n, mask: 0n }, + { id: '{u', time: 200, cmd: 19, value: 0xf0f0f0f0f0f0f0f0n, mask: 0xff00ff00ff00ff00n }, { id: '"}G', time: 300, cmd: 14, value: 0n, mask: 0n }, { id: '{u', time: 300, cmd: 19, value: 0xf000000000000000n, mask: 0n }, { id: '{u', time: 301, cmd: 19, value: 0x0f00000000000000n, mask: 0n }, @@ -69,6 +70,7 @@ $timescale 1ns $end 0"}G #200 1"}G +bzzzzxxxx11110000zzzzxxxx11110000zzzzxxxx11110000zzzzxxxx11110000 {u #300 0"}G b1111000000000000000000000000000000000000000000000000000000000000 {u diff --git a/vcd_spans.c b/vcd_spans.c index ff1f9af..48c3629 100644 --- a/vcd_spans.c +++ b/vcd_spans.c @@ -144,11 +144,11 @@ int onDigit( vcd_parser_t* state, const unsigned char* p, const unsigned char* endp, - int match + int value ) { state->value *= 2; state->mask *= 2; - switch (match) { + switch (value) { case 1: { state->value += 1; return 0;