When BSC source was opened, we removed some special-purpose code that Bluespec Inc had inserted to support their emulation system (SceMi). There was a flag -scemi that would automatically insert additional objects into the build (.a libraries or .ba modules) as if they had been specified on the command-line, but it would also insert some hooks into generated Bluesim models. I looked at resurrecting the SceMi tools and the first part can be done manually by the user, by adding to the command-line, but the second part is more difficult. It would be useful if BSC had a generic feature for hooking into the start/stop routines of Bluesim.
How this worked before was that the user would have a file scemilink.h that defined scemi_setup() and scemi_shutdown(). When given the -scemi flag, BSC would insert the following into the model_<topModuleName>.cxx file (created by SimBlocksToC):
- at the top:
#include "scemilink.h"
- at the end of the
create_model() function: scemi_setup(sim_hdl)
- at the end of the
destroy_model() function: scemi_shutdown(sim_hdl)
The scemi_setup function took a handle, because it would do things like set a config register inside the model (to tell it what port number to use for the communication link, say).
It would be helpful if there was someway to tell BSC to insert code. Maybe BSC can hardcode what the create and destroy functions should be called and the user just specifies the name of the file to include (or even, BSC can hardcode what the name should be, if that's easier). So, for example, -sim-hooks scemilink.h could be specified and the functions in the file would need to be called bluesim_custom_setup() and bluesim_custom_destroy() (or bluesim_create_hook and bluesim_destroy_hook) or something like that. But maybe there's also a different better way to register additional functions -- that perhaps doesn't even require a flag to compilation.
When BSC source was opened, we removed some special-purpose code that Bluespec Inc had inserted to support their emulation system (SceMi). There was a flag
-scemithat would automatically insert additional objects into the build (.alibraries or.bamodules) as if they had been specified on the command-line, but it would also insert some hooks into generated Bluesim models. I looked at resurrecting the SceMi tools and the first part can be done manually by the user, by adding to the command-line, but the second part is more difficult. It would be useful if BSC had a generic feature for hooking into the start/stop routines of Bluesim.How this worked before was that the user would have a file
scemilink.hthat definedscemi_setup()andscemi_shutdown(). When given the-scemiflag, BSC would insert the following into themodel_<topModuleName>.cxxfile (created bySimBlocksToC):#include "scemilink.h"create_model()function:scemi_setup(sim_hdl)destroy_model()function:scemi_shutdown(sim_hdl)The
scemi_setupfunction took a handle, because it would do things like set a config register inside the model (to tell it what port number to use for the communication link, say).It would be helpful if there was someway to tell BSC to insert code. Maybe BSC can hardcode what the create and destroy functions should be called and the user just specifies the name of the file to include (or even, BSC can hardcode what the name should be, if that's easier). So, for example,
-sim-hooks scemilink.hcould be specified and the functions in the file would need to be calledbluesim_custom_setup()andbluesim_custom_destroy()(orbluesim_create_hookandbluesim_destroy_hook) or something like that. But maybe there's also a different better way to register additional functions -- that perhaps doesn't even require a flag to compilation.