Commit 3ad568f6 authored by Tiago Jorge's avatar Tiago Jorge
Browse files

RMAP offset read/write fix; Bambu prefix added to autogen artifacts; Changes...

RMAP offset read/write fix; Bambu prefix added to autogen artifacts; Changes in Bambu input autogen file.
parent 9783f7cf
...@@ -161,7 +161,7 @@ class FromVHDLToASN1SCC(RecursiveMapperGeneric[List[int], str]): # pylint: disa ...@@ -161,7 +161,7 @@ class FromVHDLToASN1SCC(RecursiveMapperGeneric[List[int], str]): # pylint: disa
lines.append(" unsigned int i;\n") lines.append(" unsigned int i;\n")
lines.append(" asn1SccSint val = 0;\n") lines.append(" asn1SccSint val = 0;\n")
lines.append(" for(i=0; i<sizeof(asn1SccSint)/4; i++) {\n") lines.append(" for(i=0; i<sizeof(asn1SccSint)/4; i++) {\n")
lines.append(" rmap_tgt_read(R_RMAP_BASEADR + %s - 1 + ((i+1)*4), &tmp, 4, R_RMAP_DSTADR);\n" % hex(register)) lines.append(" rmap_tgt_read(R_RMAP_BASEADR + %s + (i*4), &tmp, 4, R_RMAP_DSTADR);\n" % hex(register))
lines.append(" tmp >>= 32; // ?\n") lines.append(" tmp >>= 32; // ?\n")
lines.append(" val |= (tmp << (32*i));\n") lines.append(" val |= (tmp << (32*i));\n")
lines.append(" }\n") lines.append(" }\n")
...@@ -287,7 +287,7 @@ class FromASN1SCCtoVHDL(RecursiveMapperGeneric[str, List[int]]): # pylint: disa ...@@ -287,7 +287,7 @@ class FromASN1SCCtoVHDL(RecursiveMapperGeneric[str, List[int]]): # pylint: disa
lines.append(" asn1SccSint val = %s;\n" % srcVar) lines.append(" asn1SccSint val = %s;\n" % srcVar)
lines.append(" for(i=0; i<sizeof(asn1SccSint)/4; i++) {\n") lines.append(" for(i=0; i<sizeof(asn1SccSint)/4; i++) {\n")
lines.append(" tmp = val & 0xFFFFFFFF;\n") lines.append(" tmp = val & 0xFFFFFFFF;\n")
lines.append(" rmap_tgt_write(R_RMAP_BASEADR + %s - 1 + ((i+1)*4), &tmp, 4, R_RMAP_DSTADR);\n" % hex(register)) lines.append(" rmap_tgt_write(R_RMAP_BASEADR + %s + (i*4), &tmp, 4, R_RMAP_DSTADR);\n" % hex(register))
lines.append(" val >>= 32;\n") lines.append(" val >>= 32;\n")
lines.append(" }\n") lines.append(" }\n")
lines.append("}\n") lines.append("}\n")
...@@ -1048,7 +1048,7 @@ def OnFinal() -> None: ...@@ -1048,7 +1048,7 @@ def OnFinal() -> None:
completions.append(c._spCleanName + '_CalculationsComplete') completions.append(c._spCleanName + '_CalculationsComplete')
AddToStr('circuits', ' component %s is\n' % c._spCleanName) AddToStr('circuits', ' component bambu_%s is\n' % c._spCleanName)
AddToStr('circuits', ' port (\n') AddToStr('circuits', ' port (\n')
AddToStr('circuits', '\n'.join([' ' + x for x in circuitLines]) + '\n') AddToStr('circuits', '\n'.join([' ' + x for x in circuitLines]) + '\n')
AddToStr('circuits', ' start_%s : in std_logic;\n' % c._spCleanName) AddToStr('circuits', ' start_%s : in std_logic;\n' % c._spCleanName)
...@@ -1057,7 +1057,8 @@ def OnFinal() -> None: ...@@ -1057,7 +1057,8 @@ def OnFinal() -> None:
AddToStr('circuits', ' reset_%s : in std_logic\n' % c._spCleanName) AddToStr('circuits', ' reset_%s : in std_logic\n' % c._spCleanName)
AddToStr('circuits', ' );\n') AddToStr('circuits', ' );\n')
AddToStr('circuits', ' end component;\n\n') AddToStr('circuits', ' end component;\n\n')
'''
skeleton = [] skeleton = []
skeleton.append(' entity %s is\n' % c._spCleanName) skeleton.append(' entity %s is\n' % c._spCleanName)
skeleton.append(' port (\n') skeleton.append(' port (\n')
...@@ -1075,6 +1076,7 @@ def OnFinal() -> None: ...@@ -1075,6 +1076,7 @@ def OnFinal() -> None:
'declaration': ''.join(skeleton) 'declaration': ''.join(skeleton)
}) })
vhdlSkeleton.close() vhdlSkeleton.close()
'''
AddToStr('ioregisters', '\n'.join([' ' + x for x in ioregisterLines]) + '\n\n') AddToStr('ioregisters', '\n'.join([' ' + x for x in ioregisterLines]) + '\n\n')
...@@ -1098,7 +1100,7 @@ def OnFinal() -> None: ...@@ -1098,7 +1100,7 @@ def OnFinal() -> None:
AddToStr('readinputdata', '\n'.join([' ' * 22 + x for x in readinputdataLines]) + '\n') AddToStr('readinputdata', '\n'.join([' ' * 22 + x for x in readinputdataLines]) + '\n')
AddToStr('writeoutputdata', '\n'.join([' ' * 16 + x for x in writeoutputdataLines]) + '\n') AddToStr('writeoutputdata', '\n'.join([' ' * 16 + x for x in writeoutputdataLines]) + '\n')
AddToStr('connectionsToSystemC', '\n Interface_%s : %s\n' % (c._spCleanName, c._spCleanName)) AddToStr('connectionsToSystemC', '\n Interface_%s : bambu_%s\n' % (c._spCleanName, c._spCleanName))
AddToStr('connectionsToSystemC', ' port map (\n') AddToStr('connectionsToSystemC', ' port map (\n')
AddToStr('connectionsToSystemC', ',\n'.join([' ' + x for x in connectionsToSystemCLines]) + ',\n') AddToStr('connectionsToSystemC', ',\n'.join([' ' + x for x in connectionsToSystemCLines]) + ',\n')
AddToStr('connectionsToSystemC', ' start_%s => %s_StartCalculationsPulse,\n' % (c._spCleanName, c._spCleanName)) AddToStr('connectionsToSystemC', ' start_%s => %s_StartCalculationsPulse,\n' % (c._spCleanName, c._spCleanName))
...@@ -1122,14 +1124,14 @@ def OnFinal() -> None: ...@@ -1122,14 +1124,14 @@ def OnFinal() -> None:
msg = "" msg = ""
for c in VHDL_Circuit.allCircuits: for c in VHDL_Circuit.allCircuits:
msg += ' %s.vhd' % c._spCleanName msg += ' bambu_%s.vhd' % c._spCleanName
makefile = open(vhdlBackend.dir + '/TASTE-VHDL-DESIGN/design/Makefile', 'w') makefile = open(vhdlBackend.dir + '/TASTE-VHDL-DESIGN/design/Makefile', 'w')
makefile.write(vhdlTemplateBrave.makefile % {'pi': msg, 'tab': '\t'}) makefile.write(vhdlTemplateBrave.makefile % {'pi': msg, 'tab': '\t'})
makefile.close() makefile.close()
msg = "" msg = ""
for c in VHDL_Circuit.allCircuits: for c in VHDL_Circuit.allCircuits:
msg += '\n\'%s.vhd\',' % c._spCleanName msg += '\n\'bambu_%s.vhd\',' % c._spCleanName
script = open(vhdlBackend.dir + '/TASTE-VHDL-DESIGN/design/script.py', 'w') script = open(vhdlBackend.dir + '/TASTE-VHDL-DESIGN/design/script.py', 'w')
script.write(vhdlTemplateBrave.script % {'pi': msg}) script.write(vhdlTemplateBrave.script % {'pi': msg})
script.close() script.close()
...@@ -655,7 +655,7 @@ def EmitBambuBridge(sp: ApLevelContainer, subProgramImplementation: str): ...@@ -655,7 +655,7 @@ def EmitBambuBridge(sp: ApLevelContainer, subProgramImplementation: str):
bambuFile = open(os.path.dirname(simulinkBackend.C_SourceFile.name) + '/' + outputCsourceFilename, 'w') bambuFile = open(os.path.dirname(simulinkBackend.C_SourceFile.name) + '/' + outputCsourceFilename, 'w')
bambuFile.write("#include \"%s.h\"\n" % (simulinkBackend.CleanNameAsToolWants(sp._id + "_" + subProgramImplementation) + "." + simulinkBackend.CleanNameAsToolWants(subProgramImplementation))) #bambuFile.write("#include \"%s.h\"\n" % (simulinkBackend.CleanNameAsToolWants(sp._id + "_" + subProgramImplementation) + "." + simulinkBackend.CleanNameAsToolWants(subProgramImplementation)))
bambuFile.write("#include \"%s.h\" // Space certified compiler generated\n" % simulinkBackend.asn_name) bambuFile.write("#include \"%s.h\" // Space certified compiler generated\n" % simulinkBackend.asn_name)
bambuFile.write("#include \"%s.h\"\n" % simulinkBackend.CleanNameAsToolWants(sp._id)) bambuFile.write("#include \"%s.h\"\n" % simulinkBackend.CleanNameAsToolWants(sp._id))
bambuFile.write("#include \"%s_types.h\"\n\n" % simulinkBackend.CleanNameAsToolWants(sp._id)) bambuFile.write("#include \"%s_types.h\"\n\n" % simulinkBackend.CleanNameAsToolWants(sp._id))
...@@ -679,7 +679,19 @@ def EmitBambuBridge(sp: ApLevelContainer, subProgramImplementation: str): ...@@ -679,7 +679,19 @@ def EmitBambuBridge(sp: ApLevelContainer, subProgramImplementation: str):
bambuFile.write( bambuFile.write(
'%s%s;' % ("\n ", line)) '%s%s;' % ("\n ", line))
bambuFile.write("\n\n Execute_%s();\n" % simulinkBackend.CleanNameAsToolWants(sp._id + "_" + subProgramImplementation)) #bambuFile.write("\n\n Execute_%s();\n" % simulinkBackend.CleanNameAsToolWants(sp._id + "_" + subProgramImplementation))
stepStr = """
#ifndef rtmGetStopRequested
do_something_step();
#else
if (!rtmGetStopRequested(do_something_M)) {
do_something_step();
if (rtmGetStopRequested(do_something_M)) { do_something_terminate(); }
}
#endif
"""
bambuFile.write(stepStr)
lines = [] lines = []
for param in sp._params: for param in sp._params:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment