Matrix Operations Using HDL Coder

2 visualizaciones (últimos 30 días)
Mateus Silva
Mateus Silva el 12 de En. de 2016
Respondida: Mateus Silva el 19 de En. de 2016
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 comentarios
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran el 13 de En. de 2016
HDL coder is for implementing using VLSI Technology, are you developing any application using VLSI?
Mateus Silva
Mateus Silva el 19 de En. de 2016
Yes, I am. Actually, the target device is a FPGA.

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 13 de En. de 2016
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 comentario
Mateus Silva
Mateus Silva el 17 de En. de 2016
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 !!

Iniciar sesión para comentar.


Mateus Silva
Mateus Silva el 19 de En. de 2016
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!! :)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by