dump initial timestamp "t0"
This commit is contained in:
parent
baa48eeee0
commit
51296f30b8
@ -85,6 +85,7 @@ b0000000000001111 {u
|
||||
date: ' Wed Sep 18 22:59:07 2019\n ',
|
||||
version: ' Generated by VerilatedVcd ',
|
||||
timescale: ' 1ns ',
|
||||
t0: 1,
|
||||
varId: 'u)',
|
||||
wires: {
|
||||
top: {
|
||||
|
@ -83,6 +83,7 @@ b0000000000001111 {u
|
||||
date: ' Wed Sep 18 22:59:07 2019\n ',
|
||||
version: ' Generated by VerilatedVcd ',
|
||||
timescale: ' 1ns ',
|
||||
t0: 1,
|
||||
varId: 'u)',
|
||||
wires: {
|
||||
top: {
|
||||
|
2
vcd.c
2
vcd.c
@ -1,5 +1,6 @@
|
||||
#define NAPI_VERSION 1
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include "vcd_parser.h"
|
||||
#include <node_api.h>
|
||||
@ -135,6 +136,7 @@ METHOD(init) {
|
||||
state->tmpStr2 = tmpStr2;
|
||||
state->value = valueBuf;
|
||||
state->mask = maskBuf;
|
||||
state->time = UINT64_MAX;
|
||||
state->digitCount = 0;
|
||||
|
||||
napi_value status;
|
||||
|
14
vcd_spans.c
14
vcd_spans.c
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "vcd_parser.h"
|
||||
|
||||
#ifndef VCDWASM
|
||||
@ -261,6 +262,17 @@ int onDigit(
|
||||
}
|
||||
|
||||
int timeSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
|
||||
state->time = strtoul((const char *)p, (char **)&endp, 10);
|
||||
int64_t time = strtoul((const char *)p, (char **)&endp, 10);
|
||||
if (state->time == UINT64_MAX) {
|
||||
#ifndef VCDWASM
|
||||
napi_env env = state->napi_env;
|
||||
napi_value val;
|
||||
ASSERT(val, napi_create_int32(env, time, &val))
|
||||
ASSERT(state->info, napi_set_named_property(env, state->info, "t0", val))
|
||||
#else
|
||||
set_property_int("t0", time);
|
||||
#endif
|
||||
}
|
||||
state->time = time;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <iostream>
|
||||
#include "vcd_parser.h"
|
||||
|
||||
@ -87,7 +88,7 @@ int init(
|
||||
externalJsSetProperty* sfn,
|
||||
externalJsGetProperty* gfn
|
||||
) {
|
||||
|
||||
|
||||
|
||||
state = (struct vcd_parser_s*) malloc(sizeof *state);
|
||||
|
||||
@ -119,6 +120,7 @@ int init(
|
||||
state->value = valueBuf;
|
||||
state->mask = maskBuf;
|
||||
state->digitCount = 0;
|
||||
state->time = UINT64_MAX;
|
||||
|
||||
set_property_string("status", "declaration");
|
||||
|
||||
@ -185,7 +187,7 @@ uint64_t getTime(const int context) {
|
||||
// externalOne = f1;
|
||||
|
||||
// set_property_int("foo", 10);
|
||||
|
||||
|
||||
|
||||
// int got = get_property_int("bar");
|
||||
|
||||
@ -199,4 +201,4 @@ int main(void) {
|
||||
}
|
||||
|
||||
|
||||
} // extern C
|
||||
} // extern C
|
||||
|
Loading…
x
Reference in New Issue
Block a user