Skip to content

Commit

Permalink
Fixed process_sv.
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Aug 22, 2018
1 parent 08d5c2b commit 18288e0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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;
}

Expand Down
16 changes: 15 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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": {
Expand Down

0 comments on commit 18288e0

Please sign in to comment.