#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
*/
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<string | undefined> {
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,18 +496,23 @@ class XilinxOperation {
vscode.window.showErrorMessage(stderr);
} else {
vscode.window.showInformationMessage("GUI open successfully");
this.guiLaunched = true;
}
});
}
}
addFiles(files: string[], config: PLConfig) {
public addFiles(files: string[], config: PLConfig) {
if (!this.guiLaunched) {
this.processFileInPrj(files, config, "add_file");
}
}
delFiles(files: string[], config: PLConfig) {
public delFiles(files: string[], config: PLConfig) {
if (!this.guiLaunched) {
this.processFileInPrj(files, config, "remove_files");
}
}
setSrcTop(name: string, config: PLConfig) {
const cmd = `set_property top ${name} [current_fileset]`;

View File

@ -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<AbsPath>(oldFiles);
const addFiles: AbsPath[] = [];