Open raczben opened 4 years ago
You can totally feed this parser with a single chunk. That will make it non-streaming. Example: https://github.com/wavedrom/vcd/blob/master/test/basic.js#L44 About ALL value changes. How would you imagine the result data structure that you want to see?
That example does not checks the value changes...
Let's see this example:
'use strict';
const vcd = require('vcd-stream');
const inst = vcd.parser();
inst.on("$enddefinitions", () => {
console.log(inst.info.wires)
// {
// top: { clock: '"}G', leaf: { counter: '{u' }, fruit: { point: 'u)' } }
// }
});
inst.change.on('"}G', (time, cmd) => {
console.log(`change: "}G @${time} cmd: ${cmd}`) // < < < < < < What is the meaning of cmd?
});
inst.change.on('u)', (time, cmd) => {
console.log(`change: u) @${time} cmd: ${cmd}`)
});
inst.change.on('{u', (time, cmd) => {
console.log(`change: {u @${time} cmd: ${cmd}`)
});
inst.write(`
$version Generated by VerilatedVcd $end
$date Wed Sep 18 22:59:07 2019
$end
$timescale 1ns $end
$scope module top $end
$var wire 1 "}G clock $end
$scope module leaf $end
$var wire 64 {u counter [63:0] $end
$upscope $end
$scope module fruit $end
$var wire 4 u) point [3:0] $end
$upscope $end
$upscope $end
$enddefinitions $end
`
);
inst.write(`
#1
0"}G
#2
1"}G
#300
0"}G
b1111000000000000 {u
#301
b0000111100000000 {u
#302
b0000000011110000 {u
#303
b0000000000001111 {u
`
);
This prints out:
{
top: { clock: '"}G', leaf: { counter: '{u' }, fruit: { point: 'u)' } }
}
change: "}G @1 cmd: 14
change: "}G @2 cmd: 15
change: "}G @300 cmd: 14
change: {u @300 cmd: 19
change: {u @301 cmd: 19
change: {u @302 cmd: 19
change: {u @303 cmd: 19
What is the meaning of cmd? Where is the new value?
cmd is enum: https://github.com/wavedrom/vcd/blob/master/bin/build.js#L87
{
14: 0,
15: 1,
19: binary string starts with `b`
}
I like this stream reader behavior, but it is overkill when the whole file is available. I just want a method, which gives back the fully parsed file, with all of the value changes.
I need a similar behavior to this, (just, that has some bug...)
The format from from ahmed-agiza/vcd-parser
is very verbose and will eat all memory very quickly. Maybe we should come up with a better format?
I think we have to discuss the format of the data on cmd=19, 20 here https://github.com/wavedrom/vcd/issues/16
I like this stream reader behavior, but it is overkill when the whole file is available. I just want a method, which gives back the fully parsed file, with all of the value changes.
I need a similar behavior to this, (just, that has some bug...)