support for $comment, $date, $timescale, $version
This commit is contained in:
parent
e1c5f08747
commit
54332dfef3
@ -32,6 +32,7 @@ describe('basic', () => {
|
||||
' \n $comment some text $end $comment more text $end ???'
|
||||
))).to.eq(true);
|
||||
expect(inst.info).to.deep.eq({
|
||||
comment: ' more text ',
|
||||
stack: [{}],
|
||||
status: 'declaration',
|
||||
wires: {}
|
||||
@ -81,6 +82,9 @@ b0000000000001111 {u
|
||||
|
||||
expect(inst.info).to.deep.eq({
|
||||
status: 'simulation',
|
||||
date: ' Wed Sep 18 22:59:07 2019\n ',
|
||||
version: ' Generated by VerilatedVcd ',
|
||||
timescale: ' 1ns ',
|
||||
varId: 'u)',
|
||||
wires: {
|
||||
top: {
|
||||
|
@ -10,6 +10,9 @@ describe('events', () => {
|
||||
inst.on('$enddefinitions', () => {
|
||||
expect(inst.info).to.deep.eq({
|
||||
status: 'simulation',
|
||||
date: ' Wed Sep 18 22:59:07 2019\n ',
|
||||
version: ' Generated by VerilatedVcd ',
|
||||
timescale: ' 1ns ',
|
||||
varId: 'u)',
|
||||
wires: {
|
||||
top: {
|
||||
|
@ -31,6 +31,7 @@ describe('wasm basic', () => {
|
||||
' \n $comment some text $end $comment more text $end ???'
|
||||
))).to.eq(true);
|
||||
expect(inst.info).to.deep.eq({
|
||||
comment: ' more text ',
|
||||
stack: [{}],
|
||||
status: 'declaration',
|
||||
wires: {}
|
||||
@ -79,6 +80,9 @@ b0000000000001111 {u
|
||||
|
||||
expect(inst.info).to.deep.eq({
|
||||
status: 'simulation',
|
||||
date: ' Wed Sep 18 22:59:07 2019\n ',
|
||||
version: ' Generated by VerilatedVcd ',
|
||||
timescale: ' 1ns ',
|
||||
varId: 'u)',
|
||||
wires: {
|
||||
top: {
|
||||
|
@ -18,6 +18,9 @@ describe('wasm events', () => {
|
||||
inst.on('$enddefinitions', () => {
|
||||
expect(inst.info).to.deep.eq({
|
||||
status: 'simulation',
|
||||
timescale: ' 1ns ',
|
||||
date: ' Wed Sep 18 22:59:07 2019\n ',
|
||||
version: ' Generated by VerilatedVcd ',
|
||||
varId: 'u)',
|
||||
wires: {
|
||||
top: {
|
||||
|
24
vcd_spans.c
24
vcd_spans.c
@ -74,6 +74,30 @@ int commandSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (
|
||||
(state->command == 1) || // $comment
|
||||
(state->command == 2) || // $date
|
||||
(state->command == 4) || // $timescale
|
||||
(state->command == 7) // $version
|
||||
) {
|
||||
char* key;
|
||||
switch(state->command) {
|
||||
case 1: key = "comment"; break;
|
||||
case 2: key = "date"; break;
|
||||
case 4: key = "timescale"; break;
|
||||
case 7: key = "version"; break;
|
||||
}
|
||||
#ifndef VCDWASM
|
||||
napi_value val;
|
||||
ASSERT(val, napi_create_string_latin1(env, (char*)p, (endp - p - 4), &val))
|
||||
ASSERT(state->info, napi_set_named_property(env, state->info, key, val))
|
||||
#else
|
||||
strcopy(p, endp - 3, state->tmpStr);
|
||||
set_property_string(key, state->tmpStr);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (state->command == 8) { // $enddefinitions
|
||||
#ifndef VCDWASM
|
||||
napi_value status, undefined, eventName, eventPayload, return_val;
|
||||
|
Loading…
x
Reference in New Issue
Block a user