1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-28 03:29:35 +00:00

fixed verilog tests

This commit is contained in:
Steven Hugg 2018-07-09 20:58:24 -05:00
parent d6a702b929
commit bbe665bb03
3 changed files with 7 additions and 6 deletions

View File

@ -1062,7 +1062,7 @@ function compileJSASM(asmcode, platform, options, is_inline) {
var main_filename = includes[includes.length-1];
var code = '`include "' + main_filename + '"\n';
code += "/* module " + top_module + " */\n";
var voutput = compileVerilator({code:code, platform:platform, dependencies:options.dependencies}); // TODO
var voutput = compileVerilator({code:code, platform:platform, dependencies:options.dependencies, path:options.path}); // TODO
if (voutput.errors.length)
return voutput.errors[0].msg;
jsasm_module_output = voutput;
@ -1141,10 +1141,11 @@ function compileVerilator(step) {
});
starttime();
try {
verilator_mod.callMain(["--cc", "-O3", "-DEXT_INLINE_ASM", "-DTOPMOD__"+topmod,
var args = ["--cc", "-O3", "-DEXT_INLINE_ASM", "-DTOPMOD__"+topmod,
"-Wall", "-Wno-DECLFILENAME", "-Wno-UNUSED", '--report-unoptflat',
"--x-assign", "fast", "--noassert", "--pins-bv", "33",
"--top-module", topmod, step.path]);
"--top-module", topmod, step.path]
verilator_mod.callMain(args);
} catch (e) {
console.log(e);
errors.push({line:0,msg:"Compiler internal error: " + e});

View File

@ -36,7 +36,7 @@ function compileVerilator(code, callback, nerrors) {
callback(null, msg);
};
global.onmessage({
data:{code:code, platform:'verilog', tool:'verilator'}
data:{code:code, platform:'verilog', tool:'verilator', path:'main.v'}
});
}

View File

@ -150,7 +150,7 @@ describe('Worker', function() {
});
it('should compile verilog example', function(done) {
var csource = ab2str(fs.readFileSync('presets/verilog/lfsr.v'));
var msgs = [{code:csource, platform:"verilog", tool:"verilator", dependencies:[]}];
var msgs = [{code:csource, platform:"verilog", tool:"verilator", dependencies:[], path:'main.v'}];
var done2 = function(err, msg) {
var jscode = msg.output.code;
var fn = new Function(jscode);
@ -167,7 +167,7 @@ describe('Worker', function() {
var code = ab2str(fs.readFileSync('presets/verilog/' + dfile));
depends.push({filename:dfile, data:code, prefix:"verilog"});
}
var msgs = [{code:csource, platform:"verilog", tool:"jsasm", dependencies:depends}];
var msgs = [{code:csource, platform:"verilog", tool:"jsasm", dependencies:depends, path:'main.asm'}];
var done2 = function(err, msg) {
var jscode = msg.output.code;
var fn = new Function(jscode);