diff --git a/src/manager/PL/xilinx.ts b/src/manager/PL/xilinx.ts index a153bf7..f23c866 100644 --- a/src/manager/PL/xilinx.ts +++ b/src/manager/PL/xilinx.ts @@ -49,6 +49,11 @@ interface BootInfo { * xilinx operation under PL */ class XilinxOperation { + guiLaunched: boolean; + constructor() { + this.guiLaunched = false; + } + public get xipRepo(): XilinxIP[] { return opeParam.prjInfo.IP_REPO; } @@ -126,6 +131,7 @@ class XilinxOperation { * @param config */ async launch(config: PLConfig): Promise { + this.guiLaunched = false; const vivadoTerminal = config.terminal; if (!vivadoTerminal) { return undefined; @@ -475,9 +481,10 @@ class XilinxOperation { config.terminal?.sendText(cmd); } - gui(config: PLConfig) { + public gui(config: PLConfig) { if (config.terminal) { config.terminal.sendText("start_gui -quiet"); + this.guiLaunched = true; } else { const prjFiles = hdlFile.pickFileRecursive(this.prjPath, [], filePath => filePath.endsWith('.xpr')); @@ -489,17 +496,22 @@ class XilinxOperation { vscode.window.showErrorMessage(stderr); } else { vscode.window.showInformationMessage("GUI open successfully"); + this.guiLaunched = true; } }); } } - addFiles(files: string[], config: PLConfig) { - this.processFileInPrj(files, config, "add_file"); + public addFiles(files: string[], config: PLConfig) { + if (!this.guiLaunched) { + this.processFileInPrj(files, config, "add_file"); + } } - delFiles(files: string[], config: PLConfig) { - this.processFileInPrj(files, config, "remove_files"); + public delFiles(files: string[], config: PLConfig) { + if (!this.guiLaunched) { + this.processFileInPrj(files, config, "remove_files"); + } } setSrcTop(name: string, config: PLConfig) { diff --git a/src/monitor/event.ts b/src/monitor/event.ts index bbdd9ea..1c00c80 100644 --- a/src/monitor/event.ts +++ b/src/monitor/event.ts @@ -12,6 +12,7 @@ import { hdlParam, HdlSymbol } from '../hdlParser'; import { prjManage } from '../manager'; import { libManage } from '../manager/lib'; import type { HdlMonitor } from './index'; +import { ToolChainType } from '../global/enum'; enum Event { Add = 'add', // emit when add file @@ -202,6 +203,7 @@ class PpyAction extends BaseAction { } opeParam.mergePrjInfo(rawPrjInfo); + await this.updatePL(originalHdlFiles); await prjManage.refreshPrjFolder(); const currentPathSet = this.getImportantPathSet(); @@ -217,20 +219,26 @@ class PpyAction extends BaseAction { } else { // update hdl monitor const options: vscode.ProgressOptions = { location: vscode.ProgressLocation.Notification, title: 'modify the project' }; - await vscode.window.withProgress(options, async () => await this.refreshHdlMonitor(m, originalHdlFiles)); + await vscode.window.withProgress(options, async () => await this.refreshHdlMonitor(m)); } refreshArchTree(); } - public async refreshHdlMonitor(m: HdlMonitor, originalHdlFiles: AbsPath[]) { + public async refreshHdlMonitor(m: HdlMonitor) { m.remakeHdlMonitor(); - - // update pl - const currentHdlFiles = await prjManage.getPrjHardwareFiles(); - await this.updatePL(originalHdlFiles, currentHdlFiles); } - public async updatePL(oldFiles: AbsPath[], newFiles: AbsPath[]) { + public async updatePL(oldFiles: AbsPath[]) { + // current only support xilinx + const options: vscode.ProgressOptions = { location: vscode.ProgressLocation.Notification }; + if (opeParam.prjInfo.toolChain === ToolChainType.Xilinx) { + options.title = 'update Xilinx PL'; + await vscode.window.withProgress(options, async () => await this.updateXilinxPL(oldFiles)); + } + } + + public async updateXilinxPL(oldFiles: AbsPath[]) { + const newFiles = await prjManage.getPrjHardwareFiles(); if (prjManage.pl) { const uncheckHdlFileSet = new Set(oldFiles); const addFiles: AbsPath[] = [];