This commit is contained in:
锦恢 2025-01-14 23:36:51 +08:00
commit 49ca4653da
26 changed files with 254 additions and 58 deletions

View File

@ -19,4 +19,5 @@ design
lib lib
*.vcd *.vcd
*.zip *.zip
figures figures
scripts

View File

@ -4,7 +4,11 @@
## <code>Digital IDE</code> | All in one <code>vscode</code> plugin for Verilog/VHDL development ## <code>Digital IDE</code> | All in one <code>vscode</code> plugin for Verilog/VHDL development
<<<<<<< HEAD
[Document (New)](https://nc-ai.cn/) | [中文文档 (New)](https://nc-ai.cn/zh/) | [Bilibili Video](https://www.bilibili.com/video/BV1t14y1179V/?spm_id_from=333.999.0.0) [Document (New)](https://nc-ai.cn/) | [中文文档 (New)](https://nc-ai.cn/zh/) | [Bilibili Video](https://www.bilibili.com/video/BV1t14y1179V/?spm_id_from=333.999.0.0)
=======
[Document (New)](https://nc-ai.cn/en/) | [中文文档 (New)](https://nc-ai.cn/) | [Bilibili Video](https://www.bilibili.com/video/BV1t14y1179V/?spm_id_from=333.999.0.0)
>>>>>>> 3838196cca3b041f9324ef7788847a91d45658b6
![](https://img.shields.io/badge/version-0.4.0-purple) ![](https://img.shields.io/badge/version-0.4.0-purple)
![](https://img.shields.io/badge/Verilog-support-green) ![](https://img.shields.io/badge/Verilog-support-green)

View File

@ -117,5 +117,14 @@
"info.addDevice.add-success": "Gerät {0} wurde erfolgreich hinzugefügt", "info.addDevice.add-success": "Gerät {0} wurde erfolgreich hinzugefügt",
"info.delDevice.placeholder": "Wählen Sie das zu löschende Gerät aus", "info.delDevice.placeholder": "Wählen Sie das zu löschende Gerät aus",
"info.delDevice.del-success": "Gerät {0} wurde erfolgreich gelöscht", "info.delDevice.del-success": "Gerät {0} wurde erfolgreich gelöscht",
"info.progress.launch-lsp": "Starten Sie den Digital LSP-Sprachserver" "info.progress.launch-lsp": "Starten Sie den Digital LSP-Sprachserver",
"info.choose.digital-lsp-targz": "Wählen Sie das Digital LSP-Archiv aus",
"info.digital-lsp.targz": "Digitales LSP-Paket",
"error.digital-lsp.incorrect-filename": "Die von Ihnen bereitgestellte Digital-LSP-Archivdatei {0} entspricht nicht der aktuellen Systemarchitektur. Bitte laden Sie die Archivdatei mit dem Namen {1} herunter!",
"error.not-valid-browser": "{0} ist kein gültiger Browser-Pfad!",
"info.config-browser-path": "Browser-Pfad konfigurieren",
"info.pdf.exporting": "PDF wird nach {0} exportiert",
"info.generate-pdf-to": "PDF wurde unter {0} generiert",
"info.vivado-gui.started": "Vivado GUI wird gestartet, bitte warten Sie einen Moment",
"ok": "Gut"
} }

View File

@ -117,5 +117,14 @@
"info.addDevice.add-success": "Device {0} has been successfully added", "info.addDevice.add-success": "Device {0} has been successfully added",
"info.delDevice.placeholder": "Select the device to delete", "info.delDevice.placeholder": "Select the device to delete",
"info.delDevice.del-success": "Device {0} has been successfully deleted", "info.delDevice.del-success": "Device {0} has been successfully deleted",
"info.progress.launch-lsp": "Start the Digital LSP language server" "info.progress.launch-lsp": "Start the Digital LSP language server",
"info.choose.digital-lsp-targz": "Select the Digital LSP archive",
"info.digital-lsp.targz": "Digital LSP Package",
"error.digital-lsp.incorrect-filename": "The digital LSP archive file {0} you provided does not match the current system architecture. Please download the archive file named {1}!",
"error.not-valid-browser": "{0} is not a valid browser path!",
"info.config-browser-path": "Configure browser path",
"info.pdf.exporting": "Exporting PDF to {0}",
"info.generate-pdf-to": "PDF has been generated to {0}",
"info.vivado-gui.started": "Vivado GUI is starting, please wait a moment",
"ok": "Good"
} }

View File

@ -117,5 +117,14 @@
"info.addDevice.add-success": "デバイス {0} が正常に追加されました", "info.addDevice.add-success": "デバイス {0} が正常に追加されました",
"info.delDevice.placeholder": "削除するデバイスを選択してください", "info.delDevice.placeholder": "削除するデバイスを選択してください",
"info.delDevice.del-success": "デバイス {0} は正常に削除されました", "info.delDevice.del-success": "デバイス {0} は正常に削除されました",
"info.progress.launch-lsp": "Digital LSP 言語サーバーを起動する" "info.progress.launch-lsp": "Digital LSP 言語サーバーを起動する",
"info.choose.digital-lsp-targz": "Digital LSPのアーカイブを選択してください",
"info.digital-lsp.targz": "デジタルLSPパッケージ",
"error.digital-lsp.incorrect-filename": "提供されたデジタルLSPアーカイブファイル{0}は、現在のシステムアーキテクチャに適合していません。{1}という名前のアーカイブファイルをダウンロードしてください!",
"error.not-valid-browser": "{0} は有効なブラウザのパスではありません!",
"info.config-browser-path": "ブラウザのパスを設定",
"info.pdf.exporting": "PDFを{0}にエクスポート中",
"info.generate-pdf-to": "PDFは{0}に生成されました",
"info.vivado-gui.started": "Vivado GUI を起動しています、少々お待ちください",
"ok": "良い"
} }

View File

@ -117,5 +117,14 @@
"info.addDevice.add-success": "device {0} 已被成功添加", "info.addDevice.add-success": "device {0} 已被成功添加",
"info.delDevice.placeholder": "选择需要删除的 device", "info.delDevice.placeholder": "选择需要删除的 device",
"info.delDevice.del-success": "device {0} 已被成功删除", "info.delDevice.del-success": "device {0} 已被成功删除",
"info.progress.launch-lsp": "启动 Digital LSP 语言服务器" "info.progress.launch-lsp": "启动 Digital LSP 语言服务器",
"info.choose.digital-lsp-targz": "选择 Digital LSP 的压缩包",
"info.digital-lsp.targz": "Digital LSP 压缩包",
"error.digital-lsp.incorrect-filename": "您提供的 digital lsp 压缩包文件 {0} 并不是一个符合当前系统架构的,请下载名为 {1} 的压缩包文件!",
"error.not-valid-browser": "{0} 并不是一个有效的浏览器路径!",
"info.config-browser-path": "配置浏览器路径",
"info.pdf.exporting": "正在导出 pdf 到 {0}",
"info.generate-pdf-to": "pdf 已经生成至 {0}",
"info.vivado-gui.started": "Vivado GUI 正在启动中,稍等片刻",
"ok": "好的"
} }

View File

@ -117,5 +117,14 @@
"info.addDevice.add-success": "設備 {0} 已成功添加", "info.addDevice.add-success": "設備 {0} 已成功添加",
"info.delDevice.placeholder": "選擇需要刪除的設備", "info.delDevice.placeholder": "選擇需要刪除的設備",
"info.delDevice.del-success": "設備 {0} 已被成功刪除", "info.delDevice.del-success": "設備 {0} 已被成功刪除",
"info.progress.launch-lsp": "啟動 Digital LSP 語言伺服器" "info.progress.launch-lsp": "啟動 Digital LSP 語言伺服器",
"info.choose.digital-lsp-targz": "選擇 Digital LSP 的壓縮包",
"info.digital-lsp.targz": "數位LSP壓縮包",
"error.digital-lsp.incorrect-filename": "您提供的 digital lsp 壓縮包文件 {0} 並不是一個符合當前系統架構的,請下載名為 {1} 的壓縮包文件!",
"error.not-valid-browser": "{0} 並不是一個有效的瀏覽器路徑!",
"info.config-browser-path": "配置瀏覽器路徑",
"info.pdf.exporting": "正在導出PDF到{0}",
"info.generate-pdf-to": "PDF 已生成至 {0}",
"info.vivado-gui.started": "Vivado GUI 正在啟動中,稍等片刻",
"ok": "好的"
} }

View File

@ -608,6 +608,11 @@
"category": "Digital-IDE", "category": "Digital-IDE",
"title": "%digital-ide.digital-lsp.download.title%" "title": "%digital-ide.digital-lsp.download.title%"
}, },
{
"command": "digital-ide.digital-lsp.install",
"category": "Digital-IDE",
"title": "%digital-ide.digital-lsp.install.title%"
},
{ {
"command": "digital-ide.vhdl2vlog", "command": "digital-ide.vhdl2vlog",
"title": "%digital-ide.vhdl2vlog.title%", "title": "%digital-ide.vhdl2vlog.title%",

View File

@ -105,5 +105,6 @@
"digital-ide.function.netlist.schema-mode.0.title": "Prä-Verhaltenssynthese", "digital-ide.function.netlist.schema-mode.0.title": "Prä-Verhaltenssynthese",
"digital-ide.function.netlist.schema-mode.1.title": "Post-Verhaltenssynthese", "digital-ide.function.netlist.schema-mode.1.title": "Post-Verhaltenssynthese",
"digital-ide.function.netlist.schema-mode.2.title": "Post-RTL-Synthese", "digital-ide.function.netlist.schema-mode.2.title": "Post-RTL-Synthese",
"digital-ide.run-ys.title": "yosys-Skript ausführen" "digital-ide.run-ys.title": "yosys-Skript ausführen",
"digital-ide.digital-lsp.install.title": "Digital LSP-Sprachserver installieren"
} }

View File

@ -105,5 +105,6 @@
"digital-ide.function.netlist.schema-mode.0.title": "ビヘイビア前合成", "digital-ide.function.netlist.schema-mode.0.title": "ビヘイビア前合成",
"digital-ide.function.netlist.schema-mode.1.title": "ビヘイビア後合成", "digital-ide.function.netlist.schema-mode.1.title": "ビヘイビア後合成",
"digital-ide.function.netlist.schema-mode.2.title": "RTL後合成", "digital-ide.function.netlist.schema-mode.2.title": "RTL後合成",
"digital-ide.run-ys.title": "yosys スクリプトを実行" "digital-ide.run-ys.title": "yosys スクリプトを実行",
"digital-ide.digital-lsp.install.title": "Digital LSP 言語サーバーをインストール"
} }

View File

@ -105,5 +105,6 @@
"digital-ide.function.netlist.schema-mode.0.title": "Pre-Behavioral Synthesis", "digital-ide.function.netlist.schema-mode.0.title": "Pre-Behavioral Synthesis",
"digital-ide.function.netlist.schema-mode.1.title": "Post-Behavioral Synthesis", "digital-ide.function.netlist.schema-mode.1.title": "Post-Behavioral Synthesis",
"digital-ide.function.netlist.schema-mode.2.title": "Post-RTL Synthesis", "digital-ide.function.netlist.schema-mode.2.title": "Post-RTL Synthesis",
"digital-ide.run-ys.title": "Run yosys script" "digital-ide.run-ys.title": "Run yosys script",
"digital-ide.digital-lsp.install.title": "Install Digital LSP Language Server"
} }

View File

@ -105,5 +105,6 @@
"digital-ide.function.netlist.schema-mode.0.title": "行为前综合", "digital-ide.function.netlist.schema-mode.0.title": "行为前综合",
"digital-ide.function.netlist.schema-mode.1.title": "行为后综合", "digital-ide.function.netlist.schema-mode.1.title": "行为后综合",
"digital-ide.function.netlist.schema-mode.2.title": "RTL后综合", "digital-ide.function.netlist.schema-mode.2.title": "RTL后综合",
"digital-ide.run-ys.title": "运行 yosys 脚本" "digital-ide.run-ys.title": "运行 yosys 脚本",
"digital-ide.digital-lsp.install.title": "安装 Digital LSP 语言服务器"
} }

View File

@ -105,5 +105,6 @@
"digital-ide.function.netlist.schema-mode.0.title": "行為前綜合", "digital-ide.function.netlist.schema-mode.0.title": "行為前綜合",
"digital-ide.function.netlist.schema-mode.1.title": "行為後綜合", "digital-ide.function.netlist.schema-mode.1.title": "行為後綜合",
"digital-ide.function.netlist.schema-mode.2.title": "RTL後綜合", "digital-ide.function.netlist.schema-mode.2.title": "RTL後綜合",
"digital-ide.run-ys.title": "運行 yosys 腳本" "digital-ide.run-ys.title": "運行 yosys 腳本",
"digital-ide.digital-lsp.install.title": "安裝 Digital LSP 語言伺服器"
} }

View File

@ -198,7 +198,8 @@
"xc7a35tftg256-1", "xc7a35tftg256-1",
"xc7a35tcsg324-1", "xc7a35tcsg324-1",
"xc7z035ffg676-2", "xc7z035ffg676-2",
"xc7z020clg484-1" "xc7z020clg484-1",
"hello-world"
] ]
} }
}, },

View File

@ -1,27 +0,0 @@
open_hw -quiet
connect_hw_server -quiet
set found 0
foreach hw_target [get_hw_targets] {
current_hw_target $hw_target
open_hw_target -quiet
foreach hw_device [get_hw_devices] {
if { [string equal -length 6 [get_property PART $hw_device] xc7z020clg400-2] == 1 } {
puts "------Successfully Found Hardware Target with a xc7z020clg400-2 device------ "
current_hw_device $hw_device
set found 1
}
}
if {$found == 1} {break}
close_hw_target
}
#download the hw_targets
if {$found == 0 } {
puts "******ERROR : Did not find any Hardware Target with a xc7z020clg400-2 device****** "
} else {
set_property PROGRAM.FILE ./[current_project].bit [current_hw_device]
program_hw_devices [current_hw_device] -quiet
disconnect_hw_server -quiet
}
file delete /home/dide/project/Digital-IDE/resources/script/xilinx/program.tcl -force

View File

@ -64,12 +64,12 @@ def modify_vsix():
os.remove(dist_path) os.remove(dist_path)
# webview # webview
print("") print("move netlist")
copy_dir('./resources/dide-netlist/view', os.path.join(extract_folder, 'extension', 'resources', 'dide-netlist', 'view')) copy_dir('./resources/dide-netlist/view', os.path.join(extract_folder, 'extension', 'resources', 'dide-netlist', 'view'))
copy_dir('./resources/dide-netlist/static/share', os.path.join(extract_folder, 'extension', 'resources', 'dide-viewer', 'static', 'share')) copy_dir('./resources/dide-netlist/static/share', os.path.join(extract_folder, 'extension', 'resources', 'dide-netlist', 'static', 'share'))
copy_file('./resources/dide-netlist/static/yosys.wasm', os.path.join(extract_folder, 'extension', 'resources', 'dide-viewer', 'static', 'yosys.wasm')) copy_file('./resources/dide-netlist/static/yosys.wasm', os.path.join(extract_folder, 'extension', 'resources', 'dide-netlist', 'static', 'yosys.wasm'))
print("") print("move vcd")
copy_dir('./resources/dide-viewer/view', os.path.join(extract_folder, 'extension', 'resources', 'dide-viewer', 'view')) copy_dir('./resources/dide-viewer/view', os.path.join(extract_folder, 'extension', 'resources', 'dide-viewer', 'view'))
# remake # remake
@ -96,6 +96,9 @@ def install_extension():
vsix_path = os.path.join('dist', vsix_files[0]) vsix_path = os.path.join('dist', vsix_files[0])
os.system('code --install-extension ' + vsix_path) os.system('code --install-extension ' + vsix_path)
if os.path.exists('dist'):
shutil.rmtree('dist')
pipe = CommandPipe() pipe = CommandPipe()
pipe.add_command('uninstall original extension', 'code --uninstall-extension sterben.fpga-support') pipe.add_command('uninstall original extension', 'code --uninstall-extension sterben.fpga-support')
pipe.add_command('compile typescript', 'tsc -p ./ --outDir out-js') pipe.add_command('compile typescript', 'tsc -p ./ --outDir out-js')

View File

@ -43,6 +43,11 @@ function registerFileDocExport(context: vscode.ExtensionContext) {
new ExportFunctionItem('html', ' html', 'only support light theme', exportCurrentFileDocAsHTML) new ExportFunctionItem('html', ' html', 'only support light theme', exportCurrentFileDocAsHTML)
]; ];
if (uri === undefined && vscode.window.activeTextEditor) {
// TODO: 制作新的 doc UI
uri = vscode.Uri.file(vscode.window.activeTextEditor.document.fileName);
}
const item = await vscode.window.showQuickPick(items, option); const item = await vscode.window.showQuickPick(items, option);
if (item) { if (item) {
item.exportFunc(uri); item.exportFunc(uri);

View File

@ -5,6 +5,7 @@ import * as puppeteer from 'puppeteer-core';
import { makeShowHTML } from './html'; import { makeShowHTML } from './html';
import { hdlFile, hdlPath } from '../../hdlFs'; import { hdlFile, hdlPath } from '../../hdlFs';
import { AbsPath, MainOutput, opeParam, ReportType } from '../../global'; import { AbsPath, MainOutput, opeParam, ReportType } from '../../global';
import { t } from '../../i18n';
// TODO : finish it in each platform // TODO : finish it in each platform
function getDefaultBrowerPath(): AbsPath { function getDefaultBrowerPath(): AbsPath {
@ -27,10 +28,18 @@ function getDefaultBrowerPath(): AbsPath {
async function htmlFile2PdfFile(htmlPath: AbsPath, pdfPath: AbsPath) { async function htmlFile2PdfFile(htmlPath: AbsPath, pdfPath: AbsPath) {
const pdfConfig = vscode.workspace.getConfiguration("digital-ide.function.doc.pdf"); const pdfConfig = vscode.workspace.getConfiguration("digital-ide.function.doc.pdf");
const platformDefaultBrowerPath = getDefaultBrowerPath(); const platformDefaultBrowerPath = getDefaultBrowerPath();
const browserPath = pdfConfig.get('browserPath', platformDefaultBrowerPath);
const browserPath = pdfConfig.get<string>('browserPath') || platformDefaultBrowerPath;
if (!fs.existsSync(browserPath)) { if (!fs.existsSync(browserPath)) {
vscode.window.showErrorMessage("Path " + browserPath + " is not a valid browser path!"); const res = await vscode.window.showErrorMessage(
t('error.not-valid-browser', browserPath),
{ title: t('info.config-browser-path'), value: true }
);
if (res?.value) {
await vscode.commands.executeCommand('workbench.action.openSettings', 'digital-ide.function.doc.pdf.browserPath');
}
return; return;
} }
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
@ -48,7 +57,7 @@ async function htmlFile2PdfFile(htmlPath: AbsPath, pdfPath: AbsPath) {
scale: pdfConfig.scale, scale: pdfConfig.scale,
displayHeaderFooter: pdfConfig.displayHeaderFooter, displayHeaderFooter: pdfConfig.displayHeaderFooter,
headerTemplate: pdfConfig.headerTemplate, headerTemplate: pdfConfig.headerTemplate,
footerTemplate: pdfConfig.footerTemplate, footerTemplate: `<div style="font-size: 15px; margin: 0 auto;">CodeDoc - Powered By Digital IDE</div>`,
printBackground: pdfConfig.printBackground, printBackground: pdfConfig.printBackground,
landscape: pdfConfig.landscape, landscape: pdfConfig.landscape,
format: pdfConfig.format, format: pdfConfig.format,
@ -74,7 +83,8 @@ async function exportCurrentFileDocAsPDF(uri: vscode.Uri) {
return vscode.window.withProgress({ return vscode.window.withProgress({
location: vscode.ProgressLocation.Notification, location: vscode.ProgressLocation.Notification,
title: '[Digital-IDE]: Export ' + currentFilePath + '...' title: t('info.pdf.exporting', currentFilePath),
cancellable: true
}, async progress => { }, async progress => {
try { try {
const html = await makeShowHTML(uri, "pdf"); const html = await makeShowHTML(uri, "pdf");
@ -102,15 +112,18 @@ async function exportCurrentFileDocAsPDF(uri: vscode.Uri) {
fs.writeFileSync(tempHtmlPath, html); fs.writeFileSync(tempHtmlPath, html);
await htmlFile2PdfFile(tempHtmlPath, pdfPath); await htmlFile2PdfFile(tempHtmlPath, pdfPath);
hdlFile.rmSync(tempHtmlPath); // hdlFile.rmSync(tempHtmlPath);
// 在当前编辑器中打开生成的 pdf // 在当前编辑器中打开生成的 pdf
vscode.window.showInformationMessage('pdf generated at ' + pdfPath); if (fs.existsSync(pdfPath)) {
vscode.window.showInformationMessage(t('info.generate-pdf-to', pdfFolderPath));
}
} catch (error) { } catch (error) {
MainOutput.report("error happen in export pdf: " + error, { MainOutput.report("error happen in export pdf: " + error, {
level: ReportType.Error level: ReportType.Error
}); });
return;
} }
}); });
} }

View File

@ -170,7 +170,7 @@ async function html2pdf(htmlPath: string, pdfPath: string, moduleName: string, w
scale: 1, scale: 1,
displayHeaderFooter: true, displayHeaderFooter: true,
// headerTemplate: `<div style="font-size: 12px; margin-left: 1cm;">module ${moduleName}</div>`, // headerTemplate: `<div style="font-size: 12px; margin-left: 1cm;">module ${moduleName}</div>`,
footerTemplate: `<div style="font-size: 15px; margin: 0 auto;">Netlist for <code>${moduleName}</code> - 由 Digital IDE 生成 </div>`, footerTemplate: `<div style="font-size: 15px; margin: 0 auto;">Netlist for <code>${moduleName}</code> - Powered By Digital IDE</div>`,
printBackground: true, printBackground: true,
landscape: true, landscape: true,
width: width width: width

View File

@ -20,7 +20,6 @@ interface SimpleOpe {
extensionPath: string extensionPath: string
} }
const workerScriptPath = hdlPath.join(__dirname, 'worker.js');
class NetlistRender { class NetlistRender {
panel?: vscode.WebviewPanel; panel?: vscode.WebviewPanel;
@ -177,6 +176,7 @@ function checkResource() {
export async function openNetlistViewer(context: vscode.ExtensionContext, uri: vscode.Uri, moduleName: string) { export async function openNetlistViewer(context: vscode.ExtensionContext, uri: vscode.Uri, moduleName: string) {
checkResource(); checkResource();
const workerScriptPath = hdlPath.join(opeParam.extensionPath, 'out', 'function', 'dide-netlist', 'worker.js');
const worker = new Worker(workerScriptPath); const worker = new Worker(workerScriptPath);
let success = true; let success = true;
@ -245,6 +245,7 @@ async function showErrorLogFile(data: any) {
export async function runYsScript(context: vscode.ExtensionContext, uri: vscode.Uri) { export async function runYsScript(context: vscode.ExtensionContext, uri: vscode.Uri) {
checkResource(); checkResource();
const workerScriptPath = hdlPath.join(opeParam.extensionPath, 'out', 'function', 'dide-netlist', 'worker.js');
const worker = new Worker(workerScriptPath); const worker = new Worker(workerScriptPath);
worker.on('message', message => { worker.on('message', message => {

View File

@ -311,6 +311,7 @@ class Netlist {
wasi_snapshot_preview1: wasi.wasiImport wasi_snapshot_preview1: wasi.wasiImport
}); });
try { try {
const exitCode = wasi.start(instance); const exitCode = wasi.start(instance);
} catch (error) { } catch (error) {

View File

@ -16,7 +16,7 @@ import * as FSM from './fsm';
import * as Netlist from './dide-netlist'; import * as Netlist from './dide-netlist';
import * as WaveView from './dide-viewer'; import * as WaveView from './dide-viewer';
import { ModuleDataItem } from './treeView/tree'; import { ModuleDataItem } from './treeView/tree';
import { downloadLsp } from './lsp-client'; import { downloadLsp, installLsp } from './lsp-client';
import { hdlPath } from '../hdlFs'; import { hdlPath } from '../hdlFs';
function registerDocumentation(context: vscode.ExtensionContext) { function registerDocumentation(context: vscode.ExtensionContext) {
@ -101,6 +101,13 @@ function registerLsp(context: vscode.ExtensionContext, version: string) {
downloadLsp(context, version, versionFolderPath) downloadLsp(context, version, versionFolderPath)
}); });
vscode.commands.registerCommand('digital-ide.digital-lsp.install', () => {
const versionFolderPath = context.asAbsolutePath(
path.join('resources', 'dide-lsp', 'server', version)
);
installLsp(context, version, versionFolderPath);
});
const vlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'verilog'}; const vlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'verilog'};
const svlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'systemverilog'}; const svlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'systemverilog'};
const vhdlSelector: vscode.DocumentSelector = {scheme: 'file', language: 'vhdl'}; const vhdlSelector: vscode.DocumentSelector = {scheme: 'file', language: 'vhdl'};

View File

@ -1,16 +1,21 @@
import axios from 'axios'; import axios from 'axios';
import { performance } from 'perf_hooks'; import { performance } from 'perf_hooks';
export function getLspFileName(version: string, signature: string) {
return `digital-lsp_${version}_${signature}.tar.gz`;
}
// const link1 = 'https://gitee.com/Digital-IDE/Digital-IDE/releases/download/0.4.0/digital-lsp_0.4.0_darwin_aarch64.tar.gz'; // const link1 = 'https://gitee.com/Digital-IDE/Digital-IDE/releases/download/0.4.0/digital-lsp_0.4.0_darwin_aarch64.tar.gz';
// const link2 = 'https://github.com/Digital-EDA/Digital-IDE/releases/download/0.4.0/digital-lsp_0.4.0_darwin_aarch64.tar.gz'; // const link2 = 'https://github.com/Digital-EDA/Digital-IDE/releases/download/0.4.0/digital-lsp_0.4.0_darwin_aarch64.tar.gz';
export function getGithubDownloadLink(signature: string, version: string): string { export function getGithubDownloadLink(signature: string, version: string): string {
return `https://github.com/Digital-EDA/Digital-IDE/releases/download/${version}/digital-lsp_${version}_${signature}.tar.gz`; const filename = getLspFileName(version, signature);
return `https://github.com/Digital-EDA/Digital-IDE/releases/download/${version}/${filename}`;
} }
export function getGiteeDownloadLink(signature: string, version: string): string { export function getGiteeDownloadLink(signature: string, version: string): string {
return `https://gitee.com/Digital-IDE/Digital-IDE/releases/download/${version}/digital-lsp_${version}_${signature}.tar.gz`; const filename = getLspFileName(version, signature);
return `https://gitee.com/Digital-IDE/Digital-IDE/releases/download/${version}/${filename}`;
} }
function measureRequestTimecost(url: string, timeout: number = 5): Promise<number> { function measureRequestTimecost(url: string, timeout: number = 5): Promise<number> {

View File

@ -13,7 +13,7 @@ import * as tar from 'tar';
import { platform } from "os"; import { platform } from "os";
import { IProgress, LspClient, opeParam } from '../../global'; import { IProgress, LspClient, opeParam } from '../../global';
import axios, { AxiosResponse } from "axios"; import axios, { AxiosResponse } from "axios";
import { chooseBestDownloadSource } from "./cdn"; import { chooseBestDownloadSource, getLspFileName } from "./cdn";
import { hdlDir, hdlPath } from "../../hdlFs"; import { hdlDir, hdlPath } from "../../hdlFs";
import { registerConfigurationUpdater, registerLinter } from "./config"; import { registerConfigurationUpdater, registerLinter } from "./config";
import { t } from "../../i18n"; import { t } from "../../i18n";
@ -115,7 +115,7 @@ export async function downloadLsp(context: vscode.ExtensionContext, version: str
console.log('choose download link: ' + downloadLink); console.log('choose download link: ' + downloadLink);
clearInterval(intervalHandler); clearInterval(intervalHandler);
return downloadLink return downloadLink;
}); });
const tarGzFilePath = await vscode.window.withProgress({ const tarGzFilePath = await vscode.window.withProgress({
@ -142,6 +142,48 @@ export async function downloadLsp(context: vscode.ExtensionContext, version: str
return false; return false;
} }
export async function installLsp(context: vscode.ExtensionContext, version: string, versionFolderPath: string): Promise<boolean> {
const uri = await vscode.window.showOpenDialog({
title: t('info.choose.digital-lsp-targz'),
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
filters: {
[t('info.digital-lsp.targz')]: ['tar.gz'],
[t('info.vcd-viewer.all-file')]: ['*']
}
});
if (!uri) {
return false;
}
const tarGzFilePath = uri[0].fsPath;
const filename = path.basename(tarGzFilePath);
const signature = getPlatformPlatformSignature().toString();
const expectFilename = getLspFileName(version, signature);
if (expectFilename !== filename) {
vscode.window.showErrorMessage(t('error.digital-lsp.incorrect-filename', filename, expectFilename));
return false;
}
await vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: t('info.progress.extract-digital-lsp')
}, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
if (fs.existsSync(tarGzFilePath)) {
console.log('check finish, begin to extract');
await extractTarGz(tarGzFilePath, versionFolderPath);
} else {
vscode.window.showErrorMessage(t('error.lsp.download-digital-lsp') + version);
}
});
return false;
}
export async function activate(context: vscode.ExtensionContext, packageJson: any) { export async function activate(context: vscode.ExtensionContext, packageJson: any) {
const version = packageJson.version; const version = packageJson.version;
await checkAndDownload(context, version); await checkAndDownload(context, version);

View File

@ -444,6 +444,10 @@ class XilinxOperation {
* @param context * @param context
*/ */
public refresh(context: PLContext) { public refresh(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Refresh",
{ title: 'ok', value: true }
);
const cmd = this.getRefreshXprDesignSourceCommand(); const cmd = this.getRefreshXprDesignSourceCommand();
context.process?.stdin.write(cmd + '\n'); context.process?.stdin.write(cmd + '\n');
} }
@ -477,6 +481,11 @@ class XilinxOperation {
} }
public simulateGui(context: PLContext) { public simulateGui(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Simulate GUI",
{ title: 'ok', value: true }
);
const scriptPath = `${this.xilinxPath}/simulate.tcl`; const scriptPath = `${this.xilinxPath}/simulate.tcl`;
const script = ` const script = `
@ -508,6 +517,11 @@ file delete ${scriptPath} -force\n`;
} }
public simulateCli(context: PLContext) { public simulateCli(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Simulate CLI",
{ title: 'ok', value: true }
);
const scriptPath = hdlPath.join(this.xilinxPath, 'simulate.tcl'); const scriptPath = hdlPath.join(this.xilinxPath, 'simulate.tcl');
const script = ` const script = `
if {[current_sim] != ""} { if {[current_sim] != ""} {
@ -536,6 +550,11 @@ file delete ${scriptPath} -force\n`;
} }
public synth(context: PLContext) { public synth(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Synth",
{ title: 'ok', value: true }
);
let quietArg = ''; let quietArg = '';
if (opeParam.prjInfo.enableShowLog) { if (opeParam.prjInfo.enableShowLog) {
quietArg = '-quiet'; quietArg = '-quiet';
@ -550,6 +569,11 @@ file delete ${scriptPath} -force\n`;
} }
impl(context: PLContext) { impl(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Impl",
{ title: 'ok', value: true }
);
let quietArg = ''; let quietArg = '';
if (opeParam.prjInfo.enableShowLog) { if (opeParam.prjInfo.enableShowLog) {
quietArg = '-quiet'; quietArg = '-quiet';
@ -566,6 +590,10 @@ file delete ${scriptPath} -force\n`;
} }
build(context: PLContext) { build(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Build",
{ title: 'ok', value: true }
);
let quietArg = ''; let quietArg = '';
if (this.prjConfig.enableShowLog) { if (this.prjConfig.enableShowLog) {
quietArg = '-quiet'; quietArg = '-quiet';
@ -595,6 +623,11 @@ file delete ${scriptPath} -force\n`;
generateBit(context: PLContext) { generateBit(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: BitStream",
{ title: 'ok', value: true }
);
let scripts: string[] = []; let scripts: string[] = [];
let core = this.prjConfig.soc.core; let core = this.prjConfig.soc.core;
let sysdefPath = `${this.prjInfo.path}/${this.prjInfo.name}.runs` + let sysdefPath = `${this.prjInfo.path}/${this.prjInfo.name}.runs` +
@ -626,6 +659,11 @@ file delete ${scriptPath} -force\n`;
} }
program(context: PLContext) { program(context: PLContext) {
vscode.window.showInformationMessage(
"Xilinx: Program",
{ title: 'ok', value: true }
);
let scriptPath = `${this.xilinxPath}/program.tcl`; let scriptPath = `${this.xilinxPath}/program.tcl`;
let script = ` let script = `
open_hw -quiet open_hw -quiet
@ -672,6 +710,10 @@ file delete ${scriptPath} -force\n`;
} }
tclProcess.stdin.write('start_gui -quiet\n'); tclProcess.stdin.write('start_gui -quiet\n');
vscode.window.showInformationMessage(
t('info.vivado-gui.started'),
{ title: t('ok'), value: true }
);
HardwareOutput.report(t('info.pl.gui.report-title'), { HardwareOutput.report(t('info.pl.gui.report-title'), {
level: ReportType.Info level: ReportType.Info
}); });

View File

@ -342,18 +342,53 @@ class PrjManage {
continue; continue;
} }
const sourcePath = hdlPath.join(workspace, file);
if (file.startsWith(plname)) { if (file.startsWith(plname)) {
const targetFolder = hdlPath.join(workspace, 'prj', 'xilinx'); const targetFolder = hdlPath.join(workspace, 'prj', 'xilinx');
const sourcePath = hdlPath.join(workspace, file);
hdlFile.move(sourcePath, targetFolder); hdlFile.move(sourcePath, targetFolder);
} else { } else {
// 排除非 hdl 文件
if (hdlFile.isFile(sourcePath) && !hdlFile.isHDLFile(sourcePath)) {
continue;
}
const targetFolder = hdlPath.join(workspace, 'user', 'src'); const targetFolder = hdlPath.join(workspace, 'user', 'src');
const sourcePath = hdlPath.join(workspace, file);
hdlFile.move(sourcePath, targetFolder); hdlFile.move(sourcePath, targetFolder);
} }
} }
} }
/**
* @description Xilinx BD
*
* bd ${workspace}/${plname}.srcs/sources_xxx/bd
*/
function transformBD(
matchPrefix: string,
workspace: string,
plname: string
) {
const xilinxSrcsPath = hdlPath.join(workspace, plname + '.srcs');
const standardBdPath = hdlPath.join(workspace, 'user', 'bd');
if (!fs.existsSync(xilinxSrcsPath)) {
return;
}
const sourceNames = fs.readdirSync(xilinxSrcsPath).filter(filename => filename.startsWith(matchPrefix));
for (const sn of sourceNames) {
const bdPath = hdlPath.join(xilinxSrcsPath, sn, 'bd');
if (!hdlFile.isDir(bdPath)) {
continue;
}
for (const bdname of fs.readdirSync(bdPath)) {
const sourcePath = hdlPath.join(bdPath, bdname);
hdlDir.mvdir(sourcePath, standardBdPath, true);
}
hdlDir.rmdir(bdPath);
}
}
/** /**
* @description Xilinx IP * @description Xilinx IP
* *
@ -481,11 +516,15 @@ class PrjManage {
// 创建标准项目结构基本文件夹 // 创建标准项目结构基本文件夹
// xilinx prj // xilinx prj
hdlDir.mkdir(hdlPath.join(workspacePath, 'prj', 'xilinx')); hdlDir.mkdir(hdlPath.join(workspacePath, 'prj', 'xilinx'));
// hardware // hardware
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'src')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'src'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sim')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sim'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'data')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'data'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'ip')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'ip'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'bd'));
// software // software
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk', 'data')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk', 'data'));
@ -498,6 +537,10 @@ class PrjManage {
transformIP('sources_', workspacePath, plname); transformIP('sources_', workspacePath, plname);
transformIP('sim_', workspacePath, plname); transformIP('sim_', workspacePath, plname);
// 迁移 BD
transformBD('sources_', workspacePath, plname);
transformBD('sim_', workspacePath, plname);
// 迁移文件夹 ${workspace}/${plname}.srcs // 迁移文件夹 ${workspace}/${plname}.srcs
transformXilinxPL('src', 'sources_', workspacePath, plname); transformXilinxPL('src', 'sources_', workspacePath, plname);
transformXilinxPL('sim', 'sim_', workspacePath, plname); transformXilinxPL('sim', 'sim_', workspacePath, plname);