# How to get started in FPGA/CPLD

#### mcardoso

Joined May 19, 2020
187
Hi All,

I recently completed a project that used discrete CMOS components to do digital decoding of an encoder signal. I was stubborn and ignored everyone telling me to use FPG/CPLD and got it working perfectly with the discrete chips. Honestly I'm glad that I did and taught myself the logic design, however I think that FPGA/CPLD is a much more modern solution to these kinds of problems and think I should probably get some exposure to them.

How would you suggest someone get started in FPGA development who has zero experience in using them or VHDL/Verilog. I have a few years of microcontroller experience. Most everything I work with is 5V TTL so a product which natively supports that would be a big plus to me. I recently downloaded Xilinx ISE but don't know what development board to get. Ideally something low cost.

Thanks,

Mike

#### bogosort

Joined Sep 24, 2011
571

#### mcardoso

Joined May 19, 2020
187
How do you make the decision between manufacturers? I understand you pretty much learn an stick to the toolchain that you start with.

#### bogosort

Joined Sep 24, 2011
571
How do you make the decision between manufacturers? I understand you pretty much learn an stick to the toolchain that you start with.
Between FPGA manufacturers? You pick one and inertia keeps you there. Seems like you've already picked Xilinx (a good choice, IMO), which is why I pointed you to Digilent dev boards.

#### tindel

Joined Sep 16, 2012
756
I'd suggest Xilinx or Altera (Intel) devices as they have the largest market share and support if you're playing around at your house. Be warned - this sh!t gets complex quickly... timing, metastability, clock domains, FSM's, test benches, MultiSim, HDL, synthesis, etc... it's not trivial to get simple things working properly. It's a completely different mindset from the microcontrollers you're familiar with. I'd look at cheaper $100-300 FPGA development boards. My first FPGA dev board was the Alchitry Mojo (Spartan6) and it used ISE... the Mojo has been discontinued, but is still available used on the internet and from alternate manufactures. Alchitry also has some good verilog tutorials for the beginner, and newer boards available at sparkfun. I've also used the DE10-Lite (Max10) from Terasic with success... they have good products as well but the demo projects aren't as complex - basically load the device with the code and you're done. I would not recommend the Digilent Pynq boards... They are bad toys... I'm not familiar with their other product offerings. The Zynq-7000 is a great chip - my favorite that I've used - dual Cortex-A9 processors, analog front-end, 1GHz fabric, etc., but that board doesn't do well displaying its abilities or teach the user how to program an FPGA. Thread Starter #### mcardoso Joined May 19, 2020 187 I'd suggest Xilinx or Altera (Intel) devices as they have the largest market share and support if you're playing around at your house. Be warned - this sh!t gets complex quickly... timing, metastability, clock domains, FSM's, test benches, MultiSim, HDL, synthesis, etc... it's not trivial to get simple things working properly. It's a completely different mindset from the microcontrollers you're familiar with. I'd look at cheaper$100-300 FPGA development boards.
Yeah, I've read a lot about them but have never actually touched one, think that is absolutely necessary.

Is spending that much on a dev board necessary? I've seen some in the $20 range. What is missing in those? Also, how do you determine how large/expensive of an FPGA is needed for a project? As an example, a board I built with discrete gates used the following: (11) D-Type Flip Flops (8) 2-Input AND gates (3) 2-Input XOR gates (3) JK Flip Flops (6) 3-Input AND gates (3) 3-Input OR gates (1) 8MHz Clock This seems like a pretty small amount of gates to require a huge expensive FPGA #### bogosort Joined Sep 24, 2011 571 This seems like a pretty small amount of gates to require a huge expensive FPGA The FPGA itself is not what makes a dev board expensive, it's the surrounding peripherals (i.e., the human effort to integrate, test, and make a commercial product). For under$40, you can get an FPGA on a minimalistic break-out board and do the work of integrating peripherals yourself. But if you're brand new to FPGA design, I'd strongly recommend paying the premium for a full-featured dev board, which usually have the additional benefit of coming with their own tutorials and support. You're paying for the lowest barrier to entry possible.

Otherwise, you're going to be deep-diving into the FPGA datasheet just to try to figure out how to properly connect a switch and an LED. With a proper dev board, you can get right to learning how to use an FPGA (which is already a fairly steep learning curve).

#### kaindub

Joined Oct 28, 2019
45
I have some experience with CPLD and none with FPGA. However I found that if you understand digital circuit design, then using these devices is not so hard. Understand truth charts for different gates, learn how to interchange gates, understand Karnaugh maps.
If you understand digital basics, you can use any manufacturers system with a little re-education.
These size of the device will depend on the number of inputs and outputs and the amount of recombination logic used (taking an signal from an output gate and feeding it back to an input device). Usually you only find the lastpiece of information after you start doing the layout, and where you are going to spend a lot of time optimising your design to make it fit.
And finally if you have a programming background, you need to get your head around the fact that “instructions“ are calculated on clock cycles, or if no clock as soon as an input changes. You don’t need to “read” inputs.
These devices are just another tool in your design arsenal . Use them for what they are.

#### andrewmm

Joined Feb 25, 2011
902
How to get started,

well, this is going to be a ramble. some of which others have said,

First which companies chips to use does not matter that much once you are an expert, but to learn, all the tool chains are very different. so pick one and stick to it

Historically, there have been three main companies,
Alter, now part of Intel
Xilinx, now part of AMD
Others, which keep getting sold / bought by other companies,
( Lattice is the current name ]

Xilinx invented the FPGA , Altera are almost as big, Lattice always the has been.

Re chips,
FPGAs cam out of CPLD's , CPLDs came out of PLD's.

In PLDs you think of registers / gates, in CPLDs you start to think of "functions", in FPGAs you think of what you want to do,

As you imply, FPGAs have lots of "gates" and are very flexible, whilst PLDs are very fixed, certain pins have a certain register / number of terms into a gate.

As the silicon in FPGAs is very small, a cheap chip can do a lot of function,
where as a CPLD due to age and different architecture, has comparatively few gates per chip.

We have to talk tools,
FPGAs are complex, if your a software guy, think of them as a mutli core processor, where as CPLDs are like a very small PiC , and PLDs are more like an adder.... ( OK analogy falls down at PLD's )

You will spend all your time in FPGA world in the tools, simulating , synthesising and then programming,

Xilinx has to tools, ISE, for the older parts, Vivado for the newer parts.
Altera has one tool, Quartus, that behaves in different ways for different families.
Lattice, has a different tool for each type of chip it has purchased.

You might gather, Lattice ( which I think this week might be micro semi ) though great cheap parts, I don't rate the tools, and could not recommend them as a way forward,

Xilinx / Altera, are fairly similar, I will declare that I am mainly a Xilinx person, so have a natural bias to there tools,
Having said that, both Altera are fantastic,
BUT
you have a problem,

I once herd a conference of a big company, where they said it costs almost as much to support a USD 1 chip as it does to support a USD100 chip, and we make ore profit on the USD100 chip.

And as far as I can see , this is still true.

On balance,
would probably look at the Altera Max10 range of chips to start with,
I have no connection with these people , but I have used a fair few of their products with great success,
https://shop.trenz-electronic.de/en/Products/Trenz-Electronic/MAX1000-Intel-MAX-10/

Next you have to select which language to learn !
like CPU's, there are many languages to learn.

Im old, and what would now be called a purist,
the basis of Hardware design IMHO is design and test well, and once, synthesis once, and re use.
For this VHDL is my language of choice.

Now if you are one that wants to "hack" or as its called now "agile develop", then you will probably be drawn o SystemVerilog,
IMHO, if you are initially taught / learn the "good" practices that VHDL imposes, then sytemVerlog is an easy step down
but as I say, I'm old and tired of fixing other peoples hacks in SystemVerilog,

A IMHO good book to learn VHDL from is, but I must declare, I was involved in this in a VERY VERY limited way, and I receive no moneys from them,
https://freerangefactory.org/
http://freerangefactory.org/pdf/df344hdh4h8kjfh3500ft2/free_range_vhdl.pdf

I hope this is of some help,
good luck,

#### mganz

Joined Oct 30, 2020
2
DE10-Lite from Terasic is a great board. Uses Altera MAX10. Good manual, good free tools. No connection to them but love mine. Good luck!

#### bpark1000

Joined Jan 26, 2013
2
Yeah, I've read a lot about them but have never actually touched one, think that is absolutely necessary.

Is spending that much on a dev board necessary? I've seen some in the \$20 range. What is missing in those?

Also, how do you determine how large/expensive of an FPGA is needed for a project? As an example, a board I built with discrete gates used the following:
(11) D-Type Flip Flops
(8) 2-Input AND gates
(3) 2-Input XOR gates
(3) JK Flip Flops
(6) 3-Input AND gates
(3) 3-Input OR gates
(1) 8MHz Clock

This seems like a pretty small amount of gates to require a huge expensive FPGA
Are you aware you can make a "poor man's FPGA" from EPROM (forms the combinatorial logic), and octal D flipflops (form the memory elements).For example, I made one to drive NeoPixel LEDs (2 octal flipflops and 27256 EPROM, 2.5MHz oscillator) from slower processor. You only need EPROM programmer, breadboard or simple circuit board), and PC, any programming language such as Basic or Python, and logic knowledge. (In circuit board image, red is top copper, blue is bottom, green is top cuts, cyan is bottom cuts. The FPGA2Basic.txt is the Basic file (had to rename as AllAboutCircuits would not permit BAS filename attachment).
You could most likely also do this with fast, simple processor, and small ASSEMBLY language program.

#### Attachments

• 4.6 KB Views: 2

#### chrisjackson

Joined Mar 6, 2020
9
Before you start thinking about coding for FPGAs, you need to familiarize yourself with certain terms and concepts such as logic gates, Boolean algebra, and logic circuits and their various types. The next step is to start learning the Verilog or VHDL programming languages.

#### mcardoso

Joined May 19, 2020
187
Thanks for all the tips so far everyone. Been working stupid hours lately and haven't had the time to dig into this, but I have started reading through the links provided above and I'm learning a ton. Definitely different than C++. I think I agree with the idea of spending the money to get a real dev board and go from there. When I get some free time, I'll probably do just that.

#### ElectricSpidey

Joined Dec 2, 2017
1,398
If your not committed to using FPGA/CPLD I would definitely have a look at PSoC.

No programming logic as well as C++ coding with plenty of built in peripherals.

#### mcardoso

Joined May 19, 2020
187
Ok have to admit I know nothing about PSoC other than what it stands for. How does it differ from microprocessors and FPGAs and when would I choose to use one over these other technologies?
Thanks!

#### ElectricSpidey

Joined Dec 2, 2017
1,398
It differs from microprocessors and FPGAs first in the fact that it combines both in a single chip.

Also a wide array of peripherals, hence the name PSoC (programmable system on chip)

I would imagine one would choose to use it for anything you want to do based on its versatility.

If you are interested purchase the PSoC 5LP CY8CKIT-059 and download the free IDE (PSoC Creator ) and start messing around with it.

10 bucks for the board direct from Cypress, and like 15.00 from Digi-Key.

Here is a screenshot of the drag and drop schematic from the very first "no code" project I did before learning the first thing about C++.

I was so impressed with the system that I started to take lessons in C++ and now have the ability to take advantage of a lot more of the systems capabilities.

#### mcardoso

Joined May 19, 2020
187
Wow, so microprocessor + gate logic + peripherals all in one package? Pretty neat.

I'm very much new to this side of electronics. I've got maybe 8 years of hobby microprocessor experience (arduino, NodeMCU, ST Nucleo, etc), 12 years of general electronics experience, 1 year of combinational/sequential logic (4000 series ICs) experience, and zero FPGA, CPLD, PSoC.

I do mostly industrial robotics and servo systems, so I'm interested in learning a new tool that will have better real time characteristics for controlling this type of hardware.

I think I will download that IDE and see what it can do - thanks.