NetBSD/virt68k実機を作る(実機とは言ってない)

FPGAでMC68LC040もどきを用意したので、CPU側からvirtioに見えるデバイスを用意して、NetBSD/virt68kを動かそうという試み(の途中)

  • CPU:公開されている68020互換コアにPMMUやキャッシュを追加して、やや68040っぽく振る舞うように改造(しかけてたものが既にあった)
  • FPU:未実装
  • virtio:裏でRISC-V (VexRiscv) がI/Oプロセッサとして動いてそれっぽく見せる
  • NetBSD/vrit68k:FPUの存在を前提にしているので、少しいじってm68k/fpeを有効に
  • FPGA:diligent Arty A7-100T (AMD (XILINX) Artix 7)
  • その他:680×0もRISC-VもLiteXの枠組みを使用

まだちゃんと使えるようにはなってないのと、ライセンス回り整理すると公開できない(?)感じなので、なんとかしたいところ。

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|
   Build your hardware, easily!

 (c) Copyright 2012-2026 Enjoy-Digital
 (c) Copyright 2007-2015 M-Labs

 BIOS CRC passed (82f8e6a0)

 LiteX git sha1: e4a641d39

--================ SoC =================--
CPU:            VexRiscv @ 100MHz
BUS:            wishbone 32-bit data/32-bit addr
CSR:            32-bit data big ordering
ROM:            64.0KiB
SRAM:           8.0KiB
L2:             8.0KiB
SDRAM:          256.0MiB 16-bit @ 800MT/s (CL-6 CWL-5)
MAIN RAM:       256.0MiB

--=========== Initialization ===========--
Ethernet init...
Local IP: 192.168.1.50
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
  m0, b00: |00000000000000000000000000000000| delays: -
  m0, b01: |00000000000000000000000000000000| delays: -
  m0, b02: |11111111111110000000000000000000| delays: 06+-06
  m0, b03: |00000000000000001111111111111000| delays: 22+-06
  m0, b04: |00000000000000000000000000000000| delays: -
  m0, b05: |00000000000000000000000000000000| delays: -
  m0, b06: |00000000000000000000000000000000| delays: -
  m0, b07: |00000000000000000000000000000000| delays: -
  best: m0, b03 delays: 22+-06
  m1, b00: |00000000000000000000000000000000| delays: -
  m1, b01: |00000000000000000000000000000000| delays: -
  m1, b02: |11111111111110000000000000000000| delays: 06+-06
  m1, b03: |00000000000000001111111111111000| delays: 22+-06
  m1, b04: |00000000000000000000000000000000| delays: -
  m1, b05: |00000000000000000000000000000000| delays: -
  m1, b06: |00000000000000000000000000000000| delays: -
  m1, b07: |00000000000000000000000000000000| delays: -
  best: m1, b03 delays: 22+-06
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)...
  Write: 0x40000000-0x40200000 2.0MiB
   Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)...
  Write speed: 37.1MiB/s
   Read speed: 48.7MiB/s
--================ Boot ================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Executing booted program at 0x4f000000

--============== Liftoff! ==============--

[iop] m68k-virtio IOP firmware
[iop] sdcard: no card (cd=1)
[iop] no boot image at 0x4f100000 and no bootable SD card
iop> load 6176768 254e1dcb
ready
load ok 6176768
iop> boot
[iop] virtio-blk: ramdisk, 2048 sectors
[iop] virtio-net: slirp (10.0.2.2), mac 52:54:00:12:34:56
[iop] m68k start: entry 00002000 bootinfo 0036fbe4 ram 240MB
[   1.0000000] Initialized Goldfish TTY console @ 0xff008000
[   1.0000000] Reserving RAM disk pages 0xef00000 - 0xeffffff from memory segment 0.
[   1.0000000] Memory segment 0: addr=0x003b5000 size=0x0eb4b000
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[   1.0000000]     2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[   1.0000000]     2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[   1.0000000]     2024, 2025, 2026
[   1.0000000]     The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights reserved.

[   1.0000000] NetBSD 11.0 (VIRT_FPGA) #3: Sat Oct 10 18:50:31 JST 2026
[   1.0000000]  est@ursula:/home/est/opt/build/netbsd-virt68k/obj/sys/arch/virt68k/compile/VIRT_FPGA
[   1.0000000] Qemu 6.0.1: MC68040+MMU, 4k+4k on-chip physical I/D caches
[   1.0000000] total memory = 240 MB
[   1.0000000] avail memory = 229 MB
[   1.0000000] mainbus0 (root)
[   1.0000000] gfpic0 at mainbus0 addr 0xff000000: Google Goldfish PIC
[   1.0000000] gfpic0: interrupting at IPL 1
[   1.0000000] gfpic1 at mainbus0 addr 0xff001000: Google Goldfish PIC
[   1.0000000] gfpic1: interrupting at IPL 2
[   1.0000000] gfpic2 at mainbus0 addr 0xff002000: Google Goldfish PIC
[   1.0000000] gfpic2: interrupting at IPL 3
[   1.0000000] gfpic3 at mainbus0 addr 0xff003000: Google Goldfish PIC
[   1.0000000] gfpic3: interrupting at IPL 4
[   1.0000000] gfpic4 at mainbus0 addr 0xff004000: Google Goldfish PIC
[   1.0000000] gfpic4: interrupting at IPL 5
[   1.0000000] gfpic5 at mainbus0 addr 0xff005000: Google Goldfish PIC
[   1.0000000] gfpic5: interrupting at IPL 6
[   1.0000000] gfrtc0 at mainbus0 addr 0xff006000: Google Goldfish RTC + timer
[   1.0000000] gfrtc0: hardclock interrupting at gfpic5 irq 1 (IPL 6)
[   1.0000000] gfrtc0: Using as delay() timer.
[   1.0000000] gfrtc1 at mainbus0 addr 0xff007000: Google Goldfish RTC + timer
[   1.0000000] gfrtc1: using as Time of Day Register.
[   1.0000000] gftty0 at mainbus0 addr 0xff008000: Google Goldfish TTY
[   1.0000000] gftty0: console
[   1.0000000] gftty0: interrupting at gfpic0 irq 32 (IPL 1)
[   1.0000000] virtctrl0 at mainbus0 addr 0xff009000: Qemu Virtual System Controller
[   1.0000000] virtctrl0: features=0x00000001
[   1.0000000] virtio0 at mainbus0 addr 0xff01fc00
[   1.0000000] virtio0: VirtIO-MMIO-v2
[   1.0000000] virtio0: network device (id 1, rev. 0x01)
[   1.0000000] vioif0 at virtio0: features: 0x100000020<V1,MAC>
[   1.0000000] vioif0: Ethernet address 52:54:00:12:34:56
[   1.0000000] virtio0: interrupting at gfpic4 irq 31 (IPL 5)
[   1.0000000] virtio1 at mainbus0 addr 0xff01fe00
[   1.0000000] virtio1: VirtIO-MMIO-v2
[   1.0000000] virtio1: block device (id 2, rev. 0x01)
[   1.0000000] ld0 at virtio1: features: 0x100000244<V1,FLUSH,BLK_SIZE,SEG_MAX>
[   1.0000000] ld0: max 62 segs of max 65536 bytes
[   1.0000000] virtio1: interrupting at gfpic4 irq 32 (IPL 5)
[   1.0000000] ld0: 1024 KB, 2 cyl, 16 head, 63 sec, 512 bytes/sect x 2048 sectors (0 bytes/physsect)
[   1.0000000] Spurious interrupt on CPU ipl 5
[   1.0000000] WARNING: system needs entropy for security; see entropy(7)
[   1.0000000] No statclock; using hardclock.
[   1.0000000] Initialzing hardclock: freq=100 Hz, interval=10000 usec
[   2.5500030] swwdog0: software watchdog initialized
[   2.5800030] Initializing root RAM disk @ 0xef00000 - 0xeffffff
[   2.6000030] root on md0a dumps on md0b
[   2.6300030] root file system type: ffs
[   2.6300030] kern.module.path=/stand/virt68k/11.0/modules
[   2.6500030] WARNING: preposterous TOD clock time
[   2.6500030] WARNING: using filesystem time
[   2.6600030] WARNING: CHECK AND RESET THE DATE!
[   7.0000030] entropy: best effort

途中Qemuとか出てくるのはNetBSD/virt68kの仕様。6.0.1なのは、QEMU 6.0.1に合わせただけで意味はない。

続く(かな?)