Minicomputers on Microcontrollers

PDP

Developed in the very late 60s and through the 70s, the PDP-11 series of minicomputers was quite possibly the single most important computer ever created. The first widely distributed versions of Unix and C were developed on the PDP-11, and it’s hardware influence can be found in everything from the Motorola 68000 to the MSP430.

When [Dave Cheney] saw the recent 8086 simulator written in 4kB of C code, he realized simulating entire computer systems doesn’t actually require a whole lot of resources outside a big chunk of memory. Armed with an Arduino Mega clone, he set out on one of the coolest projects we’ve seen in a while: simulating a PDP-11 on an AVR.

[Dave] used an ATMega2560-powered Arduino Mega clone with an Ethernet module for the hardware of this build. Attached to it is a shield filled up with a pair of RAM chips that expand relatively limited amount of RAM on the ‘Mega.

So far, [Dave] has his simulated system booting Unix V6 off an SD card. For PDP-11 storage, he’s also simulating an RK05 disk drive, a massive 14 inch platter containing 2.5 Megabytes of data. Compared to the original PDP-11/40, [Dave] estimates his machine is about 10 times slower. Still, an original 11/40 system fills multiple server racks, and the most common installations consume several kilowatts of power. The Arduino Mega can fit in a pocket and can be powered over USB.

Future developments for this system include improving the accuracy of the simulator, running more advanced operating systems and the DEC diagnostic programs, and possibly speeding up the simulation. We’d suggest adding some switches and blinkenlights on an additional shield, but that’s just us.

All the code can be found on [Dave]‘s git, with a description of his SPI RAM shield coming shortly.

Comments

  1. F says:

    It runs slower than slower than shit.

    (an homage to RSTS/E)

    • Gak! RSTS/E, though I would never hear of that again. DEC had the worse documentation ever plus charged a lot for each copy of each horrible “manual”.

      He should be able to get a lot more speed. I would use an instruction lookup table that points to assembly code. PDP/11 is 16 bits – not hard to emulate well. An 8 MHZ AVR-328 benchmarks at 1.1 VAX MIPS. There is a small list of comparisons a little over halfway down the extra long bonus home page here http://andahammer.com/

  2. six677 says:

    Is this the 3rd one we’ve seen on an AVR now after the DCPU and the ARM emulators?

  3. Damn, I was working on a PDP11 emulator for AVR too.
    My cpu code is only 2x as slow as original though :)

    Still working on emulating the rest of the system

  4. Kevin says:

    yes, learned to program cobol on a dec pdp – 11 44

  5. GuruBuckaroo says:

    I’ve always wanted to rebuild a VAX processor in an FPGA so I can plug it into my VAX 4000/200 system and see if it’s faster.

  6. JIm B says:

    Could someone please write an AVR emulator in qbasic, then run interpreted BASIC on the emulated PDP-11 on the qbasic AVR emulation running on a VM? I’m curious to know if time would stop.

  7. ScottishCaptain says:

    That’s pretty cool.

    Couldn’t you run a PDP-11 natively though? The CPU in those systems was shrunk to a single flip chip carrier that was only about twice the size of a 32 pin DIP. It required no active cooling, and while I’m positive the power requirements were probably more then a dev kit can provide without an external PSU, it would be really cool to see an AVR or such replacing the bulk if the PDP but still running code on the native PDP CPU.

    Of course I would suggest this for any computer, but the pin count on the PDP-11 flip chip is very manageable.

  8. Josh Watts says:

    One of my college classes had us implement very simple CPUs in a style very similar to this. While there’s no (much of a) realistic use for such a simulator, it is certainly fun to play around with. This also costs less than building a hardware CPU ;-)

  9. pez says:

    That is actually pretty awesome. Using a Mega as the platform seems a bit misplaced, but porting the emulator to a chip with a little more grunt might be pretty sweet.

    Got into computers just a little too late to be involved with the PDP-11s, but frittered away plenty of time on VAX 11/780s and always had a soft spot for VMS.

    Great work!

  10. lulzersaurus says:

    Does this mean we can finally have computers similar to those in Fallout that can potentially last 200 years with a trickle of solar??

    squee!!

    • Me says:

      Sounds like an interesting project. What would one do for capacitors to last that long? Does the flash in a microcontroller stay written forever?

      • six677 says:

        Flash is non volatile. Doesnt require an external charge to stay in its current state in theory.

        • Greenaum says:

          It is stored as static charges though right? They’ll bleed away eventually, since the substrate and whatever else doesn’t have infinite resistance. The Internet seems to think 5 or 10 years for a current-day SD card. In MCUs, who knows, is it on the data sheets?

          For capacitors, I’d bet solid ones would last about forever. It’s easy to put 2 bits of metal next to an insulator, the work’s all done by physics rather than the chemistry that keeps electrolytics alive.

          There are people like the Long Now Project involved in making machines that will work for thousands of years, currently they’re building a clock that will tick for 10,000 years with chimes each millennium. There’s all sorts of considerations that are completely irrelevant to normal mechanics and engineers, but come to dominate when you’re working on timescales like that.

          Even worse are the vaults that have to store hideously dangerous nuclear waste for 5 millions years. Over that time rock acts like jelly! Still really no clue as to how that’s gonna work, we’ve still got linguists working out how to write warning signs for a language that’s evolved 5 million years later. Although whatever the hell will be walking the Earth by then is another complete mystery.

          Ah, life is brief!

  11. Dave Cheney says:

    Hello hack-a-day.

    Thanks for your comments.

    Right now this project falls solidly into the ‘I wonder if this could be done’ space. If you’re looking for a simulator that runs at a reasonable speed, have a look at the version I wrote in parallel in Go (https://github.com/davecheney/pdp11).

    If you actually want a usable simulator E11 or SIMH are awesome, but if you’re like me, and like to tinker, then the best way to understand something is to pull it apart, and put it back together again.

    @dmitry, I’d love to collaborate to improve the speed of the simulator. As I identified in the first article the two areas that I know I’m throwing away performance are the ALU, where everything is handled as a 32 bit int, which absolutely blows on the 8bit Atmel ALU, and the memory bus.

    I was thinking of adding an L2 cache using the few kilobytes of spare SRAM on the atmega2560, but I now have two XRam style memory expansion boards in my possession so I’m going to integrate one of them into my design. Yay! Bank switching like it’s the ’80′s

    Thanks again

    Dave

  12. Frank W says:

    There are many Apple II fans at 6502.org who did the same with their AVRs: http://forum.6502.org/viewtopic.php?f=8&t=2766

  13. Me says:

    Does anybody have an old serial terminal they can send this guy? Something that looks like it may have one day been attached to a real PDP11?

    • Greenaum says:

      There’s very few on Ebay, and they sell for a lot of money. And shipping is no joke. I’d guess the best time to get them would’ve been about 10 – 15 years ago as companies threw them out. Then again, are they still used much?

      My first terminal was a lovely Wyse 60, on a Honeywell Bull mini. I learned C and Unix on that. And COBOL. This was early 1990s, gods know why they taught us COBOL. I suppose in 20 years when everyone else who ever knew COBOL is dead, I can corner the market!

      • IIRC A Decwriter is a 300 baud pin printer that takes full wide computer paper. Runs very slow, and if you pause while typing the head will to a mover to the right so you can see what you have done. I was actually cheaper to buy a new Apple II at the time (which cost a lot) and use a terminal program, though it was nearly impossible to talk campus computing centers or CS/Math/Physics departments to do it. It also turned out that running BASIC programs for a class was a lot faster using the Applesoft than the timeshared PDP-11 or VAX-11/780. Can you imagine 32 or 64 people using your Arduino-328? All limited to 64KBytes through virtual RAM. Hmmm. Contest?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s