This repository is dedicated to helping FPGA enthusiasts and beginners explore the capabilities of the iCE40 FPGA. It contains a collection of basic programs designed to get you started with digital design. Inside, you'll find:
- Blinky: A simple LED blinking program to demonstrate basic FPGA outputs.
- Knight Rider: An LED pattern inspired by the famous moving light sequence, showcasing more complex LED control.
- UART Communication: A module for sending and receiving messages using UART protocol, interfaced through Python, to demonstrate basic serial communication.
Each program comes with comprehensive documentation, including step-by-step guides on how to set up your development environment, compile the code, and deploy it to an iCE40 FPGA board. Whether you're a student, a hobbyist, or just curious about FPGAs, this repository has the necessary tools to get you started.
This repository will use Alchitry Cu FPGA with Lattice iCE40 FPGA which can use open-source toolchain that includes Yosys, Nextpnr, and IceStorm tools.
Following is the steps you need to build and run any RTL on Alchitry Cu using the toolchain. There is a docker container with th toolchain installed by Archfx that can be used if you're familiar with docker. Following are the steps you need to move forward with this quickstart.
- Clone this repository
git clone https://github.com/hansikaweerasena/ice40-Quickstart
- Pull the docker image from docker hub
docker pull archfx/ice40tools
- Run the docker image
docker run -t -p 6080:6080 -v "${PWD}/:/ice40-Quickstart" -w /ice40-Quickstart --name ice40tools archfx/ice40tools
- Get in to interactive shell inside docker
docker exec -it ice40tools /bin/bash
- Compile the design using following command
# Change to the appropriate directory
cd ice40-Quickstart/examples/blinky
# Synthesize the Verilog source into a JSON representation
yosys -p 'synth_ice40 -top blinky -json blinky.json' blinky.v
# Run placement and routing
nextpnr-ice40 --hx8k --json blinky.json --pcf blinky.pcf --asc blinky.asc --package cb132
# Generate the binary bitstream file
icepack blinky.asc blinky.bin
-
You need to download the alchitry loader if you're using Alchitry Cu chip from here to load .bin files directly to your board.
-
Now enjoy
-
Pin Constraint Files (.pcf):
- The Alchitry Cu board includes specific pin constraint files (.pcf) for each example, essential for mapping the design's input/output signals to the physical pins of the FPGA. When using a different board equipped with an iCE40 FPGA, these files must be updated to reflect the pin configurations of the new board.
-
FPGA Specification in Tool Commands:
- The Alchitry Cu utilizes the
ICE40HX8K-CB132IC
FPGA, whereHX8K
indicates the family and capacity, andCB132
specifies the package type and pin count. If you are using a different iCE40 FPGA board, adjust the parameters (--hx8k
and--package cb132
) in place and route tools like Nextpnr to match the new board's FPGA specifications.
- The Alchitry Cu utilizes the