Skip the complexity and learn to program FPGAs the easy way through this hands-on, beginner-friendly introduction to digital circuit design with Verilog and VHDL.
Whether you have been toying with field programmable gate arrays (FPGAs) for years or are completely new to these reprogrammable devices, this book will teach you to think like an FPGA engineer and develop reliable designs with confidence.
Through detailed code examples, patient explanations, and hands-on projects, Getting Started with FPGAs will actually get you started. Russell Merrick, creator of the popular blog Nandland.com, will guide you through the basics of digital logic, look-up tables, and flip-flops, as well as high-level concepts like state machines. You’ll explore the fundamentals of the FPGA build process including simulation, synthesis, and place and route.You’ll learn about key FPGA primitives, such as DSP blocks and PLLs, and examine how FPGAs handle math...
Author(s): Russell Merrick
Publisher: No Starch Press
Year: 2023
Language: English
Pages: 320
Title Page
Copyright
Dedication
About the Author and Technical Reviewer
Acknowledgments
Introduction
Who Is This Book For?
What This Book Isn’t
What’s in the Book?
What You’ll Need
Online Resources
1. Meet the FPGA
A Brief History of FPGAs
Popular FPGA Applications
Comparing Common Digital Logic Components
FPGAs vs. Microcontrollers
FPGAs vs. ASICs
FPGAs vs. Microcontrollers vs. ASICs
Verilog and VHDL
Summary
2. Setting Up Your Hardware and Tools
Choosing an FPGA Development Board
Requirements for the Book
Setting Up Your Development Environment
iCEcube2
Diamond Programmer
Project #1: Wiring Switches to LEDs
Writing the Code
Creating a New iCEcube2 Project
Adding Pin Constraints
Running the Build
Connecting Your Development Board
Programming the FPGA
Summary
3. Boolean Algebra and the Look-Up Table
Logic Gates and Their Truth Tables
AND Gates
OR Gates
NOT Gates
XOR Gates
NAND Gates
Other Gates
Combining Gates with Boolean Algebra
The Look-Up Table
Project #2: Lighting an LED with Logic Gates
Writing the Code
Building and Programming the FPGA
Summary
4. Storing State with the Flip-Flop
How a Flip-Flop Works
The Clock Signal
A Flip-Flop in Action
A Chain of Flip-Flops
Project #3: Blinking an LED
Writing the Code
Adding Constraints
Building and Programming the FPGA
Combinational Logic vs. Sequential Logic
The Dangers of Latches
Resetting a Flip-Flop
Look-Up Tables and Flip-Flops on a Real FPGA
Summary
5. Testing Your Code with Simulation
Why Simulation Matters
FPGA Simulation Tools
The Testbench
Writing a Testbench
Running a Testbench and Viewing Waveforms
Project #4: Debouncing a Switch
Measuring Time on an FPGA
Writing the Code
Creating the Testbench and Simulation
Building and Programming the FPGA
Self-Checking Testbenches
Initial Signal Conditions
On-FPGA Debugging
Verification
Summary
6. Common Fpga Modules
Multiplexers and Demultiplexers
Implementing a Multiplexer
Implementing a Demultiplexer
The Shift Register
Delaying Data
Converting Between Serial and Parallel Data
Creating a Linear Feedback Shift Register
Project #5: Selectively Blinking an LED
Writing the Code
Trying Another Way
Comparing the Two Approaches
Random Access Memory
A RAM Implementation
RAM on an FPGA
FIFO: First In, First Out
Input and Output Signals
A FIFO Implementation
Summary
7. Synthesis, Place and Route, and Crossing Clock Domains
Synthesis
Notes, Warnings, and Errors
Non-synthesizable Code
Place and Route
Constraints
Timing Errors
Crossing Clock Domains
Crossing from Slower to Faster
Crossing from Faster to Slower
Using a FIFO
Addressing Timing Errors
Summary
8. The State Machine
States, Transitions, and Events
Implementing a State Machine
Using Two always or process Blocks
Using One always or process Block
Testing the Design
State Machine Best Practices
Project #6: Creating a Memory Game
Planning the State Machine
Organizing the Design
Using the Seven-Segment Display
Coding the Top-Level Module
Coding the State Machine
Testing the Memory Game
Adding the Pin Constraints
Building and Programming the FPGA
Summary
9. Useful FPGA Primitives
How to Create Primitives
Instantiation
The GUI Approach
The Block RAM
Features and Limitations
Creation
The Digital Signal Processing Block
Analog vs. Digital Signals
Common DSP Tasks
Features
Creation
The Phase-Locked Loop
How It Works
Creation
Summary
10. Numbers and Math
Numerical Data Types
Representing Signed vs. Unsigned Values
Taking the Two’s Complement
Sizing Signals Appropriately
Converting Between Types in VHDL
Performing Mathematical Operations
Addition
Subtraction
Multiplication
Multiplication by Powers of 2
Division
How FPGAs Implement Math Operations
Working with Decimals
Adding and Subtracting with Fixed Point
Multiplying with Fixed Point
Summary
11. Getting Data in and Out with I/O and Serdes
Working with GPIO Pins
I/O Buffers
Electrical Characteristics
Faster Data Transmission with Double Data Rate
SerDes
Parallel vs. Serial Communication
Self-Clocking Signals
How SerDes Works
Summary
A. FPGA Development Boards
The Nandland Go Board
The Lattice iCEstick
The Alchitry Cu
Switching Between Boards
B. Tips for a Career in FPGA Engineering
The Resume
The Interview
The Job Offer and Negotiation
Summary
Glossary
Index