fixes #19 ; 4-state value support
This commit is contained in:
parent
5a6333a089
commit
5d320c539f
@ -233,13 +233,13 @@ const generate = cb => {
|
|||||||
.match(spaces, timeSpan.end(simulation))
|
.match(spaces, timeSpan.end(simulation))
|
||||||
.skipTo(simulationTime);
|
.skipTo(simulationTime);
|
||||||
|
|
||||||
const onDigit = p.code.mulAdd('value', {base: 2, signed: false});
|
// const onDigit = p.code.mulAdd('value', {base: 2, signed: false});
|
||||||
|
|
||||||
simulationVector
|
simulationVector
|
||||||
.select(
|
.select(
|
||||||
{0: 0, 1: 1, x: 2, z: 3},
|
{0: 0, 1: 1, x: 2, z: 3},
|
||||||
p.invoke(
|
p.invoke(
|
||||||
onDigit,
|
p.code.value('onDigit'),
|
||||||
{1: p.error(1, 'Content-Length overflow')},
|
{1: p.error(1, 'Content-Length overflow')},
|
||||||
simulationVector
|
simulationVector
|
||||||
)
|
)
|
||||||
|
@ -25,6 +25,7 @@ describe('dump', () => {
|
|||||||
expect(dump).to.deep.eq([
|
expect(dump).to.deep.eq([
|
||||||
{ id: '"}G', time: 100, cmd: 14, value: 0n, mask: 0n },
|
{ id: '"}G', time: 100, cmd: 14, value: 0n, mask: 0n },
|
||||||
{ id: '"}G', time: 200, cmd: 15, value: 1n, 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: '"}G', time: 300, cmd: 14, value: 0n, mask: 0n },
|
||||||
{ id: '{u', time: 300, cmd: 19, value: 0xf000000000000000n, mask: 0n },
|
{ id: '{u', time: 300, cmd: 19, value: 0xf000000000000000n, mask: 0n },
|
||||||
{ id: '{u', time: 301, cmd: 19, value: 0x0f00000000000000n, mask: 0n },
|
{ id: '{u', time: 301, cmd: 19, value: 0x0f00000000000000n, mask: 0n },
|
||||||
@ -69,6 +70,7 @@ $timescale 1ns $end
|
|||||||
0"}G
|
0"}G
|
||||||
#200
|
#200
|
||||||
1"}G
|
1"}G
|
||||||
|
bzzzzxxxx11110000zzzzxxxx11110000zzzzxxxx11110000zzzzxxxx11110000 {u
|
||||||
#300
|
#300
|
||||||
0"}G
|
0"}G
|
||||||
b1111000000000000000000000000000000000000000000000000000000000000 {u
|
b1111000000000000000000000000000000000000000000000000000000000000 {u
|
||||||
|
@ -144,11 +144,11 @@ int onDigit(
|
|||||||
vcd_parser_t* state,
|
vcd_parser_t* state,
|
||||||
const unsigned char* p,
|
const unsigned char* p,
|
||||||
const unsigned char* endp,
|
const unsigned char* endp,
|
||||||
int match
|
int value
|
||||||
) {
|
) {
|
||||||
state->value *= 2;
|
state->value *= 2;
|
||||||
state->mask *= 2;
|
state->mask *= 2;
|
||||||
switch (match) {
|
switch (value) {
|
||||||
case 1: {
|
case 1: {
|
||||||
state->value += 1;
|
state->value += 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user