How to specify class method to compile to codegen
10 views (last 30 days)
Show older comments
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?
0 Comments
Answers (2)
Nithin Kumar
on 6 Sep 2023
Edited: Nithin Kumar
on 6 Sep 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.
0 Comments
Raghu Boggavarapu
on 28 Sep 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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!