How to specify class method to compile to codegen
조회 수: 8 (최근 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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!