Ask Hackaday: Putting The C In CPU

I was once in a meeting where the facilitator asked us to introduce ourselves with the usual information, but also wanted us to share our favorite hobby. I spent a second trying to think of which hobby I could say to not sound like a total nerd. Then I realized it didn’t matter. All my hobbies are nerdy, including designing CPUs and their instruction sets.

I actually started sketching out an instruction set when I was a kid, back when no one had home computers. I am glad I lost that notebook: it would be painful to see today. The first CPU I put on an FPGA wasn’t of my own design, though. I implemented BLUE from Caxton Foster’s Computer Architecture book. I also extended it and modernized it a lot. I really wanted a C compiler for it.

C Compilation

That’s really the problem. C was once a simple language, but modern C is far from simple, and compilers are huge projects. I have looked before at porting GCC to a different architecture, and it looks daunting. There’s LLVM, which is a bit more modern, but also non-trivial to port. There are a few older compilers that ought to be easier, but they often aren’t quite modern enough. Plus, if your CPU were big enough, which BLUE isn’t, GCC or a similar modern compiler would be attractive because you could use it to get Linux going.

Keep in mind, though, I’m not talking about a C compiler that runs on BLUE. Just a cross-compiler. My OneDer CPU is 32-bit and could host a C compiler, though. That’s another reason to bite the bullet and do a “big” compiler port. Because even if BLUE isn’t that big, other CPUs are, and I’d love to have a GCC port under my belt.

Continue reading “Ask Hackaday: Putting The C In CPU” →

A Versatile PDP-11/70 Emulator

The PDP-11 was a 16-bit minicomputer that was very influential in its time. That’s what inspired [vanheusden] to start working on an emulator for the machine in 2018, which has since been developed to run on a wide variety of platforms. 

The emulator, named “Kek,” is quite capable, able to run Unix 5 up to an d including Unix 7 in multi-user mode, along with BSD 2.11 Unix depending on what it’s running on. It also supports classic hardware like RK05, RL02, RP06, and RP07 disks, the KW11-L line time clock, and the DC-11 serial line interface. The emulator can also run on a wide variety of platforms. It’s possible to run it on a standard Linux machine if so desired, or you can run it on BSD, MacOS, or Windows if so desired. Beyond that, you can even get it going on a Teensy 4.1 or an ESP32 if that’s more your jam. Modern microcontrollers are just that powerful that emulating a PDP-11/70 just isn’t a challenge anymore.

We love seeing old machines emulated and brought back to life. It’s funny to see how often it’s done on microcontrollers instead of full-scale PCs these days, too. Video after the break.

Continue reading “A Versatile PDP-11/70 Emulator” →

The Y2K Bug In BSD 2.11 That Survived 2000

A year before the arrival of the brand-new 21st century, the Year 2000 Bug was predicted to grind modern society to a halt and ensure that at the dawn of the year 2001, there’d be nothing left but the smoldering wreck of once great societies. Thanks to the concerted efforts of countless engineers, software developers, and many others, we were left with mostly just silly glitches, with one of these surviving bugs apparently just discovered, as [Van Heusden] reported on an NTPd bug in BSD 2.11.

To be fair, it is a pretty obscure one, as the demonstration involves BSD 2.11 on a PDP-11/70 from 1975, so it’s probably not something that still sees much use outside retrocomputing enthusiast circles. In the blog post, the demonstration involves connecting a specific adapter by Traconex, capable of receiving WWV/WWVH time signals, and setting it up for use by the NTPd prior to running the ntpd -a any -d -d -d -d command.

Continue reading “The Y2K Bug In BSD 2.11 That Survived 2000” →

The ikea desk, with the spectrometer on the far left.

PDP-11 Lives In Literal Computer Desk Once More

When you think of iconic parings, your brain probably goes more to “cookies and milk” than “DEC and Ikea” but after watching [Dave]’s latest on Usagi Electric where he puts a PDP-11 into an Ikea desk, you may rethink that.

The PDP-11 is vintage hardware that actually lived inside of a different desk, once upon a time, serving as the control unit for an FTIR spectrometer. While the lab equipment has thankfully survived the decades, the desk did not and when [Dave] got the unit it was as a pile of parts. He revived it, of course– it’s kind of what he does– but it didn’t get a new desk for years, until his latest shop re-organization.

The one concession to modernity– and missing parts– is using switching power supplies rather than the bulky linear PSU that would have originally powered the unit. It’s a good thing, too, or we have trouble picturing how everything would fit! This particular PDP-11 comes with the high performance vector processing unit in order to crunch those spectrographs, and apparently those chips idle at about 60C, so the desk-case got some decent-sized 120V fans to keep everything cool and running for years to come.

This isn’t the most aesthetic or fanciest case-mod we’ve seen, mostly being made of surplus plywood and scrap metal fittings, but it certainly gets the job done. Given that the PDP-11 has been crammed into every form-factor known to man, from a system-on-a-chip (before anybody really talked about SOCs) to desktop workstations, and of course the hulking cabinets with their iconic blinkenlights-– it’s hard to say that this installation isn’t reasonably authentic, even if it isn’t the original desk.

Continue reading “PDP-11 Lives In Literal Computer Desk Once More” →

Training A Transformer With 1970s-era Technology

Although generative language models have found little widespread, profitable adoption outside of putting artists out of work and giving tech companies an easy scapegoat for cutting staff, their their underlying technology remains a fascinating area of study. Stepping back to the more innocent time of the late 2010s, before the cultural backlash, we could examine these models in their early stages. Or, we could see how even older technology processes these types of machine learning algorithms in order to understand more about their fundamentals. [Damien Boureille] has put a 60s-era IBM as well as a PDP-11 to work training a transformer algorithm in order to take a closer look at it.

For such old hardware, the task [Damien Boureille] is training his transformer to do is to reverse a list of digits. This is a trivial problem for something like a Python program but much more difficult for a transformer. The model relies solely on self-attention and a residual connection. To fit within the 32KB memory limit of the PDP-11, it employs fixed-point arithmetic and lookup tables to replace computationally expensive functions. Training is optimized with hand-tuned learning rates and stochastic gradient descent, achieving 100% accuracy in 350 steps. In the real world, this means that he was able to get the training time down from hours or days to around five minutes.

Not only does a project like this help understand these tools, but it also goes a long way towards demonstrating that not every task needs a gigawatt datacenter to be useful. In fact, we’ve seen plenty of large language models and other generative AI running on computers no more powerful than an ESP32 or, if you need slightly more computing power, on consumer-grade PCs with or without GPUs.

FPGA Brings UNIX V1 To The DEC J-11

If you’ve never used a PDP-11 before it’s probably because you simply weren’t around in the 70s and 80s. Although they started as expensive machines only in research labs and industry, they eventually became much more accessible. They’re a bit of a landmark in computing history, too, being largely responsible for the development of things like UNIX and the C programming language. [ryomuk] is using an FPGA in combination with an original DEC J-11 to bring us a new take on this machine. (Google Translate from Japanese)

The FPGA used in this build is a Tang Nano 20k, notable for its relatively low cost. The FPGA emulates the memory system and UART of a PDP-11 system down to the instruction set, while the original, unmodified DEC chip is left to its own devices. After some initial testing [ryomuk] built a PC11 paper tape emulator to ensure the system was working which runs a version of BASIC from the era. The next thing up was to emulate some disk drives and co-processors so that the machine can run the first version of UNIX. 

[ryomuk] also developed a PCB for the DEC microprocessor and the FPGA to sit on together, and it includes all of the jumpers and wiring needed to allow the computer to run UNIX, as well as handling other miscellaneous tasks like power. It’s an interesting build that gets to the heart of the early days of computer science. PDP-11 computers did eventually get smaller and more accessible, and if you want to build a modern version this build fits a complete system into an ATX case.

Thanks to [RetepV] for the tip!

Learn Computing? Head For MonTana!

We’ve often thought that it must be harder than ever to learn about computers. Every year, there’s more to learn, so instead of making the gentle slope from college mainframe, to Commodore 64, to IBM PC, to NVidia supercomputer, you have to start at the end. But, really, you don’t. You can always emulate computers from simpler times, and even if you don’t need to, it can be a lot of fun.

That’s the idea behind the MonTana mini-computer. It combines “…ideas from the PDP-11, MIPS, Scott CPU, Game Boy, and JVM to make a relatively simple 16-bit computer…”

The computer runs on Java, so you can try it nearly anywhere. The console is accessed through a web browser and displays views of memory, registers, and even something that resembles a Game Boy screen. You’ll need to use assembly language until you write your own high-level language (we’d suggest Forth). There is, however, a simple operating system, MTOS.

This is clearly made for use in a classroom, and we’d love to teach a class around a computer like this. The whole thing reminds us of a 16-bit computer like the PDP-11 where everything is a two-byte word. There are only 4K bytes of memory (so 2K words). However, you can accomplish a great deal in that limited space. Thanks to the MTOS API, you don’t have to worry about writing text to the screen and other trivia.

It looks like fun. Let us know what you’ll use it for. If you want to go down a level, try CARDIAC. Or skip ahead a little, and teach kids QBasic.