Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Digital Design for FPGAs, with free tools
Tutorial of synthesizable digital systems design in FPGAs using ONLY free and open source tools. The Hardware descriptions in this tutorial will be in Verilog.
- Development board : iCEstick . With the Lattice iCE40HX-1k FPGA
- Verilog Simulator : Icarus Verilog
- Signal Viewer : Gtkwave
- Synthesizer : Yosys (Repository on github)
- Place & route : Arachne-pnr (on github)
- FPGA Utilities and Download : Project icestorm
It is an incremental tutorial , in which concepts are introduced progressively, while being tested on real hardware. The circuits presented initially are not designed according to the usual design rules, but rather simplicity is emphasized. Then little by little, as the tutorial progresses, they are refined and improved.
The journey begins with the simplest circuit possible: a wire. And it ends with the design of a very simple microprocessor : MICROBIO
Join the FPGA-WARS group : exploring the free side for the latest news, questions, share and collaborate on the development of free reconfigurable hardware.
Juan González Gómez (Obijuan)
Licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
- Project icestorm, by Clifford Wolf and Mathias Lasser
- Arachne-pnr, by Cotton Seed
- BQ , for supporting this project from 2015-07-01 to 2016-04-14
- This tutorial would not have been possible without the incredible free tools of the Icestorm and Arachne-pnr project, by Clifford Wolf , Mathias Lasser and Cotton Seed . They represent a spectacular advance for the technological heritage of mankind. Thank you very much!
- To BQ , to finance the material used in the tutorial. Thank you very much!
- To Jesús Arroyo , for the incredible tools: icestudio and celery you are developing to make FPGAs easier to use Thank you very much!
- To David Sánchez Falero , for teaching me how to highlight Verilog code in the github markdown :-) This has made the code much more readable! Thank you so much!
- To Carlos García Saura , for the installation instructions of icestorm tools in Fedora. Thank you very much!
- To Javibc (J Bc) , by the instructions to relaunch the udev when configuring the icestick ¡Muchas Gracias!
- To David Cuartielles by the installer of free tools and makefile examples for the board with the FPGA ICE40HX8K. Thank you very much!
- To Fernando Barcala (Barkalez) for his feedback on the problems doing the tutorial 1. This has improved the documentation. Thank you!
- To Alberto Piganti (pighixxx) for doing the pinout of the icestick. Thank you!
- To Cristóbal Bueno for his tests of icestorm toolchains for Linux-32bits. Thank you!
- To Sebastián Gallardo For the test of the libusb in Windows 32-bits. Thank you!
- To Carlos Diaz for the tests of the libusb in Windows 10 64-bits. Thank you!
- To Pablo Cisneros (ZioGuillo) by the synthesis / download instructions in MAC. Thank you!
- To Julian Caro for all the issues sent to improve this tutorial. Graciass!
What is the difference between an FPGA and Arduino? Arduino's are a microcontroller, which are programmed. FPGAs are NOT PROGRAMMED, instead, they are configured to implement HARDWARE and are used to design circuits.
What does an FPGA do that an Arduino can't do? Many applications can be done either by software (programming) or by hardware. For example a counter. The difference is that in designing with hardware we get much higher speeds. In addition, the hardware can be "cloned" directly and operates in parallel. Whereas having several things running in parallel in software is not trivial.
Why Verilog and not VHDL? Verilog is the language that is supported by the icestorm project at the moment. But as it is a free project, the community will expand it and the VHDL will be supported sooner or later. As of today (Sep-2015), to work with free tools and FPGAs, you have to use Verilog
Update (August-2016) : The Yodl Project is implementing VHDL for the free Yosys synthesizer. It's still green, but VHDL support is on the way :-)
I have done the Hello World tutorial but synthesizing the file does not generate a .bin , instead it's a .blif The .blif file is what is generated in the synthesis, after running the yosys program. However, to get the .bin you still have to execute more commands. All the commands to execute to get the .bin from .v in the first tutorial are:
$ yosys -p "synth_ice40 -blif setbit.blif" setbit.v $ arachne-pnr -d 1k -p setbit.pcf setbit.blif -o setbit.txt $ icepack setbit.txt setbit.bin
To make it easier, it is best to run the make sint command . To do this you have to clone the repository of the github tutorial, enter the working directory and execute make sint:
$ git clone https://github.com/Obijuan/open-fpga-verilog-tutorial.git $ cd open-fpga-verilog-tutorial/tutorial/ICESTICK/T01-setbit/ $ make sim
2016/12/29 : Clifford adds an example hello world for the Icezum Alhambra Alhambra inside the Icestorm project.
2016/12/28 : Clifford Wolf already has his Icezum Alhambra !. He received it from Ismael Olea, 33C3 in Hamburg. All our recognition of Clifford's work. And many thanks to Ismael for giving it to him :-)
- Delivered the 100 Icezum Alhambras (v1.1) of the first Lot! :-) #ElAlhambraRepairer can rest now
- Julian Caro makes this epic video ( More information )
2016/12/10 : Activities in the Ourense MakersLab 2016 :
- Chat: " Free FPGAs ": ( More information )
- Delivered the III Workshop of Free FPGAs ( More information )
2016/11/18 : Talk: " Free FPGAs " in the Bilbao MakerFaire ( More information )
2016/11/09 : Talk: " Free FPGAs " at the Rey Juan Carlos University, fuenlabrada campus ( More information )
2016/11/05 : Activities at OSHWDEM 2016 of A Coruña , at the Domus Museum
- Chat: " Free FPGAs " ( More information )
- Delivered the II workshop of Free FPGAs in Spain ( More information )
2016/10/28 : Organized the 1st workshop on free FPGAs in Spain . Taught at the Technical School of Industrial Engineering, UPM ( More information
2016/10/24 : Talk: " Free FPGAs ", given in THE EVENT 2016, at the University Carlos III of Madrid (UC3M) ( More information )
2016/10/20 : The Alhambra-led card is published: Peripheral with an LED, for the Icezum Alhambra, with printable PCB ( More information)
2016/10/18 : Podcast 97: Obijuan, free software to join you. Interview with obijuan in the Podcast of Programarfacil.com , by Luis del Valle
2016/10/02 : Clifford announces that it will begin reverse engineering the bitstream of Xilinx 7 Series FPGAs . It will take more than 1 year, but it is a very important milestone to increase the free FPGAs park ( More information )
2016/09/24 : Talk: "FPGAwars: Exploring the free side of FPGAs" given at Madrid Mini maker faire ( More information )
2016/09/23 : First talk given in Spain on free FPGAs. It was given at the ETSIIT of the University of Granada, organized by the Free Software Office of the University of Granada ( More information )
2016/07/29 : Videoblog 22: Icezum Alhambra V1.0K World Heritage Edition ( VIDEO )
2016/07/28 : Icezum Alhambra V1.0K released! It has been created from scratch using only free tools, from our technological heritage
2016/07/07 : VHDL frontend for Yosys! Still green, but the community is already starting VHDL support on free FPGAs : https://github.com/forflo/yodl
2016/07/03 : Finished the phase of raising money for the crowdfunding of the manufacture of the Alhambra Icezum. We have already received the € 6,500 from the funders. Thank you very much to all of you for your help! List of all funders
2016/07/02 : Jesús Arroyo releases version 0.2.0-Beta1 of Icestudio. Publish this video showing the most relevant new features : code blocks and hierarchical design. Clifford Wolf echoes the news and tries it on a icestick :-) twitter post
2016/05/19 : The pinout of Icezum Alhambra by Maestro Piganti has been migrated to SVG format with Inkscape so that anyone can modify or use it easily ( repo
2016/05/18 : Objective achieved . The 100 Icezum Alhambras are now in full swing. We started the process for the manufacture of the first 100 units!
2016-05-04 : We already have the pinout of the card Icezum Alhambra , made by Alberto Piganti. Thanks!
2016-05-01 : Help is requested on the list of FPGA-wars for the financing of the manufacture of 100 cards Icezum Alhambra. A mini-crowdfunding ( Original message in the group )
2016-04-29 : Platformio 2.9.0 already supports free FPGAs :-)
2016-04-20 : FPGAwars organization in github. All repos related to free fpgas have been transferred to that organization. BQ no longer continues with free FPGAs
2016-03-24 : Cross-compilation of icestorm tools for Ubuntu Phone ( VIDEO )
2016-03-22 : Document with the synthesis instructions for Mac , created by Pablo Cisneros (ZioGuillo). Thank you!
2016-03-15 : Locomotion of a worm-like modular robot using hardware oscillators in a FPGA, with the IceZUM card ( VIDEO )
2016-03-12 : Videoblog on the IceZUM Alhambra ( VIDEO )
2016-03-09 : Post on Hackaday on the IceZUM Alhambra.
2016-03-05 : First downloaded bitstream on the IceZUM Alhambra card! :-) The board works. In addition, the tests have been done from Windows, using icestorm MULTIPLATAFORMA Double validation! ;-) ( Image )
2016-03-04 : First version of icestorm MULTIPLATAFORMA . You already have cross-compiled tools for Mac and Windows. Initial tests ok
2016-02-28 : Cross-compilation of the iceprog tool for windows. Cristóbal Bueno has reported the first tests of correct operation in Windows 10 64-bit
2016-02-25 : Cross-compilation of icestorm tools for Linux-32-bit . The packages are generated and can be installed directly from Apio. Cristóbal Bueno , from the FPGA-wars list, is in charge of making the tests. Thank you!
2016-02-23 : Icestudio is published in hackaday :-)
2016-02-19 : Icezum card published in github. Designed by Eladio Delgado . Yesterday they were sent to manufacture the first 5 pcbs. It is a coach card like the icestick but shaped like BUM ZUM, which is in turn as an Arduino one
2016-02-08 : Alberto Piganti (pighixxx) has done the pinout drawing of the icestick
2016-01-31 : First platformio + FPGA model , used since Atom ( VIDEO ). Developing hardware now is a lot easier. You no longer need to use the console and make ;-)
2016-01-28 : Starting to support lattice FPGA ice40 in Platformio : Platformio + FPGA
2016-01-24 : Simplez documenting and with improvements: ( VIDEO )
2016-01-11 : We received the icoboard card donated to us at 32CCC, which was attended by Victor Diaz. Thank you very much! :-)
2016-01-02 : David Cuartielles creates an installer to facilitate the installation of all free tools to work with FPGA (on Ubuntu / Debian systems)
2015-12-30 : We received two ICE40HX8K lattice board cards, purchased at MOUSER. They have the FPGA HX8K lattice, with 8 times the size of the HX1K of the icestick. In this can already be synthesized a 32-bit risc-v processor (not yet tested)
2015-12-27 : Clifford gives the lecture "A Free and Open Source Verilog-to-Bitstream Flow for iCE40 FPGAs" in the 32nd edition of the Chaos Communication Congress in Hamburg. All material is published on his website. In the demo they use an HX8K FPGA on the icoboard with a 32-bit risc-v processor synthesized using free tools. Víctor Díaz who is there knows Clifford, and this one gives him an icoboard to give it to obijuan :-)
2015-12-08 : Found the solution to a bug in iceprog: Now download times on the icestick are always less than 3 seconds !!! Clifford integrates the official repo almost instantly. The development cycle is now much faster
2015-12-01 : Dinner of David Cuartielles of Arduino.cc and Rodrigo of the Prado and Juan González of BQ, in Madrid. We talked to David about the new ecosystem of free FPGA tools and the possibility of collaborating together
2015-11-26 : First version of the SIMPLEZ educational processor synthesized in the icestick, executing a program that shows a sequence by the leds: Repo
2015-11-20 : Finished the last chapter of the tutorial (30)
2015-10-21 : Imperial March plays on the icestick. I'm sending this video to Clifford. I also tell him that I am working on these tutorials. He likes the idea and publishes the link of the tutorials on the icestorm website :-)
2015-08-12 : First contact with Clifford Wolf (the author of the icestorm project). I send him an email thanking him for the project. He answers.
2015-08-10 : Returned to Madrid, although still on vacation. I passed by BQ to pick up an icestick. I achieved a historic milestone: I downloaded my first verilog design to the fpga, using free tools !!! A "hello world"" program that lights a led !!!!! :-) I start this wiki to do the tutorials as I'm learning.
2015-08-05 : The two icestick packages are received at BQ (And I on vacation with the SAV butt !!!!)
2015-08-03 : Jesús Arroyo buys 2 icesticks cards directly from Lattice, for the department of innovation and robotics of BQ
2015-07-31 : First tests. Installed the entire tool-chain of icestorm web in a ubuntu 15.04. It works!. All test examples I upload to this repo . The SAV shoots me. I'm going on vacation (no internet for 10 days). I take PDFs with verilog manuals to read and learn
2015-07-30 : I finish the second season of the Freecad tutorials. I can already use it with FPGAs!
2015-07-04 : I begin to write the Notes on free FPGAs in the wiki, to gather information. I still can not evaluate anything because first I have to finish the Freecad season 2 tutorials. Until I finish one thing I can not start with the next
2015-07-03 : Another post in hack-a-day . I get shot SAV (live anxiety syndrome)
2015-05-29 : The news comes out in a hack-a-day post. I learn of its existence through this post and I begin to evaluate the tools (obijuan)
2015-05-27 : The icestorm project reaches the first big milestone: They already have a workflow that works completely using only free tools
Compilation of Links
- Project icestorm ( Github ). A project to encompass all the low level iCE tools
- Yosys: synthesis tool ( Github )
- Arachne: Place & route
- Icarus Verilog Simulator ( Github )
- Gtkwave : Waveform display
- Icestick board
- ICE40LPHXFamilyDataSheet.pdf : ICE40 FPGA datasheet
- Icestickusermanual.pdf : Icestick data sheet
- Pinout of the Icestick board by Alberto Piganti
- Processor Simplez-F. Educational processor Simplez, by Professor Gregorio Fernández, written in Verilog and synthesized into an Icestick
- Simplez on Atom . Package to highlight the Simplez syntax from Atom
- FPGA-WARS Group : Exploring the Free Side
- Platformio + FPGA . Inclusion of ICE40 FPGAs in the Platformio environment
- Apio . Multiplatform ecosystem to synthesize hardware in free FPGAs
- Icestudio . Visual tool to synthesize hardware in free FPGAs
- IceZUM Alhambra Card
Tools used for the preparation of this tutorial
Inkscape, 0.91: For the figures (All of the figures source files in .SVG are in the repository)
Gimp: Retouching and processing of photos
Operating System : Ubuntu GNU / Linux 16.04
- "Digital Design, An Embedded Systems Approach Using Verilog". P. Ashenden. 2007. It is a reference book of digital design using hdl languages