2

I want to describe a Matrix multiplier with Chisel, but there are some things that I do not understand.

First, I found that response giving the code of a 3X5 matrix multiplier. I would like to generalize it for any square matrix up to 128X128. I know that in Chisel, I can parameterize a module by giving a size parameter to the module (so that I'll use n.W instead of a defined size). But at the end of the day, a Verilog file will be generated right ? So the parameters have to be fixed ? I probably confuse some things. My prupose is to adapt the code to be able to perform any matrix multiplication up to 128x128, and I do not know if it is technically possible.

user54517
  • 2,020
  • 5
  • 30
  • 47

1 Answers1

0

The advantage of chisel is that everything can be parameterized. That being said at the end of the day when you are making your physical hardware obviously the parameter should be fixed. The advantage of making it parameterized is that if you don't know your exact requirements (like area of the die available etc) you can have a parameterized version ready and when the time comes you plug in the values you need and generate the verilog file for that parameter. And to answer your question, yes it is possible to perform any matrix multiplication up to 128x128 (or beyond if your Laptop RAM is sufficient). You get the verilog only when you create a Hardware driver this tells you how to create verilog from chisel so go ahead and create your parameterized hardware.

CV_Ruddha
  • 406
  • 2
  • 13
  • Thank you for your response. So implemeting this algorithm https://en.wikipedia.org/wiki/Matrix_multiplication_algorithm would be enought ? So if I build it taking 128X128 matrices, to perform the computation with a lower matrix, let's say 5X5, only consist of replacing the non-used boxes with zeros ? – user54517 Nov 22 '19 at 00:33
  • You can pad zeroes that way but that would be just a waste of computation power. What I mean is instead of what you said the chisel code can be paramterized in such a way that when you plug in say 128 and 128 you get the hardware for a 128x128 matrix, similarly if you want a 5x5 matrix you will just have to plug in the value 5 and 5. – CV_Ruddha Nov 22 '19 at 01:24