diff --git a/src/manager/PL/efinity.ts b/src/manager/PL/efinity.ts index 4c763c0..f1bb59e 100644 --- a/src/manager/PL/efinity.ts +++ b/src/manager/PL/efinity.ts @@ -16,14 +16,23 @@ import { t } from '../../i18n'; import { HdlFileProjectType } from '../../hdlParser/common'; import { integer } from 'vscode-languageclient'; import { AnyARecord } from 'dns'; +import { interfaces } from 'mocha'; +import { readJSON } from '../../hdlFs/file'; +import { c } from 'tar'; type ChainInfo = [number, number, number, number]; +interface efinixIO { + name: string; +} + export class EfinityOperation { prjScript: string; efxPath: string; + deviceName: string; constructor() { this.prjScript = ''; + this.deviceName = ''; this.efxPath = hdlPath.join(opeParam.workspacePath, `${opeParam.prjInfo.prjName.PL}.xml`); } @@ -32,8 +41,10 @@ export class EfinityOperation { fs.writeFileSync(this.efxPath, this.prjScript); - hdlParam.getHdlModule(opeParam.firstSrcTopModule.path || '', opeParam.firstSrcTopModule.name); + const peri_xml = ` +\n${this.getIODeviceConfig()}\n${this.getGPIOInfo()}\n${this.getPLLInfo()}\n${this.getOscInfo()}\n${this.getLVDSInfo()}\n${this.getJtagInfo()}\n${this.getMIPIInfo()}\n${this.getFlashInfo()}\n${this.getHBRAMConfig()}\n`; + fs.writeFileSync(hdlPath.join(opeParam.workspacePath, `${opeParam.prjInfo.prjName.PL}.peri.xml`), peri_xml); } public simulate() { @@ -55,7 +66,8 @@ export class EfinityOperation { public build() { exec(`${this.updateEfinixPath()} ${this.efxPath} --flow compile --work_dir=${opeParam.workspacePath}/prj/efinix --output_dir ${opeParam.workspacePath}/prj/efinix/outflow --cleanup_work_dir work_pt`, (error, stdout, stderr) => { console.log(error); - + console.log(stdout); + console.log(stderr); }) } @@ -97,6 +109,7 @@ export class EfinityOperation { private getDeviceInfo(device: string): string { const deviceInfo = device.split('-'); + this.deviceName = deviceInfo[0]; let family = 'Trion'; if (device.slice(0, 2).toLowerCase() === 'ti') { family = 'Titanium'; @@ -104,7 +117,7 @@ export class EfinityOperation { return ` - + `; } @@ -294,24 +307,71 @@ export class EfinityOperation { ` } - private setCompInputGPIO(param:Record): string { - return ` - - - - - - - ` + private getGPIOInfo(): string { + const topModule = hdlParam.getHdlModule(opeParam.firstSrcTopModule.path || '', opeParam.firstSrcTopModule.name); + + if (!topModule) { + return ''; + } + + const edc = readJSON(hdlPath.join(opeParam.prjInfo.arch.hardware.data, 'edc.json')); + + let compGPIO = ''; + for (let index = 0; index < topModule.ports.length; index++) { + const port = topModule.ports[index]; + if (port.type === 'input') { + compGPIO += setCompInputGPIO(port.name, edc); + } else if (port.type === 'output') { + compGPIO += setCompOutputGPIO(port.name, edc); + } + } + + return ` \n${compGPIO} `; + + function setCompOutputGPIO(name:string, param:Record) { + return ` + + \n`; + } + + function setCompInputGPIO(name:string, param:Record): string { + return ` + + \n`; + } + } + + private getPLLInfo(): string { + return ` `; + } + + private getOscInfo(): string { + return ` `; + } + + private getLVDSInfo(): string { + return ` `; + } + + private getJtagInfo(): string { + return ` `; + } + + private getMIPIInfo(): string { + return ` `; + } + + private getFlashInfo(): string { + return ` `; } private getHBRAMConfig(): string { return ` - + - - - + + +