[#73220] add checking for duration and divider mismatches

This commit is contained in:
Mateusz Gancarz 2025-02-25 08:47:54 +01:00
parent 536c5fe293
commit 8347acacc9
1 changed files with 17 additions and 0 deletions

View File

@ -114,6 +114,8 @@ class SAIFParser:
self.top_instances = {}
self.current_instance = None
self.traversing_nets = False
self.duration = 0
self.divider = ''
def parse(self, saif_filename):
with open(saif_filename, 'r') as saif_file:
@ -122,6 +124,14 @@ class SAIFParser:
if not line:
continue
match = re.search(r'\(DIVIDER\s+(.)', line)
if match:
self.divider = match.groups()[0]
match = re.search(r'\s*\(DURATION\s+(\d+)', line)
if match:
self.duration = int(match.groups()[0])
match = re.search(r'INSTANCE\s+([\w.]*)', line)
if match:
instance_name = match.groups()[0]
@ -2510,6 +2520,13 @@ class VlTest:
def compare_saif_contents(self, first: SAIFParser, second: SAIFParser):
"""Test if second SAIF file has the same values as the first"""
if first.duration != second.duration:
self.error(f"Duration of trace doesn't match: {first.duration} != {second.duration}")
if first.divider != second.divider:
self.error(f"Dividers don't match: {first.divider} != {second.divider}")
for top_instance_name, top_instance in first.top_instances.items():
if top_instance_name not in second.top_instances:
self.error(f"Top instance {top_instance_name} missing in other SAIF")