logo Spade Blog

Spade 0.7.0

Posted 2024-03-21 by The Spade Developers

Today we're releasing v0.7.0 of Spade. This release adds additional capabilities when writing generic code, some new features to the standard library, and fixes several small annoyances and bugs.

First contributions 🎉🔗

Three bachelor students from JKU have started contributing to Spade as part of their bachelor project. They have made several improvements to the language this release:

  • In the previous release, we removed the need to use () after zero parameter enum variants, but this was accidentally still needed when useing enum variants. This has now been fixed, so None() can be written as None
  • You can now use the bitwise invert operator (~) on unsigned integers
  • Fixing a compiler panic when using the wrong number of arguments in a turbofish (::<>)

Thanks Alex, Rene and Fabian!

Generic parameters as expressions🔗

With this release, it is now possible to use generic integers as constants inside modules, for example a counter with a constant maximum value can be written as:

entity counter::<#Width, #Max>(clk: clock, rst: bool) -> uint<Width> {
    reg(clk) val reset(rst: 0) = if val == Max {0} else {trunc(val + 1)};
    val
}

// Emits a tick every 10th clock cycle
entity count_to_10(clk: clock, rst: bool) -> bool {
  inst counter::<4, 9>(clk, rst) == 9
}

As part of this change, it is now also possible to refer to generic parameters inside the body of units, so you no no longer have to rely on the type inferer to get what you mean. This is very useful when wrapping memories

entity fifo<#W, D, #C>(
    write_clk: clock,
    write_rst: bool,
    read_clk: clock,
    read_rst: bool
) -> (FifoWrite<D>, FifoRead<W, D>) {
    // ...
    let (ram_write, ram_read) = inst dp_bram::<W, D, C>(write_clk, read_clk);
                                            // ^^^^^^^ These had to be inferred previously
    // ...
}

Misc smaller changes🔗

  • It is now possible to write 1-2, previously a space was required.
  • swim clean no longer removes the compiled Spade compiler leading to faster clean build times.
  • Added --use-sudo to swim to run upload tools with superuser permissions. This can be helpful if you don't have udev rules set up.

Spade at conferences🔗

Frans will be at DATE and OSDA 2024 next week! If you're also going to be there get in touch!

Spade will also be presented at LatchUp in Boston on May 19-21, and the week after that Frans is co-organizing LATTE 2024 which is co-located with ASPLOS.