增加对 IP 的支持
This commit is contained in:
parent
6841795c2a
commit
0c820c7e55
@ -24,5 +24,6 @@
|
||||
"error.vcd-viewer.bad-view-file": "Ansichtsdatei ist beschädigt",
|
||||
"error.vcd-viewer.unexist-direct-vcd-file": "Die von der Ansichtsdatei referenzierte vcd-Datei existiert nicht",
|
||||
"info.welcome.join-qq-group": "Klicken Sie auf den Link, um der QQ-Gruppe beizutreten",
|
||||
"info.level.test": "Dies ist ein einfaches Beispiel"
|
||||
"info.level.test": "Dies ist ein einfaches Beispiel",
|
||||
"info.progress.build-ip-module-tree": "构建 IP 模块树"
|
||||
}
|
@ -24,5 +24,6 @@
|
||||
"error.vcd-viewer.bad-view-file": "View file is corrupted",
|
||||
"error.vcd-viewer.unexist-direct-vcd-file": "The vcd file pointed to by the view file does not exist",
|
||||
"info.welcome.join-qq-group": "Click the link to join the QQ group",
|
||||
"info.level.test": "This is a simple example"
|
||||
"info.level.test": "This is a simple example",
|
||||
"info.progress.build-ip-module-tree": "构建 IP 模块树"
|
||||
}
|
@ -24,5 +24,6 @@
|
||||
"error.vcd-viewer.bad-view-file": "ビューファイルが破損しています",
|
||||
"error.vcd-viewer.unexist-direct-vcd-file": "ビューファイルが指す vcd ファイルは存在しません",
|
||||
"info.welcome.join-qq-group": "リンクをクリックして QQ グループに参加",
|
||||
"info.level.test": "これは簡単な例です"
|
||||
"info.level.test": "これは簡単な例です",
|
||||
"info.progress.build-ip-module-tree": "构建 IP 模块树"
|
||||
}
|
@ -24,5 +24,6 @@
|
||||
"error.vcd-viewer.bad-view-file": "视图文件已损坏",
|
||||
"error.vcd-viewer.unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在",
|
||||
"info.welcome.join-qq-group": "点击链接加入 QQ 群",
|
||||
"info.level.test": "这是一个简单的样例"
|
||||
"info.level.test": "这是一个简单的样例",
|
||||
"info.progress.build-ip-module-tree": "构建 IP 模块树"
|
||||
}
|
@ -24,5 +24,6 @@
|
||||
"error.vcd-viewer.bad-view-file": "視圖文件已損壞",
|
||||
"error.vcd-viewer.unexist-direct-vcd-file": "視圖文件指向的 vcd 文件不存在",
|
||||
"info.welcome.join-qq-group": "點擊鏈接加入 QQ 群",
|
||||
"info.level.test": "這是一個簡單的樣例"
|
||||
"info.level.test": "這是一個簡單的樣例",
|
||||
"info.progress.build-ip-module-tree": "构建 IP 模块树"
|
||||
}
|
7
resources/script/xilinx/launch.tcl
Normal file
7
resources/script/xilinx/launch.tcl
Normal file
@ -0,0 +1,7 @@
|
||||
set_param general.maxThreads 8
|
||||
create_project template /home/dide/project/Digital-Test/DIDEtemp/prj/xilinx -part none -force
|
||||
set_property SOURCE_SET sources_1 [get_filesets sim_1]
|
||||
set_property top_lib xil_defaultlib [get_filesets sim_1]
|
||||
update_compile_order -fileset sim_1 -quiet
|
||||
source /home/dide/project/Digital-IDE/resources/script/xilinx/refresh.tcl -quiet
|
||||
file delete /home/dide/project/Digital-IDE/resources/script/xilinx/launch.tcl -force
|
40
resources/script/xilinx/refresh.tcl
Normal file
40
resources/script/xilinx/refresh.tcl
Normal file
@ -0,0 +1,40 @@
|
||||
remove_files -quiet [get_files]
|
||||
set xip_repo_paths {}
|
||||
set_property ip_repo_paths $xip_repo_paths [current_project] -quiet
|
||||
update_ip_catalog -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/ip/xfft_v9/xfft_v9.xci -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/bimpy.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/bimpy.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/bitreverse.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/bitreverse.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/butterfly.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/butterfly.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/convround.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/convround.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/hwbfly.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/hwbfly.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/ifftmain.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/ifftmain.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/ifftstage.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/ifftstage.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/laststage.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/laststage.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/longbimpy.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/longbimpy.v -quiet
|
||||
add_files /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/qtrstage.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/src/ifft/qtrstage.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-Test/DIDEtemp/user/sim/FFT_IFFT_tb.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/FFT_IFFT.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/stage/BF_stage.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/stage/fft_stage.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/top/fft.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/top/ifft.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/utils/ftrans.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/FFT/Flow/utils/ftwiddle.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Memory/SRAM/Shift/shiftTaps.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/Complex/cmplAdsu.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/Complex/cmplMult.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Memory/SRAM/SDPRAM.v -quiet
|
||||
add_files -fileset sim_1 /home/dide/project/Digital-IDE/library/Basic/Math/Advance/Complex/cordic.v -quiet
|
||||
add_files -fileset constrs_1 /home/dide/project/Digital-Test/DIDEtemp/user/data -quiet
|
||||
file delete /home/dide/project/Digital-IDE/resources/script/xilinx/refresh.tcl -force
|
@ -302,8 +302,6 @@ function instanceByLangID(module: HdlModule): string {
|
||||
async function instantiation() {
|
||||
const module = await selectModuleFromAll();
|
||||
if (module) {
|
||||
console.log(module);
|
||||
|
||||
const code = instanceByLangID(module);
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor) {
|
||||
|
@ -62,10 +62,10 @@ async function testbench() {
|
||||
if (!hdlFile.isHDLFile(path)) {
|
||||
return;
|
||||
}
|
||||
console.log(path);
|
||||
// console.log(path);
|
||||
|
||||
const currentHdlFile = hdlParam.getHdlFile(path);
|
||||
console.log(currentHdlFile);
|
||||
// console.log(currentHdlFile);
|
||||
|
||||
if (!currentHdlFile) {
|
||||
vscode.window.showErrorMessage('There is no hdlFile respect to ' + path);
|
||||
|
@ -37,6 +37,11 @@ export interface ICommonParam {
|
||||
param: string
|
||||
}
|
||||
|
||||
export type DoFastFileType = 'common' | 'ip' | 'primitives';
|
||||
export type DoFastToolChainType = 'xilinx' | 'efinity' | 'intel';
|
||||
|
||||
export interface IDoFastParam {
|
||||
path: string
|
||||
path: string,
|
||||
fileType: DoFastFileType,
|
||||
toolChain: DoFastToolChainType
|
||||
}
|
@ -613,7 +613,6 @@ class PrjInfo implements PrjInfoMeta {
|
||||
} else if (srcPath === '') {
|
||||
return workspace;
|
||||
}
|
||||
console.log(hdlPath.join(workspace, srcPath));
|
||||
|
||||
return hdlPath.join(workspace, srcPath);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import * as vscode from 'vscode';
|
||||
|
||||
import { AbsPath, RelPath } from '../global';
|
||||
import { HdlLangID } from '../global/enum';
|
||||
import { DoFastFileType } from '../global/lsp';
|
||||
|
||||
interface Position {
|
||||
// row/line of the cursor, index from 0
|
||||
@ -37,6 +38,7 @@ enum HdlFileType {
|
||||
LocalLib = 'local_lib',
|
||||
RemoteLib = 'remote_lib'
|
||||
};
|
||||
|
||||
enum InstModPathStatus {Current, Include, Others, Unknown};
|
||||
// enum SymbolType {
|
||||
// Module = 'module',
|
||||
@ -195,7 +197,8 @@ interface CommentResult {
|
||||
interface Fast {
|
||||
content: RawHdlModule[]
|
||||
languageId: string
|
||||
macro: Macro
|
||||
macro: Macro,
|
||||
fileType: DoFastFileType
|
||||
}
|
||||
|
||||
interface All {
|
||||
|
@ -8,6 +8,7 @@ import { MainOutput, ReportType } from '../global/outputChannel';
|
||||
import * as common from './common';
|
||||
import { hdlFile, hdlPath } from '../hdlFs';
|
||||
import { HdlSymbol } from './util';
|
||||
import { DoFastFileType } from '../global/lsp';
|
||||
|
||||
class HdlParam {
|
||||
private readonly topModules : Set<HdlModule> = new Set<HdlModule>();
|
||||
@ -52,7 +53,7 @@ class HdlParam {
|
||||
*/
|
||||
public async addHdlPath(path: AbsPath) {
|
||||
path = hdlPath.toSlash(path);
|
||||
await this.initHdlFiles([path]);
|
||||
await this.doHdlFast(path, 'common');
|
||||
const hdlFile = this.getHdlFile(path);
|
||||
if (!hdlFile) {
|
||||
MainOutput.report('error happen when we attempt to add file by path: ' + path, ReportType.Error);
|
||||
@ -225,15 +226,16 @@ class HdlParam {
|
||||
}
|
||||
}
|
||||
|
||||
private async doHdlFast(path: AbsPath) {
|
||||
private async doHdlFast(path: AbsPath, fileType: DoFastFileType) {
|
||||
try {
|
||||
const fast = await HdlSymbol.fast(path);
|
||||
const fast = await HdlSymbol.fast(path, fileType);
|
||||
if (fast) {
|
||||
const languageId = hdlFile.getLanguageId(path);
|
||||
new HdlFile(path,
|
||||
languageId,
|
||||
fast.macro,
|
||||
fast.content);
|
||||
fast.content,
|
||||
fast.fileType);
|
||||
}
|
||||
} catch (error) {
|
||||
MainOutput.report('Error happen when parse ' + path, ReportType.Error);
|
||||
@ -241,29 +243,18 @@ class HdlParam {
|
||||
}
|
||||
}
|
||||
|
||||
public async initHdlFiles(hdlFiles: AbsPath[], progress?: vscode.Progress<IProgress>) {
|
||||
|
||||
public async initializeHdlFiles(hdlFiles: AbsPath[], progress: vscode.Progress<IProgress>) {
|
||||
const { t } = vscode.l10n;
|
||||
let count: number = 0;
|
||||
let fileNum = hdlFiles.length;
|
||||
|
||||
// TODO: 找出最合理的核心数
|
||||
const parallelChunk = Math.min(os.cpus().length, 32);
|
||||
console.log("use cpu: " + parallelChunk);
|
||||
|
||||
|
||||
const pools: { id: number, promise: Promise<void>, path: string }[] = [];
|
||||
const reportTitle = t('info.progress.build-module-tree');
|
||||
|
||||
progress?.report({ message: reportTitle + ` ${1}/${fileNum}`, increment: 0 });
|
||||
|
||||
// for (const path of hdlFiles) {
|
||||
// count ++;
|
||||
// console.log('send request: ' + path);
|
||||
|
||||
// await this.doHdlFast(path);
|
||||
// const increment = Math.floor(count / fileNum * 100);
|
||||
// progress?.report({ message: reportTitle + ` ${count}/${fileNum}`, increment });
|
||||
// }
|
||||
progress.report({ message: reportTitle + ` ${1}/${fileNum}`, increment: 0 });
|
||||
|
||||
async function consumePools() {
|
||||
for (const p of pools) {
|
||||
@ -279,7 +270,7 @@ class HdlParam {
|
||||
count ++;
|
||||
console.log('send request: ' + path);
|
||||
|
||||
const p = this.doHdlFast(path);
|
||||
const p = this.doHdlFast(path, 'common');
|
||||
pools.push({ id: count, promise: p, path });
|
||||
if (pools.length % parallelChunk === 0) {
|
||||
// 消费并发池
|
||||
@ -290,12 +281,49 @@ class HdlParam {
|
||||
if (pools.length > 0) {
|
||||
await consumePools();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async initialize(hdlFiles: AbsPath[], progress: vscode.Progress<IProgress>) {
|
||||
await this.initHdlFiles(hdlFiles, progress);
|
||||
public async initializeIPsPath(IPsPath: string[], progress: vscode.Progress<IProgress>) {
|
||||
const { t } = vscode.l10n;
|
||||
let count: number = 0;
|
||||
let fileNum = IPsPath.length;
|
||||
|
||||
const parallelChunk = Math.min(os.cpus().length, 32);
|
||||
console.log("use cpu: " + parallelChunk);
|
||||
|
||||
const pools: { id: number, promise: Promise<void>, path: string }[] = [];
|
||||
|
||||
const reportTitle = t('info.progress.build-ip-module-tree');
|
||||
progress.report({ message: reportTitle + ` ${1}/${fileNum}`, increment: 0 });
|
||||
|
||||
async function consumePools() {
|
||||
for (const p of pools) {
|
||||
const increment = Math.floor(p.id / fileNum * 100);
|
||||
await p.promise;
|
||||
console.log("handle id " + p.id + ' increment: ' + increment);
|
||||
progress?.report({ message: reportTitle + ` ${p.id}/${fileNum}`, increment });
|
||||
}
|
||||
pools.length = 0;
|
||||
}
|
||||
|
||||
for (const path of IPsPath) {
|
||||
count ++;
|
||||
console.log('send request: ' + path);
|
||||
|
||||
const p = this.doHdlFast(path, 'ip');
|
||||
pools.push({ id: count, promise: p, path });
|
||||
if (pools.length % parallelChunk === 0) {
|
||||
// 消费并发池
|
||||
await consumePools();
|
||||
}
|
||||
}
|
||||
|
||||
if (pools.length > 0) {
|
||||
await consumePools();
|
||||
}
|
||||
}
|
||||
|
||||
public async makeAllInstance() {
|
||||
for (const hdlFile of this.getAllHdlFiles()) {
|
||||
hdlFile.makeInstance();
|
||||
}
|
||||
@ -352,7 +380,7 @@ class HdlParam {
|
||||
|
||||
public async addHdlFile(path: AbsPath) {
|
||||
path = hdlPath.toSlash(path);
|
||||
await this.initHdlFiles([path]);
|
||||
await this.doHdlFast(path, 'common');
|
||||
const moduleFile = this.getHdlFile(path);
|
||||
if (!moduleFile) {
|
||||
MainOutput.report('error happen when create moduleFile ' + path, ReportType.Warn);
|
||||
@ -665,9 +693,7 @@ class HdlModule {
|
||||
// search included file
|
||||
for (const include of this.file.macro.includes) {
|
||||
const absIncludePath = hdlPath.rel2abs(this.path, include.path);
|
||||
console.log(absIncludePath);
|
||||
const includeFile = hdlParam.getHdlFile(absIncludePath);
|
||||
console.log(includeFile);
|
||||
|
||||
if (includeFile) {
|
||||
excludeFile.add(includeFile);
|
||||
@ -810,18 +836,21 @@ class HdlFile {
|
||||
public path: string;
|
||||
public languageId: HdlLangID;
|
||||
public type: common.HdlFileType;
|
||||
public doFastType: DoFastFileType;
|
||||
public macro: common.Macro;
|
||||
private readonly nameToModule: Map<string, HdlModule>;
|
||||
|
||||
constructor(path: string,
|
||||
languageId: HdlLangID,
|
||||
macro: common.Macro,
|
||||
modules: common.RawHdlModule[]) {
|
||||
modules: common.RawHdlModule[],
|
||||
doFastType: DoFastFileType) {
|
||||
|
||||
this.path = path;
|
||||
this.languageId = languageId;
|
||||
this.macro = macro;
|
||||
this.type = hdlFile.getHdlFileType(path);
|
||||
this.doFastType = doFastType;
|
||||
|
||||
// add to global hdlParam
|
||||
hdlParam.setHdlFile(this);
|
||||
|
@ -1,34 +1,18 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { hdlFile } from '../hdlFs';
|
||||
import { HdlLangID } from '../global/enum';
|
||||
import { AbsPath, LspClient } from '../global';
|
||||
import { DoFastRequestType, ITextDocumentItem, CustomParamRequestType, UpdateFastRequestType } from '../global/lsp';
|
||||
import { AbsPath, LspClient, opeParam } from '../global';
|
||||
import { DoFastRequestType, ITextDocumentItem, CustomParamRequestType, UpdateFastRequestType, DoFastFileType, DoFastToolChainType } from '../global/lsp';
|
||||
import { Fast, RawHdlModule } from './common';
|
||||
|
||||
|
||||
|
||||
async function doFastApi(path: string): Promise<Fast | undefined> {
|
||||
async function doFastApi(path: string, fileType: DoFastFileType): Promise<Fast | undefined> {
|
||||
try {
|
||||
const client = LspClient.DigitalIDE;
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
const toolChain = opeParam.prjInfo.toolChain as DoFastToolChainType;
|
||||
if (client) {
|
||||
const response = await client.sendRequest(DoFastRequestType, { path });
|
||||
response.languageId = langID;
|
||||
return response;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("error happen when run doFastApi, " + error);
|
||||
console.error("error file path: " + path);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async function updateFastApi(path: string): Promise<Fast | undefined> {
|
||||
try {
|
||||
const client = LspClient.DigitalIDE;
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
if (client) {
|
||||
const response = await client.sendRequest(UpdateFastRequestType, { path });
|
||||
const response = await client.sendRequest(DoFastRequestType, { path, fileType, toolChain });
|
||||
response.languageId = langID;
|
||||
return response;
|
||||
}
|
||||
@ -46,26 +30,8 @@ namespace HdlSymbol {
|
||||
* @param path 文件绝对路径
|
||||
* @returns
|
||||
*/
|
||||
export function fast(path: AbsPath): Promise<Fast | undefined> {
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
switch (langID) {
|
||||
case HdlLangID.Verilog:
|
||||
case HdlLangID.Vhdl:
|
||||
case HdlLangID.SystemVerilog:
|
||||
return doFastApi(path);
|
||||
default: return new Promise(resolve => resolve(undefined));
|
||||
}
|
||||
}
|
||||
|
||||
export function updateFast(path: AbsPath): Promise<Fast | undefined> {
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
switch (langID) {
|
||||
case HdlLangID.Verilog:
|
||||
case HdlLangID.Vhdl:
|
||||
case HdlLangID.SystemVerilog:
|
||||
return updateFastApi(path);
|
||||
default: return new Promise(resolve => resolve(undefined));
|
||||
}
|
||||
export function fast(path: AbsPath, fileType: DoFastFileType): Promise<Fast | undefined> {
|
||||
return doFastApi(path, fileType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,6 +269,7 @@ class XilinxOperation {
|
||||
// 导入非本地的设计源文件
|
||||
const HDLFiles = hdlParam.getAllHdlFiles();
|
||||
for (const file of HDLFiles) {
|
||||
// TODO: 新增library的add_files
|
||||
if (file.type === "src") {
|
||||
scripts.push(`add_files ${file.path} -quiet`);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
import * as fspath from 'path';
|
||||
|
||||
import { AbsPath, IProgress, LspClient, MainOutput, opeParam, ReportType } from '../global';
|
||||
import { PathSet } from '../global/util';
|
||||
@ -94,7 +95,11 @@ class PrjManage {
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the hdl files that to be parsed in the project
|
||||
* @description 获取所有的用户 hdl 文件,包括:
|
||||
* - sim
|
||||
* - src
|
||||
* - common lib
|
||||
* - custom lib
|
||||
* @returns
|
||||
*/
|
||||
public async getPrjHardwareFiles(): Promise<AbsPath[]> {
|
||||
@ -126,47 +131,76 @@ class PrjManage {
|
||||
return hdlFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取当前项目中所有的 IP 文件夹
|
||||
*/
|
||||
public async getPrjIPs() {
|
||||
const toolchain = opeParam.prjInfo.toolChain;
|
||||
|
||||
switch (toolchain) {
|
||||
case 'xilinx':
|
||||
return this.getXilinxIPs();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public getXilinxIPs() {
|
||||
const srcFolder = opeParam.prjInfo.arch.hardware.src;
|
||||
const ipFolder = hdlPath.resolve(srcFolder, '../ip');
|
||||
const validIPs: string[] = [];
|
||||
if (fs.existsSync(ipFolder) && hdlFile.isDir(ipFolder)) {
|
||||
for (const folder of fs.readdirSync(ipFolder)) {
|
||||
const folderPath = hdlPath.join(ipFolder, folder);
|
||||
if (this.isValidXilinxIP(folderPath)) {
|
||||
validIPs.push(folderPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return validIPs;
|
||||
}
|
||||
|
||||
public isValidXilinxIP(folderPath: string): boolean {
|
||||
const folderName = fspath.basename(folderPath);
|
||||
const descriptionFile = folderName + '.vho';
|
||||
const descriptionFilePath = hdlPath.join(folderPath, descriptionFile);
|
||||
return fs.existsSync(descriptionFilePath);
|
||||
}
|
||||
|
||||
public async initialise(context: vscode.ExtensionContext, progress: vscode.Progress<IProgress>, countTimeCost: boolean = true) {
|
||||
if (countTimeCost) {
|
||||
console.time('launch');
|
||||
}
|
||||
|
||||
// 初始化 OpeParam
|
||||
// 包含基本的插件的文件系统信息、用户配置文件和系统配置文件的合并数据结构
|
||||
const refreshPrjConfig = await this.initOpeParam(context);
|
||||
MainOutput.report('finish initialise opeParam', ReportType.Info);
|
||||
prjManage.refreshPrjFolder(refreshPrjConfig);
|
||||
|
||||
// 解析 hdl 文件,构建 hdlParam
|
||||
const hdlFiles = await this.getPrjHardwareFiles();
|
||||
MainOutput.report(`finish collect ${hdlFiles.length} hdl files`, ReportType.Info);
|
||||
await hdlParam.initializeHdlFiles(hdlFiles, progress);
|
||||
|
||||
await hdlParam.initialize(hdlFiles, progress);
|
||||
// 根据 toolchain 解析合法的 IP,构建 hdlParam
|
||||
const IPsPath = await this.getPrjIPs();
|
||||
await hdlParam.initializeIPsPath(IPsPath, progress);
|
||||
|
||||
// TODO: 解析原语并构建
|
||||
|
||||
|
||||
// 构建 instance 解析
|
||||
await hdlParam.makeAllInstance();
|
||||
|
||||
// 分析依赖关系错位情况
|
||||
const unhandleNum = hdlParam.getUnhandleInstanceNumber();
|
||||
MainOutput.report(`finish analyse ${hdlFiles.length} hdl files, find ${unhandleNum} unsolved instances`, ReportType.Info);
|
||||
|
||||
// 完成后端向前端发送消息的注册
|
||||
const mainClient = LspClient.DigitalIDE;
|
||||
if (mainClient !== undefined) {
|
||||
await mainClient.onReady();
|
||||
mainClient.onNotification('update/fast', async (params: any) => {
|
||||
try {
|
||||
const fast = params.fast as Fast;
|
||||
const path = params.path as string;
|
||||
console.log("[receive notification] path: " + path);
|
||||
hdlParam.updateFast(path, fast);
|
||||
refreshArchTree();
|
||||
} catch (error) {
|
||||
console.error("error happen when update fast: " + error);
|
||||
}
|
||||
});
|
||||
|
||||
// mainClient.onNotification('update/string', async (params: any) => {
|
||||
// console.log('[StringNotificationType] receive from backend');
|
||||
// console.log(params);
|
||||
// });
|
||||
}
|
||||
|
||||
this.pl = new PlManage();
|
||||
|
||||
// TODO : finish it later
|
||||
// this.ps = new PsManage();
|
||||
MainOutput.report('create pl', ReportType.Info);
|
||||
|
@ -146,8 +146,8 @@ class HdlAction extends BaseAction {
|
||||
return;
|
||||
}
|
||||
|
||||
const fast = await HdlSymbol.updateFast(path);
|
||||
console.log('get update fast');
|
||||
const fast = await HdlSymbol.fast(path, 'common');
|
||||
console.log('update fast: ' + path);
|
||||
|
||||
if (!fast) {
|
||||
// vscode.window.showErrorMessage('error happen when parse ' + path + '\nFail to update');
|
||||
|
Loading…
x
Reference in New Issue
Block a user