Micro Code

Michael's blog about teaching, hardware, software and the things in between

What have I been up to?

June 12, 2020 — Michael Engel

No blog updates for almost half a year - so at least a summary of what I did since January is in order.

Thinking about all the changes since mid March due to Corona, I get the impression that I spent most of my time here in Trondheim installing countless different videoconferencing and communication tools (Zoom, Teams, Slack, ...) and using them for so many virtual meetings. But, luckily, that's not all.

In fact, I have been busy creating a new version of NTNU's compiler course, since March also in the form of youtube videos. The semester here in Trondheim is over (and "spring semester" definitely was a misnomer this year, we had new snow until mid May here in Trondheim) and there is time to prepare for student projects.

I am happy to have found five highly motivated master students to work on interesting topics on the intersection of system software and compilers/programming languages. Some of the students will be working on the Plan 9 and Inferno operating systems from Bell Labs as well as Project Oberon by Niklaus Wirth.

Amazingly, all these projects share common ideas. Plan 9 was the successor of research Unix (8th to 10th editions) at Bell Labs, developed initially by the experienced Unix creators (Rob Pike, Ken Thompson, Dave Presotto and Phil Winterbottom). It is especially interesting since it tries to get rid of all the cruft that has accumulated in commercial (and open source - looking at you, Linux!) Unix variants and to build an OS that makes it easy to build distributed systems in a highly networked environment. Inferno is a project inspired by and forked from Plan 9 (around version 2, I think) which replaces native user-mode software by code executed in a virtual machine environment. The success of Java (which is itself already 25 years old now, yikes) seems to have had an influence here, too...

Oberon is the successor of Niklaus Wirth's Pascal and Modula-2 languages. Wirth started to build his own hardware and create the required system software at ETHZ to support his research and teaching. Oberon is the culmination of these projects; with Project Oberon Wirth also designed his own hardware description language (Lola) and RISC CPU (confusingly called RISC5 as the sixth in a series of iteratively more complex RISC designs - but Wirth was first) to run the Oberon language, operating system and integrated user interface. Readers of my blog might remember my previous experiments to run Project Oberon on an FPGA.

How does all of this fit together now? The relation between Plan 9 and Inferno (which is now commercially supported by VitaNuova systems in York, UK) is obvious. But there is more to it, which you can see if you compare a screenshot of Project Oberon and Rob Pike's integrated Acme development system for Plan 9. In his paper, Rob mentions a lineage of influences between different system. All starts with the Cedar system at Xerox PARC, where Wirth spent sabbaticals in 1976/77 and 1984/85 (according to Wikipedia), which was a major inspiration for Oberon. Acme, in turn, tries to apply some of the Oberon ideas to a development system for Plan 9 and, in turn, Inferno with its own Limbo programming language as well as the predecessor Acme on Plan 9.

So we're talking ancient unsupported operating systems here, right? Not quite... some of the Unix developers (Rob Pike and Ken Thompson) now work at Google on the Go programming language. The third person in the Go design team is Robert Griesemer, who was a PhD student at ETH Zürich with Niklaus Wirth and Hanspeter Mössenböck. Small world, isn't it?

I already mentioned Xerox PARC (Palo Alto Research Center). One of the interesting projects developed at PARC was the Smalltalk system developed by Alan Kay, Dan Ingalls, Adele Goldberg and many more talented researchers. Do you remember that Wirth spent some time at Xerox? So Smalltalk is the system missing in the overview here. It's very interesting in itself and the topic of a future blog post.

Tags: Trondheim, NTNU, Update, Plan9, Inferno, Oberon, Smalltalk



Picture credits: Oberon - SomPost (license BSDU), Acme - unknown, LPL license

Small is beautiful!

June 30, 2018 — Michael Engel

If you got into contact with computers in the 1980s (at least in Europe), there's a good chance that you have learned to program in Pascal, one of the languages designed by Prof. Niklaus Wirth at ETH Zürich.

Even though he is retired for several years now, to this day Prof. Wirth continues to design software and even hardware systems that follow the maxime "small is beautiful" - elegant and simple systems including more recent programming languages such as Modula-2 and Oberon, the whole Oberon system environment including a simple OS and a graphical user interface, and even complete computer systems. In-house designs at ETH were the early Lilith and Ceres workstations in the 1980s; more recently, Prof. Wirth designed a small RISC system on an FPGA including all peripherals that is able to run Oberon.

You can find more information on the Oberon system including all software and Verilog source code as well as a textbook describing the complete design at Project Oberon. Reading the sources is a nice project for a rainy weekend - the whole Oberon system's source code, including the compiler and GUI, is only about 10k LoC (written in Oberon, of course). The Verilog sources including the CPU, all peripheral interfaces and the video driver, amount to less than 1000 lines - impressive!

The Oberon FPGA system originally ran on a quite old FPGA board, the Xilinx Spartan 3 starter board, which features a Spartan 3S400, a tiny (by today's standards) FPGA, 1 MB of fast 32-bit SRAM, and a number of peripheral interfaces. I recently found my old Spartan 3 board and finally got the system to run.

Oberon on FPGA

In order to use the Oberon system, you have to connect a PS/2 keyboard and VGA monitor to the onboard ports. In addition, you need to connect an SD card (containing the Oberon file system image) and a PS/2 mouse.

For reference (you need to look it up in the ucf pinout definition file and figure out that SPI0 is the one the SD card is supposed to be connected to - SPI1 is reserved for some wireless network interface), here are the necessary connections to connector A2 on the board:

  • SD MISO: A2 pin 17
  • SD MOSI: A2 pin 7
  • SD SCLK: A2 pin 13
  • SD SSEL: A2 pin 5
  • SD Vcc (3.3V): A2 pin 3
  • PS/2 CLK: A2 pin 4
  • PS/2 DAT: A2 pin 6
  • PS/2 Vcc (5V): A2 pin 2
  • GND: A2 pin 1

I have used a generic Logitech PS/2 mouse (type M-BJ69) and a Waveshare Micro-SD adapter board with a SanDisk 8 GB card.

Tags: FPGA, Oberon, Xilinx, Wirth