Skip to content

Commit 50cf296

Browse files
authored
Merge pull request #639 from vloncar/vsynth_report_fix
Fix parsing of logic synthesis reports
2 parents e8f048a + 1dd148c commit 50cf296

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

hls4ml/report/vivado_report.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,23 @@ def parse_vivado_report(hls_dir):
169169
if os.path.isfile(vivado_syn_file):
170170
vivado_synth_rpt = {}
171171
with open(vivado_syn_file) as f:
172+
section = 0
172173
for line in f.readlines():
174+
match = re.match(r'^(\d)\.', line)
175+
if match:
176+
section = int(match.group(1))
173177
# Sometimes, phrases such as 'CLB Registers' can show up in the non-tabular sections of the report
174178
if '|' in line:
175-
if 'CLB LUTs' in line:
179+
if 'CLB LUTs' in line and section == 1:
176180
vivado_synth_rpt['LUT'] = line.split('|')[2].strip()
177-
elif 'CLB Registers' in line:
181+
elif 'CLB Registers' in line and section == 1:
178182
vivado_synth_rpt['FF'] = line.split('|')[2].strip()
179-
elif 'RAMB18 ' in line:
183+
elif 'Block RAM Tile' in line and section == 2:
180184
vivado_synth_rpt['BRAM_18K'] = line.split('|')[2].strip()
181-
elif 'DSPs' in line:
182-
vivado_synth_rpt['DSP48E'] = line.split('|')[2].strip()
183-
elif 'URAM' in line:
185+
elif 'URAM' in line and section == 2:
184186
vivado_synth_rpt['URAM'] = line.split('|')[2].strip()
187+
elif 'DSPs' in line and section == 3:
188+
vivado_synth_rpt['DSP48E'] = line.split('|')[2].strip()
185189
report['VivadoSynthReport'] = vivado_synth_rpt
186190
else:
187191
print('Vivado synthesis report not found.')

0 commit comments

Comments
 (0)