Commit 634de4d0 authored by Daniel Tuulik's avatar Daniel Tuulik
Browse files

Update DMT to support QGen

parent 74b182d0
Pipeline #3657 passed with stage
in 2 minutes and 59 seconds
...@@ -409,10 +409,9 @@ class QGenCGlueGenerator(SynchronousToolGlueGenerator): ...@@ -409,10 +409,9 @@ class QGenCGlueGenerator(SynchronousToolGlueGenerator):
"#include \"%s.oss.h\" // OSS generated\n" % self.asn_name) "#include \"%s.oss.h\" // OSS generated\n" % self.asn_name)
self.C_SourceFile.write("extern OssGlobal *g_world;\n\n") self.C_SourceFile.write("extern OssGlobal *g_world;\n\n")
self.C_SourceFile.write("#include \"%s.h\" // Space certified compiler generated\n" % self.asn_name) self.C_SourceFile.write("#include \"%s.h\" // Space certified compiler generated\n" % self.asn_name)
self.C_SourceFile.write("#include \"%s.h\"\n\n" % self.CleanNameAsToolWants(subProgram._id).lower()) self.C_SourceFile.write("#include \"qgen_entry_%s.h\"\n\n" % self.CleanNameAsToolWants(subProgram._id).lower())
self.C_SourceFile.write("#include \"%s_types.h\"\n\n" % self.CleanNameAsToolWants(subProgram._id).lower()) self.C_SourceFile.write("static qgen_entry_%s_comp_Input cInput;\n\n" % self.CleanNameAsToolWants(subProgram._id))
self.C_SourceFile.write("static comp_Input cInput;\n\n") self.C_SourceFile.write("static qgen_entry_%s_comp_Output cOutput;\n\n" % self.CleanNameAsToolWants(subProgram._id))
self.C_SourceFile.write("static comp_Output cOutput;\n\n")
self.g_FVname = subProgram._id self.g_FVname = subProgram._id
def SourceVar(self, def SourceVar(self,
...@@ -453,19 +452,11 @@ class QGenCGlueGenerator(SynchronousToolGlueGenerator): ...@@ -453,19 +452,11 @@ class QGenCGlueGenerator(SynchronousToolGlueGenerator):
self.C_SourceFile.write(" static int initialized = 0;\n") self.C_SourceFile.write(" static int initialized = 0;\n")
self.C_SourceFile.write(" if (!initialized) {\n") self.C_SourceFile.write(" if (!initialized) {\n")
self.C_SourceFile.write(" initialized = 1;\n") self.C_SourceFile.write(" initialized = 1;\n")
self.C_SourceFile.write(" %s_init();\n" % self.g_FVname) self.C_SourceFile.write(" qgen_entry_%s_init();\n" % self.g_FVname)
self.C_SourceFile.write(" }\n") self.C_SourceFile.write(" }\n")
def ExecuteBlock(self, unused_modelingLanguage: str, unused_asnFile: str, unused_sp: ApLevelContainer, unused_subProgramImplementation: str, unused_maybeFVname: str) -> None: def ExecuteBlock(self, unused_modelingLanguage: str, unused_asnFile: str, unused_sp: ApLevelContainer, unused_subProgramImplementation: str, unused_maybeFVname: str) -> None:
self.C_SourceFile.write("#ifndef rtmGetStopRequested\n") self.C_SourceFile.write(" qgen_entry_%s_comp(&cInput, &cOutput);\n" % self.g_FVname)
self.C_SourceFile.write(" %s_comp(&cInput, &cOutput);\n" % self.g_FVname)
self.C_SourceFile.write("#else\n")
self.C_SourceFile.write(" if (!rtmGetStopRequested(%s_M)) {\n" % self.g_FVname)
self.C_SourceFile.write(" %s_step(&cInput, &cOutput);\n" % self.g_FVname)
self.C_SourceFile.write(" if (rtmGetStopRequested(%s_M)) { %s_terminate(); }\n" %
(self.g_FVname, self.g_FVname))
self.C_SourceFile.write(" }\n")
self.C_SourceFile.write("#endif\n")
qgencBackend: QGenCGlueGenerator qgencBackend: QGenCGlueGenerator
......
...@@ -149,15 +149,11 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]): ...@@ -149,15 +149,11 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
self.ADA_HeaderFile.write('with taste_dataview;\n') self.ADA_HeaderFile.write('with taste_dataview;\n')
self.ADA_HeaderFile.write('use taste_dataview;\n') self.ADA_HeaderFile.write('use taste_dataview;\n')
self.ADA_HeaderFile.write('with %s_types;\n' % self.CleanNameAsADAWants(subProgram._id))
self.ADA_HeaderFile.write('use %s_types;\n\n' % self.CleanNameAsADAWants(subProgram._id))
self.ADA_HeaderFile.write( self.ADA_HeaderFile.write(
'package %s is\n\n' % 'package %s is\n\n' %
self.CleanNameAsADAWants(subProgram._id + "_" + subProgramImplementation + "_wrapper")) self.CleanNameAsADAWants(subProgram._id + "_" + subProgramImplementation + "_wrapper"))
self.ADA_SourceFile.write('with %s;\n' % self.CleanNameAsADAWants(subProgram._id)) self.ADA_SourceFile.write('with qgen_entry_%s;\n' % self.CleanNameAsADAWants(subProgram._id))
self.ADA_SourceFile.write('with %s_types;\n' % self.CleanNameAsADAWants(subProgram._id))
self.ADA_SourceFile.write('use %s_types;\n\n' % self.CleanNameAsADAWants(subProgram._id))
self.ADA_SourceFile.write( self.ADA_SourceFile.write(
'package body %s is\n\n' % 'package body %s is\n\n' %
self.CleanNameAsADAWants(subProgram._id + "_" + subProgramImplementation + "_wrapper")) self.CleanNameAsADAWants(subProgram._id + "_" + subProgramImplementation + "_wrapper"))
...@@ -580,7 +576,7 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]): ...@@ -580,7 +576,7 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
self.CleanNameAsToolWants(param._id), self.CleanNameAsToolWants(param._id),
self.CleanNameAsToolWants(param._id))) self.CleanNameAsToolWants(param._id)))
self.ADA_SourceFile.write("\n %s.comp (" % self.CleanNameAsADAWants(sp._id)) self.ADA_SourceFile.write("\n qgen_entry_%s.comp (" % self.CleanNameAsADAWants(sp._id))
for param in sp._params: for param in sp._params:
if param._id != sp._params[0]._id: if param._id != sp._params[0]._id:
self.ADA_SourceFile.write(', ') self.ADA_SourceFile.write(', ')
...@@ -624,10 +620,16 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]): ...@@ -624,10 +620,16 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
self.C_HeaderFile.write("void Execute_%s(void);\n" % self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)) self.C_HeaderFile.write("void Execute_%s(void);\n" % self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation))
if maybeFVname != "": if maybeFVname != "":
if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'): if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'):
if modelingLanguage == "QGenC":
self.C_HeaderFile.write("void init_%s%s(void);\n" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)))
else:
self.C_HeaderFile.write("void init_%s%s(void);\n" % (self.CleanNameAsADAWants(maybeFVname), fpgaSuffix)) self.C_HeaderFile.write("void init_%s%s(void);\n" % (self.CleanNameAsADAWants(maybeFVname), fpgaSuffix))
if genFpgaDevDrv: if genFpgaDevDrv:
# Return to dispatcher if HW delegation via Execute() is successful (0) or not (-1). # Return to dispatcher if HW delegation via Execute() is successful (0) or not (-1).
self.C_HeaderFile.write("int %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix)) self.C_HeaderFile.write("int %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
else:
if modelingLanguage == "QGenC":
self.C_HeaderFile.write("void %s_%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)))
else: else:
self.C_HeaderFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix)) self.C_HeaderFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
else: # pragma: no cover else: # pragma: no cover
...@@ -672,7 +674,7 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]): ...@@ -672,7 +674,7 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
if maybeFVname != "": if maybeFVname != "":
if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'): if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'):
self.C_SourceFile.write("void init_%s%s(void)\n" % (self.CleanNameAsADAWants(maybeFVname), fpgaSuffix)) self.C_SourceFile.write("void init_%s%s(void)\n" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)))
else: # pragma: no cover else: # pragma: no cover
self.C_SourceFile.write("void %s_init(void)\n" % self.CleanNameAsADAWants(sp._id)) # pragma: no cover self.C_SourceFile.write("void %s_init(void)\n" % self.CleanNameAsADAWants(sp._id)) # pragma: no cover
if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'): if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'):
...@@ -686,6 +688,9 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]): ...@@ -686,6 +688,9 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
if genFpgaDevDrv: if genFpgaDevDrv:
# Return to dispatcher if HW delegation via Execute() is successful (0) or not (-1). # Return to dispatcher if HW delegation via Execute() is successful (0) or not (-1).
self.C_SourceFile.write("int %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix)) self.C_SourceFile.write("int %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
else:
if modelingLanguage == "QGenC":
self.C_SourceFile.write("void %s_%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)))
else: else:
self.C_SourceFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix)) self.C_SourceFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
else: # pragma: no cover else: # pragma: no cover
......
...@@ -141,7 +141,7 @@ g_sync_mappers = { ...@@ -141,7 +141,7 @@ g_sync_mappers = {
'Simulink': simulink_B_mapper, 'Simulink': simulink_B_mapper,
'gui': gui_B_mapper, 'gui': gui_B_mapper,
'python': python_B_mapper, 'python': python_B_mapper,
'QgenC': qgenc_B_mapper, 'QGenC': qgenc_B_mapper,
'vhdl': vhdl_B_mapper, 'vhdl': vhdl_B_mapper,
} }
......
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