Created
February 28, 2012 20:22
-
-
Save hktechn0/1934876 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ld-mist32 -Tdata=0x0400 -Ttext=0x0000 -o reloc.o $1 | |
objcopy-mist32 -j .text -O binary reloc.o text.bin | |
objcopy-mist32 -j .data -O binary reloc.o data.bin | |
od -t xC -w4 -v text.bin | cut -s -d ' ' -f 2- | sed -e 's/ //g' > text.hex | |
od -t xC -w4 -v data.bin | cut -s -d ' ' -f 2- | sed -e 's/ //g' > data.hex | |
echo "=== .text" | |
python verilog_out_text.py < text.hex | |
echo "=== .data" | |
python verilog_out_data.py < data.hex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
i = 0 | |
eof = False | |
while not eof: | |
try: | |
lo = 0 | |
lo = int(raw_input(), 16) | |
except: | |
eof = True | |
print """memory[%d] <= 32'h%08x;""" % ( | |
i, lo) | |
i += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
i = 0 | |
eof = False | |
while not eof: | |
try: | |
lo = 0 | |
hi = 0 | |
lo = int(raw_input(), 16) | |
hi = int(raw_input(), 16) | |
except: | |
eof = True | |
print """32'h%08x : func_inst_rom = 64'h%08x%08x;""" % ( | |
i, hi, lo) | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment