Skip to content

Commit

Permalink
one passing
Browse files Browse the repository at this point in the history
  • Loading branch information
esromneb committed Sep 28, 2020
1 parent 68a6115 commit 2571735
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
5 changes: 1 addition & 4 deletions lib/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ module.exports = () => {
return {
start,
c,
log: () => {
console.log(wasm);
},
init: (cb0, cb1, info) => {
boundInfo = info;
ee[0] = cb0;
Expand All @@ -166,7 +163,7 @@ module.exports = () => {
return c.setTrigger(ctx, triggerString);
},
getTime: (ctx) => {
return c.getTime(ctx);
return BigInt(c.getTime(ctx));
},
time: () => total + start
};
Expand Down
22 changes: 3 additions & 19 deletions vcd_spans.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ typedef void* napi_env;


// #define LOGSPAN
#define LOGSPAN printf("%s\n", __FUNCTION__);
// #define LOGSPAN printf("%s\n", __FUNCTION__);


#define ASSERT(val, expr) \
Expand Down Expand Up @@ -67,11 +67,10 @@ int stringEq (
}

int commandSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
LOGSPAN;
napi_env env = state->napi_env;

if (state->command == 5) { // $upscope
printf("commandSpan sp goes from %d to %d\n", state->stackPointer, state->stackPointer-1);
// printf("commandSpan sp goes from %d to %d\n", state->stackPointer, state->stackPointer-1);
state->stackPointer -= 1;
return 0;
}
Expand All @@ -90,15 +89,14 @@ int commandSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char
set_property_string("status", "simulation");
emit_lifee("$enddefinitions");
#endif
printf("commandSpan END\n");
// printf("commandSpan END\n");
return 0;
}

return 0;
}

int scopeIdentifierSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
// LOGSPAN;
#ifndef VCDWASM
napi_env env = state->napi_env;
strcopy(p, endp, state->tmpStr);
Expand Down Expand Up @@ -136,13 +134,11 @@ int scopeIdentifierSpan(vcd_parser_t* state, const unsigned char* p, const unsig
}

int varSizeSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
// LOGSPAN;
state->size = strtol((const char *)p, (char **)&endp, 10);
return 0;
}

int varIdSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
// LOGSPAN;
#ifndef VCDWASM
napi_env env = state->napi_env;
napi_value varId;
Expand All @@ -156,7 +152,6 @@ int varIdSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char*
}

int varNameSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
// LOGSPAN;
#ifndef VCDWASM
napi_env env = state->napi_env;
// *(endp - 1) = 0; // FIXME NULL termination of ASCII string
Expand All @@ -177,15 +172,10 @@ int varNameSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char
}

int idSpan(vcd_parser_t* state, const unsigned char* p, const unsigned char* endp) {
LOGSPAN;
#ifndef VCDWASM
napi_env env = state->napi_env;
#endif

// uint64_t foo = 0x123456789abcdef0;

// printf(" '%s' ", state->trigger);

const int valueWords = (state->digitCount >> 6) + 1;
uint64_t* value = state->value;
// value = &foo;
Expand Down Expand Up @@ -252,13 +242,7 @@ int onDigit(
maskCout = mask[i] >> 63;
mask[i] = (mask[i] << 1) + maskCin;
maskCin = maskCout;
// unsigned char* c = p;
// while(c != endp) {
// puts(c); c++;
// }
}
char c = *p;
printf("%c", c);
state->digitCount += 1;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion wasm_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int setTrigger(const int context, char* triggerString) {
return 0;
}

int getTime(const int context) {
uint64_t getTime(const int context) {
return state->time;
}

Expand Down

0 comments on commit 2571735

Please sign in to comment.