How to specify class method to compile to codegen
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Nithin Kumar
2023-9-6
编辑:Nithin Kumar
2023-9-6
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 个评论
Raghu Boggavarapu
2023-9-28
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Generating Code 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!