Shop OBEX P1 Docs P2 Docs Learn Events
So I bought an FPGA... — Parallax Forums

So I bought an FPGA...

PoundSign2PoundSign2 Posts: 129
edited 2013-11-25 06:36 in General Discussion
Just yesterday I was roaming and/or browsing the Propeller 2 pages to see what it was all about. After reading the sticky, not finding and obvious answer to my solution, I posted in the 130+ Page behemoth dubbed, "Propeller 2 BLOG." After asking my question and getting an answer, I stumbled upon boards using an FPGA. This new (as it appears to me) technology looked very fascinating to explore and tinker with. Upon doing more research and seeing how the FPGA chips work, and what exactly they are capable of doing I then decided to take the plunge and buy a Development Board based upon the FPGA chip. The link below is what I purchased. Please feel free to point me in the direction of a potentially better product for the $$$, however this was the best I could find in an hour's worth of searching on eBay and Amazon, in addition to Sparkfun and a couple of others.

Link:
http://www.ebay.com/itm/281177568173?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649



I
t is to my understanding that FPGAs can be 'programmed' to do just about anything digital. Such as acting simulating circuitry (although I think this feature might be exaggerated, I do not know) or being programmed as a microcontroller, among other things. However, searching YouTube hasn't really yielded much 'useful' information, if you could even call it that! A lot of the videos are really techy and super technical. A simple run down of the language or software you use to program the chip, or rather 'configure' the FPGA to do what you want. I am also unsure if the FPGA has some firmware embedded in it so that it auto-stores/reads from the EEPROM or FLASH but I am not sure. Generally anything that is useful or that could help me get started with this fantastic piece of silicon would be much appreciated!
«13

Comments

  • Heater.Heater. Posts: 21,230
    edited 2013-10-08 01:49
    That looks like nice board to get started with FPGA. Some say the Altera tools are easier to use for beginners than Xilinx.

    FPGA's are generally configured with high level hardware description languages. Verilog is popular in the states, VHDL is more popular in Europe apparently. I'm sure there are tutorials for both on the net.

    You might want to start here: http://www.fpga4fun.com/
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-10-08 10:41
    I have done a class on FPGAs * VHDL*
    Was a real eye opener as I knew of relay logic and gates ........... and then went in to the BS2 and its offspring .
    somewhere in the middle is FPGAs and they are sweet !

    I have a small dev board here that does a great job for the class I took .
    its a avnet spartan 6
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-10-08 16:00
    PoundSign2: It's only a simple Cyclone chip, but lots of I/O, switches and 7sseg leds. Should be a great intro for you at a nice price!
    I have a Xilinx Spartan 3A which is quite a basic board but with more LEs. I also have the DE0-nano that I use for the P2 single cog emulation.
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-08 16:16
    Heater. wrote: »
    That looks like nice board to get started with FPGA. Some say the Altera tools are easier to use for beginners than Xilinx.

    FPGA's are generally configured with high level hardware description languages. Verilog is popular in the states, VHDL is more popular in Europe apparently. I'm sure there are tutorials for both on the net.

    You might want to start here: http://www.fpga4fun.com/

    That website is fantastic thank you! A lot of resources on there. :)

    I have done a class on FPGAs * VHDL*
    Was a real eye opener as I knew of relay logic and gates ........... and then went in to the BS2 and its offspring .
    somewhere in the middle is FPGAs and they are sweet !

    I have a small dev board here that does a great job for the class I took .
    its a avnet spartan 6


    Are FPGAs overly complicated or is it equatable to learning the Propeller system and its difficulty? Most electronics things are complicated in their own right, but is FPGA programming/configuring something that only an EE would be able to grasp?

    Cluso99 wrote: »
    PoundSign2: It's only a simple Cyclone chip, but lots of I/O, switches and 7sseg leds. Should be a great intro for you at a nice price!
    I have a Xilinx Spartan 3A which is quite a basic board but with more LEs. I also have the DE0-nano that I use for the P2 single cog emulation.


    I could not locate this chip on Altera's website. Is the chip on this board obsolete? No good?
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-10-08 17:37
    I think VHDL makes a TON of sense !!!!! BUT its the sintax gotyas that are a royal pain .
  • dgatelydgately Posts: 1,630
    edited 2013-10-08 17:47
    the sintax gotyas that are a royal pain.

    Yes, those "sin taxes" could be a real pain after a trip to Las Vegas... Oh, you meant syntax :smile:
  • jazzedjazzed Posts: 11,803
    edited 2013-10-08 17:53
    Dangit Dennis!

    Now I have to clean my monitor again!

    Note to self: don't drink OJ and read forums.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-10-08 18:21
    Well played sirs .

    FPGAs have a down side .....they spoil you with speed ....... the guys here at FLIR use them and man they pump some mean clock rates. .
  • jazzedjazzed Posts: 11,803
    edited 2013-10-08 18:29
    Well played sirs .

    Sorry Peter.

    I wasn't trying to pick on you.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-10-08 18:34
    Oh nooo I think its funny! ....

    consideing how over priced vegas is .. the idea of a sin-tax is not to far off...

    Ill find my code i did and set a link o others can play with it ..


    meanwhile below



    question.jpg
  • dgatelydgately Posts: 1,630
    edited 2013-10-08 18:48
    jazzed wrote: »
    Sorry Peter.

    I wasn't trying to pick on you.

    Pete is a good sport! I know because we video'd him live to the web at a Propeller Expo a few years ago. He was sleeping in his propeller-controlled heated suit. Poor guy dozed-off and we had fun with the camera. :innocent:

    All in fun, until someone puts an eye out!

    Back to FPGA's... Are they easier to program than SoC's (systems on a chip)? They seem far more capable, but what's the difficulty in programming them? Unless someone like Chip sends a file (P2), would a software geek (i.e. not an EE) be able to do something useful with one?


    dgately
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-09 16:47
    dgately wrote: »
    Pete is a good sport! I know because we video'd him live to the web at a Propeller Expo a few years ago. He was sleeping in his propeller-controlled heated suit. Poor guy dozed-off and we had fun with the camera. :innocent:

    All in fun, until someone puts an eye out!

    Back to FPGA's... Are they easier to program than SoC's (systems on a chip)? They seem far more capable, but what's the difficulty in programming them? Unless someone like Chip sends a file (P2), would a software geek (i.e. not an EE) be able to do something useful with one?


    dgately

    I too am wondering about this. Ive been digging around at the site Heater posted earlier; http://www.FPGA4fun.com has a bunch of good info but sometimes I feel like it leaves something uncovered. As in, more could be explained but for whatever reason it's a skipped subject. Or they go into a lot of detail about one particular thing while skimming through others. I cannot complain though, as the vast amount of information on the website more than makes up for any nit-picking.

    I will also check out SoC's. I had never heard this before either, so maybe another Dev.Board purchase is in order...
  • Heater.Heater. Posts: 21,230
    edited 2013-10-09 17:03
    SoC's can range from hard to use to down right impossible. They are "systems" on "chips" which means that can be a ton of peripherals in there, thousands or registers to control them with and data sheets thousands of pages thick.

    For a nice cheap simple one get an STM32F4 Discovery Kit which has an STM32 ARM based SoC on it and all it's I/O pins available on headers. http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/PF252419

    When you have had enough pulling your hair out trying to program it in C you can install a JavaScript interpreter on it, slow but simple and fun, http://www.espruino.com/
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-09 17:06
    Heater. wrote: »
    SoC's can range from hard to use to down right impossible. They are "systems" on "chips" which means that can be a ton of peripherals in there, thousands or registers to control them with and data sheets thousands of pages thick.

    For a nice cheap simple one get an STM32F4 Discovery Kit which has an STM32 ARM based SoC on it and all it's I/O pins available on headers. http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/PF252419

    When you have had enough pulling your hair out trying to program it in C you can install a JavaScript interpreter on it, slow but simple and fun, http://www.espruino.com/



    Better yet I'll pass on the SoCs for now and stick with Propeller and my FPGA Dev Board. lol.
  • rod1963rod1963 Posts: 752
    edited 2013-10-10 12:47
    For free sources

    AldecHDL has a nice set of VHDL and Verilog tutorials.

    Just download their ActiveHDL Student edition

    http://www.aldec.com

    The site below offers a on-line tutorial

    http://www.asic-world.com/verilog/


    Yes, SOC's are real problem children. About a year ago I tried learning about the ST32 series and junked it. It also explains why so little is done with them by hobbyists. They are way too complex for most people. And looking at Xynq SOC used on the Parallela board is just mind boggling in it's complexity.
  • rjo__rjo__ Posts: 2,114
    edited 2013-10-10 18:11
    Heater...

    Just wanted to thank you for the link. Wish I had it 5 years ago:)

    Rich
  • Too_Many_ToolsToo_Many_Tools Posts: 765
    edited 2013-10-10 20:21
    Knowing how to use a FPGA is a very useful skill in industry...well worth knowing.

    PoundSign2 wrote: »
    Just yesterday I was roaming and/or browsing the Propeller 2 pages to see what it was all about. After reading the sticky, not finding and obvious answer to my solution, I posted in the 130+ Page behemoth dubbed, "Propeller 2 BLOG." After asking my question and getting an answer, I stumbled upon boards using an FPGA. This new (as it appears to me) technology looked very fascinating to explore and tinker with. Upon doing more research and seeing how the FPGA chips work, and what exactly they are capable of doing I then decided to take the plunge and buy a Development Board based upon the FPGA chip. The link below is what I purchased. Please feel free to point me in the direction of a potentially better product for the $$$, however this was the best I could find in an hour's worth of searching on eBay and Amazon, in addition to Sparkfun and a couple of others.

    Link:
    http://www.ebay.com/itm/281177568173?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649



    I
    t is to my understanding that FPGAs can be 'programmed' to do just about anything digital. Such as acting simulating circuitry (although I think this feature might be exaggerated, I do not know) or being programmed as a microcontroller, among other things. However, searching YouTube hasn't really yielded much 'useful' information, if you could even call it that! A lot of the videos are really techy and super technical. A simple run down of the language or software you use to program the chip, or rather 'configure' the FPGA to do what you want. I am also unsure if the FPGA has some firmware embedded in it so that it auto-stores/reads from the EEPROM or FLASH but I am not sure. Generally anything that is useful or that could help me get started with this fantastic piece of silicon would be much appreciated!
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-10 21:18
    Knowing how to use a FPGA is a very useful skill in industry...well worth knowing.

    That's also one reason why I want to get into it. I believe FPGAs are the new cutting edge of micro-controllers/Integrated Circuits, etc. Although I don't know how accurate of an assessment that is... Never hurts to try and get a leg up on the competition!

    EDIT:

    I found this link while exploring Altera's website and they say that FPGAs are SoC's? Now I'm confused...I thought SoC's were different than FPGAs?

    http://www.altera.com/devices/processor/fpgas/emb-why-use.html
  • Heater.Heater. Posts: 21,230
    edited 2013-10-10 23:26
    PoundSign2,

    "SoC" = "System On a Chip"

    Could be anything. It's a very general term. Think of it as like "PCB", except on a silicon chip.

    In the old days a PCB would hold chips for processor, RAM, ROM, video, I/O etc etc all connected by copper tracks.

    SoC is what you get when you can make all your CPU/ROM/RAM/Peripherals so small that they all fit on a single sliver of silcon. You get the whole system on a chip.

    So, a Soc could be the main chip in your mobile phone with it's ARM processor and GPU and all. Or it could be something like an STM32, small ARM plus FLASH, plus RAM, plus a lot of I2C, SPI, UART, PWM, GPIO interfaces.

    When the FPGA guys talk about "Soc" they mean they have taken a pile of their configurable logic cells and added a ready made ARM processor or two and other goodies. For Example the XILINX Zynq chips http://www.xilinx.com/products/silicon-devices/soc/zynq-7000/

    In a way an FPGA has always been a "Soc". If it's big enough you can configure the cells to be a processor plus whatever peripherals you want. It's up to you what kind of system it is.

    You might be wise to pass on the SoCs for a while. Better to keep foucus on one thing at a time. Starting with a nice cheap FPGA board like yours seems like a good way to go. Try out some tutoirials, try out some verilog and VHDL, see what you want to do next.

    (Of course it can be easy to use a Soc. A Raspberry Pi or Beagle Bone is based on a SoC. Just boot it up to Linux and get going. I'm really not into studing the low level details of such chips just happy I can use them at the higher OS level like any other computer)
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-11 00:40
    Heater. wrote: »
    PoundSign2,

    "SoC" = "System On a Chip"

    Could be anything. It's a very general term. Think of it as like "PCB", except on a silicon chip.

    In the old days a PCB would hold chips for processor, RAM, ROM, video, I/O etc etc all connected by copper tracks.

    SoC is what you get when you can make all your CPU/ROM/RAM/Peripherals so small that they all fit on a single sliver of silcon. You get the whole system on a chip.

    So, a Soc could be the main chip in your mobile phone with it's ARM processor and GPU and all. Or it could be something like an STM32, small ARM plus FLASH, plus RAM, plus a lot of I2C, SPI, UART, PWM, GPIO interfaces.

    When the FPGA guys talk about "Soc" they mean they have taken a pile of their configurable logic cells and added a ready made ARM processor or two and other goodies. For Example the XILINX Zynq chips http://www.xilinx.com/products/silicon-devices/soc/zynq-7000/

    In a way an FPGA has always been a "Soc". If it's big enough you can configure the cells to be a processor plus whatever peripherals you want. It's up to you what kind of system it is.

    You might be wise to pass on the SoCs for a while. Better to keep foucus on one thing at a time. Starting with a nice cheap FPGA board like yours seems like a good way to go. Try out some tutoirials, try out some verilog and VHDL, see what you want to do next.

    (Of course it can be easy to use a Soc. A Raspberry Pi or Beagle Bone is based on a SoC. Just boot it up to Linux and get going. I'm really not into studing the low level details of such chips just happy I can use them at the higher OS level like any other computer)

    Wow that makes a lot more sense now! Thank you!

    The board I purchased (linked in OP) seems like a really good introduction into the FPGA world. Although I would have probably been better off getting a more updated/current Cyclone chip, other than that I find the Dev. Board to be a great way to understand the FPGA and what not. Altera has tutorials and classes, while some are free and others are not I'll be sure to go through them. YouTube however, has been a disappointment for finding tutorials catered to the beginner. Perhaps this is due to the way YouTube filters & recommends videos to me, but my results were seriously lacking in anything remotely usable for a novice. This is why I really like that http://www.FPGA4fun.com site. A whole plethora of knowledge on there! I go there at least a few times a day and read something, small or big, anything helps a novice really.

    What I would really, really like to do is program/configure the FPGA as a function generator. Lately I've been particularly fascinated with the wireless inductive transfer stuff. This probably comes from the fact that I have a strong interest in magnetism, and how current can be induced via magnetic fields, and vice verse. So if the FPGA can help with respect to that project, would truly be more than worth it!

    In any case the FPGAs seem like a really fascinating piece of technology to discover and learn about. :)
  • Heater.Heater. Posts: 21,230
    edited 2013-10-11 00:56
    It's always tempting to what newer, bigger, faster. Worry about that when you have reached the limits of what you have. Which seems like a really neat board by the way. The priciples and most of the tools are the same so there is a lot you can learn and experiment with on that board.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-10-11 07:28
    There is nothing wrong with that board for an intro. The raw concepts haven't changed that much except they have a lotmore gates (LE's) now and they are larger/more complex. And the price is right. I am not sure you willbeable to run an embeded micro on it- other than a miniversion anyway.But you have to start somewhere.
    What you will do with the fpga is not really like you would do with a micro board though.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-10-11 08:40
    Pound ......... As you live local .... Heck If you want , just borrow mine and its book .......... and this winter Is the VHDL class at Oregon tech
    Audit a class?
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-11 11:27
    Pound ......... As you live local .... Heck If you want , just borrow mine and its book .......... and this winter Is the VHDL class at Oregon tech
    Audit a class?

    That's a great idea actually. I'll have a look at OIT's Winter Term stuff. Maybe I can use my G.I Bill to pay for it.
  • Too_Many_ToolsToo_Many_Tools Posts: 765
    edited 2013-10-11 11:56
    FWIW...in some industries software is very undesireable...the cost of maintainance/verification can make it a no-go.

    FPGAs can be passed as "hardware" and thereby not incurring the software overhead cost.

    I have seen much effort made to use hardware to avoid that cost.

    The other issue is if you are a hardware house, every problem "obviously" deserves a hardware solution.

    In many parts of industry, software is a dirty word.

    Also in many instances, using a software solution means having to pay a royalty for each product shipped...hardware solution means only one initial cost.

    PoundSign2 wrote: »
    That's also one reason why I want to get into it. I believe FPGAs are the new cutting edge of micro-controllers/Integrated Circuits, etc. Although I don't know how accurate of an assessment that is... Never hurts to try and get a leg up on the competition!

    EDIT:

    I found this link while exploring Altera's website and they say that FPGAs are SoC's? Now I'm confused...I thought SoC's were different than FPGAs?

    http://www.altera.com/devices/processor/fpgas/emb-why-use.html
  • Heater.Heater. Posts: 21,230
    edited 2013-10-11 14:48
    Too_Many_Tools,
    FPGAs can be passed as "hardware" and thereby not incurring the software overhead cost.
    Interesting, because now you can fit a CPU into an FPGA along with enough memory for all the software that it runs.
    The whole thing is just a hardware chip right?

    Already back in the day of developing the Primary Fight Control software for the Boing 777 I noticed that much of it was being "burried" in chips that never did get the same scrutiny as the Ada software of the main CPUs.
  • PoundSign2PoundSign2 Posts: 129
    edited 2013-10-24 00:02
    So it's been a bit since I've really updated this thread with my FPGA and what not. Here's a rundown of what transpired over the last couple weeks...

    Last week I received the Cyclone FPGA Dev. Board that I had purchased from eBay. Prior to it arriving I went to the Altera Forums and asked about my specific Cyclone board and what the consensus was on the quality, build, usability, etc. Overall everyone agreed that the board was very outdated and that it was not an official product and therefor could not accurately assess the board as virtually no one had it. Having at the time of purchase asking for the boards specific Datasheet, I got a response and the datasheet added some clarity but the organization and presentation of the Datasheet was god-awful. After gaining support from the forum to instead purchase a board that is official and has a lot of documentation and is widely known and used within the community. That's when I decided to purchase the DE-0 Nano Dev. Board.

    Today I received the Nano and the presentation of the product and the included documentation/support was amazing. Absolutely 1,000% better than the eBay board, which really, was to kind of be expected. While preparing for the board to arrive I did some additional digging for FPGA and programming, most notably using VHDL vs Verilog, where and what industries use which and so on. So right now I am viewing the Tutorial at http://www.asic-world.com/verilog/index.html for Verilog. And one passage in the Introductory section states,
    Even though Verilog executes different code blocks concurrently as opposed to the sequential execution of most programming languages, there are still many parallels.


    What I would like to know with regards to the above quote, is does Verilog, or the the FPGA, process/execute code in the same way that the Propeller and SPIN does? How SPIN and the Propeller allow you to run 8 things at the same time, does the FPGA and Verilog, or VHDL, allow you to do the same thing? I am a little confused by this passage.
  • Heater.Heater. Posts: 21,230
    edited 2013-10-24 00:52
    PoundSign2,
    s, there are still many parallels.

    It is confusing, all they are saying is that Verilog/VHDL have some similarities with source code for normal programming languages. Well, they do have things that look like subroutines and variables and operators etc. But that's about it.

    Designing logic with Verilog or VHDL may look like a normal programming language but it is very different.

    Instead of variables sitting in memory locations we have wires connecting things together.

    Instead of operators like AND, OR, NOT, XOR becoming instructions in an executable acting on variables we are configuring actual hardware logic gates to do those functions with inputs and outputs being the wires we have defined.

    In a normal program we have a processor stepping through instructions and executing them one by one. In an FPGA we don't, instead we have a lot of those wires and logic gates and they all perform there operations at the same time.

    It's just the same as building an actual circuit out of many logic gates or TTL chips. (or any real circuit actually). All the parts exist and function simultaneously.

    That is massive parallelism.

    Let's look at an example in VHDL:
    -- import std_logic from the IEEE library
    library IEEE;
    use IEEE.std_logic_1164.all;
     
    -- this is the entity
    entity ANDGATE is
      port ( 
        I1 : in std_logic;
        I2 : in std_logic;
        O  : out std_logic);
    end entity ANDGATE;
     
    -- this is the architecture
    architecture RTL of ANDGATE is
    begin
      O <= I1 and I2;
    end architecture RTL;
    

    Here we have defined an entity called "ANDGATE", it has inputs "I1" and "I2" an output "O". These are the "wires" external circuitry can connect to.

    Then we have the functionality "O <= I1 and I2" which just says the signal on the wire "O" will be the result of anding the signals on the two inputs.

    There is no clock or instruction stepping going on here. What you will get is an AND gate that is in your circuit doing it's AND thing all the time, in parallel with anything else you put in the circuit.

    We could imagine adding some more inputs and out puts to this design:
        I3 : in std_logic;
        I4 : in std_logic;
        O1 : out std_logic);
    

    and then another bit of functionality:
      O1 <= I3 or I4;
    
    Now we have an OR function as well. It will be performing it's OR at the same time as our AND. All the time.

    So there is the challenge. When you write or read Verilog/VHDL you have to be aware that everything in your "program" is happening at the same time all the time.

    Of course we then introduce the idea of clock signals to get things to happen in an orderly fashion. But that is another discussion.
  • msrobotsmsrobots Posts: 3,709
    edited 2013-10-24 01:00
    I am not a expert here at all. But the answer is yes.

    As I understand it Verilog defines Hardware with a script looking like software. Don't get confused there. A Verilog script does not get executed by the FPGA.
    So if you define multiple modules and connect them they all will run parallel - it is hardware.
    You can run as many parallel things as you want but if one needs the input of another then sequential execution is your only way - you need to wait for inputs to produce outputs.

    [EDIT]
    @heater. beat me. again.:smile:
    [/EDIT]

    Enjoy!

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2013-10-24 01:26
    msrobots,
    ...if one needs the input of another then sequential execution is your only way - you need to wait for inputs to produce outputs.

    I have to take a little issue with that.

    In a normal sequential programming language running on a normal sequential processor you might write something like:

    B := A
    C := B

    Here we would expect at least one instruction to be generated to move the content of memory A to B. Then another instruction to move B to C. Importantly each instruction will take some time to execute and they will be executed in the order that they are written.

    In an HDL though what this is saying is that A is connected to B and B is connected to C. Both those connections exist permanently at the same time. It does not matter if I write those statements in reverse order,

    Without further specification the time taken to get the signal from A to B is zero. Same for B to C. What we have created is a short circuit from A to C which takes no time.

    The idea of any sequential execution of your HDL statements goes out the window totally.

    Now of course in a real device there is the speed of light, and the speed of gates to think about so our connection from A to C is not instant but some rather messy function of the technology used and the layout that is generated.

    That is where we start to need clock signals to regulate the actions in a circuit. Here we get into "sequential" operation with flip-flops and clocks and so on. But this is subtly different. That "sequentialness" is in the circuit we are designing not in the language we are designing it with.
Sign In or Register to comment.