Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20640 Discussions

How to tell my computer to run a program on fpga

Altera_Forum
Honored Contributor II
1,374 Views

Hi, i have an important question, which I cant figure it out. 

 

 

lets say I'm designing an fpga which all he is doing is multiplying matrices,Im writing a matlab program and I want my fpga to use the fpga for (some/all) calculations, how can it be done? 

 

 

I thought about few things: 

1.burn the matlab program (somehow, bit/hex/(happy to here for another way)) on the fpga SDRAM - well this is more like a bypass than a solution..  

 

 

2.build a compiler for the fpga - I have a lot of motivation, but I'm not superman.. 

 

 

Even the ideas above, Im not sure about them and I (still) don't know how to implement them, I dont know what's possible and what's not, is it even possible to make the fpga "help"? (sounds like a waste of time), or the entire programm must run ont he fpga? 

 

 

when Im thinking about the fpga helping the cpu I'm thinking I need to make something like a controller between the both of them..But again, Im lost in the dark. 

 

 

That's why I need your help, Ill be happy to ear your knowledge. 

 

 

Thanks! 

 

edit: 

I'm trying to learn to use FPGA, it's not about his functionality,It's about getting there by my own, I dont really wants FPGA that multiple matrices..:D
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
273 Views

It sounds like you dont really understand what an FPGA is. An FPGA is a field programmable gate array. Basically, it is block of programmable logic cells, meaning the user can program it to do pretty much whatever the user wants. Depending on the device, it will have 10s to about 2000 IO pins, allowing it to be connected to several interfaces at once. You would then create controller logic for each interface and logic internally to process that data before sending on through another interface. Some devices have high speed transceivers, allowing it to be connected to PCIe, ethernet (up to 100GB now on the newest top end devices) SRIO or any other high speed serial IO. 

 

It is very common for the FPGA to be a slave to a CPU - with the CPU being the master controller for the system, and the FPGA being a large data processor. Because the FPGA has much higher data capabilities, it can handle far more data than the CPU. 

 

It sounds like you need to read up on digital logic design, HDL coding and other things. Altera have many tutorials online, like here: https://www.altera.com/support/training/university/materials-tutorials.html
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

Thanks, Im a foruth year in EE (were not touching FPGAs or anythink practical...), I'm writing in systemVerilog, I know what FPGA is, I know how to program him, but the idea of how to make the cpu use the fpga as a slave , this is what Im missing.. 

 

Lets say I have an Ip on my fpga that allows me to use the pcie on my computer, and lets assume that I have a driver that let's my fpga use the pcie, from that point how do I tell the cpu to use my fpga as a slave. 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

You will need to add a PCIe core to your FPGA. Then map your Slave IP onto the address map of the End Point PCIe. Then write the driver for the PC to talk to your slave. 

Btw, I dont think PCIe is a free IP core from Altera, you need to buy it as an add-on to your licence, as is ethernet. For a simple interface there is RS232 that you can drive through a serial port on your PC (or via a cheap usb-> serial cable).
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

Thanks a lot just one more gap I have , the understanding of how my core is deciding which "mission" to send to the fpga, and which not? Isn't that something that suppose to be inside the core? or It can be made using embedded software? (driver?)

0 Kudos
Altera_Forum
Honored Contributor II
273 Views

I saw a wonderfull project on github: 

https://github.com/kastnerrg/riffa 

 

I think that's answer my questions and even more. 

 

Thanks a lot for supporting and helping!
0 Kudos
Reply