From 7136bad4b49abdad3e07be114f60e221239600a7 Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 5 Jan 2025 14:50:06 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20i18n=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- digital-netlist-render | 1 + package.nls.json | 2 +- package.nls.zh-cn.json | 2 +- package.nls.zh-tw.json | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 160000 digital-netlist-render diff --git a/digital-netlist-render b/digital-netlist-render new file mode 160000 index 0000000..f148e9a --- /dev/null +++ b/digital-netlist-render @@ -0,0 +1 @@ +Subproject commit f148e9a24fbafd144c3961b36ebd6c3266335beb diff --git a/package.nls.json b/package.nls.json index 1585a9f..9dd6a3b 100644 --- a/package.nls.json +++ b/package.nls.json @@ -6,7 +6,7 @@ "digital-ide.hdlDoc.showWebview.title": "Show the document of current file in a webview", "digital-ide.tool.instance.title": "Generate instance template from selected module", "digital-ide.tool.testbench.title": "Generate testbench template from current file", - "digital-ide.tool.icarus.simulateFile.title": "Do simulation for current file", + "digital-ide.tool.icarus.simulateFile.title": "Do simulation for current module", "digital-ide.treeView.arch.expand.title": "Expand 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", diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index 0d1b078..5a0275e 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -6,7 +6,7 @@ "digital-ide.hdlDoc.showWebview.title": "在 webview 中展示文档", "digital-ide.tool.instance.title": "生成选中 module 的例化模板", "digital-ide.tool.testbench.title": "从当前文件中选择 module 生成 testbench", - "digital-ide.tool.icarus.simulateFile.title": "对当前文件进行仿真", + "digital-ide.tool.icarus.simulateFile.title": "对当前模块进行仿真", "digital-ide.treeView.arch.expand.title": "展开视图中的所有项目", "digital-ide.treeView.arch.collapse.title": "收起视图中的所有项目", "digital-ide.treeView.arch.refresh.title": "刷新树视图", diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index 81fecd8..89c0f2f 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -6,7 +6,7 @@ "digital-ide.hdlDoc.showWebview.title": "在 webview 中展示文檔", "digital-ide.tool.instance.title": "生成選中 module 的例化模板", "digital-ide.tool.testbench.title": "從當前文件中選擇 module 生成 testbench", - "digital-ide.tool.icarus.simulateFile.title": "對當前文件進行仿真", + "digital-ide.tool.icarus.simulateFile.title": "對當前文模块進行仿真", "digital-ide.treeView.arch.expand.title": "展開視圖中的所有項目", "digital-ide.treeView.arch.collapse.title": "收起視圖中的所有項目", "digital-ide.treeView.arch.refresh.title": "刷新樹視圖", From 541c53c5931ccae39c5f9517d0c9c4f1ec4d2205 Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 5 Jan 2025 14:50:52 +0800 Subject: [PATCH 2/6] delete --- digital-netlist-render | 1 - 1 file changed, 1 deletion(-) delete mode 160000 digital-netlist-render diff --git a/digital-netlist-render b/digital-netlist-render deleted file mode 160000 index f148e9a..0000000 --- a/digital-netlist-render +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f148e9a24fbafd144c3961b36ebd6c3266335beb From ce5e69e6f0469ebab8aaf7428035238f2666f047 Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 5 Jan 2025 16:01:23 +0800 Subject: [PATCH 3/6] update --- snippets/svlog.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/svlog.json b/snippets/svlog.json index f66795b..2985515 100644 --- a/snippets/svlog.json +++ b/snippets/svlog.json @@ -278,7 +278,7 @@ " output [OWIDTH - 1 : 0] ${4:data_o}", ");", " $5", - "endmodule //$1\n" + "endmodule" ], "description": "Insert a module with parameter" }, From a143ec8573c57f978671f3717d76d2b680f88000 Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 5 Jan 2025 16:27:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20netlist=20=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E7=9A=84=20range=20=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function/dide-netlist/api.ts | 2 +- src/function/sim/simulate.ts | 45 +++++++++++++++++++++++--------- src/hdlParser/core.ts | 2 +- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/function/dide-netlist/api.ts b/src/function/dide-netlist/api.ts index f7ee665..46ba9df 100644 --- a/src/function/dide-netlist/api.ts +++ b/src/function/dide-netlist/api.ts @@ -125,7 +125,7 @@ export async function gotoDefinition(data: any, panel: vscode.WebviewPanel) { const uri = vscode.Uri.file(getRealPath(path)); await vscode.commands.executeCommand('vscode.open', uri, { selection: new vscode.Range( - new vscode.Position(range.start.line, range.end.character), + new vscode.Position(range.start.line, range.start.character), new vscode.Position(range.end.line, range.end.character) ) }); diff --git a/src/function/sim/simulate.ts b/src/function/sim/simulate.ts index dd5916d..7bce328 100644 --- a/src/function/sim/simulate.ts +++ b/src/function/sim/simulate.ts @@ -189,7 +189,6 @@ class IcarusSimulate extends Simulate { /** * @description 生成用于进行仿真的依赖项相关的参数 - * @param dependences * @returns */ private makeDependenceArguments(dependences: string[]): string { @@ -236,9 +235,6 @@ class IcarusSimulate extends Simulate { /** * @description 获取 iverilog 仿真的命令 - * @param name name of top module - * @param path path of the simulated file - * @param dependences dependence that not specified in `include macro * @returns */ private getCommand(name: string, path: AbsPath, dependences: string[]): string | undefined { @@ -276,9 +272,38 @@ class IcarusSimulate extends Simulate { const argu = '-g' + iverilogCompileOptions.standard; const outVvpPath = makeSafeArgPath(hdlPath.join(simConfig.simulationHome, name + '.vvp')); const mainPath = makeSafeArgPath(path); - - const cmd = `${iverilogPath} ${argu} -o ${outVvpPath} -s ${name} ${macroIncludeArgs} ${thirdLibraryDirArgs} ${mainPath} ${dependenceArgs} ${thirdLibraryFileArgs}`; - return cmd; + + const args = []; + if (macroIncludeArgs) { + args.push(macroIncludeArgs); + } + + if (thirdLibraryDirArgs) { + args.push(thirdLibraryDirArgs); + } + + if (mainPath) { + args.push(mainPath); + } + + if (dependenceArgs) { + args.push(dependenceArgs); + } + + if (thirdLibraryFileArgs) { + args.push(thirdLibraryFileArgs); + } + + const extaArgs = args.join(' '); + let command = `${iverilogPath} ${argu} -o ${outVvpPath} -s ${name}`; + if (extaArgs) { + command += ' ' + extaArgs; + } + + const parent = fspath.dirname(path); + command += ' ' + '-I"' + parent + '"'; + + return command; } private execInTerminal(command: string, cwd: AbsPath, hdlModule: HdlModule) { @@ -332,10 +357,6 @@ class IcarusSimulate extends Simulate { /** * @description 运行 iverilog xxx 的命令 - * @param simConfig - * @param command - * @param cwd - * @param hdlModule */ private runIverilog(simConfig: SimulateConfig, command: string, cwd: string, hdlModule: HdlModule) { child_process.exec(command, (error, stdout, stderr) => { @@ -369,8 +390,6 @@ class IcarusSimulate extends Simulate { /** * @description 陨星 vvp xxx 的命令 - * @param command - * @param cwd */ private runVvp(command: string, cwd: string) { child_process.exec(command, { cwd }, (error, stdout, stderr) => { diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts index 94eb2db..93d0ac9 100644 --- a/src/hdlParser/core.ts +++ b/src/hdlParser/core.ts @@ -885,7 +885,7 @@ class HdlModule { const instModName = rawHdlInstance.type; if (this.languageId === HdlLangID.Verilog || this.languageId === HdlLangID.SystemVerilog) { - const searchResult = this.searchInstModPath(instModName); + const searchResult = this.searchInstModPath(instModName); const hdlInstance = new HdlInstance(rawHdlInstance.name, rawHdlInstance.type, searchResult.path, From cff21c2572bac39a77a39af5583a5471dfa9634b Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 5 Jan 2025 17:35:03 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E4=BB=BF=E7=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function/sim/simulate.ts | 17 ++++++++++------- src/global/outputChannel.ts | 29 ++++++++++++++++++++++++----- src/hdlParser/core.ts | 2 ++ syntaxes/digital-ide-output.json | 15 +++++++++++++++ 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/function/sim/simulate.ts b/src/function/sim/simulate.ts index 7bce328..049b4eb 100644 --- a/src/function/sim/simulate.ts +++ b/src/function/sim/simulate.ts @@ -370,9 +370,9 @@ class IcarusSimulate extends Simulate { const generateVvpName = hdlModule.name + '.vvp'; const outVvpPath = hdlPath.join(simConfig.simulationHome, generateVvpName); - MainOutput.report(t('info.simulation.create-vvp', outVvpPath), { - level: ReportType.Run - }); + // MainOutput.report(t('info.simulation.create-vvp', outVvpPath), { + // level: ReportType.Run + // }); const vvpPath = simConfig.vvpPath; @@ -382,7 +382,7 @@ class IcarusSimulate extends Simulate { const vvpCwd = opeParam.openMode === 'file' ? cwd: opeParam.workspacePath; const vvpCommand = `${vvpPath} ${outVvpPath}`; - MainOutput.report(vvpCommand, { level: ReportType.Run }); + // MainOutput.report(vvpCommand, { level: ReportType.Run }); this.runVvp(vvpCommand, vvpCwd); }); @@ -427,7 +427,7 @@ class IcarusSimulate extends Simulate { if (match) { const vcdPath = match[1]; const absVcdPath = hdlPath.resolve(cwd, vcdPath); - MainOutput.report(t('info.simulate.vvp.vcd-generate', absVcdPath)); + MainOutput.report(t('info.simulate.vvp.vcd-generate', absVcdPath), { level: ReportType.Finish }); } else { MainOutput.report(line.slice(9).trim()); } @@ -448,7 +448,10 @@ class IcarusSimulate extends Simulate { MainOutput.report(line.slice(10).trim(), { level: ReportType.Error }); } } else { - MainOutput.report(line, { level: ReportType.Info }); + const displayMessage = line.trim(); + if (displayMessage) { + MainOutput.report(displayMessage, { level: ReportType.PrintOuput}); + } } } } @@ -489,7 +492,7 @@ class IcarusSimulate extends Simulate { // return; // } - const dependences = this.getAllOtherDependences(path, name); + const dependences = this.getAllOtherDependences(path, name); const simulationCommand = this.getCommand(name, path, dependences); if (simulationCommand) { const cwd = hdlPath.resolve(path, '..'); diff --git a/src/global/outputChannel.ts b/src/global/outputChannel.ts index d6499f6..66fe85d 100644 --- a/src/global/outputChannel.ts +++ b/src/global/outputChannel.ts @@ -33,7 +33,15 @@ enum ReportType { /** * 某些功能或者子进程在运行中产出的信息 */ - Run = 'Run' + Run = 'Run', + /** + * 展示程序的输出 + */ + PrintOuput = 'PrintOutput', + /** + * 代表程序的结束 + */ + Finish = 'Finish' }; interface ReportOption { @@ -96,13 +104,24 @@ class Output { option = option || { level: ReportType.Info, notify: false } as ReportOption; const level = option.level || ReportType.Info; const notify = option.notify || false; - + if (!this.skipMessage(level) && message) { const currentTime = this.getCurrentTime(); - this._output.appendLine('[' + level + ' - ' + currentTime + '] ' + message); - if (notify) { - this.showInWindows('' + message, level); + switch (option.level) { + case ReportType.PrintOuput: + this._output.appendLine(message.toString()); + break; + case ReportType.Finish: + this._output.appendLine('\n[' + level + ' - ' + currentTime + '] ' + message); + break; + + default: + this._output.appendLine('[' + level + ' - ' + currentTime + '] ' + message); + if (notify) { + this.showInWindows('' + message, level); + } + break; } } } diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts index 93d0ac9..52fc71a 100644 --- a/src/hdlParser/core.ts +++ b/src/hdlParser/core.ts @@ -480,6 +480,8 @@ class HdlParam { return; } + console.log('fast:', fast); + // 1. 更新 macro moduleFile.updateMacro(fast.macro); diff --git a/syntaxes/digital-ide-output.json b/syntaxes/digital-ide-output.json index 13a59d0..e3dc672 100644 --- a/syntaxes/digital-ide-output.json +++ b/syntaxes/digital-ide-output.json @@ -71,6 +71,21 @@ } } }, + { + "name": "digital-ide.Finish", + "match": "^(\\[Finish - (.*?)\\])(.*)", + "captures": { + "1": { + "name": "token.warn-token" + }, + "2": { + "name": "string" + }, + "3": { + "name": "token.warn-token" + } + } + }, { "name": "digital-ide.Launch", "match": "^(\\[Launch - (.*?)\\])([\\s\\S]*)", From 69ef25bd5279d352e6648f959425e29ea95509ca Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 5 Jan 2025 21:51:46 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20include=20=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=B7=AF=E5=BE=84=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/property-schema.json | 17 +---------------- src/hdlParser/core.ts | 2 -- src/monitor/hdl.ts | 1 + 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/project/property-schema.json b/project/property-schema.json index 9a8091d..34c1ebf 100644 --- a/project/property-schema.json +++ b/project/property-schema.json @@ -200,22 +200,7 @@ "xc7z035ffg676-2", "xc7z020clg484-1" ] - }, - "iverilogCompileOptions": { - "type": "object", - "description": "options to define iverilog arguments", - "properties": { - "standard": { - "type": "string", - "description": "value of argument -g, default is -g2012", - "default": "2012" - }, - "includes": { - "type": "array", - "description": "value of argument -I" - } - } - } + } }, "required": [ "toolChain", diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts index 52fc71a..93d0ac9 100644 --- a/src/hdlParser/core.ts +++ b/src/hdlParser/core.ts @@ -480,8 +480,6 @@ class HdlParam { return; } - console.log('fast:', fast); - // 1. 更新 macro moduleFile.updateMacro(fast.macro); diff --git a/src/monitor/hdl.ts b/src/monitor/hdl.ts index 48c5aad..2bcf7ff 100644 --- a/src/monitor/hdl.ts +++ b/src/monitor/hdl.ts @@ -105,6 +105,7 @@ export class HdlAction extends BaseAction { // 更新 hdl 文件 const fast = await LspClient.DigitalIDE?.sendRequest(SyncFastRequestType, { path, fileType, toolChain }) if (fast) { + console.log('update includes:', fast.macro.includes); hdlParam.updateFast(path, fast); }