frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

The Sail instruction-set semantics specification language

https://alasdair.github.io/manual.html
25•weinzierl•10h ago

Comments

timhh•9h ago
I've used this a lot via the RISC-V Sail model: https://github.com/riscv/sail-riscv

It's a really nice language - especially the lightweight dependent types. Basically it has dependent types for integers and bit-vector lengths so you can have some really nice guarantees. E.g. in this example https://github.com/Timmmm/sail_demo/blob/master/src/079_page... we have this function type

  val splitAccessWidths : forall 'w, 0 <= 'w . (xlenbits, int('w)) ->
    {'w0 'w1, 'w0 >= 0 & 'w1 >= 0 & 'w0 + 'w1 == 'w . (int('w0), int('w1))}
Which basically means it returns a tuple of 2 integers, and they must sum to the input integer. The type system knows this. Then when we do this:

  let (width0, width1) = splitAccessWidths(vaddr, width);
  let val0 = mem_read_contiguous(paddr0, width0);
  let val1 = mem_read_contiguous(paddr1, width1);
  val1 @ val0
The type system knows that `length(val0) + length(val1) == width`. When you concatenate them (@ is bit-vector concatenation; wouldn't have been my choice but it's heavily OCaml-inspired), the type system knows `length(val1 @ val0) == width`.

If you make a mistake and do `val1 @ val1` for example you'll get a type error.

A simpler example is https://github.com/Timmmm/sail_demo/blob/master/src/070_fanc...

The type `val count_ones : forall 'n, 'n >= 0. (bits('n)) -> range(0, 'n)` means that it's generic over any length of bit vector and the return type is an integer from 0 to the length of the bit vector.

I added it to Godbolt (slightly old version though) so you can try it out there.

It's not a general purpose language so it's really only useful for modelling hardware.

Y_Y•9h ago
I see the RISC-V Sail repo mentions compiling to SystemVerilog. That would be amazing, if you could specify instruction semantics and have that transformed all the way into silicon.
timhh•9h ago
It's still kind of experimental. Also the purpose is more for formal verification against a real design. The RISC-V model doesn't have any microarchitectural features you'd need for a real chip - not even pipelining - so it would be very slow.

Still... it is tantalisingly close to a really nice HDL for design purposes. I have considered trying to make a pipelined RISC-V chip in Sail with all the caches, branch predictor etc.

One feature that makes it a little awkward though is that there isn't really anything like a class or a SV module that you can reuse. If you want to have N of anything you pretty much have to copy & paste it N times.

aseipp•6h ago
It says they intend the backend to be used for FEC, so it's probably an untimed model that it outputs. Sail would probably generate bad SystemVerilog anyway even if it was timed/synthesizable because the language doesn't have any concepts to express things like pipelining or the necessary concurrency primitives or properly structured modules for the output netlists.

If you want a high-level RTL with some of the dependent features of Sail, but for hardware that can generate good SystemVerilog, I think Bluespec is probably the best complement.

Cieric•6h ago
I really like the idea of this. I wonder if I can convince my work to use it for our hardware. Are things like SIMD, SIMT, and other weird formats easy to represent in this kind of language? Or should I just assume anything describable in Verilog/HDL can be described in this language.

This also brings up another question if anyone knows. Is there a term for hardware description languages similar to turning complete for programming languages, or is there a different set of common terms?

Chemical process produces critical battery metals with no waste

https://spectrum.ieee.org/nmc-battery-aspiring-materials
33•stubish•1h ago•1 comments

Fast and cheap bulk storage: using LVM to cache HDDs on SSDs

https://quantum5.ca/2025/05/11/fast-cheap-bulk-storage-using-lvm-to-cache-hdds-on-ssds/
44•todsacerdoti•2h ago•8 comments

Resizable structs in Zig

https://tristanpemble.com/resizable-structs-in-zig/
108•rvrb•8h ago•47 comments

Smallest particulate matter sensor revolutionizes air quality measurement

https://www.bosch-sensortec.com/news/worlds-smallest-particulate-matter-sensor-bmv080.html
16•Liftyee•2h ago•2 comments

Show HN: QuickTunes: Apple Music player for Mac with iPod vibes

https://furnacecreek.org/quicktunes/
69•albertru90•6h ago•13 comments

How we rooted Copilot

https://research.eye.security/how-we-rooted-copilot/
287•uponasmile•14h ago•110 comments

Low cost mmWave 60GHz radar sensor for advanced sensing

https://www.infineon.com/part/BGT60TR13C
53•teleforce•3d ago•20 comments

Purple Earth hypothesis

https://en.wikipedia.org/wiki/Purple_Earth_hypothesis
203•colinprince•3d ago•57 comments

Personal aviation is about to get interesting (2023)

https://www.elidourado.com/p/personal-aviation
79•JumpCrisscross•7h ago•77 comments

A low power 1U Raspberry Pi cluster server for inexpensive colocation

https://github.com/pawl/raspberry-pi-1u-server
10•LorenDB•3d ago•2 comments

Paul Dirac and the religion of mathematical beauty (2011) [video]

https://www.youtube.com/watch?v=jPwo1XsKKXg
54•magnifique•7h ago•4 comments

Rust running on every GPU

https://rust-gpu.github.io/blog/2025/07/25/rust-on-every-gpu/
516•littlestymaar•20h ago•172 comments

Coronary artery calcium testing can reveal plaque in arteries, but is underused

https://www.nytimes.com/2025/07/26/health/coronary-artery-calcium-heart.html
65•brandonb•8h ago•56 comments

What went wrong for Yahoo

https://dfarq.homeip.net/what-went-wrong-for-yahoo/
149•giuliomagnifico•11h ago•142 comments

Getting decent error reports in Bash when you're using 'set -e'

https://utcc.utoronto.ca/~cks/space/blog/programming/BashGoodSetEReports
98•zdw•3d ago•30 comments

Teach Yourself Programming in Ten Years (1998)

https://norvig.com/21-days.html
70•smartmic•8h ago•23 comments

16colo.rs: ANSI/ASCII art archive

https://16colo.rs/
16•debo_•3d ago•2 comments

The natural diamond industry is getting rocked. Thank the lab-grown variety

https://www.cbc.ca/news/business/lab-grown-diamonds-1.7592336
173•geox•17h ago•214 comments

Torqued Accelerator Using Radiation from the Sun (Tars) for Interstellar Payload

https://arxiv.org/abs/2507.17615
46•virgildotcodes•7h ago•4 comments

Tinyio: A tiny (~200 line) event loop for Python

https://github.com/patrick-kidger/tinyio
63•tehnub•4d ago•13 comments

Where are vacation homes located in the US?

https://www.construction-physics.com/p/where-are-vacation-homes-located
84•rufus_foreman•12h ago•69 comments

Arvo Pärt at 90

https://www.theguardian.com/music/2025/jul/24/the-god-of-small-things-celebrating-arvo-part-at-90
64•merrier•9h ago•19 comments

Shallow water is dangerous too

https://www.jefftk.com/p/shallow-water-is-dangerous-too
103•surprisetalk•3d ago•56 comments

Test Results for AMD Zen 5

https://www.agner.org/forum/viewtopic.php?t=287&start=10
219•matt_d•11h ago•41 comments

Large ancient Hawaiian petroglyphs uncovered by waves on Oahu

https://www.sfgate.com/hawaii/article/hawaii-petroglyphs-uncovered-20780579.php
79•c420•4d ago•23 comments

Millet mystery: A staple crop failed to take root in ancient Japanese kitchens

https://phys.org/news/2025-07-millet-mystery-staple-crop-root.html
25•PaulHoule•3d ago•8 comments

Asyncio: A library with too many sharp corners

https://sailor.li/asyncio
83•chubot•6h ago•66 comments

Open Sauce is a confoundingly brilliant Bay Area event

https://www.jeffgeerling.com/blog/2025/open-sauce-confoundingly-brilliant-bay-area-event
326•rbanffy•3d ago•186 comments

Font-size-adjust Is Useful

https://matklad.github.io/2025/07/16/font-size-adjust.html
162•Bogdanp•3d ago•51 comments

OCaml Programming: Correct and Efficient and Beautiful

https://cs3110.github.io/textbook/cover.html
106•smartmic•9h ago•34 comments