pulp-runtime/bin/slm_hyper.py
Luca Valente 277d7ac330 Add support for running from flash
* Add possibility to supply additional vsim flags with run target
* Now the user can supply the bootmode=<spi|flash|fast_debug|jtag>
variable with the run target to choose the desired boot mode.
2021-05-05 17:39:24 +02:00

30 lines
1.2 KiB
Python
Executable file

#!/usr/bin/python3
#Written by ABA to update the format of the slm file to be compliant with hyperflash model used in testbench
import numpy as np
import os
import os.path
import argparse
import sys
parser = argparse.ArgumentParser(description='Generate hyper memory image file from slm')
parser.add_argument("--input", dest="input_file", default=None, help="Specify input file (ex. ./build/pulpissimo/slm_files/flash_stim.slm)")
parser.add_argument("--output", dest="output_file", default=None, help="Specify output file (ex. ./build/pulpissimo/slm_files/hyper_flash_stim.slm)")
args = parser.parse_args()
if args.input_file is None:
raise Exception('Specify the input file with --input=<path> (ex. --input=./build/pulpissimo/slm_files/flash_stim.slm)')
if args.output_file is None:
raise Exception('Specify the output file with --output=<path> (ex. --output=./build/pulpissimo/slm_files/hyper_flash_stim.slm')
delimiter=" "
with open(args.input_file, "rU") as fi:
data = list(map(lambda x:x.split(delimiter), fi.read().strip().split("\n")))
fo=open(args.output_file, "w")
A=np.array(data)
fo.write('@000000\n')
for i in range(0, A.shape[0],2):
fo.write('%s%s\n' %(A[i+1][1],A[i][1]))