UNPKG

edacation

Version:

Library and CLI for interacting with Yosys and nextpnr.

122 lines 4.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.schemaProjectConfiguration = exports.DEFAULT_CONFIGURATION = exports.DEFAULT_TARGET = void 0; const zod_1 = require("zod"); exports.DEFAULT_TARGET = { id: 'default', name: 'ECP5 - LFE5U-25 - caBGA381', vendor: 'lattice', family: 'ecp5', device: 'lfe5u-25', package: 'caBGA381' }; exports.DEFAULT_CONFIGURATION = { targets: [ exports.DEFAULT_TARGET ] }; const schemaValueList = zod_1.z.object({ useGenerated: zod_1.z.boolean().optional().default(true), values: zod_1.z.array(zod_1.z.string()).optional().default([]) }); const schemaValueListTarget = schemaValueList.extend({ useDefault: zod_1.z.boolean().optional().default(true) }); const schemaWorker = zod_1.z.object({ inputFiles: schemaValueList.optional(), outputFiles: schemaValueList.optional() }); const schemaWorkerTarget = zod_1.z.object({ inputFiles: schemaValueListTarget.optional(), outputFiles: schemaValueListTarget.optional() }); const schemaYosysOptions = zod_1.z.object({ optimize: zod_1.z.boolean().optional(), topLevelModule: zod_1.z.string().optional(), synthArguments: zod_1.z.string().optional(), }); const schemaYosys = zod_1.z.object({ synthPrepareCommands: schemaValueList.optional(), synthCommands: schemaValueList.optional(), rtlCommands: schemaValueList.optional(), options: schemaYosysOptions.optional() }); const schemaYosysTarget = zod_1.z.object({ synthPrepareCommands: schemaValueListTarget.optional(), synthCommands: schemaValueListTarget.optional(), rtlCommands: schemaValueListTarget.optional(), options: schemaYosysOptions.optional() }); const schemaNextpnrOptions = zod_1.z.object({ placedSvg: zod_1.z.boolean().optional(), routedSvg: zod_1.z.boolean().optional(), routedJson: zod_1.z.boolean().optional(), reportJson: zod_1.z.boolean().optional(), pinConfigFile: zod_1.z.string().optional() }); const schemaNextpnr = zod_1.z.object({ arguments: schemaValueList.optional(), options: schemaNextpnrOptions.optional() }); const schemaNextpnrTarget = zod_1.z.object({ arguments: schemaValueListTarget.optional(), options: schemaNextpnrOptions.optional() }); const schemaFlasherOptions = zod_1.z.object({ board: zod_1.z.string().optional(), programToFlash: zod_1.z.boolean().optional(), }); const schemaFlasher = zod_1.z.object({ packerArguments: schemaValueList.optional(), flasherArguments: schemaValueList.optional(), options: schemaFlasherOptions.optional() }); const schemaFlasherTarget = zod_1.z.object({ packerArguments: schemaValueListTarget.optional(), flasherArguments: schemaValueListTarget.optional(), options: schemaFlasherOptions.optional() }); const schemaIVerilogOptions = zod_1.z.object({ testbenchFile: zod_1.z.string().optional() }); const schemaIVerilog = zod_1.z.object({ arguments: schemaValueList.optional(), options: schemaIVerilogOptions.optional() }); const schemaIVerilogTarget = zod_1.z.object({ arguments: schemaValueListTarget.optional(), options: schemaIVerilogOptions.optional() }); const schemaCombinedYosys = schemaWorker.merge(schemaYosys); const schemaCombinedYosysTarget = schemaWorkerTarget.merge(schemaYosysTarget); const schemaCombinedNextpnr = schemaWorker.merge(schemaNextpnr); const schemaCombinedNextpnrTarget = schemaWorkerTarget.merge(schemaNextpnrTarget); const schemaCombinedIVerilog = schemaWorker.merge(schemaIVerilog); const schemaCombinedIVerilogTarget = schemaWorkerTarget.merge(schemaIVerilogTarget); const schemaCombinedFlasher = schemaWorker.merge(schemaFlasher); const schemaCombinedFlasherTarget = schemaWorkerTarget.merge(schemaFlasherTarget); const schemaTargetDefaults = zod_1.z.object({ yosys: schemaCombinedYosys.optional(), nextpnr: schemaCombinedNextpnr.optional(), iverilog: schemaCombinedIVerilog.optional(), flasher: schemaCombinedFlasher.optional() }); const schemaTarget = zod_1.z.object({ id: zod_1.z.string(), name: zod_1.z.string(), vendor: zod_1.z.string(), family: zod_1.z.string(), device: zod_1.z.string(), package: zod_1.z.string(), directory: zod_1.z.string().optional(), yosys: schemaCombinedYosysTarget.optional(), nextpnr: schemaCombinedNextpnrTarget.optional(), iverilog: schemaCombinedIVerilogTarget.optional(), flasher: schemaCombinedFlasherTarget.optional() }); exports.schemaProjectConfiguration = zod_1.z.object({ defaults: schemaTargetDefaults.optional(), targets: zod_1.z.array(schemaTarget), activeTargetId: zod_1.z.string().optional(), }); //# sourceMappingURL=configuration.js.map