2nd passing
This commit is contained in:
parent
ae8f76a0c0
commit
1d5fb9f82f
@ -23,7 +23,7 @@ function u8ToBn(u8) {
|
|||||||
return BigInt('0x' + hex.join(''));
|
return BigInt('0x' + hex.join(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let startCalled = 0;
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
// let state = 0; // idle
|
// let state = 0; // idle
|
||||||
@ -45,7 +45,10 @@ module.exports = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const start = async() => {
|
const start = async() => {
|
||||||
await _waitForStart(wasm);
|
if( !startCalled ) {
|
||||||
|
await _waitForStart(wasm);
|
||||||
|
startCalled++;
|
||||||
|
}
|
||||||
bindCWrap();
|
bindCWrap();
|
||||||
bindCallback();
|
bindCallback();
|
||||||
}
|
}
|
||||||
|
84
test/wasm_events.js
Normal file
84
test/wasm_events.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const expect = require('chai').expect;
|
||||||
|
const lib = require('../lib/index.js');
|
||||||
|
|
||||||
|
describe('wasm events', () => {
|
||||||
|
let inst;
|
||||||
|
// return a promise, and mocha will wait until it resolves
|
||||||
|
before(() => {
|
||||||
|
const fn = async () => {
|
||||||
|
inst = await lib.wasmparser();
|
||||||
|
};
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('$enddefinitions', done => {
|
||||||
|
|
||||||
|
inst.on('$enddefinitions', () => {
|
||||||
|
expect(inst.info).to.deep.eq({
|
||||||
|
status: 'simulation',
|
||||||
|
varId: 'u)',
|
||||||
|
wires: {
|
||||||
|
top: {
|
||||||
|
clock: '"}G',
|
||||||
|
fruit: {
|
||||||
|
point: 'u)'
|
||||||
|
},
|
||||||
|
leaf: {
|
||||||
|
counter: '{u'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stack: [{
|
||||||
|
top: {
|
||||||
|
clock: '"}G',
|
||||||
|
fruit: {
|
||||||
|
point: 'u)'
|
||||||
|
},
|
||||||
|
leaf: {
|
||||||
|
counter: '{u'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
clock: '"}G',
|
||||||
|
fruit: {
|
||||||
|
point: 'u)'
|
||||||
|
},
|
||||||
|
leaf: {
|
||||||
|
counter: '{u'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
point: 'u)'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
expect(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
|
||||||
|
`
|
||||||
|
)).to.eq(true);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/* eslint-env mocha */
|
Loading…
x
Reference in New Issue
Block a user