Designing digital circuits used to be something that only big companies could afford to do. It used to require creating application-specific integrated circuits (ASICs)—taking weeks or months to produce an actual chip, and requiring piles of cash or wiring together tons of individual chips to perform various logic functions. Then the field-programmable gate array (FPGA) was introduced. FPGAs are programmable logic devices. Unlike an ASIC, the function an FPGA performs is determined at runtime, so an FPGA can be configured to act like just about any digital circuit. However, it wasn’t until recently that the cost of FPGAs has dropped to a point where they are now affordable for even hobbyists.

An FPGA allows you to design digital circuits. Digital circuits are basically just a bunch of logic gates (and, or, nor, etc.) connected together to perform a specific task. The designs that you create can range from something as simple as a counter that blinks an LED to something as complex as a multicore processor.

This book starts at the very beginning, with setting up your environment and getting an LED to turn on. As you develop your skills, you will learn how to perform more-complicated tasks and eventually design your own basic processor.

The board used in this book is the Mojo (along with the IO Shield). I created the Mojo in 2013 as a simple no-shenanigans FPGA development board for the hobbyist. I ran a Kickstarter to gauge interest and fund the initial round of boards. A lot more excitement than I originally expected resulted and has allowed me to continue working on it. My goal is to build a platform so that anyone who wants to learn about FPGAs—and more generally, digital design—can without having to go to college or having a personal mentor. This book is just another step toward this goal.

Expected Background

This book is going to teach you the basics of digital hardware design. This is not a topic for the complete beginner, and some background information is going to be assumed. You should be familiar with electricity (voltage and current) and basic electrical components (resistors, capacitors, transistors, and LEDs). While not strictly required, some programming background will be helpful, especially if it is with embedded microcontrollers such as an Arduino.

The majority of this book uses Lucid. Lucid is a hardware description language (HDL) that was designed to be beginner friendly and simpler to use with FPGAs than the more traditional Verilog and VHDL languages. Lucid is similar to Verilog in many ways, and our tools actually translate it to Verilog as an intermediate step during the build process. However, it removes some of the quirks that plague Verilog and makes many of the easy-to-make mistakes impossible.

Check out the Lucid Quick Reference guide in Chapter 13.

Lucid shares similar syntax with programming languages such as C/C++ and Java. Being familiar with one of these can help. However, it is important to remember that Lucid is a hardware description language and not a programming language.

It is important to have a solid understanding of binary, hexadecimal, and decimal number systems.

Conventions Used in This Book

The following typographical conventions are used in this book:


Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.


This element signifies a tip or suggestion.


This element signifies a general note.


This element indicates a warning or caution.

Using Code Examples

A repo of the book example projects is here:

A repo of all the built-in example projects in the Mojo IDE is here:

If you are familiar with Git, you can use it to clone the repos. If you aren’t, you can follow those links and click the green “Clone or download” button to open a dropdown menu with a link to download a ZIP of all the files.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at

Find us on Facebook:

Follow us on Twitter:

Watch us on YouTube:

Get Learning FPGAs now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.