mirror of
https://github.com/antonblanchard/microwatt.git
synced 2026-03-09 12:06:05 +00:00
Add a simple test case
We use 2 32bit RAMs, so we need to split the test case into two files.
This commit is contained in:
committed by
Anton Blanchard
parent
83faae4a86
commit
185bcba6bb
24
scripts/bin2hex-split.py
Executable file
24
scripts/bin2hex-split.py
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import struct
|
||||
|
||||
even = open('even.hex', 'w')
|
||||
odd = open('odd.hex', 'w')
|
||||
|
||||
with open(sys.argv[1], "rb") as f:
|
||||
while True:
|
||||
even_word = f.read(4)
|
||||
if len(even_word) == 0:
|
||||
exit(0)
|
||||
if len(even_word) != 4:
|
||||
raise Exception("Bad length")
|
||||
even.write("%08x\n" % struct.unpack('<I', even_word));
|
||||
|
||||
odd_word = f.read(4)
|
||||
if len(odd_word) == 0:
|
||||
exit(0)
|
||||
if len(odd_word) != 4:
|
||||
raise Exception("Bad length")
|
||||
odd.write("%08x\n" % struct.unpack('<I', odd_word));
|
||||
Reference in New Issue
Block a user