You're reading an old version of this documentation.
For the latest stable release version, please have a look at master.

Examples

Introduction

Examples are split into three kinds:

  • Simple examples that could be used to get used to the basics of SpinalHDL.

  • Intermediate examples which implement components by using a traditional approach.

  • Advanced examples which go further than traditional HDL by using object-oriented programming, functional programming, and meta-hardware description.

They are all accessible in the sidebar under the corresponding sections.

Important

The SpinalHDL workshop contains many labs with their solutions. See here.

Note

You can also find a list of repositories using SpinalHDL there

Getting started

All examples assume that you have the following imports on the top of your scala file:

import spinal.core._
import spinal.lib._

To generate VHDL for a given component, you can place the following at the bottom of your scala file:

object MyMainObject {
  def main(args: Array[String]) {
    SpinalVhdl(new TheComponentThatIWantToGenerate(constructionArguments))   //Or SpinalVerilog
  }
}