Commits (1)
......@@ -409,10 +409,9 @@ class QGenCGlueGenerator(SynchronousToolGlueGenerator):
"#include \"%s.oss.h\" // OSS generated\n" % self.asn_name)
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\"\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 comp_Input cInput;\n\n")
self.C_SourceFile.write("static comp_Output cOutput;\n\n")
self.C_SourceFile.write("#include \"qgen_entry_%s.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 qgen_entry_%s_comp_Output cOutput;\n\n" % self.CleanNameAsToolWants(subProgram._id))
self.g_FVname = subProgram._id
def SourceVar(self,
......@@ -453,19 +452,11 @@ class QGenCGlueGenerator(SynchronousToolGlueGenerator):
self.C_SourceFile.write(" static int initialized = 0;\n")
self.C_SourceFile.write(" if (!initialized) {\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")
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(" %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")
self.C_SourceFile.write(" qgen_entry_%s_comp(&cInput, &cOutput);\n" % self.g_FVname)
qgencBackend: QGenCGlueGenerator
......
......@@ -149,15 +149,11 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
self.ADA_HeaderFile.write('with 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(
'package %s is\n\n' %
self.CleanNameAsADAWants(subProgram._id + "_" + subProgramImplementation + "_wrapper"))
self.ADA_SourceFile.write('with %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('with qgen_entry_%s;\n' % self.CleanNameAsADAWants(subProgram._id))
self.ADA_SourceFile.write(
'package body %s is\n\n' %
self.CleanNameAsADAWants(subProgram._id + "_" + subProgramImplementation + "_wrapper"))
......@@ -580,7 +576,7 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
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:
if param._id != sp._params[0]._id:
self.ADA_SourceFile.write(', ')
......@@ -624,12 +620,18 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
self.C_HeaderFile.write("void Execute_%s(void);\n" % self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation))
if maybeFVname != "":
if not (genFpgaDevDrv and maybeFVname in fpga_seen and fpga_seen[maybeFVname] == 'with_init_already'):
self.C_HeaderFile.write("void init_%s%s(void);\n" % (self.CleanNameAsADAWants(maybeFVname), fpgaSuffix))
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))
if genFpgaDevDrv:
# 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))
else:
self.C_HeaderFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
if modelingLanguage == "QGenC":
self.C_HeaderFile.write("void %s_%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)))
else:
self.C_HeaderFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
else: # pragma: no cover
self.C_HeaderFile.write("void %s_init%s(void);\n" % (self.CleanNameAsADAWants(sp._id), fpgaSuffix)) # pragma: no cover
self.C_HeaderFile.write("void %s%s(" % (self.CleanNameAsADAWants(sp._id), fpgaSuffix)) # pragma: no cover
......@@ -672,7 +674,7 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
if maybeFVname != "":
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
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'):
......@@ -687,7 +689,10 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
# 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))
else:
self.C_SourceFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
if modelingLanguage == "QGenC":
self.C_SourceFile.write("void %s_%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id + "_" + subProgramImplementation)))
else:
self.C_SourceFile.write("void %s_%s%s(" % (self.CleanNameAsADAWants(maybeFVname), self.CleanNameAsADAWants(sp._id), fpgaSuffix))
else: # pragma: no cover
self.C_SourceFile.write("void %s(" % self.CleanNameAsADAWants(sp._id)) # pragma: no cover
for param in sp._params:
......
......@@ -141,7 +141,7 @@ g_sync_mappers = {
'Simulink': simulink_B_mapper,
'gui': gui_B_mapper,
'python': python_B_mapper,
'QgenC': qgenc_B_mapper,
'QGenC': qgenc_B_mapper,
'vhdl': vhdl_B_mapper,
}
......