Skip to content

Latest commit

 

History

History
164 lines (114 loc) · 7.9 KB

README.md

File metadata and controls

164 lines (114 loc) · 7.9 KB

Silice example projects

Looking at examples is a great way to learn and experiment. So I prepared several projects, from small to big, to show off Silice features. These projects are at various degrees of maturity and complexity, some have detailed explanations and code walk-through in their README (see list below).

Note that these designs are entirely created from scratch with Silice, from SDRAM, HDMI, VGA, OLED/LCD controlers to dividers and multipliers, importing only tiny bits of Verilog (for e.g. PLLs). Most of the designs rely on common functions grouped in the common folder, which is a treasure trove of functionalities that can be reused in your own designs: UART, keypads, OLED/LCD screens controllers, HDMI, VGA, SDRAM controllers, etc.

To build a design please refer to the building section below and the README of the project. All designs can be simulated with Icarus/Verilator, and many will work right out of the box on real hardware. This directory also contains a test_all.sh script which is mostly meant for development: it allows to check that all projects still compile with the latest Silice version. It relies on a configs file defined in each project sub-directory.

A few projects rely on some external hardware (typical low cost peripherals: OLED, keypad, LCD 1602, etc.), this is all detailed in the README of the projects. See also the peripherals Section below.

All example projects

For projects that do not have a README, please refer to building the examples below.

Building the examples

All examples are in the projects directory.

To build a project, make sure your board is ready to be programmed, open a command line (MinGW64 under Windows), enter the project directory and type make <target board> ; for instance make icestick.

Let's take an example! We will build the 'divint bare' demo for simulation with icarus. Do the following:

Note: under Windows please use a MinGW shell, please refer to the getting started guide.

cd silice/projects/divint_bare
make icarus

If everthing goes well you should see in the last console output:

20043 /   -817 =    -24

and a gtkwave window opens to let you explore the produced signals.

A good project to start with Silice is silice/project/blinky.

Peripherals

VGA

Some projects require extra hardware, for instance a VGA DAC (a bunch of resistors on a breadbord will do!). This is simple and fun to do, so I highly encourage you to make one. You may also use a VGA PMOD on the IceBreaker, e.g. the one by Digilent works great (see e.g. the terrain project).

All VGA and SDRAM projects can be simulated with the verilator framework (see next section), which opens a window and shows the rendering on screen. Most projects can also be simulated with Icarus, which outputs a fst file that can be explored with gtkwave.

OLED

Some of the projects use a small OLED/LCD screen. I typically use a 128x128 OLED screen with a SSD1351 driver.

The OLED/LCD screen library in common is compatible with multiple drivers (feel free to contribute more!). You may configure your OLED/LCD setup by editing the common/oled.si to specify the driver and resolution being used. Note however that some projects have their own controllers. The OLED/LCD library supports the SDD1351 and ST7789 drivers. Also checkout the specific pinout used for your board.

I now typically wire OLED/LCD screens with a four wire interface, as shown below for the IceStick. Most demos support this new pinout but please refer to each project README.

Examples highlights

Blinky

Blinks LEDs on all supported boards.

VGA demos

Old-school effects

Some old-school effects ported on FPGA.

Requires: VGA DAC
Tested on: IceStick, IceBreaker (VGA pmod), ULX3S (VGA DAC), de10nano (MiSTer SDRAM, VGA DAC or MiSTer I/O board)

VGA text buffer

A small demo featuring a font and text buffer

Requires: VGA DAC
Tested on: ULX3S (VGA DAC), IceStick, IceBreaker (VGA pmod), de10nano (MiSTer SDRAM, VGA DAC or MiSTer I/O board)

Video demos with SDRAM framebuffer

WolfPGA

The (very simplified) render loop of Wolfenstein 3D.

Requires: VGA DAC or HDMI, SDRAM
Tested on: ULX3S (HDMI), de10nano (MiSTer SDRAM, VGA DAC or MiSTer I/O board)

The DooM-chip

The DooM-chip, pushing the limits.

Requires: VGA DAC or OLED/LCD screen, SDRAM
Tested on: ULX3S (HDMI), de10nano (MiSTer SDRAM, VGA DAC or MiSTer I/O board)

Ice-V

A cool and tiny Risc-V processor (fits a HX1K Ice40, e.g. on the IceStick). Now includes a dual-core version! (only slightly bigger, still fits the IceStick!)

Tested on: ULX3S, IceStick, IceBreaker
Optional: OLED/LCD screen, audio I2S

Arithmetic

Divider (because we need one), multiplier and pipelined multiplier.

Algorithms

Pipelined sort (with detailed explanations)

License

All projects are under the MIT license. Feel free to reuse!