Learn skalp by Building Real Hardware

This tutorial takes you from zero skalp knowledge to a fully-featured UART peripheral with FIFOs, clock domain crossings, safety mechanisms, and a complete test suite. Each chapter introduces a language feature with a small standalone example, then applies it to the running UART project.

By the end, you’ll have built:


Prerequisites

This tutorial assumes you already know how to design digital hardware. You should be comfortable with:

You do not need to know Rust, though familiarity helps for Chapter 10 (testing). The tutorial explains Rust-specific concepts where they appear.


Installation

Install skalp from source:

git clone https://github.com/girivs82/skalp.git
cd skalp
cargo build --release

Add the binary to your PATH:

export PATH="$PATH:$(pwd)/target/release"

Verify:

skalp --version

Create a new project for the tutorial:

skalp new uart-tutorial
cd uart-tutorial

This creates a project with skalp.toml and a src/ directory. Each chapter adds files to this project.


Chapters

  1. Getting Started — Entities, signals, on(clk.rise), and your first counter. The entity/impl split, port declarations, basic types.

  2. State Machines — UART Transmitter — Build the UART TX with FSM states, baud rate timing, and shift register serialization.

  3. UART Receiver — Mid-bit sampling, edge detection, bit reconstruction. The RX side of the UART.

  4. Arrays and Generics — FIFO Buffering — Array types, generic parameters, clog2(). Build a parameterized FIFO and add buffering to the UART.

  5. Const Generics and Parameterization — Generic defaults, compile-time computation, test vs. production parameters. Make the UART fully configurable.

  6. Structs and Hierarchical Composition — Struct definitions, struct ports, hierarchical instantiation. Clean up the UART with structured configuration.

  7. Enums and Pattern Matching — Enum types, match expressions, exhaustiveness checking. Refactor FSM states and add a command parser.

  8. Clock Domain Crossing — Clock lifetimes, CDC compile-time safety, dual-clock entities, async FIFOs. Make the UART dual-clock.

  9. Safety and Annotations#[safety_mechanism], TMR voting, #[trace], #[breakpoint]. Add safety infrastructure to the UART.

  10. Testing and Verification — Rust testbench API, test organization, waveform generation. Build a complete test suite for the UART.


What This Tutorial Doesn’t Cover

This tutorial focuses on the skalp language and workflow. For deeper topics, see:


Ready? Start with Chapter 1: Getting Started.