Getting started with FPGA from scratch - Page 1
Forum section: electronics / beginners

author: VSV_electron
author_rank: Regular Contributor
timestamp: October 27, 2022, 04:44:12 am
content: If you can bear with me please give me some really starter instructions on how to approach the FPGA system development/programming.Honestly saying for me FPGA at the moment is just a fancy name with not much information behind it.I found a budget board based on Spartan 6. Here it is:https://aliexpress.com/item/32890953742.htmlI'll ask some basic questions:- Since that's a bare board what periferals I can/need_to connect to it to make it minimally functional? Please consider this question as if I was asking about a microcontroller. I hope I can treat the FPGA as a micrcontroller in the first approximation (purists please be patient). Oh, mind you I perfectly understand this might me a completely wrong approach but I would rather start from the analogy since I can hardly understand the nature of the 'Field Programmable Gate Array' at the moment. I'll learn along the way.- Apart from the board itself which apparently has nothing on it to confirm its functionality what minimum additional hardware do I need? A JTAG serial SPI is a must to upload the code, I know. I also need to connect at least some LEDs to the board to start with.- As far as I understand the Software Development suite that is meant for XILINX FPGAs including Spartan-6 is Vivado. Do I need any specific knowledge of what version to download for this development board?Anyway, please just help me out. The more information you can provide the better. Please remember you all started some day from scratch perhaps in the University environment under good supervision. I have no one to help me with this apart from you my friends on this forum.I downloaded a dozen of books on FPGA but books will help me later and now I just need to get it going.(I've watched a bunch of videos about FPGA on YT but they don't explain much apart from the general theoretic definitions of what FPGAs are on the most fundamental level.)If you ask me about what do I need it for or otherwise what I want to do with it you better think of it the other way round: You've got an FPGA and you try to find out what you can do with it.

author: pcprogrammer
author_rank: Super Contributor
timestamp: October 27, 2022, 05:18:20 am
content: Hi, the board you found is a nice one to play with, but indeed needs things connected to it do do something meaningful, but that just depends on what you want it to do for you.It has some LED's and buttons on the board you can do some first tests with. You might get some example programmings with the board on how to use these.For as far as I know you need the older development tools (ISE) for the spartan-6 series. Vivado is for 7 series and up.In some way a FPGA is far more then a microcontroller, but also less. A FPGA is a blank slate of a series of gates that can be connected to each other in many ways. It can become a microcontroller to some extend. What is less then a microcontroller is it might not have build in bits like an analog to digital converter. (There are FPGA's that do have them)What this means is that you create hardware when programming a FPGA.There are plenty of modules available for connecting to a FPGA, that include ADC's, DAC's, cameras, displays, etc.Take a look at my repository here:https://github.com/pecostm32/Lichee_NanoI'm using a different FPGA board there combined with a Lichee Nano F1C100s board and a DAC module, but it can give you an idea of the possibilities.Edit: Link to the ISE suite:https://www.xilinx.com/products/design-tools/ise-design-suite.html

author: RoGeorge
author_rank: Super Contributor
timestamp: October 27, 2022, 07:58:51 am
content: Quote from: VSV_electron on October 27, 2022, 04:44:12 amNo you can not. That's the worst, most damaging start. Microcontrollers and FPGA are unrelated. And their "programming language" does not describe aprogram, HDL code describes aschematic. That's why the language is called HDL (Hardware Description Language). Notice theHardware Descriptionwords in the name, that means schematic, not program.The Verilog or VHDL "code" is a text that describes a schematic with logic gates and flip-flops and such, it does not describe a programming algorithm. The instructionlines in HDL are not executed sequential, one after another, like in the most other programming languages.Try this place as a starting point:https://www.fpga4fun.com/FPGAinfo1.htmland again, leave microcontrollers out of this, HDL is about digital schematics, not about programming.AFAIK Xilinx Vivado only supports series 7 and later of their FPGAs.For Spartan 6 you'll need to download and install Xilinx ISE 14.7The board manufacturer often might recommend a specific version/license + their tutorials. Use those at first. IIRC the Xilinx ISE WebPACK is free. Find the documentation corresponding to the Spartan-6 devboard you have, and follow the install instructions from there. But read first from the intro link above, or else the Xilinx ISE toolchain won't make any sense.

author: Ice-Tea
author_rank: Super Contributor
timestamp: October 27, 2022, 08:08:52 am
content: I would suggest getting another dev board like per examplehttps://nl.farnell.com/terasic-technologies/p0082/e22f17c6n-de0-nano-dev-kit/dp/2076463It has a lot more features, all well documented and debugged. There are code examples. Like that you know you are starting from a working system and won't be spending time figuring out whether you're seeing a HW ghost or have a code issue.Oh, and don't approach it like a uC. Not even to get started.

author: dietert1
author_rank: Super Contributor
timestamp: October 27, 2022, 08:28:53 am
content: As far as i remember i got a used Digilent board from ebay to learn FPGA, Spartan II at the time. It had some LEDs, some buttons and even a small LCD display. If you can afford a new one, even better.You need a reasonable workstation, too. Modern EDA software is huge. Although one needs less than 1 % of it at the beginning, as far as i remember there was no "beginners" setup.Regards, Dieter

author: rstofer
author_rank: Super Contributor
timestamp: October 27, 2022, 09:37:44 am
content: Be aware that ISE 14.7 doesn't work on Win 10 (and presumably Win 11) due to a SmartHeap issue. Xilinx has an official workaround that incorporates a VM and some pushups. The other way is described in this page as 'ISE 14.7 64-bit - Turning off SmartHeap:'https://support.xilinx.com/s/article/62380?language=en_USI have been using 14.7 on Win 10 for a long time so I know it works. It's even better if you have a Win 7 machine and don't have to solve this problem.Vivado is a far superior toolchain but it only works on Artix 7 devices and up. I just don't know about any inexpensive boards.Although I am a Xilinx fan, the GoBoard (based on Lattice FPGA) is attractively priced with lots of tutorials:https://nandland.com/the-go-board/

author: CaptDon
author_rank: Super Contributor
timestamp: October 27, 2022, 02:57:58 pm
content: You will learn to hate Xilinx in a hurry. Their fabric is o.k. but their software tools eat up tons of space and are quirky and behave like bandaids on already poor coding. Many broken links on their websites, just the kind of things to ruin your productive day. Try posting in the FPGA forum by the way.

author: funhobby
author_rank: Newbie
timestamp: October 27, 2022, 04:28:53 pm
content: I am really a beginner, but let me share what I found useful in case some of it will be helpful.I started by building 6502 based computer (by stumbling upon Ben Eater youtube videos:)Then I wanted to add a VGA based video card and a keyboard. While this could be build with basic logic chips, it seemed too repetitive and limiting (you can only fit so much on breadboards and breadboards have their own issues). So I figured that I should do it with FPGA.I got Cmod A7 and started watching videos and making small implementations.https://digilent.com/reference/programmable-logic/cmod-a7/reference-manual?redirect=1It only has few LEDs on the board, but I can add external buttons, LEDs and adapters for VGA, PS2, HDMI and so on.I recommend watching a series of videos starting with this one:Digi-Key has a nice series as well, starting with:P.S. Yeah I already dislike some things about Xilinx. :-) Download alone is ridiculously slow.

author: rstofer
author_rank: Super Contributor
timestamp: October 27, 2022, 05:35:57 pm
content: So, how many times are you going to download Vivado? What difference does it make how long it takes, let it run overnight. Also, Gb Ethernet helps. For ISE, Xilinx used to provide a DVD, I have forgotten whether there was a nominal charge.For Lattice you have 3 separate tools to use: ModelSim (simulation), iCEcube2 (editor/compiler) and Diamond (programmer), with Vivado, everything is integrated. And let's not overlook the Vivado Integrated Logic Analyzer that lets you debug your project in real-time on the actual hardware.I'll concede that it took a while to transition from ISE to Vivado constraints files. It's best if you can find a published file that matches the manufacturer's board. Digilent supplies them and they have some tutorials as well.I had been using ISE for about 10 years before transitioning to Vivado. I wasn't a happy camper. Over the last few years, I have made peace with Vivado. Somehow, I'm still fond of the ISE user interface...If you plan to use VHDL and Lattice, vhdlWhiz.com might be a great resource. I did a couple of the 'for pay' projects just for giggles. Actually, I wanted to learn more about simulation. Early versions of ISE didn't include a free simulator so I never learned that aspect of FPGA development.https://vhdlwhiz.com/

author: james_s
author_rank: Super Contributor
timestamp: October 27, 2022, 05:40:17 pm
content: The best book I found for learning FPGA development is also free, it's called "Free Range VHDL"Definitely do not treat the FPGA like a microcontroller. Actually I think existing programming experience hinders rather than helps. HDL *looks* like programming but it is actually a language to describe a schematic, it is not a program.

author: pcprogrammer
author_rank: Super Contributor
timestamp: October 27, 2022, 06:10:52 pm
content: The construct of verilog is much closer to C, but you do have to alter your mind set from sequential programming to parallel handling of signals.It is thinking in terms of logic and signals. For instance to display something on a monitor you have to build your own "video card" by setting up memory, address counters and what more is needed to do this.There is another thread started in the FPGA section where I refer to a lot of sites that you can visit to learn more about this all.https://www.eevblog.com/forum/fpga/first-fpga-system/msg4487518/#msg4487518There are some new comers to the FPGA market like Gowin, Anlogic and others like Lattice, Altera/Intel, Xilinx/AMD and probably some more to choose from, and lots of boards to be found on Aliexpres that can be used to play with. Unfortunately the prices have gone up the last couple of years, and availability is poor.The Spartan-6 is an oldie but still quite a nice one to do things with. Another one is the Cyclone IV range from Altera/Intel. And then there are also FPGA's with an embedded processor. Gowin has some with an ARM cortex in them. Xilinx/AMD has the Zynq line, Altera/Intel the Cyclone V range.In the end it all depends on what it is you plan to do with FPGA's as to which one to choose.

author: rstofer
author_rank: Super Contributor
timestamp: October 27, 2022, 09:26:41 pm
content: You may find projects athttps://opencores.orguseful. They vary in quality but they do provide some insight.I particularly like the T80 core. It is a Z80 CPU that I have used to build a fast CP/M machine and, more importantly, a PacMan game. You need to deal with the interrupt input. Left floating, the CPU is constantly interrupting itself. There's a reason I know this.https://opencores.org/projects/t80I remember the days of CP/M on a 2 MHz 8080 (Altair 8800) and then the fantastic upgrade to a 6 MHz Z80 (CompuPro). At 12.5 MHz on a Spartan 2 FPGA board, CP/M is fairly responsive. Of course, the current production 50 MHz Ez80 chip is a LOT faster. With care and the proper FPGA, the T80 core can run up to 100 MHz. That's pretty quick.

author: james_s
author_rank: Super Contributor
timestamp: October 27, 2022, 10:06:32 pm
content: Quote from: rstofer on October 27, 2022, 09:26:41 pmThat seems like a strange choice, it would have been trivial to write the core such that the default state of the interrupt line is inactive. I always assign values to unused inputs when I instantiate though. The T80 core is nice, and the T65 as well which is a 6502 core I've used in a lot of projects.

author: rstofer
author_rank: Super Contributor
timestamp: October 28, 2022, 01:53:18 pm
content: Quote from: james_s on October 27, 2022, 10:06:32 pmI don't think there was a choice of level on the Non-Maskable Interrupt (compatibility) but almost certainly a PULLUP or PULLDOWN attribute could have been added. I just looked at the .ucf file that came with the project and no such attributes are declared for any signal. The file date is Dec 2004 so that was around the time I first started with FPGAs - I wasn't experienced enough to know the intricacies of constraints. I'm pretty sure the transition looked like: First, blink an LED. Second, build a CP/M machine. Third, build an entire minicomputer with all of the peripherals that would run all of the factory software.

author: iMo
author_rank: Super Contributor
timestamp: October 28, 2022, 02:42:08 pm
content: The best way to "start" is to find a moderate proven living design (a repo with all project files required) which is ready to be build in a specific IDE ("a single click approach") and which runs fine on a specific FPGA board. Messing with FPGAs is quite difficult and time consuming. I own about 20 boards from 384 to 150k LUTs (Actel, Lattice, Altera, Xilinx) and when I see something interesting to "try fast" the boards/IDEs always do not fit.. (Murphy law perhaps)..Therefore find yourself a well working proven "living" project/design, with some nice people around the project who can, and are willing to help you (important!!!), and buy the exact board and programmer they recommend. Then slowly start with your changes, improvements in the existing working design. Porting an existing design from a board_A to a board_B is pretty difficult exercise for a beginner, imho.PS: messing with "microprocessors" inside an FPGA leads always to a heavy and complex development "environment", consisting of dozens of properly installed languages, packages, scripts and tools, usually under linux and with open source initiatives - except hdl (verilog/VHDL) you have to learn how to create that "dev environment" for building up the final FPGA bitstream, and that is a complex exercise too (unless you get a detailed updated precise step by step guide how to do it)..

author: rstofer
author_rank: Super Contributor
timestamp: October 28, 2022, 03:48:46 pm
content: Quote from: imo on October 28, 2022, 02:42:08 pmWhich probably makes the case for Nandland.com and the GO board:https://nandland.com/the-go-board/https://nandland.com/lots-more-vhdl-and-verilog-modules/The FPGA 101 modules seem interesting.

author: dietert1
author_rank: Super Contributor
timestamp: October 28, 2022, 05:48:13 pm
content: Just found this eevblog video:Not everybody is born to become a FPGA designer! Many tried but finally went back to do what can be done with MCUs.Regards, Dieter

author: rstofer
author_rank: Super Contributor
timestamp: October 28, 2022, 07:49:48 pm
content: Quote from: dietert1 on October 28, 2022, 05:48:13 pmAt the hobby level, I think this is true. There has to be a reason for migrating to FPGAs and it better be compelling because you ultimately have to get down to the bare flop level of programming. And there are going to be thousands of flops. Sure, we can declare a 32 bit register with a line of code but it still takes 32 flops.My only interest in FPGAs revolves around CPUs. Trivial CPUs or complete systems but still CPUs. I started programming FORTRAN on an IBM1130 back in '70 and I wanted one - a fully functional work-alike that would run the 27 pass FORTRAN compiler. I made a microprogrammed attempt back around '74 but the 2102 static RAM wasn't readily available. AFAIK the microcode worked but a CPU with no RAM is pretty useless. I guess I wasn't up to dynamic RAM...The project sat on the back burner until I retired and had the time to work on it. It wasn't as bad as it seems, Once you learn how to structure registers, counters, MUXes and Finite State Machines the rest is just interconnecting the blocks. Wire wrap with just a simple sentence.I spent my undergrad and postgrad efforts on digital design. Of course I ate this stuff up. No more Karnaugh maps and no more wire-wrap. I could have a million gates in a single chip - a virtual dumpster load of logic! What a playground.But it was always a hobby.Here's a project:https://people.cs.georgetown.edu/~squier/Teaching/HardwareFundamentals/LC3-trunk/docs/LC3-uArch-PPappendC.pdfIt is nicely documented in books and all over the Internet. Unlike many other projects, this one doesn't include the HDL, that's up to the builder. In fact, the authors designed the machine for microcode. That's a perfectly viable approach even in an FPGA. It would be kind of fun to do.

author: iMo
author_rank: Super Contributor
timestamp: October 28, 2022, 08:14:44 pm
content: If you are into mainframesyou may try thishttps://pdp2011.sytse.net/wordpress/pdp-11/I tried with it this spring and it works as advertised, it is almost a turn-key solution (a couple of config switches have to be set in the VHDL and it builds straight then), provided you get lucky owning the right board(s). It is a complete PDP-11/XY midrange on the chip, with system disk on an sd-card.Mine is PDP-11/70 on the DE1 Cyclone-II altera board (the minimum is at least 20k cells and 2MB dram to be happy, but there are examples with smaller fpgas and srams as well). With a larger fpga (like 30-50k) you can enable VGA output and PS2 keyboard and you get a complete PDP-11 system (otherwise you work via an external terminal). As a bonus the 64bit FPU (yes, it is there on the chip) fits luckily in mine fpga as well, all supported with a ready to use BSD2.11 UNIX disk image (with latest patches) prepared by Sytse, the author (active on the PiDP groups). It runs 10MHz cpu clock and 160MHz dram clock, giving aprox 50% more speed than the original.PS: the other DEC OSes are supported as well..

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2022, 08:23:50 pm
content: My interest in FPGAs is in recreating vintage hardware. I'm much better with hardware than I am programming and FPGAs are cool. It's like having an enormous breadboard and an infinite pile of free components.

author: Bud
author_rank: Super Contributor
timestamp: October 28, 2022, 08:51:50 pm
content: In relation to vintage hardware recreation - I do not have sympaty to FPGA. It does not have the warm and fuzzy feeling to me for some reason, no matter what cool things they produce. Would use low level logic chips any time of day instead.

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2022, 08:55:36 pm
content: Quote from: Bud on October 28, 2022, 08:51:50 pmYeah, well I've got better things to do than hand wire a ~16"x12" arcade PCB with dozens of TTL chips, some of which are hard to come by. With an FPGA I can publish my designs and anybody can play with them. I've recreated a bunch of early games using what was at the time a $13 FPGA board. Without the FPGA I never would have bothered.https://github.com/james10952001

author: rstofer
author_rank: Super Contributor
timestamp: October 29, 2022, 01:05:00 am
content: Then there is the PiDP11/70 based on a simulation running on a Raspberry Pi. It runs faster than the original and BSD Unix works well. It's kind of fun to play with the original C compiler and the PDP11 Macro Assembler. Networking does what you would expect from BSD Unix. I have two of the machines...https://obsolescence.wixsite.com/obsolescence/pidp-11A few years back I built an FPGA PDP-11 based on a project out of Germany. The professor said I was the only success story outside of academia. The project wasn't necessarily ready for prime time but it did work and it was fun!FPGAs give people an opportunity to play with hardware that no longer exists. I wonder if I could do a CDC 6400 or an IBM 360/370... The nice thing about IBM documentation is that it usually includes a "Functional Characteristics" manual that describes literally everything. Very handy...http://media.ibm1130.org/E0006.pdfMore at:http://ibm1130.org/A lasting relationship for over 50 years!

author: bidrohini
author_rank: Regular Contributor
timestamp: October 29, 2022, 02:49:08 pm
content: You can follow this video if you already have not: