diff --git a/src/manager/PL/index.ts b/src/manager/PL/index.ts index ceb6812..b5f00da 100644 --- a/src/manager/PL/index.ts +++ b/src/manager/PL/index.ts @@ -43,15 +43,10 @@ class PlManage extends BaseManage { } } - public launch() { - 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 !'); - } + this.config.terminal = this.createTerminal('Hardware'); + this.config.terminal.show(true); + this.config.ope.launch(this.config); } public simulate() { @@ -117,7 +112,7 @@ class PlManage extends BaseManage { } - setSrcTop(item: ModuleDataItem) { + public setSrcTop(item: ModuleDataItem) { this.config.ope.setSrcTop(item.name, this.config); const type = moduleTreeProvider.getItemType(item); if (type === HdlFileType.Src) { @@ -126,7 +121,7 @@ class PlManage extends BaseManage { } } - setSimTop(item: ModuleDataItem) { + public setSimTop(item: ModuleDataItem) { this.config.ope.setSimTop(item.name, this.config); const type = moduleTreeProvider.getItemType(item); if (type === HdlFileType.Sim) { diff --git a/src/monitor/event.ts b/src/monitor/event.ts index 1c00c80..52ab863 100644 --- a/src/monitor/event.ts +++ b/src/monitor/event.ts @@ -174,6 +174,7 @@ class PpyAction extends BaseAction { console.log('PpyAction change'); assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); await this.updateProperty(Event.Change, m); + console.log(hdlParam); } // get path set from opeParam that used to tell if need to remake HdlMonitor @@ -203,7 +204,6 @@ class PpyAction extends BaseAction { } opeParam.mergePrjInfo(rawPrjInfo); - await this.updatePL(originalHdlFiles); await prjManage.refreshPrjFolder(); const currentPathSet = this.getImportantPathSet(); @@ -219,49 +219,63 @@ 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)); + await vscode.window.withProgress(options, async () => await this.refreshHdlMonitor(m, originalHdlFiles)); } - refreshArchTree(); + + refreshArchTree(); } - public async refreshHdlMonitor(m: HdlMonitor) { + public diffNewOld(newFiles: AbsPath[], oldFiles: AbsPath[]) { + const uncheckHdlFileSet = new Set(oldFiles); + const addFiles: AbsPath[] = []; + const delFiles: AbsPath[] = []; + + for (const path of newFiles) { + if (!uncheckHdlFileSet.has(path)) { + addFiles.push(path); + } else { + uncheckHdlFileSet.delete(path); + } + } + + for (const path of uncheckHdlFileSet) { + hdlParam.deleteHdlFile(path); + delFiles.push(path); + } + return { + addFiles, delFiles + }; + } + + public async refreshHdlMonitor(m: HdlMonitor, originalHdlFiles: AbsPath[]) { m.remakeHdlMonitor(); - } - - 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(); + const { addFiles, delFiles } = this.diffNewOld(newFiles, originalHdlFiles); + + const options: vscode.ProgressOptions = { location: vscode.ProgressLocation.Notification }; + options.title = 'update HdlParam'; + await vscode.window.withProgress(options, async () => await this.updateHdlParam(addFiles, delFiles)); + + if (opeParam.prjInfo.toolChain === ToolChainType.Xilinx) { + options.title = 'update PL'; + await vscode.window.withProgress(options, async () => await this.updatePL(addFiles, delFiles)); + } + } + + public async updateHdlParam(addFiles: AbsPath[], delFiles: AbsPath[]) { + for (const path of addFiles) { + await hdlParam.addHdlFile(path); + } + for (const path of delFiles) { + hdlParam.deleteHdlFile(path); + } + } + + public async updatePL(addFiles: AbsPath[], delFiles: AbsPath[]) { + // current only support xilinx if (prjManage.pl) { - const uncheckHdlFileSet = new Set(oldFiles); - const addFiles: AbsPath[] = []; - const delFiles: AbsPath[] = []; - - for (const path of newFiles) { - if (!uncheckHdlFileSet.has(path)) { - await hdlParam.addHdlPath(path); - addFiles.push(path); - } else { - uncheckHdlFileSet.delete(path); - } - } - const vivadoAddPromise = prjManage.pl.addFiles(addFiles); - - for (const path of uncheckHdlFileSet) { - hdlParam.deleteHdlFile(path); - delFiles.push(path); - } - const vivadoDelPromise = prjManage.pl.delFiles(delFiles); - - await vivadoAddPromise; - await vivadoDelPromise; + await prjManage.pl.addFiles(addFiles); + await prjManage.pl.delFiles(delFiles); } else { MainOutput.report('PL is not registered', ReportType.Warn); } diff --git a/src/test/.vscode/property.json b/src/test/.vscode/property.json index 7dc2beb..71cfab5 100644 --- a/src/test/.vscode/property.json +++ b/src/test/.vscode/property.json @@ -4,7 +4,7 @@ "PL": "template" }, "soc": { - "core": "none" + "core": "cortexM3" }, "enableShowLog": false, "device": "none" diff --git a/src/test/user/src/Cordic.v b/src/test/user/Hardware/src/Cordic.v similarity index 100% rename from src/test/user/src/Cordic.v rename to src/test/user/Hardware/src/Cordic.v diff --git a/src/test/user/src/fsm_test.v b/src/test/user/Hardware/src/fsm_test.v similarity index 100% rename from src/test/user/src/fsm_test.v rename to src/test/user/Hardware/src/fsm_test.v diff --git a/src/test/user/src/hello.v b/src/test/user/Hardware/src/hello.v similarity index 100% rename from src/test/user/src/hello.v rename to src/test/user/Hardware/src/hello.v diff --git a/src/test/user/src/hello.vhd b/src/test/user/Hardware/src/hello.vhd similarity index 100% rename from src/test/user/src/hello.vhd rename to src/test/user/Hardware/src/hello.vhd diff --git a/src/test/user/src/netlist_test.v b/src/test/user/Hardware/src/netlist_test.v similarity index 100% rename from src/test/user/src/netlist_test.v rename to src/test/user/Hardware/src/netlist_test.v