Comparing version 0.3.9 to 0.3.10
@@ -122,6 +122,9 @@ import { z } from 'zod'; | ||
optimize: z.ZodOptional<z.ZodBoolean>; | ||
topLevelModule: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}>; | ||
@@ -141,6 +144,9 @@ declare const schemaYosys: z.ZodObject<{ | ||
optimize: z.ZodOptional<z.ZodBoolean>; | ||
topLevelModule: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}>>; | ||
@@ -150,2 +156,3 @@ }, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -159,2 +166,3 @@ commands?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -183,6 +191,9 @@ commands?: { | ||
optimize: z.ZodOptional<z.ZodBoolean>; | ||
topLevelModule: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}>>; | ||
@@ -192,2 +203,3 @@ }, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -202,2 +214,3 @@ commands?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -355,6 +368,9 @@ commands?: { | ||
optimize: z.ZodOptional<z.ZodBoolean>; | ||
topLevelModule: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}>>; | ||
@@ -364,2 +380,3 @@ }>, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -381,2 +398,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -482,2 +500,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -520,2 +539,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -609,6 +629,9 @@ inputFiles?: { | ||
optimize: z.ZodOptional<z.ZodBoolean>; | ||
topLevelModule: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
}>>; | ||
@@ -618,2 +641,3 @@ }>, "strip", z.ZodTypeAny, { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -638,2 +662,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -766,2 +791,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -817,2 +843,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -870,2 +897,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -916,2 +944,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -962,2 +991,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -1008,2 +1038,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -1010,0 +1041,0 @@ inputFiles?: { |
@@ -33,3 +33,4 @@ "use strict"; | ||
const schemaYosysOptions = zod_1.z.object({ | ||
optimize: zod_1.z.boolean().optional() | ||
optimize: zod_1.z.boolean().optional(), | ||
topLevelModule: zod_1.z.string().optional() | ||
}); | ||
@@ -36,0 +37,0 @@ const schemaYosys = zod_1.z.object({ |
@@ -60,2 +60,3 @@ import { type ProjectConfiguration } from './configuration.js'; | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -106,2 +107,3 @@ inputFiles?: { | ||
optimize?: boolean | undefined; | ||
topLevelModule?: string | undefined; | ||
} | undefined; | ||
@@ -108,0 +110,0 @@ inputFiles?: { |
@@ -14,2 +14,26 @@ "use strict"; | ||
}; | ||
const getFileIngestCommands = (inputFiles, options) => { | ||
const commands = []; | ||
// Load vhdl files | ||
const vhdlFiles = inputFiles.filter((file) => util_js_1.FILE_EXTENSIONS_VHDL.includes(path_1.default.extname(file).substring(1))); | ||
if (vhdlFiles.length) { | ||
if (!options.topLevelModule) { | ||
throw new Error('Top level module must be defined when synthesizing VHDL'); | ||
} | ||
commands.push('plugin -i ghdl', `ghdl ${vhdlFiles.join(' ')} -e ${options.topLevelModule}`); | ||
} | ||
// Load verilog files | ||
const verilogFiles = inputFiles.filter((file) => util_js_1.FILE_EXTENSIONS_VERILOG.includes(path_1.default.extname(file).substring(1))); | ||
if (verilogFiles.length) { | ||
commands.push(...verilogFiles.map((file) => `read_verilog -sv "${file}"`)); | ||
} | ||
// (auto-)set top-level module | ||
if (options.topLevelModule) { | ||
commands.push(`hierarchy -top ${options.topLevelModule}`); | ||
} | ||
else { | ||
commands.push('hierarchy -auto-top'); | ||
} | ||
return commands; | ||
}; | ||
const getSynthCommands = (arch, outFile) => { | ||
@@ -19,6 +43,6 @@ const commands = []; | ||
commands.push('synth;'); | ||
commands.push(`write_json ${outFile};`); | ||
commands.push(`write_json "${outFile}";`); | ||
} | ||
else { | ||
commands.push(`synth_${arch} -json ${outFile};`); | ||
commands.push(`synth_${arch} -json "${outFile}";`); | ||
} | ||
@@ -42,3 +66,3 @@ return commands; | ||
const tool = 'yosys'; | ||
const commands = [...inputFiles.map((file) => `read_verilog -sv ${file}`), 'proc;']; | ||
const commands = [...getFileIngestCommands(inputFiles, options), 'proc;']; | ||
if (options.optimize) { | ||
@@ -77,7 +101,5 @@ commands.push('opt;'); | ||
const generateYosysRTLCommands = (workerOptions) => { | ||
const verilogFiles = workerOptions.inputFiles.filter((file) => util_js_1.FILE_EXTENSIONS_VERILOG.includes(path_1.default.extname(file).substring(1))); | ||
// Yosys commands taken from yosys2digitaljs (https://github.com/tilk/yosys2digitaljs/blob/1b4afeae61/src/index.js#L1225) | ||
return [ | ||
...verilogFiles.map((file) => `read_verilog -sv ${file}`), | ||
'hierarchy -auto-top;', | ||
...getFileIngestCommands(workerOptions.inputFiles, workerOptions.options), | ||
'proc;', | ||
@@ -89,3 +111,3 @@ 'opt;', | ||
`tee -q -o ${(0, target_js_1.getTargetFile)(workerOptions.target, 'stats.yosys.json')} stat -json -width *;`, | ||
`write_json ${(0, target_js_1.getTargetFile)(workerOptions.target, 'rtl.yosys.json')};`, | ||
`write_json "${(0, target_js_1.getTargetFile)(workerOptions.target, 'rtl.yosys.json')}";`, | ||
'' | ||
@@ -96,8 +118,7 @@ ]; | ||
const generateYosysSynthPrepareCommands = (workerOptions) => { | ||
const verilogFiles = workerOptions.inputFiles.filter((file) => util_js_1.FILE_EXTENSIONS_VERILOG.includes(path_1.default.extname(file).substring(1))); | ||
return [ | ||
...verilogFiles.map((file) => `read_verilog -sv ${file}`), | ||
...getFileIngestCommands(workerOptions.inputFiles, workerOptions.options), | ||
'proc;', | ||
'opt;', | ||
`write_json ${(0, target_js_1.getTargetFile)(workerOptions.target, 'presynth.yosys.json')};`, | ||
`write_json "${(0, target_js_1.getTargetFile)(workerOptions.target, 'presynth.yosys.json')}";`, | ||
'' | ||
@@ -112,3 +133,3 @@ ]; | ||
return [ | ||
`read_json ${(0, target_js_1.getTargetFile)(workerOptions.target, 'presynth.yosys.json')}`, | ||
`read_json "${(0, target_js_1.getTargetFile)(workerOptions.target, 'presynth.yosys.json')}"`, | ||
...getSynthCommands(family.architecture, workerOptions.outputFiles[0]), | ||
@@ -118,5 +139,5 @@ '', | ||
'', | ||
`read_json ${(0, target_js_1.getTargetFile)(workerOptions.target, 'presynth.yosys.json')};`, | ||
`read_json "${(0, target_js_1.getTargetFile)(workerOptions.target, 'presynth.yosys.json')}";`, | ||
'synth -lut 4;', | ||
`write_json ${workerOptions.outputFiles[1]};`, | ||
`write_json "${workerOptions.outputFiles[1]}";`, | ||
'' | ||
@@ -123,0 +144,0 @@ ]; |
@@ -15,3 +15,3 @@ "use strict"; | ||
exports.FILE_EXTENSIONS_VERILOG = ['v', 'vh', 'sv', 'svh']; | ||
exports.FILE_EXTENSIONS_VHDL = ['vhd']; | ||
exports.FILE_EXTENSIONS_VHDL = ['vhd', 'vhdl']; | ||
exports.FILE_EXTENSIONS_HDL = [...exports.FILE_EXTENSIONS_VERILOG, ...exports.FILE_EXTENSIONS_VHDL]; | ||
@@ -18,0 +18,0 @@ const formatArguments = (args) => args.reduce((prev, arg) => arg.startsWith('--') |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"contributors": [ | ||
@@ -8,0 +8,0 @@ "Danielle Huisman <danielle@huisman.me> (https://github.com/DanielleHuisman)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143829
2597