필터 지우기
필터 지우기

Matrix Operations Using HDL Coder

조회 수: 1 (최근 30일)
Mateus Silva
Mateus Silva 2016년 1월 12일
답변: Mateus Silva 2016년 1월 19일
Hi folks,
I understood reading from other questions how matrix operations could be done using HDL Coder, but it is not totally clear to me. I've read the manual, and there it says that matrix is allowed. It seems the restriction is that matrix format is not permitted as an input/output in the design top level. Isn't it? I tested it, and I got a HDL code with a sort of for loop responsible for doing the multiplication. In the matlab code, I implemented a function with vectors as parameters. Then, I concatenated them and executed the direct multiplication. I reassigned the multiplication result to output vectors.
So, the problem of doing it is that it will not be possible to execute any kind of design exploration with this generated module. Is that right? Would it have another drawback?
I'm actually trying to implement a control design using state space representation. So, it involves a lot of matrix multiplication and summation. What would be the best way for doing that? Should I implement the algorithm of matrix multiplication manually then?
Thanks a lot !!
Mateus Silva
  댓글 수: 2
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2016년 1월 13일
HDL coder is for implementing using VLSI Technology, are you developing any application using VLSI?
Mateus Silva
Mateus Silva 2016년 1월 19일
Yes, I am. Actually, the target device is a FPGA.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2016년 1월 13일
The restriction is only on the I/O level. You can use a Reshape Block to shape the data as vectors, do I/O on the vectors to send them to the device, then inside the device you can reshape them back to whatever you want and proceed with matrix operations that Simulink would be happy to generate code for you.
  댓글 수: 1
Mateus Silva
Mateus Silva 2016년 1월 17일
Hi! Thanks for your reply. In order to test it, I created a simply subsystem the does matrix multiplication. So, the inputs are vectors, then I reshaped them into matrices. After the operation, I reshaped back to a vector. Is it what you meant?
When I tried to convert this block to HDL using the tool, I got an error message complaining about the reshape block saying that "Matrices are not supported at simulink block interfaces". Am I missing something? Do you know what is wrong?
Thank you !!

댓글을 달려면 로그인하십시오.


Mateus Silva
Mateus Silva 2016년 1월 19일
I could implement a matrix multiplication using MATLAB script. I used vectors in the function's inputs and outputs. Inside the function, I concatenated the input vector in order to get two matrices, and multiplied them. Each column of the resultant matrix is an output vector. Hdl coder was able to generate a HDL code.
When I tried to generate a code for matrix multiplication using Simulink, I got the mentioned error. Have you implemented it using Simulink?? Could you help me with that? Thanks!! :)

제품

Community Treasure Hunt

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

Start Hunting!

Translated by