Skip to content
Snippets Groups Projects
Commit 15790722 authored by auphelia's avatar auphelia
Browse files

[Code gen] Added docompute part to code generation

parent 214f2203
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,8 @@ def read_npy_data(node, code_gen_dict):
code_gen_dict["$READNPDATA$"].append('for(int i=0; i < num_values; i+=2){')
for channel in range(NumChannels):
code_gen_dict["$READNPDATA$"].append('dat.range({},{}) = loaded_data{}[i+{}];'.format(channel, channel, input_ind, channel))
code_gen_dict["$READNPDATA$"].append('in{} << loaded_data[dat];\n }'.format(input_ind))
code_gen_dict["$READNPDATA$"].append('in{} << loaded_data{}[dat];'.format(input_ind, input_ind))
code_gen_dict["$READNPDATA$"].append('}')
input_ind+=1
def strm_decl(node, code_gen_dict):
......@@ -54,6 +55,11 @@ def strm_pragmas(node, code_gen_dict):
input_ind += 1
code_gen_dict["$STREAMPRAGMAS$"].append('#pragma HLS stream depth=1024 variable=out')
def docompute(node, code_gen_dict):
code_gen_dict["$DOCOMPUTE$"]=[]
if node.op_type == 'StreamingMaxPool':
code_gen_dict["$DOCOMPUTE$"].append('{}<ImgDim, PoolDim, NumChannels>(in0, out);'.format(node.op_type))
def execute(node, context, graph):
# template for single node execution
docompute_template= """
......@@ -97,6 +103,7 @@ def execute(node, context, graph):
read_npy_data(node, code_gen_dict)
strm_decl(node, code_gen_dict)
strm_pragmas(node, code_gen_dict)
docompute(node, code_gen_dict)
print(code_gen_dict)
print("\n\n Set up for code generation of single not in progress! \n\n")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment