save
This commit is contained in:
parent
9aba47ac10
commit
7fee932ade
194
package.json
194
package.json
@ -31,11 +31,18 @@
|
|||||||
"description": "path of the dictionary of \"custom\" in library"
|
"description": "path of the dictionary of \"custom\" in library"
|
||||||
},
|
},
|
||||||
"prj.file.structure.notice": {
|
"prj.file.structure.notice": {
|
||||||
"scope": "window",
|
"scope": "window",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
"description": "notice when change file structure"
|
"description": "notice when change file structure"
|
||||||
},
|
},
|
||||||
|
"prj.vivado.install.path": {
|
||||||
|
"scope": "window",
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "set the xilinx install path. \n e.g. : D:/APP/vivado_18_3/Vivado/2018.3/bin \n This applies only to WIN For other systems, add it to environment variables"
|
||||||
|
},
|
||||||
|
"prj.xsdk.install.path": {},
|
||||||
"function.doc.webview.backgroundImage": {
|
"function.doc.webview.backgroundImage": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "",
|
"default": "",
|
||||||
@ -175,14 +182,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pickLibrary",
|
"command": "digital-ide.pickLibrary",
|
||||||
"title": "import library",
|
"title": "%digital-ide.pickLibrary.title%",
|
||||||
"icon": {
|
"icon": {
|
||||||
"light": "images/svg/light/library.svg",
|
"light": "images/svg/light/library.svg",
|
||||||
"dark": "images/svg/dark/library.svg"
|
"dark": "images/svg/dark/library.svg"
|
||||||
},
|
},
|
||||||
"category": "Digital-IDE"
|
"category": "Digital-IDE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.expand",
|
"command": "digital-ide.treeView.arch.expand",
|
||||||
"category": "tool",
|
"category": "tool",
|
||||||
@ -207,9 +214,9 @@
|
|||||||
"title": "%digital-ide.treeView.arch.openFile.title%"
|
"title": "%digital-ide.treeView.arch.openFile.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.tool.tool.clean",
|
"command": "digital-ide.tool.clean",
|
||||||
"category": "tool",
|
"category": "tool",
|
||||||
"title": "%digital-ide.tool.tool.clean.title%"
|
"title": "%digital-ide.tool.clean.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.soft.launch",
|
"command": "digital-ide.soft.launch",
|
||||||
@ -285,26 +292,101 @@
|
|||||||
"command": "digital-ide.hard.exit",
|
"command": "digital-ide.hard.exit",
|
||||||
"category": "tool",
|
"category": "tool",
|
||||||
"title": "%digital-ide.hard.exit.title%"
|
"title": "%digital-ide.hard.exit.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.setSrcTop",
|
||||||
|
"category": "pl",
|
||||||
|
"title": "%digital-ide.pl.setSrcTop.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.setSimTop",
|
||||||
|
"category": "pl",
|
||||||
|
"title": "%digital-ide.pl.setSimTop.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.addDevice",
|
||||||
|
"category": "pl",
|
||||||
|
"title": "%digital-ide.pl.addDevice.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.delDevice",
|
||||||
|
"category": "pl",
|
||||||
|
"title": "%digital-ide.pl.delDevice.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.addFile",
|
||||||
|
"category": "pl",
|
||||||
|
"title": "%digital-ide.pl.addFile.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.delFile",
|
||||||
|
"category": "pl",
|
||||||
|
"title": "%digital-ide.pl.delFile.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.netlist",
|
||||||
|
"icon": {
|
||||||
|
"light": "images/svg/light/netlist.svg",
|
||||||
|
"dark": "images/svg/dark/netlist.svg"
|
||||||
|
},
|
||||||
|
"category": "tool",
|
||||||
|
"title": "%digital-ide.netlist.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.fsm",
|
||||||
|
"icon": {
|
||||||
|
"light": "images/svg/light/fsm.svg",
|
||||||
|
"dark": "images/svg/dark/fsm.svg"
|
||||||
|
},
|
||||||
|
"category": "tool",
|
||||||
|
"title": "%digital-ide.fsm.title%"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"menus": {
|
"menus": {
|
||||||
"view/title": [
|
"view/title": [
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.collapse",
|
"command": "digital-ide.treeView.arch.collapse",
|
||||||
"group": "navigation",
|
"group": "navigation",
|
||||||
"when": "view == digital-ide-treeView-arch"
|
"when": "view == digital-ide-treeView-arch"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pickLibrary",
|
"command": "digital-ide.pickLibrary",
|
||||||
"group": "navigation",
|
"group": "navigation",
|
||||||
"when": "view == digital-ide-treeView-arch"
|
"when": "view == digital-ide-treeView-arch"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.refresh",
|
"command": "digital-ide.treeView.arch.refresh",
|
||||||
"group": "navigation",
|
"group": "navigation",
|
||||||
"when": "view == digital-ide-treeView-arch"
|
"when": "view == digital-ide-treeView-arch"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"view/item/context": [
|
||||||
|
{
|
||||||
|
"command": "digital-ide.tool.icarus.simulateFile",
|
||||||
|
"group": "inline@1",
|
||||||
|
"when": "view == digital-ide-treeView-arch && viewItem == file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.netlist",
|
||||||
|
"group": "inline@3",
|
||||||
|
"when": "view == digital-ide-treeView-arch && viewItem == file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.setSrcTop",
|
||||||
|
"group": "navigation@1",
|
||||||
|
"when": "view == digital-ide-treeView-arch && viewItem == file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.pl.setSimTop",
|
||||||
|
"group": "navigation@2",
|
||||||
|
"when": "view == digital-ide-treeView-arch && viewItem == file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.tool.icarus.simulateFile",
|
||||||
|
"group": "navigation@3",
|
||||||
|
"when": "view == digital-ide-treeView-arch && viewItem == file"
|
||||||
|
}
|
||||||
|
],
|
||||||
"editor/title": [
|
"editor/title": [
|
||||||
{
|
{
|
||||||
"when": "editorLangId == verilog || editorLangId == systemverilog || editorLangId == vhdl",
|
"when": "editorLangId == verilog || editorLangId == systemverilog || editorLangId == vhdl",
|
||||||
@ -320,33 +402,33 @@
|
|||||||
},
|
},
|
||||||
"viewsContainers": {
|
"viewsContainers": {
|
||||||
"activitybar": [
|
"activitybar": [
|
||||||
{
|
{
|
||||||
"id": "TreeView",
|
"id": "TreeView",
|
||||||
"title": "Digital-IDE: TreeView",
|
"title": "Digital-IDE: TreeView",
|
||||||
"icon": "images/svg/view.svg"
|
"icon": "images/svg/view.svg"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"views": {
|
"views": {
|
||||||
"TreeView": [
|
"TreeView": [
|
||||||
{
|
{
|
||||||
"id": "digital-ide-treeView-arch",
|
"id": "digital-ide-treeView-arch",
|
||||||
"name": "architecture"
|
"name": "architecture"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "digital-ide-treeView-tool",
|
"id": "digital-ide-treeView-tool",
|
||||||
"name": "TOOL Options"
|
"name": "TOOL Options"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "digital-ide-treeView-hardware",
|
"id": "digital-ide-treeView-hardware",
|
||||||
"name": "HARD Options"
|
"name": "HARD Options"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "digital-ide-treeView-software",
|
"id": "digital-ide-treeView-software",
|
||||||
"name": "SOFT Options"
|
"name": "SOFT Options"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"keybindings": [
|
"keybindings": [
|
||||||
{
|
{
|
||||||
"command": "digital-ide.tool.instance",
|
"command": "digital-ide.tool.instance",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"digital-ide.treeView.arch.collapse.title": "collapse all the items in tree view",
|
"digital-ide.treeView.arch.collapse.title": "collapse all the items in tree view",
|
||||||
"digital-ide.treeView.arch.refresh.title": "refresh the tree view",
|
"digital-ide.treeView.arch.refresh.title": "refresh the tree view",
|
||||||
"digital-ide.treeView.arch.openFile.title": "Open the corresponding file in tree view",
|
"digital-ide.treeView.arch.openFile.title": "Open the corresponding file in tree view",
|
||||||
"digital-ide.tool.tool.clean.title": "Clean the current project",
|
"digital-ide.tool.clean.title": "Clean the current project",
|
||||||
"digital-ide.soft.launch.title": "Launch SDK development assist function",
|
"digital-ide.soft.launch.title": "Launch SDK development assist function",
|
||||||
"digital-ide.soft.build.title": "Build the current SDK project",
|
"digital-ide.soft.build.title": "Build the current SDK project",
|
||||||
"digital-ide.soft.download.title": "Download the boot file into the device",
|
"digital-ide.soft.download.title": "Download the boot file into the device",
|
||||||
@ -26,5 +26,14 @@
|
|||||||
"digital-ide.hard.build.bitstream.title": "Generate the BIT File",
|
"digital-ide.hard.build.bitstream.title": "Generate the BIT File",
|
||||||
"digital-ide.hard.program.title": "Download the bit file into the device",
|
"digital-ide.hard.program.title": "Download the bit file into the device",
|
||||||
"digital-ide.hard.gui.title": "Open the GUI",
|
"digital-ide.hard.gui.title": "Open the GUI",
|
||||||
"digital-ide.hard.exit.title": "Exit the current project"
|
"digital-ide.hard.exit.title": "Exit the current project",
|
||||||
|
"digital-ide.pickLibrary.title": "select lib from custom & common",
|
||||||
|
"digital-ide.pl.setSrcTop.title": "set as top file of src",
|
||||||
|
"digital-ide.pl.setSimTop.title": "set as top file of sim",
|
||||||
|
"digital-ide.pl.addDevice.title": "add device",
|
||||||
|
"digital-ide.pl.delDevice.title": "del device",
|
||||||
|
"digital-ide.pl.addFile.title": "add file",
|
||||||
|
"digital-ide.pl.delFile.title": "del file",
|
||||||
|
"digital-ide.netlist.title": "netlist",
|
||||||
|
"digital-ide.fsm.title": "finite state machine"
|
||||||
}
|
}
|
@ -11,7 +11,7 @@
|
|||||||
"digital-ide.treeView.arch.collapse.title": "崩溃树视图中的所有项目",
|
"digital-ide.treeView.arch.collapse.title": "崩溃树视图中的所有项目",
|
||||||
"digital-ide.treeView.arch.refresh.title": "刷新树视图",
|
"digital-ide.treeView.arch.refresh.title": "刷新树视图",
|
||||||
"digital-ide.treeView.arch.openFile.title": "在树视图打开相应的文件",
|
"digital-ide.treeView.arch.openFile.title": "在树视图打开相应的文件",
|
||||||
"digital-ide.tool.tool.clean.title": "干净的当前项目",
|
"digital-ide.tool.clean.title": "干净的当前项目",
|
||||||
"digital-ide.soft.launch.title": "启动SDK开发辅助功能",
|
"digital-ide.soft.launch.title": "启动SDK开发辅助功能",
|
||||||
"digital-ide.soft.build.title": "建立项目当前的SDK",
|
"digital-ide.soft.build.title": "建立项目当前的SDK",
|
||||||
"digital-ide.soft.download.title": "下载文件到设备引导",
|
"digital-ide.soft.download.title": "下载文件到设备引导",
|
||||||
@ -26,5 +26,14 @@
|
|||||||
"digital-ide.hard.build.bitstream.title": "生成一些文件",
|
"digital-ide.hard.build.bitstream.title": "生成一些文件",
|
||||||
"digital-ide.hard.program.title": "下载文件到设备",
|
"digital-ide.hard.program.title": "下载文件到设备",
|
||||||
"digital-ide.hard.gui.title": "打开界面",
|
"digital-ide.hard.gui.title": "打开界面",
|
||||||
"digital-ide.hard.exit.title": "退出当前项目"
|
"digital-ide.hard.exit.title": "退出当前项目",
|
||||||
|
"digital-ide.pickLibrary.title": "从自定义选择自由和普遍",
|
||||||
|
"digital-ide.pl.setSrcTop.title": "设置为src的top",
|
||||||
|
"digital-ide.pl.setSimTop.title": "设置为sim的top",
|
||||||
|
"digital-ide.pl.addDevice.title": "添加device",
|
||||||
|
"digital-ide.pl.delDevice.title": "删除device",
|
||||||
|
"digital-ide.pl.addFile.title": "添加文件",
|
||||||
|
"digital-ide.pl.delFile.title": "d删除文件",
|
||||||
|
"digital-ide.netlist.title": "netlist",
|
||||||
|
"digital-ide.fsm.title": "有限状态机"
|
||||||
}
|
}
|
@ -11,7 +11,7 @@
|
|||||||
"digital-ide.treeView.arch.collapse.title": "崩潰樹視圖中的所有項目",
|
"digital-ide.treeView.arch.collapse.title": "崩潰樹視圖中的所有項目",
|
||||||
"digital-ide.treeView.arch.refresh.title": "刷新樹視圖",
|
"digital-ide.treeView.arch.refresh.title": "刷新樹視圖",
|
||||||
"digital-ide.treeView.arch.openFile.title": "在樹視圖打開相應的文件",
|
"digital-ide.treeView.arch.openFile.title": "在樹視圖打開相應的文件",
|
||||||
"digital-ide.tool.tool.clean.title": "乾淨的當前項目",
|
"digital-ide.tool.clean.title": "乾淨的當前項目",
|
||||||
"digital-ide.soft.launch.title": "啟動SDK開發輔助功能",
|
"digital-ide.soft.launch.title": "啟動SDK開發輔助功能",
|
||||||
"digital-ide.soft.build.title": "建立項目當前的SDK",
|
"digital-ide.soft.build.title": "建立項目當前的SDK",
|
||||||
"digital-ide.soft.download.title": "下載文件到設備引導",
|
"digital-ide.soft.download.title": "下載文件到設備引導",
|
||||||
@ -26,5 +26,14 @@
|
|||||||
"digital-ide.hard.build.bitstream.title": "生成一些文件",
|
"digital-ide.hard.build.bitstream.title": "生成一些文件",
|
||||||
"digital-ide.hard.program.title": "下載文件到設備",
|
"digital-ide.hard.program.title": "下載文件到設備",
|
||||||
"digital-ide.hard.gui.title": "打開界面",
|
"digital-ide.hard.gui.title": "打開界面",
|
||||||
"digital-ide.hard.exit.title": "退出當前項目"
|
"digital-ide.hard.exit.title": "退出當前項目",
|
||||||
|
"digital-ide.pickLibrary.title": "從自定義選擇自由和普遍",
|
||||||
|
"digital-ide.pl.setSrcTop.title": "設置為src的文件",
|
||||||
|
"digital-ide.pl.setSimTop.title": "設置為文件的sim卡",
|
||||||
|
"digital-ide.pl.addDevice.title": "添加設備",
|
||||||
|
"digital-ide.pl.delDevice.title": "德爾設備",
|
||||||
|
"digital-ide.pl.addFile.title": "添加文件",
|
||||||
|
"digital-ide.pl.delFile.title": "del文件",
|
||||||
|
"digital-ide.netlist.title": "網表",
|
||||||
|
"digital-ide.fsm.title": "有限狀態機"
|
||||||
}
|
}
|
@ -11,16 +11,9 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function launch(context: vscode.ExtensionContext) {
|
async function launch(context: vscode.ExtensionContext) {
|
||||||
console.time('launch');
|
await prjManage.initialise(context);
|
||||||
prjManage.initOpeParam(context);
|
|
||||||
console.log(opeParam.prjInfo);
|
|
||||||
|
|
||||||
const hdlFiles = prjManage.getPrjHardwareFiles();
|
|
||||||
await hdlParam.initialize(hdlFiles);
|
|
||||||
|
|
||||||
console.timeLog('launch');
|
|
||||||
|
|
||||||
await registerCommand(context);
|
await registerCommand(context);
|
||||||
|
|
||||||
MainOutput.report('Digital-IDE has launched, Version: 0.3.0');
|
MainOutput.report('Digital-IDE has launched, Version: 0.3.0');
|
||||||
MainOutput.report('OS: ' + opeParam.os);
|
MainOutput.report('OS: ' + opeParam.os);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ class ToolTreeProvider extends BaseCommandTreeProvider {
|
|||||||
constructor() {
|
constructor() {
|
||||||
const config: CommandConfig = {
|
const config: CommandConfig = {
|
||||||
Clean: {
|
Clean: {
|
||||||
cmd: 'digital-ide.tool.tool.clean',
|
cmd: 'digital-ide.tool.clean',
|
||||||
icon: 'clean',
|
icon: 'clean',
|
||||||
tip: 'Clean the current project'
|
tip: 'Clean the current project'
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,8 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
|
|
||||||
public refreshSrc() {
|
public refreshSrc() {
|
||||||
this.treeEventEmitter.fire(this.srcRootItem);
|
this.treeEventEmitter.fire(this.srcRootItem);
|
||||||
|
console.log('enter');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public refreshSim() {
|
public refreshSim() {
|
||||||
@ -134,6 +136,8 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
|
|
||||||
public getChildren(element?: ModuleDataItem | undefined): vscode.ProviderResult<ModuleDataItem[]> {
|
public getChildren(element?: ModuleDataItem | undefined): vscode.ProviderResult<ModuleDataItem[]> {
|
||||||
if (element) {
|
if (element) {
|
||||||
|
console.log(element);
|
||||||
|
|
||||||
const name = element.name;
|
const name = element.name;
|
||||||
if (name === 'sim' || name === 'src') {
|
if (name === 'sim' || name === 'src') {
|
||||||
element.parent = null;
|
element.parent = null;
|
||||||
@ -182,6 +186,8 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
const range = firstTop.range;
|
const range = firstTop.range;
|
||||||
const parent = element;
|
const parent = element;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const tops = topModuleItemList.filter(item => item.path === path && item.name === name);
|
const tops = topModuleItemList.filter(item => item.path === path && item.name === name);
|
||||||
const adjustItemList = [];
|
const adjustItemList = [];
|
||||||
if (tops.length > 0 || !hdlParam.hasHdlModule(path, name)) {
|
if (tops.length > 0 || !hdlParam.hasHdlModule(path, name)) {
|
||||||
@ -271,6 +277,17 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getItemType(item: ModuleDataItem): string | null {
|
||||||
|
if (!item) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let currentLevel = item;
|
||||||
|
while (currentLevel.parent) {
|
||||||
|
currentLevel = currentLevel.parent;
|
||||||
|
}
|
||||||
|
return currentLevel.type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleTreeProvider = new ModuleTreeProvider();
|
const moduleTreeProvider = new ModuleTreeProvider();
|
||||||
|
@ -179,6 +179,8 @@ function writeFile(path: AbsPath, content: string): boolean {
|
|||||||
|
|
||||||
function readJSON(path: AbsPath): object {
|
function readJSON(path: AbsPath): object {
|
||||||
try {
|
try {
|
||||||
|
console.log(path);
|
||||||
|
|
||||||
const context = fs.readFileSync(path, 'utf-8');
|
const context = fs.readFileSync(path, 'utf-8');
|
||||||
return JSON.parse(context);
|
return JSON.parse(context);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -167,6 +167,10 @@ class HdlParam {
|
|||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getUnhandleInstanceNumber(): number {
|
||||||
|
return this.unhandleInstances.size;
|
||||||
|
}
|
||||||
|
|
||||||
public getUnhandleInstanceByType(typeName: string): HdlInstance | undefined {
|
public getUnhandleInstanceByType(typeName: string): HdlInstance | undefined {
|
||||||
for (const inst of this.unhandleInstances) {
|
for (const inst of this.unhandleInstances) {
|
||||||
if (inst.type === typeName) {
|
if (inst.type === typeName) {
|
||||||
|
186
src/manager/PL/index.ts
Normal file
186
src/manager/PL/index.ts
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
import { PLConfig, XilinxOperation } from './xilinx';
|
||||||
|
import { BaseManage } from '../common';
|
||||||
|
import { opeParam } from '../../global';
|
||||||
|
import { ToolChainType } from '../../global/enum';
|
||||||
|
import { hdlFile, hdlPath } from '../../hdlFs';
|
||||||
|
import { moduleTreeProvider, ModuleDataItem } from '../../function/treeView/tree';
|
||||||
|
import { HdlFileType } from '../../hdlParser/common';
|
||||||
|
import { PropertySchema } from '../../global/propertySchema';
|
||||||
|
|
||||||
|
class PlManage extends BaseManage {
|
||||||
|
config: PLConfig;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.config = {
|
||||||
|
tool: 'default',
|
||||||
|
path: '',
|
||||||
|
ope: new XilinxOperation(),
|
||||||
|
terminal: this.createTerminal('Hardware')
|
||||||
|
};
|
||||||
|
|
||||||
|
if (opeParam.prjInfo.toolChain) {
|
||||||
|
this.config.tool = opeParam.prjInfo.toolChain;
|
||||||
|
}
|
||||||
|
|
||||||
|
const curToolChain = this.config.tool;
|
||||||
|
if (curToolChain === ToolChainType.Xilinx) {
|
||||||
|
const vivadoPath = vscode.workspace.getConfiguration('prj.vivado.install').get('path', '');
|
||||||
|
if (hdlFile.isDir(vivadoPath)) {
|
||||||
|
this.config.path = hdlPath.join(hdlPath.toSlash(vivadoPath), 'vivado');
|
||||||
|
if (opeParam.os === 'win32') {
|
||||||
|
this.config.path += '.bat';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.config.path = 'vivado';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
launch() {
|
||||||
|
this.config.ope.launch(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.refresh(this.config.terminal);
|
||||||
|
}
|
||||||
|
|
||||||
|
simulate() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.simulate(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.build(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
synth() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.synth(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.impl(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
bit() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.generateBit(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
program() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.ope.program(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
gui() {
|
||||||
|
this.config.ope.gui(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit() {
|
||||||
|
if (!this.config.terminal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.terminal.show(true);
|
||||||
|
this.config.terminal.sendText(`exit`);
|
||||||
|
this.config.terminal.sendText(`exit`);
|
||||||
|
this.config.terminal = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setSrcTop(item: ModuleDataItem) {
|
||||||
|
this.config.ope.setSrcTop(item.name, this.config);
|
||||||
|
const type = moduleTreeProvider.getItemType(item);
|
||||||
|
if (type === HdlFileType.Src) {
|
||||||
|
moduleTreeProvider.setFirstTop(HdlFileType.Src, item.name, item.path);
|
||||||
|
moduleTreeProvider.refreshSrc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setSimTop(item: ModuleDataItem) {
|
||||||
|
this.config.ope.setSimTop(item.name, this.config);
|
||||||
|
const type = moduleTreeProvider.getItemType(item);
|
||||||
|
if (type === HdlFileType.Sim) {
|
||||||
|
moduleTreeProvider.setFirstTop(HdlFileType.Sim, item.name, item.path);
|
||||||
|
moduleTreeProvider.refreshSim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async addFiles(files: string[]) {
|
||||||
|
this.config.ope.addFiles(files, this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
async delFiles(files: string[]) {
|
||||||
|
this.config.ope.delFiles(files, this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
async addDevice() {
|
||||||
|
const propertySchema = opeParam.propertySchemaPath;
|
||||||
|
let propertyParam = hdlFile.readJSON(propertySchema) as PropertySchema;
|
||||||
|
const device = await vscode.window.showInputBox({
|
||||||
|
password: false,
|
||||||
|
ignoreFocusOut: true,
|
||||||
|
placeHolder: 'Please input the name of device'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!device) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!propertyParam.properties.device.enum.includes(device)) {
|
||||||
|
propertyParam.properties.device.enum.push(device);
|
||||||
|
hdlFile.writeJSON(propertySchema, propertyParam);
|
||||||
|
vscode.window.showInformationMessage(`Add the ${device} successfully!!!`);
|
||||||
|
} else {
|
||||||
|
vscode.window.showWarningMessage("The device already exists.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async delDevice() {
|
||||||
|
const propertySchema = opeParam.propertySchemaPath;
|
||||||
|
let propertyParam = hdlFile.readJSON(propertySchema) as PropertySchema;
|
||||||
|
const device = await vscode.window.showQuickPick(propertyParam.properties.device.enum);
|
||||||
|
if (!device) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = propertyParam.properties.device.enum.indexOf(device);
|
||||||
|
propertyParam.properties.device.enum.splice(index, 1);
|
||||||
|
hdlFile.writeJSON(propertySchema, propertyParam);
|
||||||
|
vscode.window.showInformationMessage(`Delete the ${device} successfully!!!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
PlManage,
|
||||||
|
};
|
@ -23,10 +23,10 @@ interface TopMod {
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface PLConfig {
|
interface PLConfig {
|
||||||
terminal? : vscode.Terminal | null,
|
terminal : vscode.Terminal | null,
|
||||||
tool? : string, // 工具类型
|
tool? : string, // 工具类型
|
||||||
path? : string, // 第三方工具运行路径
|
path? : string, // 第三方工具运行路径
|
||||||
ope? : XilinxOperation,
|
ope : XilinxOperation,
|
||||||
};
|
};
|
||||||
|
|
||||||
interface PLPrjInfo {
|
interface PLPrjInfo {
|
||||||
@ -152,7 +152,7 @@ class XilinxOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tclPath = hdlPath.join(this.xilinxPath, 'launch.tcl');
|
const tclPath = hdlPath.join(this.xilinxPath, 'launch.tcl');
|
||||||
scripts.push(this.refresh({terminal: null}));
|
scripts.push(this.refresh());
|
||||||
scripts.push(`file delete ${tclPath} -force`);
|
scripts.push(`file delete ${tclPath} -force`);
|
||||||
const tclCommands = scripts.join('\n') + '\n';
|
const tclCommands = scripts.join('\n') + '\n';
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ class XilinxOperation {
|
|||||||
scripts.push(`open_project ${path} -quiet`);
|
scripts.push(`open_project ${path} -quiet`);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(config: PLConfig): string {
|
refresh(terminal?: vscode.Terminal): string {
|
||||||
const scripts: string[] = [];
|
const scripts: string[] = [];
|
||||||
// 清除所有源文件
|
// 清除所有源文件
|
||||||
scripts.push(`remove_files -quiet [get_files]`);
|
scripts.push(`remove_files -quiet [get_files]`);
|
||||||
@ -284,7 +284,7 @@ class XilinxOperation {
|
|||||||
hdlFile.writeFile(scriptPath, script);
|
hdlFile.writeFile(scriptPath, script);
|
||||||
const cmd = `source ${scriptPath} -quiet`;
|
const cmd = `source ${scriptPath} -quiet`;
|
||||||
|
|
||||||
config.terminal?.sendText(cmd);
|
terminal?.sendText(cmd);
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +561,10 @@ class XilinxBd {
|
|||||||
this.extensionPath = opeParam.extensionPath;
|
this.extensionPath = opeParam.extensionPath;
|
||||||
this.xbdPath = hdlPath.join(this.extensionPath, 'lib', 'bd', 'xilinx');
|
this.xbdPath = hdlPath.join(this.extensionPath, 'lib', 'bd', 'xilinx');
|
||||||
this.schemaPath = opeParam.propertySchemaPath;
|
this.schemaPath = opeParam.propertySchemaPath;
|
||||||
|
|
||||||
|
|
||||||
this.schemaCont = hdlFile.readJSON(this.schemaPath) as PropertySchema;
|
this.schemaCont = hdlFile.readJSON(this.schemaPath) as PropertySchema;
|
||||||
|
|
||||||
this.bdEnum = this.schemaCont.properties.soc.properties.bd.enum;
|
this.bdEnum = this.schemaCont.properties.soc.properties.bd.enum;
|
||||||
this.bdRepo = this.setting.get('PRJ.xilinx.BD.repo.path', '');
|
this.bdRepo = this.setting.get('PRJ.xilinx.BD.repo.path', '');
|
||||||
}
|
}
|
||||||
@ -630,9 +633,7 @@ class XilinxBd {
|
|||||||
hdlFile.writeJSON(this.schemaPath, this.schemaCont);
|
hdlFile.writeJSON(this.schemaPath, this.schemaCont);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
delete() {
|
delete() {
|
||||||
this.getConfig();
|
this.getConfig();
|
||||||
vscode.window.showQuickPick(this.bdEnum).then(select => {
|
vscode.window.showQuickPick(this.bdEnum).then(select => {
|
||||||
@ -810,10 +811,9 @@ const tools = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const xilinxBd = new XilinxBd();
|
export {
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
XilinxOperation,
|
XilinxOperation,
|
||||||
tools,
|
tools,
|
||||||
xilinxBd
|
XilinxBd,
|
||||||
|
PLConfig
|
||||||
};
|
};
|
||||||
|
61
src/manager/PS/index.ts
Normal file
61
src/manager/PS/index.ts
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
import { opeParam } from '../../global';
|
||||||
|
import { ToolChainType } from '../../global/enum';
|
||||||
|
import { hdlFile, hdlPath } from '../../hdlFs';
|
||||||
|
import { BaseManage } from '../common';
|
||||||
|
|
||||||
|
import { PSConfig, XilinxOperation } from './xilinx';
|
||||||
|
|
||||||
|
|
||||||
|
class PsManage extends BaseManage {
|
||||||
|
config: PSConfig;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.config = {
|
||||||
|
tool : 'default',
|
||||||
|
path : '',
|
||||||
|
ope : new XilinxOperation(),
|
||||||
|
terminal : this.createTerminal('PS')
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// get tool chain
|
||||||
|
if (opeParam.prjInfo.toolChain) {
|
||||||
|
this.config.tool = opeParam.prjInfo.toolChain;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get install path & operation object
|
||||||
|
if (this.config.tool === ToolChainType.Xilinx) {
|
||||||
|
const xsdkPath = vscode.workspace.getConfiguration('prj.xsdk.install').get('path', '');
|
||||||
|
if (hdlFile.isDir(xsdkPath)) {
|
||||||
|
this.config.path = hdlPath.join(hdlPath.toSlash(xsdkPath), 'xsct');
|
||||||
|
if (opeParam.os === "win32") {
|
||||||
|
this.config.path += '.bat';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.config.path = 'xsct';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
launch() {
|
||||||
|
this.config.terminal = this.createTerminal('Software');
|
||||||
|
this.config.ope.launch(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
this.config.terminal = this.createTerminal('Software');
|
||||||
|
this.config.ope.build(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
|
program() {
|
||||||
|
this.config.terminal = this.createTerminal('Software');
|
||||||
|
this.config.ope.program(this.config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
PsManage,
|
||||||
|
};
|
@ -15,10 +15,10 @@ interface XilinxOperationConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PSConfig {
|
interface PSConfig {
|
||||||
terminal? : vscode.Terminal | null,
|
terminal : vscode.Terminal,
|
||||||
tool? : string, // 工具类型
|
tool? : string, // 工具类型
|
||||||
path? : string, // 第三方工具运行路径
|
path? : string, // 第三方工具运行路径
|
||||||
ope? : XilinxOperation,
|
ope : XilinxOperation,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,5 +120,6 @@ file delete ${scriptPath} -force\n`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
XilinxOperation
|
XilinxOperation,
|
||||||
|
PSConfig
|
||||||
};
|
};
|
37
src/manager/common.ts
Normal file
37
src/manager/common.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
class BaseManage {
|
||||||
|
/**
|
||||||
|
* 创建终端,并返回对应的属性
|
||||||
|
* @param name 终端名
|
||||||
|
* @returns 终端属性
|
||||||
|
*/
|
||||||
|
createTerminal(name: string) {
|
||||||
|
const terminal = this.getTerminal(name);
|
||||||
|
if (terminal) {
|
||||||
|
return terminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
return vscode.window.createTerminal({
|
||||||
|
name: name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取终端对应的属性
|
||||||
|
* @param name 终端名
|
||||||
|
* @returns 终端属性
|
||||||
|
*/
|
||||||
|
getTerminal(name: string): vscode.Terminal | null {
|
||||||
|
for (const terminal of vscode.window.terminals) {
|
||||||
|
if (terminal.name === name) {
|
||||||
|
return terminal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
BaseManage
|
||||||
|
};
|
@ -1,16 +1,32 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
import * as assert from 'assert';
|
||||||
|
|
||||||
import { prjManage } from './prj';
|
import { prjManage } from './prj';
|
||||||
import { pickLibrary } from './libPick';
|
import { pickLibrary } from './libPick';
|
||||||
|
|
||||||
|
|
||||||
function registerManagerCommands(context: vscode.ExtensionContext) {
|
function registerManagerCommands(context: vscode.ExtensionContext) {
|
||||||
|
// make ps and ps have been prepared
|
||||||
|
assert(prjManage.pl, 'pl is undefined');
|
||||||
|
assert(prjManage.ps, 'ps is undefined');
|
||||||
|
|
||||||
|
const plManage = prjManage.pl;
|
||||||
|
const psManage = prjManage.ps;
|
||||||
|
|
||||||
vscode.commands.registerCommand('digital-ide.property-json.generate', prjManage.generatePropertyJson);
|
vscode.commands.registerCommand('digital-ide.property-json.generate', prjManage.generatePropertyJson);
|
||||||
vscode.commands.registerCommand('digital-ide.property-json.overwrite', prjManage.overwritePropertyJson);
|
vscode.commands.registerCommand('digital-ide.property-json.overwrite', prjManage.overwritePropertyJson);
|
||||||
|
|
||||||
// libpick
|
// libpick
|
||||||
vscode.commands.registerCommand('digital-ide.pickLibrary', pickLibrary);
|
vscode.commands.registerCommand('digital-ide.pickLibrary', pickLibrary);
|
||||||
|
|
||||||
|
// ps
|
||||||
|
vscode.commands.registerCommand('digital-ide.pl.setSrcTop', (item) => plManage.setSrcTop(item));
|
||||||
|
vscode.commands.registerCommand('digital-ide.pl.setSimTop', (item) => plManage.setSimTop(item));
|
||||||
|
vscode.commands.registerCommand('digital-ide.pl.addDevice', () => plManage.addDevice());
|
||||||
|
vscode.commands.registerCommand('digital-ide.pl.delDevice', () => plManage.delDevice());
|
||||||
|
vscode.commands.registerCommand('digital-ide.pl.addFile', files => plManage.addFiles(files));
|
||||||
|
vscode.commands.registerCommand('digital-ide.pl.delFile', files => plManage.delFiles(files));
|
||||||
|
|
||||||
|
// pl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,19 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { AbsPath, opeParam } from '../global';
|
import { AbsPath, MainOutput, opeParam, ReportType } from '../global';
|
||||||
import { PathSet } from '../global/util';
|
import { PathSet } from '../global/util';
|
||||||
import { RawPrjInfo } from '../global/prjInfo';
|
import { RawPrjInfo } from '../global/prjInfo';
|
||||||
import { hdlFile, hdlPath } from '../hdlFs';
|
import { hdlFile, hdlPath } from '../hdlFs';
|
||||||
import { libManage } from './lib';
|
import { libManage } from './lib';
|
||||||
|
import { hdlParam } from '../hdlParser';
|
||||||
|
import { PlManage } from './PL';
|
||||||
|
import { PsManage } from './PS';
|
||||||
|
|
||||||
class PrjManage {
|
class PrjManage {
|
||||||
|
pl?: PlManage;
|
||||||
|
ps?: PsManage;
|
||||||
|
|
||||||
// generate property template and write it to .vscode/property.json
|
// generate property template and write it to .vscode/property.json
|
||||||
public async generatePropertyJson() {
|
public async generatePropertyJson() {
|
||||||
if (fs.existsSync(opeParam.propertyJsonPath)) {
|
if (fs.existsSync(opeParam.propertyJsonPath)) {
|
||||||
@ -78,7 +84,8 @@ class PrjManage {
|
|||||||
const hardwareInfo = prjInfo.arch.hardware;
|
const hardwareInfo = prjInfo.arch.hardware;
|
||||||
|
|
||||||
// handle library first
|
// handle library first
|
||||||
libManage.processLibFiles(prjInfo.library);
|
const fileChange = libManage.processLibFiles(prjInfo.library);
|
||||||
|
MainOutput.report(`libManage finish process, add ${fileChange.add.length} files, del ${fileChange.del.length} files`, ReportType.Info);
|
||||||
|
|
||||||
// add possible folder to search
|
// add possible folder to search
|
||||||
searchPathSet.checkAdd(hardwareInfo.src);
|
searchPathSet.checkAdd(hardwareInfo.src);
|
||||||
@ -94,8 +101,30 @@ class PrjManage {
|
|||||||
return hdlFile.getHDLFiles(searchPaths, ignores);
|
return hdlFile.getHDLFiles(searchPaths, ignores);
|
||||||
}
|
}
|
||||||
|
|
||||||
public initialise() {
|
public async initialise(context: vscode.ExtensionContext, countTimeCost: boolean = true) {
|
||||||
|
if (countTimeCost) {
|
||||||
|
console.time('launch');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initOpeParam(context);
|
||||||
|
MainOutput.report('finish initialise opeParam', ReportType.Info);
|
||||||
|
|
||||||
|
const hdlFiles = this.getPrjHardwareFiles();
|
||||||
|
MainOutput.report(`finish collect ${hdlFiles.length} hdl files`, ReportType.Info);
|
||||||
|
|
||||||
|
await hdlParam.initialize(hdlFiles);
|
||||||
|
const unhandleNum = hdlParam.getUnhandleInstanceNumber();
|
||||||
|
MainOutput.report(`finish analyse ${hdlFiles.length} hdl files, find ${unhandleNum} unsolved instances`, ReportType.Info);
|
||||||
|
|
||||||
|
this.pl = new PlManage();
|
||||||
|
this.ps = new PsManage();
|
||||||
|
MainOutput.report('create pl and ps', ReportType.Info);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (countTimeCost) {
|
||||||
|
console.timeLog('launch');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user