edacation
Version:
Library and CLI for interacting with Yosys and nextpnr.
95 lines • 3.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaProjectConfiguration = exports.DEFAULT_CONFIGURATION = void 0;
const zod_1 = require("zod");
exports.DEFAULT_CONFIGURATION = {
targets: [
{
id: 'default',
name: 'ECP5 - LFE5U-12 - caBGA381',
vendor: 'lattice',
family: 'ecp5',
device: 'lfe5u-25',
package: 'caBGA381'
}
]
};
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()
});
const schemaYosys = zod_1.z.object({
commands: schemaValueList.optional(),
options: schemaYosysOptions.optional()
});
const schemaYosysTarget = zod_1.z.object({
commands: 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()
});
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 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 schemaTargetDefaults = zod_1.z.object({
yosys: schemaCombinedYosys.optional(),
nextpnr: schemaCombinedNextpnr.optional(),
iverilog: schemaCombinedIVerilog.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()
});
exports.schemaProjectConfiguration = zod_1.z.object({
defaults: schemaTargetDefaults.optional(),
targets: zod_1.z.array(schemaTarget)
});
//# sourceMappingURL=configuration.js.map