HDL Code generation - exclusion of code
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Amor
el 22 de Oct. de 2013
Comentada: Tim McBrayer
el 23 de Oct. de 2013
Is there a way to exclude "Embedded Matlab blocks" in Simulink from code generation
Illegal "Embedded Matlab" code generation for cell array reference:
var{1}
How do I exclude code from code generation similar to
coder.extrinsic('xxx')
Many thanks, Dave
0 comentarios
Respuesta aceptada
Tim McBrayer
el 22 de Oct. de 2013
Editada: Tim McBrayer
el 23 de Oct. de 2013
There is not a direct way to have a MATLAB Function block participate in Simulink simulation while not generating any HDL code for it. There are a couple of indirect ways, however.
One way is to reorganize your design so that the MATLAB Function block is not inside the subsystem you are generating HDL code for. This will have the side effect of changing the I/O interface to your generated code. This is probably the best approach; if you do not want code generated for a particular block, then that block should probably not be part of the design you generate code for.
A second way is to wrap the MATLAB Function block inside an additional subsystem. This subsystem can be marked as having a Black Box implementation. What this means is that no HDL code will be generated for the subsystem or its contents. HDL Coder will generate a module instance with the interface of the subsystem, but no code for the contents. This is intended to allow the user to insert their own handwritten HDL code into a design.
There is no way to pick and choose what MATLAB code in a function block gets HDL code generated for it.
2 comentarios
Tim McBrayer
el 23 de Oct. de 2013
Editada: Tim McBrayer
el 23 de Oct. de 2013
It sounds like you are generating code for the entire model. if this is the case, a better approach would be to place all blocks that you want to generate code for into a subsystem, and leave all the rest of the model outside. In particular, the non-generatable MATLAB Function block will reside outside the subsystem, along with your scopes etc.
Assume you have model 'mymodel', Fcn block 'Stimulus', Fcn block 'Design', and scope 'Scope'. All the blocks reside at the top level of your model:
>> find_system('mymodel')
ans =
'mymodel'
'mymodel/Design'
'mymodel/Scope'
'mymodel/Stimulus
Select all the blocks that you want to generate HDL code for (in this case, 'mymodel/Design'), and type Ctrl-g to place them in a subsystem:
>> find_system('mymodel')
ans =
'mymodel'
'mymodel/Scope'
'mymodel/Stimulus'
'mymodel/Subsystem'
'mymodel/Subsystem/In1'
'mymodel/Subsystem/Design'
'mymodel/Subsystem/Out1
Note that 'Design' is now inside 'Subsystem'. Now you can generate HDL code for 'Subsystem' alone; 'Stimulus' won't even be analyzed by HDL Coder. You can generate code via the command line 'makehdl' command, via the Simulink Code menu (make sure that you set the HDL Configuration parameters to generate code for 'mymodel/Subsystem'), the context menu of mymodel/Subsystem, or the HDL Workflow Advisor.
Más respuestas (0)
Ver también
Categorías
Más información sobre External Component Interfaces en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!