Sun-3 in FPGA

Melkhior

Tinkerer
Jan 9, 2022
110
66
28
Disclaimer: a lot of the work described below was done with the help of AI. None of this message was.

For those who are interested in very old workstations, I have now a working FPGA-based emulation of a Sun-3/60 - based on the MC68020 processor. It can boot SunOS 4.1.1 all the way to multi-user prompt, from network or from disk.

What is simulated:
* VME-based Sun 3/60 "Ferrari"
* New CPU core compatible to the original MC68020
* Ethernet; built-in Intel AM7990-based ("Lance") Ethernet with DMA
* Disk; Emulation of the onboard NCR 5380 backed by a raw micro-sd card for disk sd0
* Framebuffer; for now only the onboard "bwtwo" framebuffer is supported (the optional color "cgfour" is a complex beast with both a 8-bits indexed color and a 1-bit B&W framebuffer and & 1-bit selector to pick pixel-by-pixel which framebuffer goes on the screen)
* Keyboard and mouse support has not been tested
* FPU is not implemented (SunOS doesn't care, but by default NetBSD uses the FPU so userland doesn't work)

The emulation is functional - the replica doesn't match the exact timings of the original design. One reason is the MMU and it's large asynchronous SRAMs, which Sun fitted in a clever way so that it wouldn't add delay to memory accesses. The replica uses synchronous BRAM in the FPGA, costing 2 cycles per access before the latency of the DDR3 is added. It also uses a core clocked faster than the original MC68020 to compensate for that - the dhrystone scores end up broadly similar or better at reasonable clock. A small cache in from of the memory bridge helps the memory performance catch up to the real thing on both the Sun-2 and Sun-3.

The custom "RD68021" core ends up clocking much faster than expected - on the Wukong (which has a better/faster FPGA than the Deca), even with a large 256 KiB memory-bridge cache, the whole system pass timings at 45.45 MHz (where it appears substantially faster than any real Sun-3). But its coprocessor interface support is wholly untested yet.

I originally had a hand-written project that reached the PROM prompt with a customized PROM, using a lightly patched Suska 68K30L core. Then I started using claude code :) The use of a custom core was prompted by my experience with the Sun-2 emulation, virtual memory support is not necessarily well tested in open-source cores. The current design use a regular Sun 3/60 PROM patched to remove testing of the parity memory support (has it would be a pain to implement). This limits memory to the 24 MiB of the original 3/60, though the custom ROM could use 128 MiB by patching the ROM memory detection routine.

Currently "supported" boards include the QMTech Wukong V1 (discontinued), QMTech Wukong V3, and Arrow/Terasic DECA (discontinued).
 
  • Wow
Reactions: Kai Robinson