Skip to content

Commit 0e9f589

Browse files
merge: pull request #1 from Kingfish404/main
fix: better synth_stat.txt format check
2 parents f909e48 + 9b02110 commit 0e9f589

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parse.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class YosysJsonStatsParseError extends Error {
2424
}
2525
}
2626

27-
const STAT_FILE_HEADER = "16. Printing statistics."
27+
const STAT_FILE_HEADER = "Printing statistics."
2828
const TOP_METANAME = "@Top@"
2929

3030
export function parseTextStats(input: string): ParsedModule[] {
@@ -38,7 +38,7 @@ export function parseTextStats(input: string): ParsedModule[] {
3838
if (rawModules.length === 0) {
3939
return []
4040
}
41-
if (rawModules[0].length !== 1 || rawModules[0][0] !== STAT_FILE_HEADER) {
41+
if (rawModules[0].length !== 1 || !rawModules[0][0].trim().endsWith(STAT_FILE_HEADER)) {
4242
throw new TextStatsParseError("Bad header")
4343
}
4444
const parsedRawModules: (ParsedModule | string)[] = rawModules.slice(1).map((rawModule) => {

0 commit comments

Comments
 (0)