Reviving a Computer System of 25 Years ago

Symposium at ETH 20.2.2014

Niklaus Wirth www.inf.ethz.ch/personal/wirth/ProjectOberon Programming Languages and Software Systems

• Algol-W (at Stanford U. 1966) • Pascal (1970) Structured programming • -2 (1979) Modular programming • Windows, Menus, Icons (on computer ) • Oberon (1988) Object-oriented programming • Oberon System (1990, on computer Ceres) Personal Computers • Alto at Xerox PARC (1975) • Hi-res, memory-mapped display, Mouse • Processor: TTL, 74S181 ALU (5.9 MHz) • 64K x 16 bit memory (1K bit chips!) • 2 MB cartridge disk (DEC) • 3 MHz Ethernet • Inaugurates the age of computers • Interactivity Xerox Alto (1975) Lilith (1980) • Alto with newer technology • Hi-res display, 640 x 800 pixels • 3 button mouse • Processor: 4 AMD 2901 (7 MHz) • 64K 16 bit word memory • 10 MB cartridge disk (later 15MB disk) • 3 MHz Ethernet (1981) • Central laser printer (Canon LBP-10) • 500 MB central file server (1982) Lilith (1980) Lilith (1982) Ceres (1985, 1988)

• Commercial microprocessor (NS32x32) • Hi-res display (1024 x 800 pixels) • 2 MB memory (Ceres-1), 8 MB (Ceres-2) • 10 MHz clock (Ceres-1), 25 MHz (C-2) • 40 MB disk (Ceres-1), 80 MB disk (C-2) • dual port RAM chips for display • 233 KHz network (low-cost) Ceres-1 (1986) Ceres-3 (1990) Resurrecting Project Oberon

• Project Oberon (Addison-Wesley, 1992) • A rare book presenting all details of an entire and compiler • Essential for engineering education • Document of the State-of-the-Art of 1990 • Bring it up to date and publish on Web! • But … • NS-processor extinct – Large chapter on compiler is now irrelevant • Subject of storage mangement presented in obscure assembler code for NS processor • Same for raster operations for displaying characters and lines • Chapters on compiler, linking loader, garbage collection, and raster operations are either outdated or missing • Yet, most of the book can be retained Consequences • Design my own processor: RISC • Implement this processor (with FPGA) – Low-cost development board Spartan-3 – board contains 1 MB memory (SRAM) – disk replaced by CD-card (SPI interface) • Describe complete hardware (in Verilog) • Rewrite chapters on compiler and linker • Rewrite chapter on peripheral interfaces • Describe all in Oberon, no assembler! RISC (2013) RISC on Spartan 3 (2013) The processor RISC

A Data Register Program Memory adr Bank regmux 16 x 32

B C0 PC IR

imm Instr Reg Program counter

decode + 1 offset off nxpc ALU Shifter + + C0 adr IR, cond Data Memory pcmux RISC instruction set

0 MOV a, n R.a := n 1 LSL a, b, n R.a := R.b ← n (shift left by n bits) 2 ASR a, b, n R.a := R.b → n (shift right by n bits) 3 ROR a, b, n R.a := R.b rot n (rotate right by n bits) 4 AND a, b, n R.a := R.b & n logical operations 5 ANN a, b, n R.a := R.b & ~n 6 IOR a, b, n R.a := R.b or n 7 XOR a, b, n R.a := R.b xor n 8 ADD a, b, n R.a := R.b + n integer arithmetic 9 SUB a, b, n R.a := R.b – n 10 MUL a, b, n R.a := R.a × n 11 DIV a, b, n R.a := R.b / n 12 FAD a, b, c R.a := R.b + R.c floating-point arithmetic 13 FSB a, b, c R.a := R.b – R.c 14 FML a, b, c R.a := R.a × R.c 15 FDV a, b, c R.a := R.b / R.c What have I learnt?

• Writing a program is difficult • Writing a correct program is even more so • Writing a publishable program is exacting • Programs are not written. They grow! • Controlling growth needs much discipline • Reducing size and complexity is the triumph • Programs must not be regarded as code for computers, but as literature for humans