use new API and utility functions
This commit is contained in:
parent
f60d437409
commit
ce3acca499
31
bin/find.js
31
bin/find.js
@ -4,36 +4,43 @@
|
|||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
|
||||||
const vcd = require('../index.js');
|
const vcd = require('../lib/index.js');
|
||||||
|
const utils = require('../lib/utils');
|
||||||
|
|
||||||
const dir = './tmp/';
|
const dir = './tmp/';
|
||||||
|
|
||||||
fs.readdir(dir).then(files => {
|
fs.readdir(dir).then(files => {
|
||||||
const tt0 = Date.now();
|
const tt0 = Date.now();
|
||||||
async.eachLimit(files, 2, (fileName, callback) => {
|
async.eachLimit(files, 2, (fileName, callback) => {
|
||||||
|
if (!fileName.match(/.vcd$/)) {
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let start = 0;
|
|
||||||
let stop = 0;
|
|
||||||
const t0 = Date.now();
|
const t0 = Date.now();
|
||||||
|
|
||||||
let inst = vcd();
|
let inst = vcd();
|
||||||
|
|
||||||
|
const loads = utils.and();
|
||||||
|
const stores = utils.and();
|
||||||
|
const duration = utils.activity(10);
|
||||||
|
|
||||||
inst.on('$enddefinitions', () => {
|
inst.on('$enddefinitions', () => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
// console.log(inst.info);
|
// console.log(inst.info);
|
||||||
inst.onTrigger('D1', time => {
|
inst.change.on('D7', (time, cmd) => { // mem_i_load
|
||||||
if (time > 10) {
|
loads.onA(time, cmd);
|
||||||
if (start == 0) {
|
stores.onNotA(time, cmd);
|
||||||
start = time;
|
});
|
||||||
} else {
|
inst.change.on('D1', (time, cmd) => { // mem_i_valid
|
||||||
stop = time;
|
loads.onB(time, cmd);
|
||||||
}
|
stores.onB(time, cmd);
|
||||||
}
|
duration.on(time);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
inst.on('finish', () => {
|
inst.on('finish', () => {
|
||||||
console.log(fileName, (stop - start), ((Date.now() - t0) / 1000 + 's'));
|
console.log(fileName, duration.time(), loads.time(), stores.time(), ((Date.now() - t0) / 1000 + 's'));
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user