#fix bug2

This commit is contained in:
锦恢 2023-07-15 23:59:34 +08:00
parent 8b1aa1a1a4
commit dd5bd10963
2 changed files with 32 additions and 12 deletions

View File

@ -49,6 +49,11 @@ interface BootInfo {
* xilinx operation under PL * xilinx operation under PL
*/ */
class XilinxOperation { class XilinxOperation {
guiLaunched: boolean;
constructor() {
this.guiLaunched = false;
}
public get xipRepo(): XilinxIP[] { public get xipRepo(): XilinxIP[] {
return opeParam.prjInfo.IP_REPO; return opeParam.prjInfo.IP_REPO;
} }
@ -126,6 +131,7 @@ class XilinxOperation {
* @param config * @param config
*/ */
async launch(config: PLConfig): Promise<string | undefined> { async launch(config: PLConfig): Promise<string | undefined> {
this.guiLaunched = false;
const vivadoTerminal = config.terminal; const vivadoTerminal = config.terminal;
if (!vivadoTerminal) { if (!vivadoTerminal) {
return undefined; return undefined;
@ -475,9 +481,10 @@ class XilinxOperation {
config.terminal?.sendText(cmd); config.terminal?.sendText(cmd);
} }
gui(config: PLConfig) { public gui(config: PLConfig) {
if (config.terminal) { if (config.terminal) {
config.terminal.sendText("start_gui -quiet"); config.terminal.sendText("start_gui -quiet");
this.guiLaunched = true;
} else { } else {
const prjFiles = hdlFile.pickFileRecursive(this.prjPath, [], const prjFiles = hdlFile.pickFileRecursive(this.prjPath, [],
filePath => filePath.endsWith('.xpr')); filePath => filePath.endsWith('.xpr'));
@ -489,17 +496,22 @@ class XilinxOperation {
vscode.window.showErrorMessage(stderr); vscode.window.showErrorMessage(stderr);
} else { } else {
vscode.window.showInformationMessage("GUI open successfully"); vscode.window.showInformationMessage("GUI open successfully");
this.guiLaunched = true;
} }
}); });
} }
} }
addFiles(files: string[], config: PLConfig) { public addFiles(files: string[], config: PLConfig) {
this.processFileInPrj(files, config, "add_file"); if (!this.guiLaunched) {
this.processFileInPrj(files, config, "add_file");
}
} }
delFiles(files: string[], config: PLConfig) { public delFiles(files: string[], config: PLConfig) {
this.processFileInPrj(files, config, "remove_files"); if (!this.guiLaunched) {
this.processFileInPrj(files, config, "remove_files");
}
} }
setSrcTop(name: string, config: PLConfig) { setSrcTop(name: string, config: PLConfig) {

View File

@ -12,6 +12,7 @@ import { hdlParam, HdlSymbol } from '../hdlParser';
import { prjManage } from '../manager'; import { prjManage } from '../manager';
import { libManage } from '../manager/lib'; import { libManage } from '../manager/lib';
import type { HdlMonitor } from './index'; import type { HdlMonitor } from './index';
import { ToolChainType } from '../global/enum';
enum Event { enum Event {
Add = 'add', // emit when add file Add = 'add', // emit when add file
@ -202,6 +203,7 @@ class PpyAction extends BaseAction {
} }
opeParam.mergePrjInfo(rawPrjInfo); opeParam.mergePrjInfo(rawPrjInfo);
await this.updatePL(originalHdlFiles);
await prjManage.refreshPrjFolder(); await prjManage.refreshPrjFolder();
const currentPathSet = this.getImportantPathSet(); const currentPathSet = this.getImportantPathSet();
@ -217,20 +219,26 @@ class PpyAction extends BaseAction {
} else { } else {
// update hdl monitor // update hdl monitor
const options: vscode.ProgressOptions = { location: vscode.ProgressLocation.Notification, title: 'modify the project' }; 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(); refreshArchTree();
} }
public async refreshHdlMonitor(m: HdlMonitor, originalHdlFiles: AbsPath[]) { public async refreshHdlMonitor(m: HdlMonitor) {
m.remakeHdlMonitor(); 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) { if (prjManage.pl) {
const uncheckHdlFileSet = new Set<AbsPath>(oldFiles); const uncheckHdlFileSet = new Set<AbsPath>(oldFiles);
const addFiles: AbsPath[] = []; const addFiles: AbsPath[] = [];