From 8b1aa1a1a4284ce603044cc845f5f9386e2e0572 Mon Sep 17 00:00:00 2001 From: Kirigaya <1193466151@qq.com> Date: Sat, 15 Jul 2023 23:23:08 +0800 Subject: [PATCH] #fix bug --- package.json | 4 ---- src/function/index.ts | 2 +- src/global/outputChannel.ts | 2 +- src/global/prjInfo.ts | 14 ++++---------- src/manager/PL/index.ts | 14 ++++++++++++-- src/manager/PL/xilinx.ts | 28 +++++++++++++++++++--------- src/manager/PS/index.ts | 4 ++++ src/manager/index.ts | 10 +++++----- src/manager/prj.ts | 12 +++++++----- src/monitor/event.ts | 2 +- 10 files changed, 54 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index f8e8af6..30d2059 100644 --- a/package.json +++ b/package.json @@ -618,10 +618,6 @@ { "id": "digital-ide-treeView-hardware", "name": "HARD Options" - }, - { - "id": "digital-ide-treeView-software", - "name": "SOFT Options" } ] }, diff --git a/src/function/index.ts b/src/function/index.ts index ec3f872..a0bc302 100644 --- a/src/function/index.ts +++ b/src/function/index.ts @@ -42,7 +42,7 @@ function registerTreeView(context: vscode.ExtensionContext) { vscode.window.registerTreeDataProvider('digital-ide-treeView-arch', treeView.moduleTreeProvider); vscode.window.registerTreeDataProvider('digital-ide-treeView-tool', treeView.toolTreeProvider); vscode.window.registerTreeDataProvider('digital-ide-treeView-hardware', treeView.hardwareTreeProvider); - vscode.window.registerTreeDataProvider('digital-ide-treeView-software', treeView.softwareTreeProvider); + // vscode.window.registerTreeDataProvider('digital-ide-treeView-software', treeView.softwareTreeProvider); // constant used in tree vscode.commands.executeCommand('setContext', 'TOOL-tree-expand', false); diff --git a/src/global/outputChannel.ts b/src/global/outputChannel.ts index 64141aa..5e4fc63 100644 --- a/src/global/outputChannel.ts +++ b/src/global/outputChannel.ts @@ -58,7 +58,7 @@ class Output { */ public report(message: string | unknown, type: ReportType = ReportType.Info, reportInWindows: boolean = false) { if (!this.skipMessage(type) && message) { - this._output.show(true); + // this._output.show(true); const currentTime = this.getCurrentTime(); this._output.appendLine('[' + type + ' - ' + currentTime + '] ' + message); diff --git a/src/global/prjInfo.ts b/src/global/prjInfo.ts index f783001..6f90643 100644 --- a/src/global/prjInfo.ts +++ b/src/global/prjInfo.ts @@ -411,22 +411,16 @@ class PrjInfo implements PrjInfoMeta { this.setDefaultValue(this.arch.software, 'src', workspacePath); this.setDefaultValue(this.arch.software, 'data', workspacePath); this.setDefaultValue(this.arch, 'prjPath', workspacePath); - - // // check existence & make dir - // this.checkDirExist(this.arch.hardware.sim); - // this.checkDirExist(this.arch.hardware.src); - // this.checkDirExist(this.arch.hardware.data); - // this.checkDirExist(this.arch.software.src); - // this.checkDirExist(this.arch.software.data); - // this.checkDirExist(this.arch.prjPath); } public checkArchDirExist() { this.checkDirExist(this.arch.hardware.sim); this.checkDirExist(this.arch.hardware.src); this.checkDirExist(this.arch.hardware.data); - this.checkDirExist(this.arch.software.src); - this.checkDirExist(this.arch.software.data); + if (this.soc.core !== 'none') { + this.checkDirExist(this.arch.software.src); + this.checkDirExist(this.arch.software.data); + } this.checkDirExist(this.arch.prjPath); } diff --git a/src/manager/PL/index.ts b/src/manager/PL/index.ts index 9699212..ceb6812 100644 --- a/src/manager/PL/index.ts +++ b/src/manager/PL/index.ts @@ -1,3 +1,7 @@ +/** + * PL: program logic + * Hardware Programming + */ import * as vscode from 'vscode'; import { PLConfig, XilinxOperation } from './xilinx'; @@ -18,7 +22,7 @@ class PlManage extends BaseManage { tool: 'default', path: '', ope: new XilinxOperation(), - terminal: this.createTerminal('Hardware') + terminal: null }; if (opeParam.prjInfo.toolChain) { @@ -41,7 +45,13 @@ class PlManage extends BaseManage { public launch() { - this.config.ope.launch(this.config); + if (!this.config.terminal) { + this.config.terminal = this.createTerminal('Hardware'); + this.config.terminal.show(true); + this.config.ope.launch(this.config); + } else { + vscode.window.showInformationMessage('Hardware Terminal is launched !'); + } } public simulate() { diff --git a/src/manager/PL/xilinx.ts b/src/manager/PL/xilinx.ts index 9bfe405..a153bf7 100644 --- a/src/manager/PL/xilinx.ts +++ b/src/manager/PL/xilinx.ts @@ -126,6 +126,11 @@ class XilinxOperation { * @param config */ async launch(config: PLConfig): Promise { + const vivadoTerminal = config.terminal; + if (!vivadoTerminal) { + return undefined; + } + let scripts: string[] = []; let prjFilePath = this.prjPath as AbsPath; @@ -152,7 +157,7 @@ class XilinxOperation { } const tclPath = hdlPath.join(this.xilinxPath, 'launch.tcl'); - scripts.push(this.refresh()); + scripts.push(this.getRefreshCmd()); scripts.push(`file delete ${tclPath} -force`); const tclCommands = scripts.join('\n') + '\n'; @@ -160,8 +165,9 @@ class XilinxOperation { const argu = `-notrace -nolog -nojournal`; const cmd = `${config.path} -mode tcl -s ${tclPath} ${argu}`; - config.terminal?.show(true); - config.terminal?.sendText(cmd); + + vivadoTerminal.show(true); + vivadoTerminal.sendText(cmd); } create(scripts: string[]) { @@ -177,7 +183,7 @@ class XilinxOperation { scripts.push(`open_project ${path} -quiet`); } - refresh(terminal?: vscode.Terminal): string { + private getRefreshCmd(): string { const scripts: string[] = []; // 清除所有源文件 scripts.push(`remove_files -quiet [get_files]`); @@ -259,9 +265,8 @@ class XilinxOperation { for (const file of HDLFiles) { if (file.type === "src") { scripts.push(`add_files ${file.path} -quiet`); - } else if (file.type === "sim") { - scripts.push(`add_files -fileset sim_1 ${file.path} -quiet`); } + scripts.push(`add_files -fileset sim_1 ${file.path} -quiet`); } scripts.push(`add_files -fileset constrs_1 ${this.datPath} -quiet`); @@ -283,11 +288,14 @@ class XilinxOperation { script += `file delete ${scriptPath} -force\n`; hdlFile.writeFile(scriptPath, script); const cmd = `source ${scriptPath} -quiet`; - - terminal?.sendText(cmd); return cmd; } + refresh(terminal: vscode.Terminal) { + const cmd = this.getRefreshCmd(); + terminal.sendText(cmd); + } + simulate(config: PLConfig) { this.simulateCli(config); } @@ -507,7 +515,9 @@ class XilinxOperation { processFileInPrj(files: string[], config: PLConfig, command: string) { const terminal = config.terminal; if (terminal) { - files.forEach(file => terminal.sendText(`${command} ${file}`)); + for (const file of files) { + terminal.sendText(command + ' ' + file); + } } } diff --git a/src/manager/PS/index.ts b/src/manager/PS/index.ts index a914df4..e5d244e 100644 --- a/src/manager/PS/index.ts +++ b/src/manager/PS/index.ts @@ -1,3 +1,7 @@ +/** + * PS: processing system + * software of cpu + */ import * as vscode from 'vscode'; import { opeParam } from '../../global'; import { ToolChainType } from '../../global/enum'; diff --git a/src/manager/index.ts b/src/manager/index.ts index df09e3e..36f7208 100644 --- a/src/manager/index.ts +++ b/src/manager/index.ts @@ -7,10 +7,10 @@ import { pickLibrary } from './libPick'; function registerManagerCommands(context: vscode.ExtensionContext) { // make ps and ps have been prepared assert(prjManage.pl, 'pl is undefined'); - assert(prjManage.ps, 'ps is undefined'); + // assert(prjManage.ps, 'ps is undefined'); const plManage = prjManage.pl; - const psManage = prjManage.ps; + // const psManage = prjManage.ps; vscode.commands.registerCommand('digital-ide.property-json.generate', prjManage.generatePropertyJson); vscode.commands.registerCommand('digital-ide.property-json.overwrite', prjManage.overwritePropertyJson); @@ -20,9 +20,9 @@ function registerManagerCommands(context: vscode.ExtensionContext) { // ps toolbox commands (soft tool in treeView) // TODO : finish digital-ide.soft.download - vscode.commands.registerCommand('digital-ide.soft.launch', () => psManage.launch()); - vscode.commands.registerCommand('digital-ide.soft.build', () => psManage.build()); - vscode.commands.registerCommand('digital-ide.soft.download', () => psManage.program()); + // vscode.commands.registerCommand('digital-ide.soft.launch', () => psManage.launch()); + // vscode.commands.registerCommand('digital-ide.soft.build', () => psManage.build()); + // vscode.commands.registerCommand('digital-ide.soft.download', () => psManage.program()); // pl functional commands vscode.commands.registerCommand('digital-ide.pl.setSrcTop', (item) => plManage.setSrcTop(item)); diff --git a/src/manager/prj.ts b/src/manager/prj.ts index 0bebc2b..4c5f673 100644 --- a/src/manager/prj.ts +++ b/src/manager/prj.ts @@ -142,8 +142,10 @@ class PrjManage { MainOutput.report(`finish analyse ${hdlFiles.length} hdl files, find ${unhandleNum} unsolved instances`, ReportType.Info); this.pl = new PlManage(); - this.ps = new PsManage(); - MainOutput.report('create pl and ps', ReportType.Info); + + // TODO : finish it later + // this.ps = new PsManage(); + MainOutput.report('create pl', ReportType.Info); if (countTimeCost) { @@ -199,11 +201,11 @@ class PrjManage { const nextmode = this.getNextMode(rawPrjInfo); const currmode = this.getCurrentMode(softwarePath, hardwarePath); - + if (currmode === nextmode) { const hardware = opeParam.prjInfo.arch.hardware; - const software = opeParam.prjInfo.arch.software; - + const software = opeParam.prjInfo.arch.software; + hdlDir.mkdir(hardware.src); hdlDir.mkdir(hardware.sim); hdlDir.mkdir(hardware.data); diff --git a/src/monitor/event.ts b/src/monitor/event.ts index c2af96e..bbdd9ea 100644 --- a/src/monitor/event.ts +++ b/src/monitor/event.ts @@ -206,7 +206,7 @@ class PpyAction extends BaseAction { const currentPathSet = this.getImportantPathSet(); const currentLibState = opeParam.prjInfo.library.state; - + if (isSameSet(originalPathSet, currentPathSet)) { // skip hdl remake if (originalLibState !== currentLibState) {