[#74021] add source comment at the beginning of the SAIF file

This commit is contained in:
Mateusz Gancarz 2025-03-04 13:26:55 +01:00
parent 9a3c6fda91
commit 29b341ac93
2 changed files with 4 additions and 1 deletions

View File

@ -186,6 +186,7 @@ void VerilatedSaif::openNextImp(bool incFilename) {
}
void VerilatedSaif::initializeSaifFileContents() {
printStr("// Generated by verilated_saif\n");
printStr("(SAIFILE\n");
printStr("(SAIFVERSION \"2.0\")\n");
printStr("(DIRECTION \"backward\")\n");

View File

@ -73,7 +73,9 @@ class SAIFParser:
file_contents = ''
with open(saif_filename, 'r', encoding="utf8") as saif_file:
file_contents = saif_file.read()
content = saif_file.readlines()
filtered_lines = [line for line in content if not line.strip().startswith('//')]
file_contents = ''.join(filtered_lines)
tokens = file_contents.replace('(', ' ( ').replace(')', ' ) ').split()
num_of_tokens = len(tokens)