Latchup

amaranth electronics latchup programming python

Latchup leaderboards showing psmears in position 1

I've wanted for quite some time to learn a hardware definition language - that is, a language that can be used to design chips (ASICs) and FPGAs - because this would enable some cool projects. Finally I've found a solution to bridge a motivation gap...

The language I've had my eye on is Amaranth (formerly known as nMigen): while the most popular choice would be Verilog, that language has a number of design choices that make it all too easy (especially for a beginner like me) to make mistakes. Amaranth eliminates these, and also has the benefit of being based on Python, which I'm already familiar with. And it can output its results as Verilog, so there's no need to miss out on any Verilog-specific tooling.

The problem I've had has been motivating myself: while Amaranth has a very nice playground that lets you create designs and run them within a web browser, there is (to my mind) quite a gap between that and a "real" design that does something interesting with hardware.

So the Catch-22 I've been in is that I can't bring myself to get out some hardware and set up the toolchain for it (which can be a painful experience) - because I don't have the skills to create an interesting enough design to be worth it - but equally, I've found it hard to motivate myself to learn those skills, because I don't have a hardware setup to run it on.

What I need is some sort of intermediate-level goal: something more challenging than writing simple toy designs, but that (ideally) doesn't require setting up a complete toolchain and getting it to work with hardware. That's where Latchup comes in...

Latchup is a site with lots of puzzles that must be solved by creating hardware designs. They range in difficulty from "multiply two numbers together" to "implement this relatively complicated algorithm in hardware". You can choose from a variety of languages (including Amaranth), and edit your design in the browser. When you're ready, pressing a button compiles your design and (if there are no errors) runs test cases on it. Once you're confident in your design you can submit it to be checked against more test cases, including hidden ones and - if it passes - have it ranked against all other users' submissions, giving an element of competition.

The quick feedback, and lack of having to install and set up a toolchain, makes the whole experience much more fun - so I've been happily beavering away at the puzzles, hopefully sharpening my skills in the process.

Most of the leaderboards are ranked by how many of your solutions are ranked #1 (or at least, #5 or better) in various aspects (latency, throughput, area consumed). By shamelessly targetting problems for which very few solutions have yet been submitted, I have managed to rise to the top of all of them!

I fully expect this not to last long - given that I'm definitely a beginner and don't really know what I'm doing, I expect people with more experience will be able to beat my solutions without too much effort. But in the meantime I will enjoy the ephemeral glory!

If you've ever been tempted to try out some hardware design, do give Latchup a try!

0 comments

Post a comment

All comments are moderated, and will not show up immediately on the site, or at all – and if they do, their content may be edited.