Create separate xspn-fpga FW
Add xspn data for different accelerators
This commit is contained in:
45
raven_spn/src/spn_data/data_array.py
Executable file
45
raven_spn/src/spn_data/data_array.py
Executable file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import re
|
||||
|
||||
import sys
|
||||
|
||||
if (len(sys.argv) < 2):
|
||||
print('No argument given')
|
||||
exit()
|
||||
|
||||
|
||||
nips = sys.argv[1]
|
||||
|
||||
input_file = open(nips + '_inputdata.txt', 'r')
|
||||
in_data = input_file.read();
|
||||
|
||||
# convert double to uint8_t
|
||||
in_data = re.sub(r'(\d)\.0+e\+00', r'\1,', in_data)
|
||||
in_data = re.sub(r'(\d)\.(\d)0+e\+01', r'\1\2,', in_data)
|
||||
in_data = re.sub(r'(\d)\.(\d)(\d)0+e\+02', r'\1\2\3,', in_data)
|
||||
in_data = in_data.replace(";", "")
|
||||
|
||||
# remove last comma
|
||||
in_data = in_data[:-2]
|
||||
# count samples
|
||||
input_sample_cnt = len(in_data.split(","))
|
||||
#####################################################################
|
||||
|
||||
ref_file = open(nips + '_outputdata.txt', 'r')
|
||||
ref_data = ref_file.read()
|
||||
ref_data = re.sub(r'\n', r' / ln2,\n', ref_data)
|
||||
ref_data = ref_data[:-2]
|
||||
ref_sample_cnt = len(ref_data.split(","))
|
||||
|
||||
# create cpp file
|
||||
f = open("../xspn_data.cpp", "w")
|
||||
cpp_file = "#include <array>\n"
|
||||
cpp_file += "#include <cmath>\n\n"
|
||||
# The results in the outputdata.txt file are not directly what comes out of the PE but the natural logarithm of it.
|
||||
cpp_file += "constexpr auto ln2 = std::log(2);\n"
|
||||
cpp_file += "std::array<uint8_t, " + str(input_sample_cnt) + "> input_data = {\n" + str(in_data) + "}; \n\n"
|
||||
cpp_file += "std::array<double, " + str(ref_sample_cnt) + "> ref_data = {\n" + str(ref_data)+ "}; \n"
|
||||
|
||||
f.write(cpp_file)
|
||||
f.close()
|
10000
raven_spn/src/spn_data/nips5_inputdata.txt
Normal file
10000
raven_spn/src/spn_data/nips5_inputdata.txt
Normal file
File diff suppressed because it is too large
Load Diff
10000
raven_spn/src/spn_data/nips5_outputdata.txt
Normal file
10000
raven_spn/src/spn_data/nips5_outputdata.txt
Normal file
File diff suppressed because it is too large
Load Diff
2000
raven_spn/src/spn_data/nips80_inputdata.txt
Normal file
2000
raven_spn/src/spn_data/nips80_inputdata.txt
Normal file
File diff suppressed because it is too large
Load Diff
2000
raven_spn/src/spn_data/nips80_outputdata.txt
Normal file
2000
raven_spn/src/spn_data/nips80_outputdata.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user