feat:修复 Windows vvp 解析问题

- 修复 iverilog 生成的 .vvp 文件 shebang 导致 Windows 解析失败
This commit is contained in:
Roe-xin
2026-03-07 18:41:42 +08:00
parent e7c631d532
commit 09ff812562

View File

@ -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(" "));