+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Member level 3
    Points: 968, Level: 7

    Join Date
    Nov 2013
    Location
    iran
    Posts
    60
    Helped
    0 / 0
    Points
    968
    Level
    7

    use C to program FPGA

    Hi everyone,
    I have a spartan 6 FPGA which I want to program it in C language I searched a lot and finally I found this software:
    1-FPGA advantage
    2-Codeveloper
    3-Altium
    which this software compile C to vhdl and after that I can use ISE to program my FPGA but I couldn't find a good site to explain which one of them is better to develop the code and I could not fine an example of them.
    and also I informed that there is a software called vivado which xilinx provided it but I understood that it is just for series 7 and it can not use for spartan 6 butt I read also it can be use for spartan 6 but I could not understand how it could be possible.
    could you please help me to choose the best software and give me some information about it?
    Regards
    Matin

  2. #2
    Super Moderator
    Points: 48,680, Level: 53
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    9,984
    Helped
    2391 / 2391
    Points
    48,680
    Level
    53

    Re: use C to program FPGA

    Hi,

    Use a HDL.
    An FPGA is no processor that needs software code like C.
    It is configurable hardware.

    Sooner or later you will come to a HDL, so why loose time with C?

    Klaus


    1 members found this post helpful.

    •   Alt2nd July 2017, 18:47

      advertising

        
       

  3. #3
    Advanced Member level 1
    Points: 5,859, Level: 18

    Join Date
    Mar 2002
    Location
    UK
    Posts
    487
    Helped
    110 / 110
    Points
    5,859
    Level
    18

    Re: use C to program FPGA

    Are you talking about embedding virtual processor core inside the FPGA and use C programming? Altera virtaul processor is called NIOS, some FPGA even have built in ARM multicore processors.
    Of course KlausST is right - there is no way to program the FPFA logic with C language, VHDL is description language, if you want to do some sequences you use completely different approach compared to C.


    1 members found this post helpful.

  4. #4
    Advanced Member level 5
    Points: 34,548, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,332
    Helped
    1845 / 1845
    Points
    34,548
    Level
    45

    Re: use C to program FPGA

    1. FPGA Advantage is just an IDE to maintain project flow through a set of tools. It does not let you compile C for FPGA.
    2. I dont even know what this is.
    3. Altium is a PCB design tool.

    FPGAs are NOT "programmed" in C. You write some form of HDL (hardware design language) or schematics and compile the design for your specific chip. There are tools out there to generate HDL from C, but generally do not give an optimal solution (I found this stack overflow post here listing many C to HDL tools): https://stackoverflow.com/questions/...-hll-synthesis
    As you suggest Xilinx support C to gates through it's HLS tool, which only supports Vivado.

    Writing C for FPGAs still requires good knowledge of FPGA design. From experience, the people who get the C to gates tools to work properly are HDL designers already. So you are much better off learning HDL yourself rather than try a C to gates tool.


    1 members found this post helpful.

    •   Alt2nd July 2017, 21:14

      advertising

        
       

  5. #5
    Member level 3
    Points: 968, Level: 7

    Join Date
    Nov 2013
    Location
    iran
    Posts
    60
    Helped
    0 / 0
    Points
    968
    Level
    7

    Re: use C to program FPGA

    thank you all. I have learnt VHDL and I can program FPGA in VHDL but my boss has forced me to program it in C because he believes it is easier I told him that I know VHDL and it is easier for me to to use VHDL but he is insisting on his own words!! :)، so I started searching about C language for FPGA but I found nothing good. I think I have to change his mind about this :). thank you for your answer :) .
    Regards
    Matin



    •   Alt4th July 2017, 05:15

      advertising

        
       

  6. #6
    Advanced Member level 5
    Points: 34,548, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,332
    Helped
    1845 / 1845
    Points
    34,548
    Level
    45

    Re: use C to program FPGA

    Or preferably - find a new boss.


    1 members found this post helpful.

  7. #7
    Super Moderator
    Points: 27,385, Level: 40
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,237
    Helped
    1524 / 1524
    Points
    27,385
    Level
    40

    Re: use C to program FPGA

    Catapult C is about the only one I've heard about that is functional (been around a long time too), besides using Vivado HLS.
    Cadence also has their own product Stratus, which I have no idea of how well it works.

    Change his mind by getting quotes for Catapult or Stratus. Last time I looked 5+ years ago Catapult was over $20K.

    In either case you have to code with a special dialect of C that has information on pipeline and clock information. You can't just take any C software code and compile it into a VHDL description.


    1 members found this post helpful.

  8. #8
    Advanced Member level 2
    Points: 3,729, Level: 14

    Join Date
    Apr 2011
    Posts
    518
    Helped
    24 / 24
    Points
    3,729
    Level
    14

    Re: use C to program FPGA

    I have heard about OpenCL being used to describe a digital circuit at a very high level of abstraction, almost like a high level programming language. However, when using tools that do something like that, they are usually not as good as us designing the circuit at a lower level of abstraction. They use more logic and do not get the "best" circuit as the output. But they are improving.

    OpenCL has NOTHING to do with OpenGL. Maybe you are looking for OpenCL?

    - - - Updated - - -

    This question is related to High Level Synthesis; please read this as well:
    https://en.wikipedia.org/wiki/High-level_synthesis


    1 members found this post helpful.

    •   Alt11th July 2017, 13:56

      advertising

        
       

  9. #9
    Advanced Member level 5
    Points: 34,548, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,332
    Helped
    1845 / 1845
    Points
    34,548
    Level
    45

    Re: use C to program FPGA

    OpenCL is a slightly different setup. The OpenCL architecture always expects a controlling CPU with slave devices in FPGA. Origionally it required an x86 CPU with PCIe interface but I think it allows ARM CPUs (and maybe others too). The Altera implementation uses Avalon to connect everything.


    1 members found this post helpful.

  10. #10
    Full Member level 5
    Points: 3,926, Level: 14

    Join Date
    Oct 2005
    Posts
    295
    Helped
    10 / 10
    Points
    3,926
    Level
    14

    Re: use C to program FPGA

    you can try systemC but i don't think there is a good synthesizer for it now :)
    good luck


    1 members found this post helpful.

  11. #11
    Full Member level 3
    Points: 1,665, Level: 9

    Join Date
    Apr 2012
    Posts
    166
    Helped
    10 / 10
    Points
    1,665
    Level
    9

    Re: use C to program FPGA

    Better to bite the bullet....try Verilog/VHDL these are easy to understand. I think you have a software background, you are thinking in terms of C, compilers etc. FPGAs are hardware and have no code as such.

    To understand better I suggest you watch some tutorials on youtube, I found the Nandlogic tutorials to be very good and informative, they start from the basic and go on to complicated stuff. You should also consider buying a FPGA development board, I think a cheap one should be good.

    You need to get over the software programming approach if you have to understand FPGA design.

    I too have a strong software background, I have a Mojo-V3 kit, I started a week ago, and now I can flash LEDs, read push buttons etc using Verilog..

    Remember no code is executed in FPGAs, there is no processor inside that is executing code. The program you make in Verilog/VHDL is synthesized to hard wired circuit inside the FPGA.


    1 members found this post helpful.

  12. #12
    Newbie level 1
    Points: 20, Level: 1

    Join Date
    Jul 2017
    Posts
    1
    Helped
    0 / 0
    Points
    20
    Level
    1

    Re: use C to program FPGA

    I wanted to let you know about LegUp, which is a high-level synthesis tool that turns C into RTL and supports Xilinx (and Altera) FPGAs.
    You can download LegUp at: www.legupcomputing.com (Disclosure: I work on LegUp)
    We also have some unique features like using parallel threads in software to express spatial hardware parallelism.
    As the above posters mentioned, there is a bit of a learning curve when targeting C to an FPGA but we'd be happy to help you.



--[[ ]]--