reconstruct prj & lib partly | test
This commit is contained in:
parent
74d6353019
commit
9c02033c41
@ -12,3 +12,4 @@ webpack.config.js
|
|||||||
node_modules
|
node_modules
|
||||||
src/**
|
src/**
|
||||||
vsixmake.js
|
vsixmake.js
|
||||||
|
script
|
226
draft.json
226
draft.json
@ -1,226 +0,0 @@
|
|||||||
{
|
|
||||||
"content": {
|
|
||||||
"error": [],
|
|
||||||
"modules": [
|
|
||||||
{
|
|
||||||
"instances": [
|
|
||||||
{
|
|
||||||
"instparams": null,
|
|
||||||
"instports": {
|
|
||||||
"end": {
|
|
||||||
"character": 10,
|
|
||||||
"line": 21
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 4,
|
|
||||||
"line": 18
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"name": "u_dependence_1",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 0,
|
|
||||||
"line": 22
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 13,
|
|
||||||
"line": 17
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "dependence_1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"instparams": null,
|
|
||||||
"instports": {
|
|
||||||
"end": {
|
|
||||||
"character": 9,
|
|
||||||
"line": 28
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 4,
|
|
||||||
"line": 25
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"name": "u_dependence_2",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 0,
|
|
||||||
"line": 29
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 13,
|
|
||||||
"line": 24
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "dependence_2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"instparams": null,
|
|
||||||
"instports": {
|
|
||||||
"end": {
|
|
||||||
"character": 9,
|
|
||||||
"line": 35
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 4,
|
|
||||||
"line": 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"name": "u_dependence_3",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 0,
|
|
||||||
"line": 36
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 13,
|
|
||||||
"line": 31
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "dependence_3"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "Main",
|
|
||||||
"params": [],
|
|
||||||
"ports": [
|
|
||||||
{
|
|
||||||
"name": "a",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 11,
|
|
||||||
"line": 13
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 10,
|
|
||||||
"line": 13
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "input",
|
|
||||||
"width": "Unknown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "b",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 14,
|
|
||||||
"line": 13
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 13,
|
|
||||||
"line": 13
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "input",
|
|
||||||
"width": "Unknown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "c",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 17,
|
|
||||||
"line": 13
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 16,
|
|
||||||
"line": 13
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "input",
|
|
||||||
"width": "Unknown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Qus",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 14,
|
|
||||||
"line": 14
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 11,
|
|
||||||
"line": 14
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "output",
|
|
||||||
"width": "Unknown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Qs",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 18,
|
|
||||||
"line": 14
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 16,
|
|
||||||
"line": 14
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "output",
|
|
||||||
"width": "Unknown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "`main",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 25,
|
|
||||||
"line": 14
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 20,
|
|
||||||
"line": 14
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "output",
|
|
||||||
"width": "Unknown"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 0,
|
|
||||||
"line": 38
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 0,
|
|
||||||
"line": 12
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"languageId": "verilog",
|
|
||||||
"macro": {
|
|
||||||
"defines": [
|
|
||||||
{
|
|
||||||
"name": "main",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 17,
|
|
||||||
"line": 10
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 1,
|
|
||||||
"line": 10
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"value": "out"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error": [],
|
|
||||||
"includes": [
|
|
||||||
{
|
|
||||||
"path": "child_1.v",
|
|
||||||
"range": {
|
|
||||||
"end": {
|
|
||||||
"character": 9,
|
|
||||||
"line": 9
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"character": 1,
|
|
||||||
"line": 9
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"invalid": []
|
|
||||||
}
|
|
||||||
}
|
|
301
package.json
301
package.json
@ -16,7 +16,8 @@
|
|||||||
"onLanguage:verilog",
|
"onLanguage:verilog",
|
||||||
"onLanguage:vhdl",
|
"onLanguage:vhdl",
|
||||||
"onLanguage:systemverilog",
|
"onLanguage:systemverilog",
|
||||||
"onCommand:TOOL.generate.property",
|
"onCommand:digital-ide.property-json.generate",
|
||||||
|
"onCommand:digital-ide.property-json.overwrite",
|
||||||
"workspaceContains:.vscode/property.json"
|
"workspaceContains:.vscode/property.json"
|
||||||
],
|
],
|
||||||
"contributes": {
|
"contributes": {
|
||||||
@ -33,155 +34,161 @@
|
|||||||
},
|
},
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "digital-ide.helloWorld",
|
"command": "digital-ide.property-json.generate",
|
||||||
"title": "Hello World"
|
"title": "%digital-ide.property-json.generate.title%",
|
||||||
|
"category": "Digital-IDE"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.property-json.overwrite",
|
||||||
|
"title": "%digital-ide.property-json.overwrite.title%",
|
||||||
|
"category": "Digital-IDE"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"languages": [
|
"languages": [
|
||||||
{
|
{
|
||||||
"id": "tcl",
|
"id": "tcl",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"TCL",
|
"TCL",
|
||||||
"Xilinx Constraints File",
|
"Xilinx Constraints File",
|
||||||
"Synopsis Constraints File"
|
"Synopsis Constraints File"
|
||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".tcl",
|
".tcl",
|
||||||
".sdc",
|
".sdc",
|
||||||
".xdc",
|
".xdc",
|
||||||
".fdc"
|
".fdc"
|
||||||
],
|
],
|
||||||
"configuration": "./config/tcl.configuration.json"
|
"configuration": "./config/tcl.configuration.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bd",
|
"id": "bd",
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".bd"
|
".bd"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "vhdl",
|
"id": "vhdl",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"VHDL",
|
"VHDL",
|
||||||
"vhdl"
|
"vhdl"
|
||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".vhd",
|
".vhd",
|
||||||
".vhdl",
|
".vhdl",
|
||||||
".vho",
|
".vho",
|
||||||
".vht"
|
".vht"
|
||||||
],
|
],
|
||||||
"configuration": "./config/vhdl.configuration.json"
|
"configuration": "./config/vhdl.configuration.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "verilog",
|
"id": "verilog",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"Verilog",
|
"Verilog",
|
||||||
"verilog"
|
"verilog"
|
||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".v",
|
".v",
|
||||||
".V",
|
".V",
|
||||||
".vh",
|
".vh",
|
||||||
".vl"
|
".vl"
|
||||||
],
|
],
|
||||||
"configuration": "./config/verilog.configuration.json"
|
"configuration": "./config/verilog.configuration.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "systemverilog",
|
"id": "systemverilog",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"System Verilog",
|
"System Verilog",
|
||||||
"systemverilog"
|
"systemverilog"
|
||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".sv",
|
".sv",
|
||||||
".SV"
|
".SV"
|
||||||
],
|
],
|
||||||
"configuration": "./config/systemverilog.configuration.json"
|
"configuration": "./config/systemverilog.configuration.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "arm",
|
"id": "arm",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"ARM",
|
"ARM",
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".s",
|
".s",
|
||||||
".S",
|
".S",
|
||||||
".asm",
|
".asm",
|
||||||
".sx"
|
".sx"
|
||||||
],
|
],
|
||||||
"configuration": "./config/arm.configuration.json"
|
"configuration": "./config/arm.configuration.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "linkerscript",
|
"id": "linkerscript",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"LinkerScript",
|
"LinkerScript",
|
||||||
"linkerscript"
|
"linkerscript"
|
||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".ld",
|
".ld",
|
||||||
".dld"
|
".dld"
|
||||||
],
|
],
|
||||||
"configuration": "./config/link.configuration.json"
|
"configuration": "./config/link.configuration.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"jsonValidation": [
|
"jsonValidation": [
|
||||||
{
|
{
|
||||||
"fileMatch": "property.json",
|
"fileMatch": "property.json",
|
||||||
"url": "./project/property-schema.json"
|
"url": "./project/property-schema.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grammars": [
|
"grammars": [
|
||||||
{
|
{
|
||||||
"language": "linkerscript",
|
"language": "linkerscript",
|
||||||
"scopeName": "source.ld",
|
"scopeName": "source.ld",
|
||||||
"path": "./syntaxes/link.json"
|
"path": "./syntaxes/link.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "arm",
|
"language": "arm",
|
||||||
"scopeName": "source.arm",
|
"scopeName": "source.arm",
|
||||||
"path": "./syntaxes/arm.json"
|
"path": "./syntaxes/arm.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "tcl",
|
"language": "tcl",
|
||||||
"scopeName": "source.tcl",
|
"scopeName": "source.tcl",
|
||||||
"path": "./syntaxes/tcl.json"
|
"path": "./syntaxes/tcl.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "vhdl",
|
"language": "vhdl",
|
||||||
"scopeName": "source.vhdl",
|
"scopeName": "source.vhdl",
|
||||||
"path": "./syntaxes/vhdl.json"
|
"path": "./syntaxes/vhdl.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "verilog",
|
"language": "verilog",
|
||||||
"scopeName": "source.verilog",
|
"scopeName": "source.verilog",
|
||||||
"path": "./syntaxes/verilog.json"
|
"path": "./syntaxes/verilog.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "systemverilog",
|
"language": "systemverilog",
|
||||||
"scopeName": "source.systemverilog",
|
"scopeName": "source.systemverilog",
|
||||||
"path": "./syntaxes/systemverilog.json"
|
"path": "./syntaxes/systemverilog.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"snippets": [
|
"snippets": [
|
||||||
{
|
{
|
||||||
"language": "tcl",
|
"language": "tcl",
|
||||||
"path": "snippets/tcl.json"
|
"path": "snippets/tcl.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "vhdl",
|
"language": "vhdl",
|
||||||
"path": "snippets/vhdl.json"
|
"path": "snippets/vhdl.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "verilog",
|
"language": "verilog",
|
||||||
"path": "snippets/svlog.json"
|
"path": "snippets/svlog.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language": "systemverilog",
|
"language": "systemverilog",
|
||||||
"path": "snippets/svlog.json"
|
"path": "snippets/svlog.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
|
4
package.nls.json
Normal file
4
package.nls.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"digital-ide.property-json.generate.title": "generate property.json",
|
||||||
|
"digital-ide.property-json.overwrite.title": "overwrite property.json template"
|
||||||
|
}
|
4
package.nls.zh-cn.json
Normal file
4
package.nls.zh-cn.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"digital-ide.property-json.generate.title": "生成 property.json 配置文件",
|
||||||
|
"digital-ide.property-json.overwrite.title": "修改默认的 property.json 模板文件"
|
||||||
|
}
|
4
package.nls.zh-tw.json
Normal file
4
package.nls.zh-tw.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"digital-ide.property-json.generate.title": "",
|
||||||
|
"digital-ide.property-json.overwrite.title": ""
|
||||||
|
}
|
5
script/.gitignore
vendored
Normal file
5
script/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
__pycache__
|
||||||
|
dist
|
||||||
|
*.pyc
|
||||||
|
*.pyd
|
||||||
|
*.pyi
|
5
script/README.md
Normal file
5
script/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Some scripts for config generation, batch processing etc.
|
||||||
|
|
||||||
|
Please run the all the scripts in the `extensionPath`.
|
||||||
|
|
||||||
|
command: scripts for `commands` in package.json
|
46
script/command/make_title_token.py
Normal file
46
script/command/make_title_token.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
from typing import List
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
sys.path.append(os.path.abspath('.'))
|
||||||
|
|
||||||
|
from script.util import read_json, write_json
|
||||||
|
|
||||||
|
PACKAGE_FILE = './package.json'
|
||||||
|
|
||||||
|
LANG_PACKGE_FILES = {
|
||||||
|
'en': './package.nls.json',
|
||||||
|
'zh-cn': './package.nls.zh-cn.json',
|
||||||
|
'zh-tw': './package.nls.zh-tw.json'
|
||||||
|
}
|
||||||
|
|
||||||
|
def generate_title_token(command_name: str) -> str:
|
||||||
|
names = command_name.split('.')
|
||||||
|
prj_name = names[0]
|
||||||
|
main_names = names[1:]
|
||||||
|
title_token_name = [prj_name] + main_names + ['title']
|
||||||
|
return '.'.join(title_token_name)
|
||||||
|
|
||||||
|
def merge_tokens(lang_package_path: str, tokens: List[str]):
|
||||||
|
config = read_json(lang_package_path)
|
||||||
|
for token in tokens:
|
||||||
|
if token not in config:
|
||||||
|
config[token] = ""
|
||||||
|
|
||||||
|
write_json(lang_package_path, config)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# adjust main package
|
||||||
|
config = read_json(PACKAGE_FILE)
|
||||||
|
commands = config['contributes']['commands']
|
||||||
|
token_names = []
|
||||||
|
|
||||||
|
for c_item in commands:
|
||||||
|
if 'command' in c_item:
|
||||||
|
token_name = generate_title_token(c_item['command'])
|
||||||
|
token_names.append(token_name)
|
||||||
|
c_item['title'] = '%' + token_name + '%'
|
||||||
|
write_json(PACKAGE_FILE, config)
|
||||||
|
|
||||||
|
# cover in lang package
|
||||||
|
for name, lang_path in LANG_PACKGE_FILES.items():
|
||||||
|
merge_tokens(lang_path, token_names)
|
6
script/command/translate_from_en.py
Normal file
6
script/command/translate_from_en.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
sys.path.append(os.path.abspath('.'))
|
||||||
|
|
||||||
|
from script.util import read_json, write_json
|
||||||
|
|
12
script/util.py
Normal file
12
script/util.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import json
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
def read_json(path: str) -> Any:
|
||||||
|
with open(path, 'r', encoding='utf-8') as fp:
|
||||||
|
config = json.load(fp=fp)
|
||||||
|
return config
|
||||||
|
|
||||||
|
def write_json(path: str, obj: object):
|
||||||
|
with open(path, 'w', encoding='utf-8') as fp:
|
||||||
|
json.dump(obj, fp=fp, indent=4, ensure_ascii=False)
|
||||||
|
|
@ -12,6 +12,7 @@ function launch(context: vscode.ExtensionContext) {
|
|||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
console.log('Digital-IDE 0.3.0 is launched');
|
console.log('Digital-IDE 0.3.0 is launched');
|
||||||
launch(context);
|
launch(context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deactivate() {}
|
export function deactivate() {}
|
@ -1,7 +1,7 @@
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { Arch, PrjInfo, RawPrjInfo, PrjInfoDefaults } from './prjInfo';
|
import { Arch, PrjInfo, RawPrjInfo, resolve, toSlash } from './prjInfo';
|
||||||
|
|
||||||
type AbsPath = string;
|
type AbsPath = string;
|
||||||
type RelPath = string;
|
type RelPath = string;
|
||||||
@ -125,6 +125,22 @@ class OpeParam {
|
|||||||
public mergePrjInfo(rawPrjInfo: RawPrjInfo) {
|
public mergePrjInfo(rawPrjInfo: RawPrjInfo) {
|
||||||
this.prjInfo.merge(rawPrjInfo);
|
this.prjInfo.merge(rawPrjInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the absolute path based on workspacePath
|
||||||
|
* @param relPath
|
||||||
|
*/
|
||||||
|
public resolvePathWorkspace(relPath: RelPath): AbsPath {
|
||||||
|
return resolve(this._workspacePath, relPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the absolute path based on extensionPath
|
||||||
|
* @param relPath
|
||||||
|
*/
|
||||||
|
public resolvePathExtension(relPath: RelPath): AbsPath {
|
||||||
|
return resolve(this._extensionPath, relPath);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const opeParam: OpeParam = new OpeParam();
|
const opeParam: OpeParam = new OpeParam();
|
||||||
|
@ -7,6 +7,7 @@ import * as fspath from 'path';
|
|||||||
import { ToolChainType, LibraryState, XilinxIP,
|
import { ToolChainType, LibraryState, XilinxIP,
|
||||||
validToolChainType, validXilinxIP, validLibraryState } from './enum';
|
validToolChainType, validXilinxIP, validLibraryState } from './enum';
|
||||||
import { PrjInfoSchema } from './propertySchema';
|
import { PrjInfoSchema } from './propertySchema';
|
||||||
|
import assert = require('assert');
|
||||||
|
|
||||||
type AbsPath = string;
|
type AbsPath = string;
|
||||||
type RelPath = string;
|
type RelPath = string;
|
||||||
@ -103,32 +104,41 @@ function toSlash(path: Path): Path {
|
|||||||
return path.replace(/\\/g,"\/");
|
return path.replace(/\\/g,"\/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolve(...paths: Path[]): AbsPath {
|
||||||
|
const absPath = fspath.resolve(...paths);
|
||||||
|
return toSlash(absPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
function join(...paths: string[]): AbsPath {
|
||||||
|
const joinedPath = fspath.join(...paths);
|
||||||
|
return toSlash(joinedPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class PrjInfo implements PrjInfoMeta {
|
class PrjInfo implements PrjInfoMeta {
|
||||||
private _extensionPath: AbsPath = '';
|
private _extensionPath: AbsPath = '';
|
||||||
private _workspacePath: AbsPath = '';
|
private _workspacePath: AbsPath = '';
|
||||||
private _libCommonPath: AbsPath = '';
|
|
||||||
private _libCustomPath: AbsPath = '';
|
|
||||||
|
|
||||||
// toolChain is the tool chain used in the project
|
// toolChain is the tool chain used in the project
|
||||||
// which is supposed to support xilinx, intel, custom
|
// which is supposed to support xilinx, intel, custom
|
||||||
private _toolChain: ToolChainType = PrjInfoDefaults.toolChain;
|
private _toolChain: ToolChainType = PrjInfoDefaults.toolChain;
|
||||||
|
|
||||||
// project name, include pl and ps
|
// project name, include pl and ps
|
||||||
private _prjName: PrjName = PrjInfoDefaults.prjName;
|
private readonly _prjName: PrjName = PrjInfoDefaults.prjName;
|
||||||
|
|
||||||
private _IP_REPO: XilinxIP[] = PrjInfoDefaults.IP_REPO;
|
private _IP_REPO: XilinxIP[] = PrjInfoDefaults.IP_REPO;
|
||||||
|
|
||||||
private _soc: Soc = PrjInfoDefaults.soc;
|
private readonly _soc: Soc = PrjInfoDefaults.soc;
|
||||||
|
|
||||||
private _enableShowLog: boolean = PrjInfoDefaults.enableShowLog;
|
private _enableShowLog: boolean = PrjInfoDefaults.enableShowLog;
|
||||||
|
|
||||||
private _device: string = PrjInfoDefaults.device;
|
private _device: string = PrjInfoDefaults.device;
|
||||||
|
|
||||||
// structure of the project, including path of source of hardware design, testBench
|
// structure of the project, including path of source of hardware design, testBench
|
||||||
private _arch: Arch = PrjInfoDefaults.arch;
|
private readonly _arch: Arch = PrjInfoDefaults.arch;
|
||||||
|
|
||||||
// library to manage
|
// library to manage
|
||||||
private _library: Library = PrjInfoDefaults.library;
|
private readonly _library: Library = PrjInfoDefaults.library;
|
||||||
|
|
||||||
public get toolChain(): ToolChainType {
|
public get toolChain(): ToolChainType {
|
||||||
return this._toolChain;
|
return this._toolChain;
|
||||||
@ -166,7 +176,41 @@ class PrjInfo implements PrjInfoMeta {
|
|||||||
return 'microphase';
|
return 'microphase';
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve path with workspacePath as root
|
/**
|
||||||
|
* replace token like ${workspace} in path
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
private replacePathToken(path: AbsPath): AbsPath {
|
||||||
|
const workspacePath = this._workspacePath;
|
||||||
|
assert(workspacePath);
|
||||||
|
this.setDefaultValue(this.prjName, 'PL', 'template');
|
||||||
|
this.setDefaultValue(this.prjName, 'PS', 'template');
|
||||||
|
const plname = this.prjName.PL;
|
||||||
|
const psname = this.prjName.PS;
|
||||||
|
|
||||||
|
// TODO : packaging the replacer
|
||||||
|
return path.replace(new RegExp('${workspace}', 'g'), workspacePath)
|
||||||
|
.replace(new RegExp('${plname}', 'g'), plname)
|
||||||
|
.replace(new RegExp('${psname}', 'g'), psname);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uniform a absolute path
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
public uniformisePath(path: AbsPath): AbsPath {
|
||||||
|
const slashPath = toSlash(path);
|
||||||
|
const replacedPath = this.replacePathToken(path);
|
||||||
|
return replacedPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* resolve path with workspacePath as root
|
||||||
|
* @param path
|
||||||
|
* @param check if true, check the existence of path
|
||||||
|
* @param root root of path, root and path will be joined
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
private resolvePath(path: Path, check: boolean = false, root?: AbsPath): AbsPath | undefined {
|
private resolvePath(path: Path, check: boolean = false, root?: AbsPath): AbsPath | undefined {
|
||||||
let uniformPath = '';
|
let uniformPath = '';
|
||||||
if (fspath.isAbsolute(path)) {
|
if (fspath.isAbsolute(path)) {
|
||||||
@ -178,6 +222,7 @@ class PrjInfo implements PrjInfoMeta {
|
|||||||
|
|
||||||
uniformPath = toSlash(uniformPath);
|
uniformPath = toSlash(uniformPath);
|
||||||
|
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
if (fs.existsSync(uniformPath)) {
|
if (fs.existsSync(uniformPath)) {
|
||||||
return uniformPath;
|
return uniformPath;
|
||||||
@ -278,7 +323,29 @@ class PrjInfo implements PrjInfoMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assign defaultValue to obj[attr] if boolean of obj[attr] is false or 'none'
|
||||||
|
* @param obj
|
||||||
|
* @param attr
|
||||||
|
* @param defaultValue
|
||||||
|
*/
|
||||||
|
private setDefaultValue<T extends string, K>(obj: Record<T, K>,
|
||||||
|
attr: T,
|
||||||
|
defaultValue: K) {
|
||||||
|
const value: K = obj[attr];
|
||||||
|
let isNull = !Boolean(value);
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
isNull &&= value === 'none';
|
||||||
|
}
|
||||||
|
if (isNull) {
|
||||||
|
obj[attr] = defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public updateArch(arch?: Arch) {
|
public updateArch(arch?: Arch) {
|
||||||
|
const workspacePath = this._workspacePath;
|
||||||
|
|
||||||
if (arch) {
|
if (arch) {
|
||||||
this.updatePathWisely(this.arch, 'prjPath', arch.prjPath);
|
this.updatePathWisely(this.arch, 'prjPath', arch.prjPath);
|
||||||
if (arch.hardware) {
|
if (arch.hardware) {
|
||||||
@ -291,7 +358,30 @@ class PrjInfo implements PrjInfoMeta {
|
|||||||
this.updatePathWisely(this.arch.software, 'src', arch.software.src);
|
this.updatePathWisely(this.arch.software, 'src', arch.software.src);
|
||||||
this.updatePathWisely(this.arch.software, 'data', arch.software.data);
|
this.updatePathWisely(this.arch.software, 'data', arch.software.data);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
let hardwarePath: AbsPath = join(workspacePath, 'user');
|
||||||
|
let softwarePath: AbsPath = join(workspacePath, 'user', 'Software');
|
||||||
|
const socCore = this._soc.core;
|
||||||
|
if (socCore && socCore !== 'none') {
|
||||||
|
hardwarePath = join(hardwarePath, 'Hardware');
|
||||||
|
}
|
||||||
|
this.arch.prjPath = join(workspacePath, 'prj');
|
||||||
|
this.arch.hardware.src = join(hardwarePath, 'src');
|
||||||
|
this.arch.hardware.sim = join(hardwarePath, 'sim');
|
||||||
|
this.arch.hardware.data = join(hardwarePath, 'data');
|
||||||
|
|
||||||
|
this.arch.software.src = join(softwarePath, 'src');
|
||||||
|
this.arch.software.data = join(softwarePath, 'data');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if path is '', set as workspace
|
||||||
|
this.setDefaultValue(this.arch.hardware, 'src', workspacePath);
|
||||||
|
this.setDefaultValue(this.arch.hardware, 'sim', workspacePath);
|
||||||
|
this.setDefaultValue(this.arch.hardware, 'data', workspacePath);
|
||||||
|
|
||||||
|
this.setDefaultValue(this.arch.software, 'src', workspacePath);
|
||||||
|
this.setDefaultValue(this.arch.software, 'data', workspacePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateLibrary(library?: Library) {
|
public updateLibrary(library?: Library) {
|
||||||
@ -306,8 +396,8 @@ class PrjInfo implements PrjInfoMeta {
|
|||||||
}
|
}
|
||||||
if (library.hardware) {
|
if (library.hardware) {
|
||||||
// TODO : finish this when you can require root of common and custom
|
// TODO : finish this when you can require root of common and custom
|
||||||
const commonPath = this._libCommonPath;
|
const commonPath = this.libCommonPath;
|
||||||
const customPath = this._libCustomPath;
|
const customPath = this.libCustomPath;
|
||||||
this.updatePathWisely(this.library.hardware, 'common', library.hardware.common, commonPath);
|
this.updatePathWisely(this.library.hardware, 'common', library.hardware.common, commonPath);
|
||||||
this.updatePathWisely(this.library.hardware, 'custom', library.hardware.custom, customPath);
|
this.updatePathWisely(this.library.hardware, 'custom', library.hardware.custom, customPath);
|
||||||
}
|
}
|
||||||
@ -339,9 +429,14 @@ class PrjInfo implements PrjInfoMeta {
|
|||||||
public initContextPath(extensionPath: AbsPath, workspacePath: AbsPath) {
|
public initContextPath(extensionPath: AbsPath, workspacePath: AbsPath) {
|
||||||
this._extensionPath = toSlash(extensionPath);
|
this._extensionPath = toSlash(extensionPath);
|
||||||
this._workspacePath = toSlash(workspacePath);
|
this._workspacePath = toSlash(workspacePath);
|
||||||
|
}
|
||||||
|
|
||||||
this._libCommonPath = toSlash(fspath.join(extensionPath, 'lib', 'common'));
|
public get libCommonPath(): AbsPath {
|
||||||
this._libCustomPath = vscode.workspace.getConfiguration().get('lib.custom.path', this._workspacePath);
|
return join(this._extensionPath, 'lib', 'common');
|
||||||
|
}
|
||||||
|
|
||||||
|
public get libCustomPath(): AbsPath {
|
||||||
|
return vscode.workspace.getConfiguration().get('lib.custom.path', this._workspacePath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -355,5 +450,7 @@ export {
|
|||||||
Arch,
|
Arch,
|
||||||
Soc,
|
Soc,
|
||||||
Library,
|
Library,
|
||||||
RawPrjInfo
|
RawPrjInfo,
|
||||||
|
toSlash,
|
||||||
|
resolve
|
||||||
};
|
};
|
22
src/global/util.ts
Normal file
22
src/global/util.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
|
import { AbsPath } from ".";
|
||||||
|
|
||||||
|
class PathSet {
|
||||||
|
files: Set<AbsPath> = new Set<AbsPath>();
|
||||||
|
add(path: AbsPath) {
|
||||||
|
this.files.add(path);
|
||||||
|
}
|
||||||
|
checkAdd(path: AbsPath | AbsPath[]) {
|
||||||
|
if (path instanceof Array) {
|
||||||
|
path.forEach(p => this.checkAdd(p));
|
||||||
|
} else if (fs.existsSync(path)) {
|
||||||
|
this.files.add(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
PathSet
|
||||||
|
};
|
@ -74,15 +74,14 @@ function isHDLFile(path: AbsPath): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getHDLFiles(path: AbsPath, ignores?: AbsPath[]) {
|
function getHDLFiles(path: AbsPath | AbsPath[] | Set<AbsPath>, ignores?: AbsPath[]) {
|
||||||
return pickFileRecursive(path, ignores, (filePath) => {
|
return pickFileRecursive(path, ignores, filePath => isHDLFile(filePath));
|
||||||
return isHDLFile(filePath);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function pickFileRecursive(path: AbsPath | AbsPath[], ignores?: AbsPath[], condition?: (filePath: string) => boolean | undefined | void): AbsPath[] {
|
function pickFileRecursive(path: AbsPath | AbsPath[] | Set<AbsPath>, ignores?: AbsPath[], condition?: (filePath: string) => boolean | undefined | void): AbsPath[] {
|
||||||
if (path instanceof Array) {
|
if ((path instanceof Array) ||
|
||||||
|
(path instanceof Set)) {
|
||||||
const hdlFiles: AbsPath[] = [];
|
const hdlFiles: AbsPath[] = [];
|
||||||
path.forEach(p => hdlFiles.push(...pickFileRecursive(p)));
|
path.forEach(p => hdlFiles.push(...pickFileRecursive(p)));
|
||||||
return hdlFiles;
|
return hdlFiles;
|
||||||
|
0
src/hdlParser/parser/index.d.ts
vendored
Normal file
0
src/hdlParser/parser/index.d.ts
vendored
Normal file
0
src/hdlParser/parser/index.js
Normal file
0
src/hdlParser/parser/index.js
Normal file
@ -13,7 +13,7 @@ import { XilinxIP } from '../../global/enum';
|
|||||||
import { MainOutput } from '../../global/outputChannel';
|
import { MainOutput } from '../../global/outputChannel';
|
||||||
|
|
||||||
interface XilinxCustom {
|
interface XilinxCustom {
|
||||||
ip_repo: AbsPath,
|
ipRepo: AbsPath,
|
||||||
bdRepo: AbsPath
|
bdRepo: AbsPath
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,88 +49,77 @@ interface BootInfo {
|
|||||||
* xilinx operation under PL
|
* xilinx operation under PL
|
||||||
*/
|
*/
|
||||||
class XilinxOperation {
|
class XilinxOperation {
|
||||||
public setting: vscode.WorkspaceConfiguration;
|
public get xipRepo(): XilinxIP[] {
|
||||||
public xipRepo: XilinxIP[];
|
return opeParam.prjInfo.IP_REPO;
|
||||||
public xipPath: AbsPath;
|
}
|
||||||
public xbdPath: AbsPath;
|
|
||||||
public xilinxPath: AbsPath;
|
|
||||||
public prjPath: AbsPath;
|
|
||||||
public srcPath: AbsPath;
|
|
||||||
public simPath: AbsPath;
|
|
||||||
public datPath: AbsPath;
|
|
||||||
public softSrc: AbsPath;
|
|
||||||
public HWPath: AbsPath;
|
|
||||||
public extensionPath: AbsPath;
|
|
||||||
public prjConfig: PrjInfo;
|
|
||||||
|
|
||||||
public custom: XilinxCustom;
|
public get xipPath(): AbsPath {
|
||||||
public topMod: TopMod;
|
return hdlPath.join(opeParam.extensionPath, 'IP_repo');
|
||||||
public prjInfo: PLPrjInfo;
|
}
|
||||||
|
|
||||||
constructor() {
|
public get xbdPath(): AbsPath {
|
||||||
this.setting = vscode.workspace.getConfiguration();
|
return hdlPath.join(opeParam.extensionPath, 'lib', 'xilinx', 'bd');
|
||||||
|
}
|
||||||
|
|
||||||
this.xipRepo = opeParam.prjInfo.IP_REPO;
|
public get xilinxPath(): AbsPath {
|
||||||
this.xipPath = hdlPath.join(opeParam.extensionPath, 'IP_repo');
|
return hdlPath.join(opeParam.extensionPath, 'resources', 'script', 'xilinx');
|
||||||
this.xbdPath = hdlPath.join(opeParam.extensionPath, 'lib', 'xilinx', 'bd');
|
}
|
||||||
this.xilinxPath = hdlPath.join(opeParam.extensionPath, 'resources', 'script', 'xilinx');
|
|
||||||
|
|
||||||
this.prjPath = opeParam.prjInfo.arch.prjPath;
|
public get prjPath(): AbsPath {
|
||||||
this.srcPath = opeParam.prjInfo.arch.hardware.src;
|
return opeParam.prjInfo.arch.prjPath;
|
||||||
this.simPath = opeParam.prjInfo.arch.hardware.sim;
|
}
|
||||||
this.datPath = opeParam.prjInfo.arch.hardware.data;
|
|
||||||
|
|
||||||
this.softSrc = opeParam.prjInfo.arch.software.src;
|
public get srcPath(): AbsPath {
|
||||||
this.HWPath = fspath.dirname(this.srcPath);
|
return opeParam.prjInfo.arch.hardware.src;
|
||||||
this.extensionPath = opeParam.extensionPath;
|
}
|
||||||
this.prjConfig = opeParam.prjInfo;
|
|
||||||
|
|
||||||
this.custom = {
|
public get simPath(): AbsPath {
|
||||||
ip_repo : this.setting.get('PRJ.xilinx.IP.repo.path', ''),
|
return opeParam.prjInfo.arch.hardware.sim;
|
||||||
bdRepo : this.setting.get('PRJ.xilinx.BD.repo.path', ''),
|
}
|
||||||
|
|
||||||
|
public get datPath(): AbsPath {
|
||||||
|
return opeParam.prjInfo.arch.hardware.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get softSrc(): AbsPath {
|
||||||
|
return opeParam.prjInfo.arch.software.src;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get HWPath(): AbsPath {
|
||||||
|
return fspath.dirname(this.srcPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get extensionPath(): AbsPath {
|
||||||
|
return opeParam.extensionPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get prjConfig(): PrjInfo {
|
||||||
|
return opeParam.prjInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get custom(): XilinxCustom {
|
||||||
|
return {
|
||||||
|
ipRepo: vscode.workspace.getConfiguration().get('PRJ.xilinx.IP.repo.path', ''),
|
||||||
|
bdRepo: vscode.workspace.getConfiguration().get('PRJ.xilinx.BD.repo.path', '')
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
this.topMod = {
|
|
||||||
|
public get topMod(): TopMod {
|
||||||
|
return {
|
||||||
src : opeParam.firstSrcTopModule.name,
|
src : opeParam.firstSrcTopModule.name,
|
||||||
sim : opeParam.firstSimTopModule.name,
|
sim : opeParam.firstSimTopModule.name,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
this.prjInfo = {
|
public get prjInfo(): PLPrjInfo {
|
||||||
|
return {
|
||||||
path : hdlPath.join(this.prjPath, 'xilinx'),
|
path : hdlPath.join(this.prjPath, 'xilinx'),
|
||||||
name : opeParam.prjInfo.prjName.PL,
|
name : opeParam.prjInfo.prjName.PL,
|
||||||
device : opeParam.prjInfo.device
|
device : opeParam.prjInfo.device
|
||||||
};
|
};
|
||||||
|
|
||||||
const _this = this;
|
|
||||||
vscode.workspace.onDidChangeConfiguration(e => _this.getConfig());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getConfig() {
|
|
||||||
this.xipRepo = opeParam.prjInfo.IP_REPO;
|
|
||||||
this.xipPath = hdlPath.join(opeParam.extensionPath, 'IP_repo');
|
|
||||||
this.xbdPath = hdlPath.join(opeParam.extensionPath, 'lib', 'xilinx', 'bd');
|
|
||||||
this.xilinxPath = hdlPath.join(opeParam.extensionPath, 'resources', 'script', 'xilinx');
|
|
||||||
|
|
||||||
this.prjPath = opeParam.prjInfo.arch.prjPath;
|
|
||||||
this.srcPath = opeParam.prjInfo.arch.hardware.src;
|
|
||||||
this.simPath = opeParam.prjInfo.arch.hardware.sim;
|
|
||||||
this.datPath = opeParam.prjInfo.arch.hardware.data;
|
|
||||||
|
|
||||||
this.softSrc = opeParam.prjInfo.arch.software.src;
|
|
||||||
this.HWPath = fspath.dirname(this.srcPath);
|
|
||||||
this.extensionPath = opeParam.extensionPath;
|
|
||||||
this.prjConfig = opeParam.prjInfo;
|
|
||||||
|
|
||||||
this.custom = {
|
|
||||||
ip_repo : this.setting.get('PRJ.xilinx.IP.repo.path', ''),
|
|
||||||
bdRepo : this.setting.get('PRJ.xilinx.BD.repo.path', ''),
|
|
||||||
};
|
|
||||||
|
|
||||||
this.topMod = {
|
|
||||||
src : opeParam.firstSrcTopModule.name,
|
|
||||||
sim : opeParam.firstSimTopModule.name,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xilinx下的launch运行,打开存在的工程或者再没有工程时进行新建
|
* xilinx下的launch运行,打开存在的工程或者再没有工程时进行新建
|
||||||
@ -196,8 +185,8 @@ class XilinxOperation {
|
|||||||
// 导入 IP_repo_paths
|
// 导入 IP_repo_paths
|
||||||
scripts.push(`set xip_repo_paths {}`);
|
scripts.push(`set xip_repo_paths {}`);
|
||||||
|
|
||||||
if (fs.existsSync(this.custom.ip_repo)) {
|
if (fs.existsSync(this.custom.ipRepo)) {
|
||||||
scripts.push(`lappend xip_repo_paths ${this.custom.ip_repo}`);
|
scripts.push(`lappend xip_repo_paths ${this.custom.ipRepo}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.xipRepo.forEach(
|
this.xipRepo.forEach(
|
||||||
|
@ -26,9 +26,8 @@ interface PSConfig {
|
|||||||
* @descriptionCn xilinx工具链下PS端的操作类
|
* @descriptionCn xilinx工具链下PS端的操作类
|
||||||
*/
|
*/
|
||||||
class XilinxOperation {
|
class XilinxOperation {
|
||||||
config: XilinxOperationConfig;
|
public get config(): XilinxOperationConfig {
|
||||||
constructor() {
|
return {
|
||||||
this.config = {
|
|
||||||
path : hdlPath.join(opeParam.extensionPath, 'resources', 'script', 'xilinx', 'soft'),
|
path : hdlPath.join(opeParam.extensionPath, 'resources', 'script', 'xilinx', 'soft'),
|
||||||
hw : "SDK_Platform",
|
hw : "SDK_Platform",
|
||||||
bsp: "BSP_package",
|
bsp: "BSP_package",
|
||||||
@ -43,33 +42,7 @@ class XilinxOperation {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getConfig() {
|
|
||||||
this.config = {
|
|
||||||
path : hdlPath.join(opeParam.extensionPath, 'resources', 'script', 'xilinx', 'soft'),
|
|
||||||
hw : "SDK_Platform",
|
|
||||||
bsp: "BSP_package",
|
|
||||||
dat: opeParam.prjInfo.arch.software.data,
|
|
||||||
src: opeParam.prjInfo.arch.software.src,
|
|
||||||
soc: {
|
|
||||||
core: "ps7_cortexa9_0",
|
|
||||||
bd: "template",
|
|
||||||
app: "Hello World",
|
|
||||||
os: "standalone"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (hdlFile.isHasAttr(opeParam.prjInfo, "soc")) {
|
|
||||||
this.config.soc = opeParam.prjInfo.soc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hdlFile.isHasAttr(opeParam.prjInfo, "prjName.PS")) {
|
|
||||||
this.config.soc.bd = opeParam.prjInfo.prjName.PS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
launch(config: PSConfig) {
|
launch(config: PSConfig) {
|
||||||
this.getConfig();
|
|
||||||
|
|
||||||
const hdfs = hdlFile.pickFileRecursive(this.config.dat, [],
|
const hdfs = hdlFile.pickFileRecursive(this.config.dat, [],
|
||||||
p => p.endsWith('.hdf'));
|
p => p.endsWith('.hdf'));
|
||||||
|
|
||||||
@ -111,8 +84,6 @@ file delete ${scriptPath} -force\n`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
build(config: PSConfig) {
|
build(config: PSConfig) {
|
||||||
this.getConfig();
|
|
||||||
|
|
||||||
const scriptPath = `${this.config.path}/build.tcl`;
|
const scriptPath = `${this.config.path}/build.tcl`;
|
||||||
const script = `
|
const script = `
|
||||||
setws ${this.config.src}
|
setws ${this.config.src}
|
||||||
@ -125,8 +96,6 @@ file delete ${scriptPath} -force\n`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
program(config: PSConfig) {
|
program(config: PSConfig) {
|
||||||
this.getConfig();
|
|
||||||
|
|
||||||
const len = this.config.soc.core.length;
|
const len = this.config.soc.core.length;
|
||||||
const index = this.config.soc.core.slice(len-1, len);
|
const index = this.config.soc.core.slice(len-1, len);
|
||||||
const scriptPath = `${this.config.path}/program.tcl`;
|
const scriptPath = `${this.config.path}/program.tcl`;
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
import { AbsPath, opeParam } from '../global';
|
||||||
|
import { hdlFile, hdlPath } from '../hdlFs';
|
||||||
|
|
||||||
|
class LibManage {
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public get srcPath(): AbsPath {
|
||||||
|
return opeParam.prjInfo.arch.hardware.src;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get simPath(): AbsPath {
|
||||||
|
return opeParam.prjInfo.arch.hardware.sim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get prjPath(): AbsPath {
|
||||||
|
return opeParam.prjInfo.arch.prjPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get localLibPath(): AbsPath {
|
||||||
|
return hdlPath.join(this.srcPath, 'lib');
|
||||||
|
}
|
||||||
|
|
||||||
|
public get sourceLibPath(): AbsPath {
|
||||||
|
return hdlPath.join(opeParam.extensionPath, 'lib');
|
||||||
|
}
|
||||||
|
|
||||||
|
public get libCustomPath(): AbsPath {
|
||||||
|
return opeParam.prjInfo.libCustomPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public processLibFiles() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
@ -3,17 +3,12 @@ import * as vscode from 'vscode';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { AbsPath, opeParam } from '../global';
|
import { AbsPath, opeParam } from '../global';
|
||||||
|
import { PathSet } from '../global/util';
|
||||||
import { RawPrjInfo } from '../global/prjInfo';
|
import { RawPrjInfo } from '../global/prjInfo';
|
||||||
import { ToolChainType } from '../global/enum';
|
import { hdlFile, hdlPath } from '../hdlFs';
|
||||||
|
|
||||||
import { hdlFile, hdlDir, hdlPath } from '../hdlFs';
|
|
||||||
|
|
||||||
class PrjManage {
|
class PrjManage {
|
||||||
setting: vscode.WorkspaceConfiguration;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.setting = vscode.workspace.getConfiguration();
|
|
||||||
|
|
||||||
vscode.commands.registerCommand('digital-ide.property-json.generate',
|
vscode.commands.registerCommand('digital-ide.property-json.generate',
|
||||||
this.generatePropertyJson);
|
this.generatePropertyJson);
|
||||||
vscode.commands.registerCommand('digital-ide.property-json.overwrite',
|
vscode.commands.registerCommand('digital-ide.property-json.overwrite',
|
||||||
@ -31,7 +26,6 @@ class PrjManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// overwrite content in current property.json to property-init.json
|
// overwrite content in current property.json to property-init.json
|
||||||
// TODO test me :D
|
|
||||||
private async overwritePropertyJson() {
|
private async overwritePropertyJson() {
|
||||||
const options = {
|
const options = {
|
||||||
preview: false,
|
preview: false,
|
||||||
@ -79,6 +73,26 @@ class PrjManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getPrjHardwareFiles(): AbsPath[] {
|
||||||
|
const searchPathSet = new PathSet();
|
||||||
|
const hardwareInfo = opeParam.prjInfo.arch.hardware;
|
||||||
|
|
||||||
|
// TODO : make something like .gitignore
|
||||||
|
|
||||||
|
// search src
|
||||||
|
searchPathSet.checkAdd(hardwareInfo.src);
|
||||||
|
|
||||||
|
// search sim
|
||||||
|
searchPathSet.checkAdd(hardwareInfo.sim);
|
||||||
|
|
||||||
|
const searchPaths = searchPathSet.files;
|
||||||
|
return hdlFile.getHDLFiles(searchPaths, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
public initialise() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const prjManage = new PrjManage();
|
const prjManage = new PrjManage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user