Skip to content
Systems programming for what’s next.
— Vex

VexHDL Getting Started ​

Start with one clock domain, an explicit reset, and a small stateful design. A counter or FIFO makes the relationship between inputs, clock edges, and outputs visible before you add external buses or multiple clocks.

Choose your toolchain ​

  • For a systems program, use the Vex first-project guide.
  • For Vex HDL Studio, select an installer for your operating system on the release page or Download, then follow that package's project and toolchain instructions.
  • For a VexHDL source checkout, use its build and simulation commands. Keep the compiler, simulator, project format, and external tools from a compatible toolchain configuration.

Specify a four-entry FIFO ​

Before writing a circuit, define its observable behavior. Use the FIFO reference model with depth four and no empty-state bypass. At each clock edge, accept a write only when the FIFO started that edge with space, and accept a read only when it started with data. Reset takes priority over both requests.

This sequence gives a small, repeatable testbench plan:

EdgeRequestAccepted operationCount after the edgeRead value
0ResetReset0No valid read
1Write 10Write1No valid read
2Write 20 and readBoth110
3ReadRead020
4ReadNeither0No valid read
5Write 30 and readWrite only1No valid read
6ReadRead030

Drive requests before the sampling edge and observe outputs according to the chosen memory's latency. Assert both the returned value and whether a transfer was accepted; a stale bus value while empty is not a successful read.

Translate the contract into hardware ​

A depth-four FIFO needs read/write pointers, a count that can represent zero through four, storage for four elements, and logic for accepted reads/writes. Derive empty and full from the count. Update the pointers and count from accepted operations, not raw request signals.

Separate the next-state calculations from the clocked register updates. The process guide explains combinational and sequential blocks; the syntax guide introduces ports and widths. Choose the memory's read-during-write behavior explicitly before selecting a hardware primitive.

Extend the testbench ​

After the sequence above, cover pointer wrap, full-state reads and writes, consecutive traffic, and reset while data remains buffered. Test a non-power-of- two depth separately because pointer wrap must respect the configured depth. Keep an independent queue model to compare accepted transactions with the hardware's output stream.

Simulation and synthesis answer different questions. Use Transpiler Integration when adding a device, external modules, timing constraints, or synthesis tools. Preserve the interface contract when replacing the simple storage model with a device memory block.

Released under the MIT License.