From 18288e0ddcb665035f3a84265b3f3830d9aa7200 Mon Sep 17 00:00:00 2001 From: Marek Materzok Date: Wed, 22 Aug 2018 14:17:35 +0200 Subject: [PATCH] Fixed process_sv. --- index.js | 14 +++++++------- package-lock.json | 16 +++++++++++++++- package.json | 4 ++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 98481b5..5258b62 100755 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ #!/usr/bin/env node "use strict"; -const tmp = require('tmp'); +const tmp = require('tmp-promise'); const child_process = require('child_process'); const assert = require('assert'); const topsort = require('topsort'); @@ -588,7 +588,7 @@ function yosys_to_simcir_mod(name, mod, portmaps) { } async function process(filenames) { - const tmpjson = await promisify(tmp.tmpName)({ postfix: '.json' }); + const tmpjson = await tmp.tmpName({ postfix: '.json' }); const yosys_result = await promisify(child_process.exec)( 'yosys -p "hierarchy; proc; fsm; memory -nomap" -o "' + tmpjson + '" ' + filenames.join(' '), {maxBuffer: 1000000}); @@ -617,11 +617,11 @@ async function process(filenames) { } async function process_sv(text) { - const tmpsv = await promisify(tmp.fileSync)({ postfix: '.sv' }); - await promisify(fs.writeSync)(tmpsv.fd, text); - await promisify(fs.closeSync)(tmpsv.fd); - const ret = await process([tmpsv.name]); - await promisify(fs.unlink)(tmpsv.name); + const tmpsv = await tmp.file({ postfix: '.sv' }); + await promisify(fs.write)(tmpsv.fd, text); + await promisify(fs.close)(tmpsv.fd); + const ret = await process([tmpsv.path]); + await promisify(fs.unlink)(tmpsv.path); return ret; } diff --git a/package-lock.json b/package-lock.json index 22dfd47..c5a681b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "yosys2digitaljs", - "version": "0.0.1", + "version": "0.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -9,6 +9,11 @@ "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.34.tgz", "integrity": "sha512-+w6B0Uo0ZvTSzDkXjoBCTNK0oe+aVL+yPi7kwGZm8hd8+Nj1AFPoxoq1Bl/mEu/G/ivOkUc1LRqVR0XeWFUzuA==" }, + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" + }, "hashmap": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/hashmap/-/hashmap-2.3.0.tgz", @@ -32,6 +37,15 @@ "os-tmpdir": "1.0.2" } }, + "tmp-promise": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-1.0.5.tgz", + "integrity": "sha512-hOabTz9Tp49wCozFwuJe5ISrOqkECm6kzw66XTP23DuzNU7QS/KiZq5LC9Y7QSy8f1rPSLy4bKaViP0OwGI1cA==", + "requires": { + "bluebird": "3.5.1", + "tmp": "0.0.33" + } + }, "topsort": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/topsort/-/topsort-0.0.2.tgz", diff --git a/package.json b/package.json index 76a9845..f60d060 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yosys2digitaljs", - "version": "0.0.2", + "version": "0.0.3", "description": "Export Yosys netlists to a logic simulator", "main": "index.js", "scripts": { @@ -12,7 +12,7 @@ "big-integer": "^1.6.34", "hashmap": "^2.3.0", "minimist": "^1.2.0", - "tmp": "0.0.33", + "tmp-promise": "^1.0.5", "topsort": "^0.0.2" }, "engines": {