How to specify class method to compile to codegen

9 visualizaciones (últimos 30 días)
Anze Slosar
Anze Slosar el 2 de Dic. de 2022
Respondida: Raghu Boggavarapu el 28 de Sept. de 2023
I need to use matlab to compile some VHDL code. I need to use several instances of the same functional block. The only way to have several instances of a function with "persistent" is to use classes. I made a class that inherits handle and does what it should do.
Now I would like to compile it with codegen. I would like to use something like
codegen -float2fixed fixptcfg -config hdlcfg -args {int16(0),0,0,0,0} weight_fold.process
where weight_fold is a class name and process is the method inside the class that I would like to compile. How do I do this? If I don't specify .process it complains that weight_fold is a class. If I do as above it also does not like it. The matlab documentation states that while it is not possible to compile classes that it is possible to compile individual class method. How do I specify it?

Respuestas (2)

Nithin Kumar
Nithin Kumar el 6 de Sept. de 2023
Editada: Nithin Kumar el 6 de Sept. de 2023
Hi Anze,
I understand that you are facing an issue while trying to compile the specific method of a class using "codegen".
In the "codegen" command that you have provided, I observed that you have mentioned the arguments before the method of a class you want to generate code for. I recommend you use the class and method first and then arguments as shown in the following code snippet -
codegen -float2fixed fixptcfg -config hdlcfg weight_fold.process -args{int16(0),0,0,0}
For more information regarding "codegen", Kindly refer to the following documentation:
I hope this provides you with the required information regarding your query.
Regards,
Nithin Kumar.

Raghu Boggavarapu
Raghu Boggavarapu el 28 de Sept. de 2023
MATLAB Coder does support classes in code generation. However they are not supported as entrypoints for code generation.
To be able to generate the code for class methods, please use the class as part of normal MATLAB function and generate the code for MATLAB function.

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by