alt.hn

1/12/2025 at 5:36:45 PM

From ASCII to ASIC: Porting donut.c to a tiny slice of silicon

https://www.a1k0n.net/2025/01/10/tiny-tapeout-donut.html

by a1k0n

1/12/2025 at 9:22:41 PM

Going slightly off topic, I was interested to learn from this blog about Tiny Tapeout, the service they've used to order their custom chip design. The concept for anyone as unfamiliar with it as me is that lots of people pay a few hundred dollars each to get a small part of a chip being made, and once it's made they receive the chip ready to use with their section everyone else's, too, with a way to choose which bit gets run.

I know basically nothing about chip design, and I'm wondering if anyone could tell me: is this only useful for education purposes, for example learning how to make a chip that creates a donut on a screen, or are there people using Tiny Tapeout for useful projects, too?

For each of their chip runs, they publish a list of the different people's projects that got included - https://tinytapeout.com/runs/ - but it's not easy to spot which ones might be more than somebody just learning how to play with chip design.

Essentially, if someone were to pick this up as a hobby, what is the most interesting thing they could make using this?

by swores

1/13/2025 at 3:46:43 AM

Almost anything you can do on Tiny Tapeout your can do on an FPGA and test it today (not wait 6-9 months to get silicon back) - if you are laying polygons yourself because you want to test out some novel circuit that TT is potentially a great idea.

On the other hand if you've learned logic design and want to spread your wings and make some real chips then TT is an educational experience - not only is the tooling different but often you need to understand stuff in depth that FPGA tooling kind of hides (because essentially FPGAs come pre routed) so it's a great way to take a small step into silicon design.

There's probably a large bunch of people who will make just one design because they can, just to say they did it.

I've taped out 4 CPUs on TT, I'm retired, I used to do chip design, TT has the same sort of scope as the logic blocks I was making 20 years ago - no one is going to be using it for manufacturing (you get just 1 die back)

by Taniwha

1/13/2025 at 8:08:29 PM

I have not programmed an FPGA in 26 years.

What do you recommend for a FPGA brand today?

by tmaly

1/14/2025 at 12:38:03 AM

Xilinx, Altera - there's also some really cheap stuff coming out of China (Tang Nano). Because they all have their own dev system you tend to choose the one you know

There's a standard for external add-ons called PMODs (small boards with external connectors or parts) tiny tapeout uses it too, picking a dev board with PMOD connectors is probably a good idea.

by Taniwha

1/13/2025 at 12:57:25 AM

I got a tile on TinyTapeout9 (I think) and participated in a workshop for it at the Hackaday Supercon last November.

I had a lot of fun. I had a bit of knowledge from my university digital logic class, but really enjoyed learning how the layers are put down and how they make transistors. If you have an opportunity to do it, I strongly recommend it.

There are some very cool things you can do, but you’re limited by the tile size, the inputs provided and it’s worth noting that you get one chip on a module. It’s probably the 2nd step in getting started making a custom ASIC if you wanted to get into that. (The first being learning how to design with logic gates)

bitlui made a VGA Rickroll with it a while ago. [1]

My tile spells out “Aaron” (my first name) on the output to the seven segment display.

I think there is enough room to make a simple microprocessor. Fun if you’ve not ever done something like it.

So, to answer your question - yes it could be useful if you had a very specific thing you wanted to do that made sense in silicon. You could buy extra tiles and get space. That said, it’s mostly educational. But worth it if you have an interest.

[1] https://youtu.be/DdF_nzMW_i8

by sircastor

1/13/2025 at 8:52:06 PM

Pretty much exclusively educational.

Iirc you pay a large amount for each chip, you only get a couple, and I seem to remember some clause about giving the chip back or something.

The project has some pretty draconian rules, but it seems to be all done with good intent: to make it impossible for corporations to abuse this for cheap ASICS while allowing actual hobbyists to get a foot in the door.

TinyTapeout is NOT for making a custom run of ASICS for your widget, it's the only plausible way for a hobbyist to spin up a single chip design just to see how it's done.

by mystified5016

1/12/2025 at 7:21:24 PM

The thing about donut.c is that its source code is shaped like a donut, that’s a huge part of its charm.

While altering it to use shifts and adds is a fun exercise, since its source code is no longer shaped like the donut it renders, I would argue that a large part of its charm has disappeared and it’s no longer a donut.c

by malux85

1/13/2025 at 11:28:45 AM

Indeed. I feel like to capture the spirit of it you could make the layout on the chip look like a donut, which would be if anything more of a challenge than the layout of the source code.

by rcxdude

1/12/2025 at 7:32:52 PM

It’s trivial to reformat the source code into a donut shape.

by Zamiel_Snawley

1/12/2025 at 7:53:22 PM

Sometimes it's those trivial changes which add a lot of the overall charm.

by zamadatix

1/12/2025 at 9:24:23 PM

Non-trivial, IMHO - automating it sounds non trivial, and doing by hand is quite non-trivial, right? We gotta go make hand edits line by line?

by refulgentis

1/13/2025 at 6:28:44 AM

For a language like C, I would describe the formatting process as "straightforward" as opposed to "trivial". It's straightforward in that it feels very mechanical, but not trivial in the sense that it's difficult to fully automate the process. (The mechanical part is inserting spaces at the right places, the not so mechanical part is swapping tokens and rewriting expressions so that things line up).

You can see an example recording here of how it's done:

https://www.ioccc.org/2019/yang/obfuscation.html

First half of it is writing and golfing, second half is the formatting bits.

For languages like Perl and Ruby, the formatting process is easily automated and mostly trivial.

by omoikane

1/13/2025 at 6:44:46 AM

That visualizer is incredible, appreciate it and the insight - and 4 hours! Wow.

by refulgentis

1/12/2025 at 9:50:58 PM

Considering the language, C and the size of the file, I would not argue it is not trivial. The key feature of donut.c is how small the file actually is.

For something larger or in other languages, or having text strings, certainly not trivial.

by mianos

1/13/2025 at 3:24:04 AM

We need someone to write pastry.c which takes any C file and reorganizes the code into the shape of delicious bakery products.

by qingcharles

1/13/2025 at 5:26:47 AM

mmmmm.. trivial donuts...

by timewizard

1/12/2025 at 9:23:25 PM

I've been deeply curious about the sort of speedup you get from doing what was in software, on hardware:

I know the chips hasn't been delivered yet, but, the statements at the beginning re: we can expect a new frame every N nanoseconds, give me hope there's a rough heuristic for what speedup we'd expect in this particular case.

Do we have a rough* understanding of what the speedup will be?

* Within 2 OOMs

by refulgentis

1/13/2025 at 9:24:38 AM

Speedup compared to what? You can’t compare it to doing it in software on the same machine. So, you need to pick a reference CPU.

Finding a somewhat comparable CPU would be challenging. It would need to run at around 48 MHz and have 16 bit integer addition. I think the fastest Z80 clone would be a candidate (https://en.wikipedia.org/wiki/Zilog_eZ80), but that’s a pipelined CPU. You may find that unfair.

If you don’t pick something comparable but just something cheap, given the 48MHz clock of this hardware and the limited amount of parallelism, it wouldn’t surprise me if the typical modern smartphone could do it faster, even without the use of a GPU.

by Someone

1/12/2025 at 10:48:03 PM

New pixel. Not new frame.

by megous

1/13/2025 at 6:02:53 PM

I suggest you all to compile the C examples with -O3 -ffast-math on legacy systems.

by anthk

1/13/2025 at 6:26:39 AM

Yay, a1k0n!

Long time since AI Challenge, I see you're dabbling into hardware too!

by amstan

1/13/2025 at 6:18:24 PM

I wonder what it's like to be ridiculously talented at everything ?

by glonq

1/12/2025 at 6:31:22 PM

So great to see this excellent explanation. Have been a fan of donut.c since it first came out. Also I'm way better at golfing js than c so it kinda feels like you wrote this just for me :)

by binarymax

1/12/2025 at 11:45:06 PM

When are you going to post part 3 of your Hacker Challenge?

It's been fifteen years and we're still waiting. Thanks.

by still_waiting

1/13/2025 at 2:10:36 AM

lmao! that was so cringe I unlisted it from the main index. who is "we"?

part 3 is to find the secp256k1 private key for satoshi's bitcoins

by a1k0n