Live data from Hacker News

Spade Hardware Description Language

spade-lang.org

41–50 of 64 posts

Re: Spade Hardware Description Language

#41

If a new HDL language doesn’t have simulation capabilities baked in its next to useless. See: hardcaml and amaranth. The hard part has never been writing HDL, it’s verifying HDL and making the verification as organized and as easy as possible. Teams spend something like 20% of time on design and 80%+ on verification allegedly (definitely true at my shop). Edit: I see it’s tightly integrated with cocotb which is good.…

Spade author here!

That is a good point, sadly I'm not experienced enough with verification to know what is actually needed for verification from a language design perspective which is why I just offload to cocotb. There are a few interesting HDLs that do focus more on verification, ReWire, PDVL, Silver Oak, and Kôika are the ones I know about if you're interested in looking into them

Also, nitpick but amaranth does have its own simulator as far as I know

Re: Spade Hardware Description Language

#42

Love to see this at the top of HN! I haven't written anything with this language yet, but I have met some of the developers of this language. They're pretty great and they are doing a lot of really good work in the open source hardware community. Another project they maintain is Surfer: https://surfer-project.org/ The challenge of a HDL over a regular sequential programming (software) language is that a software lang…

> As one HDL theory expert once told me "Too many high level HDLs try to abstract out time, when what they really need to do is expose time."

Exactly! It's astounding how often the documentation of some vendor component has in the documentation: "data_out is valid 2 cycles after read_enable is asserted", and NOTHING in the actual module definition makes a mention of this. There's so much dumb and error-prone mental arithmetic designers have to do to synchronize such latencies.

Spade does make a nod at this, with its pipelining notation. The issue I have with it is that it takes a too simplistic approach to said port timings. In a Spade pipeline you separate "pipeline stages" by adding a "reg;" statement on its own line. (It's an approach shared by another language called TL-Verilog.). A consequence of this style is that all inputs arrive at the sime time (say cycle 0), and all results are produced at a second time (say cycle 5). This is irrespective of if an input is actually only ever needed in a final addition in cycle 4. It'll insert the 4 extra registers regardless. Likewise, it leads to unnatural expression of subpipelines, where syntactically you can already see a value, but can only _access_ it 3 pipeline stages later.

With SUS, I have a solution to this: Latency Counting. (Intro here: https://m.youtube.com/watch?v=jJvtZvcimyM&t=937). A similar philosophy is also followed by Filament, though they go a step further with adding validity intervals too.

The gist of Latency Counting is that Instead of explicitly marking and naming "Pipeline stages", you annotate a statement to say that it "takes one cycle", and through exploring the dependency graph between your wires, it assigns a unique "absolute latency" to every wire, and places registers accordingly. (And now it can even infer submodule parameters based on this pipelining, in a bid to do HLS-style design in an RTL language).

Re: Spade Hardware Description Language

#43
post #8

I thought that this was about the hardware description language Clash developed by some ex-colleagues, but it appeared to be something else. Clash [1] is based on the functional programming language Haskell and it can output to VHDL, Verilog, or SystemVerilog. Although the last official release mentioned on the website is from 2021, it is still actively developed on GitHub [2]. See also contranomy [3] for a non-pipel…

Clash was the HDL that I used before starting Spade. I'm not a huge fan of haskell and wanted a few more hardware specific features which is why I didn't stick with it.

That said, Clash is great and I know quite a few people at QBay. They don't seem to be slowing down any time soon!

Re: Spade Hardware Description Language

#44
post #3

There are already Verilog and VHDL based tools alvilable. i think nopne likes to learn a third HDL. Including specific ideas into the hdl makes it less attractive to people

Chisel, BlueSpec Spinal and Migen are already used quite a bit though of course much less so than Verilog. But we do need new languages, https://drops.dagstuhl.de/storage/00lipics/lipics-vol136-sna... does a pretty good job at articulating why

Re: Spade Hardware Description Language

#45
post #7

I wonder how it compares to Bluespec?

Spade author here! The biggest difference is that BlueSpec uses a different abstraction than standard "RTL". That has significant advantages of course, but also means some overhead and a shift in mental model.

With Spade my goal is to build new abstractions on top of RTL. That should allow you to operate at a higher abstraction level with minimal overhead most of the time, and dive down to regular RTL when necessary

Re: Spade Hardware Description Language

#46

Love to see this at the top of HN! I haven't written anything with this language yet, but I have met some of the developers of this language. They're pretty great and they are doing a lot of really good work in the open source hardware community. Another project they maintain is Surfer: https://surfer-project.org/ The challenge of a HDL over a regular sequential programming (software) language is that a software lang…

Thanks for the kind words!

> The challenge of a HDL over a regular sequential programming (software) language is that a software language is programmed in time, whereas a HDL is programmed in both space and time. As one HDL theory expert once told me "Too many high level HDLs try to abstract out time, when what they really need to do is expose time."

That's an excellent quote, I might steal it :D In general, I think good abstractions are the ones that make important details explicit rather than ones that hide "uninteresting" details.

Re: Spade Hardware Description Language

#47
post #4

I'll take a closer look later, and I welcome anything that tries to bring concepts from modern programming languages to hardware design. But. The focus on "CPU" examples on the landing page ( A 3 stage CPU supporting Add, Sub, Set and Jump , "You can easily build an ALU" ) is immediately discouraging. I implement and verify FPGA designs for a living, and the vast, vast majority of my work is nothing like designing a…

Spade author here!

That's a good reminder that I need to update the example on the website, I must have written that example almost 3 years ago at this point :)

For more up to date motivation, my talk from LatchUp last year is probably the best one I have https://www.youtube.com/watch?v=_EdOHbY2dlg&t=277s

> So my fear is that this new hardware description language hasn't been created by a veteran who has many years of experience in using HDLs

That's annoyingly quite close to the truth :D But I think I have enough experience now to not be completely stumbling around in the dark

Re: Spade Hardware Description Language

#48
post #40

If the output SystemVerilog is unreadable I'm unlikely to use this. SV is still the lingua franca for physical tools. I'm not debugging timing on something that looks like this: localparam[14:0] _e_953 = 0; localparam[14:0] _e_958 = 1; assign _e_956 = \count + _e_958; assign _e_955 = _e_956[14:0]; assign _e_948 = _e_949 ? _e_953 : _e_955;

Spade author here! My probably controversial opinion on output code quality is that if you have to see the generated Verilog, I've done something wrong since there is probably a compiler bug if you need to go down to that level. Of course, you could just be looking at output from tools like timing reports, and then as someone else commented out, it is a bit of a tooling issue. Spade does emit (* src = *) attributes w…

Yeah.... I mean I get where you're coming from because how often do you have to look at disassembly to debug a C bug? Very rarely.

But that's because the tools debug at the C level. That isn't the case for SV at all - all the tools operate at the SV level.

Unless you're going to create commercial grade simulators, debuggers, synthesis tools etc. then users are going to be debugging SV.

My day job is debugging generated SV and even though it isn't nearly as bad as the code smallpipe posted it still suuucks. It costs me a lot of time reverse engineering it.

If anything is going to replace SV (and I really hope it does) it really really needs to focus on producing clean debuggable output. That includes things like using interfaces, structs and so on.

Re: Spade Hardware Description Language

#49
post #9
post #5

If you're curious why people keep wanting to reinvent HDLs, these posts by Dan Luu might be useful: - https://danluu.com/why-hardware-development-is-hard/ - https://danluu.com/pl-troll/

SystemVerilog is a much better language than verilog. You can get pretty strong typed behaviour now, if you use the language parts that allow that. It's like C, if you use it poorly/the 'verilog way' it's got some serious footguns, but you can use it quite safely if you use the more modern features. That said, I'm all for better languages, of they really are better and as expressive

It's better than Verilog but it's still awful. If you thought C had footguns....

Re: Spade Hardware Description Language

#50
post #41

If a new HDL language doesn’t have simulation capabilities baked in its next to useless. See: hardcaml and amaranth. The hard part has never been writing HDL, it’s verifying HDL and making the verification as organized and as easy as possible. Teams spend something like 20% of time on design and 80%+ on verification allegedly (definitely true at my shop). Edit: I see it’s tightly integrated with cocotb which is good.…

Spade author here! That is a good point, sadly I'm not experienced enough with verification to know what is actually needed for verification from a language design perspective which is why I just offload to cocotb. There are a few interesting HDLs that do focus more on verification, ReWire, PDVL, Silver Oak, and Kôika are the ones I know about if you're interested in looking into them Also, nitpick but amaranth does…

This is another good reason to generate clean SV with meaningful stable signal names etc. There's absolutely no way you are going to replace e.g. SVA and formal verification tools.
Post reply on HN