From 09ff8125626c4239bc1b89b099003ff85751aee7 Mon Sep 17 00:00:00 2001 From: Roe-xin Date: Sat, 7 Mar 2026 18:41:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E5=A4=8D=20Windows=20vvp=20?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=97=AE=E9=A2=98=20-=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20iverilog=20=E7=94=9F=E6=88=90=E7=9A=84=20.vvp=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20shebang=20=E5=AF=BC=E8=87=B4=20Windows=20=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/iverilogRunner.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/utils/iverilogRunner.ts b/src/utils/iverilogRunner.ts index 0c45298..2067c0f 100644 --- a/src/utils/iverilogRunner.ts +++ b/src/utils/iverilogRunner.ts @@ -308,6 +308,21 @@ export async function generateVCD( }; } + // 6.5. 删除 shebang 行(修复 Windows 上的 vvp 解析错误) + try { + const fs = require('fs'); + const vvpContent = fs.readFileSync(outputFile, 'utf8'); + const lines = vvpContent.split('\n'); + + if (lines.length > 0 && lines[0].startsWith('#!')) { + const cleanedContent = lines.slice(1).join('\n'); + fs.writeFileSync(outputFile, cleanedContent, 'utf8'); + console.log('已删除 .vvp 文件的 shebang 行'); + } + } catch (error) { + console.warn('删除 shebang 失败,继续执行:', error); + } + // 7. 执行仿真生成 VCD const simArgs = [outputFile]; console.log("执行仿真命令:", vvpPath, simArgs.join(" "));