patocarr/axi-traffic-gen

.coe with additional blank lines at end-of-file will cause "Import" fail

Closed this issue · 1 comments

Thanks for the small tool, it's much convenient than editing by hand.
However, I got error in Importing another addr.coe with has several additional blank lines at the end-of-file, and that causes readCoe to fail. I think an additional if-clause should be added to check if there is only blanks lines and nothing else.

(Here's the error:
D:\axi-traffic-gen-master>"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe" atg.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\tkinter_init_.py", line 1699, in call
return self.func(*args)
File "atg.py", line 297, in import_dialog
array = self.readCoe(filename)
File "atg.py", line 200, in readCoe
vec = '{0:08x}'.format(int(vec, 2))
ValueError: invalid literal for int() with base 2: ''
)

@libreliu Thanks for the report. I can't reproduce the import error adding blank lines to the end of file. Would you please share the addr.coe that shows the issue?
[Update] I managed to reproduce and fix the issue. Thanks again.