Skip to content

Neo

A modern HDL for building hardware you can trust

Neo checks pipeline timing, clock domains, and register resets as you write, and uses symbolic validation to check parameterized modules for every valid parameter value. Validated designs compile to readable SystemVerilog or FIRRTL for the tools you already use.

// Mult: 2 cycles when fast, 5 otherwise; Adder: 1 cycle
module MultiplyAdd(fast: Bool, t: Timing) {
  let latency = if fast { 2 } else { 5 };
  input a(t): Int(32);
  input b(t): Int(32);
  input c(t): Int(32);
  output out(t + latency + 1): Int(32);
} {
  mod mult = Mult(fast, t);
  mod add = Adder(t + latency);
  assign {
    mult.a = a; mult.b = b;
    add.a = mult.out;
    add.b = Reg(c, cycles: 2latency);
    out = add.out;
  }
}

error[timing_mismatch]

Expected timing `t + fast ? 2 : 5`, but got `t + 2`.

note: for example, when `fast = false`

You added a smaller 5-cycle multiplier option to save area, but left c delayed by 2 cycles. It passes tests on the fast build, then silently mixes operands from different cycles when fast is false.

Try Neo in Your Browser

Explore examples and inspect generated SystemVerilog, FIRRTL, or HW-IR side by side. Enable the live compiler & LSP to edit code with real-time validation, hover types, and autocomplete.

Minimal combinational 32-bit adder module with cycle-accurate timing.
main.neo Neo HDL
Loading editor…
Pre-compiled
Loading output…

Bugs Neo catches before you simulate ​

Generate-loop collisions, reset discipline, handshakes, and clock domains usually live in comments and conventions. Neo makes them part of the language. Every error below is real compiler output.

A multi-driver bug in a generate loop ​

Strided bank swizzling works for every power of two (2, 4, 8, 16, 32, …), so typical tests never trip it. Whenever n is a multiple of 3, two different iterations short-circuit onto the same output slot. Neo checks the loop symbolically across all n and hands back the colliding iterations.

neo
module BankSwizzle(T: LogicType, n: Pos, t: Timing)
where n: n >= 2 {
  input inp(t): Array(T, n);
  output out(t): Array(T, n);
} {
  for i in 0..n {
    assign out[(i * 3) % n] = inp[i];
  }
}
text
error[multi_assignment]: Signal `out[3 * i % n]` may be assigned by multiple iterations of `for` loop.
 --> main.neo:6:3
  |
6 |   for i in 0..n {
  |   ^^^^^^^^^^^^^^^
  = note: for example, when `n = 3`, `i = 1`, `i' = 2`

An unreset control register ​

If full powers up as 1, this skid buffer immediately emits garbage data downstream. Neo flags full because it controls the if mux — while leaving the datapath register data alone so you don't pay reset fanout on wide buses.

neo
module SkidBuf(T: LogicType, clk: Clock) {
  consumes inp: Decoupled(T, clk);
  provides out: Decoupled(T, clk);
} {
  reg full(Dynamic(clk)): Bits(1);
  reg data(Dynamic(clk)): T;
  assign inp.ready = !full || out.ready;
  comb {
    out.req = if full { .Valid(data) } else { inp.req };
  }
  seq clk {
    if inp.ready {
      match inp.req {
        Valid(x) => { full = !out.ready; data = x; },
        Invalid => { if out.ready { full = 0; }; },
      };
    };
  }
}
text
error[unreset_control_register]: `full` controls the `if` condition on line 9, but has no reset value.
 --> main.neo:5:3
  |
5 |   reg full(Dynamic(clk)): Bits(1);
  |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: give it a reset value (`= v`), or mark it `noreset` if it is always written before it is read

A forgotten handshake signal ​

When a has data, this arbiter never drives b.ready, so b can't tell whether its request was accepted. Every branch of a comb block must drive the same signals, so Neo catches it.

neo
module Arbiter(T: LogicType, clk: Clock) {
  consumes a: Decoupled(T, clk);
  consumes b: Decoupled(T, clk);
  provides out: Decoupled(T, clk);
} {
  comb {
    match a.req {
      Valid(x) => {
        out.req = .Valid(x);
        a.ready = out.ready;
      },
      Invalid => {
        out.req = b.req;
        a.ready = 0;
        b.ready = out.ready;
      },
    }
  }
}
text
error[inconsistent_conditional_assignments]: All branches of a conditional inside `comb` must assign the exact same set of signals.
  --> main.neo:12:18
   |
12 |       Invalid => {
   |                  ^

An accidental clock-domain crossing ​

count is incremented on fast and read straight into snapshot on slow without a synchronizer, which causes metastability and torn multi-bit reads. Neo tracks which clock domain owns every register and rejects the cross-domain read.

neo
module EventCounter(fast: Clock, slow: Clock) {
  input event(Dynamic(fast)): Bits(1);
  output reg snapshot(Dynamic(slow)): Int(16) = 0#16;
} {
  reg count(Dynamic(fast)): Int(16) = 0#16;
  seq fast {
    if event {
      count = count + 1#16;
    };
  }
  seq slow {
    snapshot = count;
  }
}
text
error[clock_domain_mismatch]: Cannot read signal in clock domain `fast` inside `seq` block clocked by `slow`.
  --> main.neo:12:16
   |
12 |     snapshot = count;
   |                ^^^^^

Learn more ​

Guide

Install Neo and learn the language one feature at a time.

Comparison with other HDLs

How Neo relates to SystemVerilog, Chisel, ROHD, and Filament.

Language reference

Exact rules, bit layouts, and the complete list of checks.