Commit 159fc2f6 authored by Tiago Jorge's avatar Tiago Jorge
Browse files

Add new b-mapper for BRAVE; Fix pointer to global variable.

(brave b-mapper is copy of zestsc1 as starting point)
parent 4e17a4b0
This diff is collapsed.
......@@ -695,15 +695,15 @@ class SynchronousToolGlueGeneratorGeneric(Generic[TSource, TDestin]):
self.C_SourceFile.write(' Delegate to one or the other side (SW or HW) depending on whether the value of a global variable storing the current\n')
self.C_SourceFile.write(' configuration equals one of those defined for the target function in new IV field.\n')
self.C_SourceFile.write(' */\n')
self.C_SourceFile.write(' extern const char *p_szGlobalState;\n')
self.C_SourceFile.write(' extern const char p_szGlobalState[];\n')
self.C_SourceFile.write(' if(!strcmp(p_szGlobalState, "%s")){\n' % (sp._fpgaConfigurations))
self.C_SourceFile.write(' // delegate to HW\n')
self.C_SourceFile.write(' printf("delegate to HW\\n");\n')
self.C_SourceFile.write(' //called_compute_something_Brave_Fpga(pinp, size_inp, poutp, pSize_outp);\n')
self.C_SourceFile.write(' printf("[###### Dispatcher ######] Delegating to HW ... (to be implemented) \\n");\n')
self.C_SourceFile.write(' // called_compute_something_Brave_Fpga(pinp, size_inp, poutp, pSize_outp);\n')
self.C_SourceFile.write(' // delegated to HW, return 0\n')
self.C_SourceFile.write(' return 0;\n')
self.C_SourceFile.write(' }else{\n')
self.C_SourceFile.write(' printf("delegate to SW\\n");\n')
self.C_SourceFile.write(' printf("[###### Dispatcher ######] Delegating to SW ...\\n");\n')
self.C_SourceFile.write(' // delegate to SW, return 1\n')
self.C_SourceFile.write(' return 1;\n')
self.C_SourceFile.write(' }\n')
......
......@@ -100,6 +100,7 @@ from .B_mappers import simulink_B_mapper
from .B_mappers import micropython_async_B_mapper
from .B_mappers import vhdl_B_mapper
from .B_mappers import zestSC1_B_mapper
from .B_mappers import brave_B_mapper
from .B_mappers.module_protos import Sync_B_Mapper, Async_B_Mapper
......@@ -216,6 +217,8 @@ types). This used to cover Dumpable C/Ada Types and OG headers.'''
def getSyncBackend(modelingLanguage: str) -> Sync_B_Mapper:
if modelingLanguage not in g_sync_mappers:
panic("Synchronous modeling language '%s' not supported" % modelingLanguage)
if os.getenv("BRAVE") is not None and modelingLanguage == 'vhdl':
return cast(Sync_B_Mapper, brave_B_mapper)
if os.getenv("ZESTSC1") is not None and modelingLanguage == 'vhdl':
return cast(Sync_B_Mapper, zestSC1_B_mapper)
return cast(Sync_B_Mapper, g_sync_mappers[modelingLanguage])
......@@ -379,6 +382,8 @@ def ProcessCustomBackends(
if lang.lower() in ["gui_pi", "gui_ri"]:
return [cast(Sync_B_Mapper, x) for x in [python_B_mapper, pyside_B_mapper]] # pragma: no cover
elif lang.lower() == "vhdl": # pragma: no cover
if os.getenv("BRAVE") is not None:
return [cast(Sync_B_Mapper, brave_B_mapper)] # pragma: no cover
if os.getenv("ZESTSC1") is not None:
return [cast(Sync_B_Mapper, zestSC1_B_mapper)] # pragma: no cover
else:
......
Markdown is supported
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