0

My boss has given a code for testing PCI express on an Altera board. The code consist of several c code files having instructions such as reading Bios, setting some registers, writing to buffers etc. My job at present is to see the functionality of the code by running it. I am new to FPGA and I am unable to understand what tools, compilers etc will I use for compiling it for the FPGA.

Since it is a C code so I am sure I cannot use the same environment as that of Verilog/VHDL. Can I get some hints as to what compilers are available for compiling C code for testing various interfaces of an FPGA?

Thanks and regards

H

gpuguy
  • 4,607
  • 17
  • 67
  • 125

2 Answers2

0

It sounds like the intent is that you connect the PCI-E card to a normal computer with a PCI-E slot, then run the test software on the host computer, so it will talk to the board via PCI-E, and exercise the board from the host, collect data on the host, and so on.

Such code will almost certainly be quite non-portable. You'll probably need to ask what system it's for (or examine the code to find hints -- e.g., if it starts with #include <windows.h> that's a pretty fair indication that it's for Windows).

The OS it's written for will give at least an 80% (or so) clue about what compiler to use -- if it's for Windows, chances are pretty good that it's intended for Microsoft's compiler. If it's for Linux, there's an even better chance that it's for gcc/g++. If it's for MacOS, it's probably for g++, but if it's really new, might target Clang.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • Thanks Jerry. Actually the FPGA is having SATA signalling but the interface for sata is PCI. so my guess, after your treading your post, thanks for the same, is the code is testing sata (writing-reading to SATA hardisk )via pci connected on the host system. I can see some files starting with sata and also I can see following hedare files #include #include #include #include #include #include #include "pcifunc.h" #include "memfunc.h" #include "iofunc.h" #include "irqfunc.h" – gpuguy Apr 10 '12 at 03:31
  • Based on the headers, it sounds like the test program is *probably* intended to run under MS-DOS. The most common compilers that targeted MS-DOS were Borland and Microsoft. There was a port of an old version of gcc to a DOS extender (djgcc) but I don't recall it's having a `` (could be my poor recollection though). – Jerry Coffin Apr 10 '12 at 03:37
  • I dont see window specific functions in the code, so I guess it is for Linux. – gpuguy Apr 10 '12 at 03:49
  • @gpuguy: Given its inclusion of ``, I'd be *quite* surprised if it's for Linux. – Jerry Coffin Apr 10 '12 at 03:52
  • you are right dos.h is not for linux, so i will try for dos environment using turbo. – gpuguy Apr 10 '12 at 03:54
  • Now here is another Issue. I want to do the entire testing in simulation first before moving for board. What is your suggestions in that case? – gpuguy Apr 20 '12 at 15:25
0

If the FPGA board is just connected through a standard PCIexpress interface, it isn't that hard to create a Linux driver to simply access a couple of registers. This might even be easier to do than getting some old DOS-based drivers to work.

I did some work on this in a pre-project to my masters thesis some years ago - if you're interested, it's available here: http://loejer.dk/files/FORK,%20pdf.zip

sonicwave
  • 5,952
  • 2
  • 33
  • 49