mmRISC-2 で LinuxLinux on mmRISC-2
RV64GC コア mmRISC-2 の RTL を Verilator で C++ にし、Wasm にした模型です。 PC で起動を済ませて保存した状態を読み戻し、BusyBox のシェルから始めます。 端末に ls などを打つか、下の欄に書いて送ってください。1 クロックずつ回しているので、応答は数秒かかります。
The RTL of the RV64GC core mmRISC-2, turned into C++ by Verilator and into Wasm. A boot saved on a PC is restored, so it starts at the BusyBox shell. Type ls and so on into the terminal, or into the box below it. The model runs clock by clock: an answer takes a few seconds.
コマンドの例Examples
押すとシェルに送ります。Press one to send it to the shell.
| ルートのディレクトリの一覧。SD カードの模型の ext4 から読みます The root directory, read from ext4 on the model of the SD card | |
| CPU の ISA (rv64imafdc …) と MMU (sv39)。カーネルが device tree から読んだ物です The ISA of the CPU (rv64imafdc …) and its MMU (sv39), as the kernel read them from the device tree | |
| 割り込みの回数。打った字ごとに UART の割り込みが増えます Interrupt counts. Every typed key adds one to the UART's |
CPU の中 (Logic Analyzer)Inside the CPU (logic analyzer)
1 クロックごとに、退役した命令とその書き戻し・トラップ・割り込み・TLB ミス・キャッシュ・パイプラインの事象・ 主記憶・SD カード・UART を記録しています (直近 16384 サンプル)。一番上の Asm の行は退役した命令を読んだ物です。 ⚙ Trigger のプリセット「打鍵 / Key press」を選んで Set し、端末で字を打つと、その字が入った瞬間からの波形で止まります。 「事象のあるクロックだけ」にすると、退役・トラップ・UART も無く、割り込みの線・TLB ミス・主記憶・SD なども 変わらないクロックを飛ばすので、もっと長い間が入ります。パイプラインの事象 (Pipeline の組) はそのクロックが 記録された時だけ見えます。
Each clock records the retired instruction and its writeback, traps, interrupts, TLB misses, caches, pipeline events, main memory, the SD card and the UART (the last 16384 samples). The Asm row at the top disassembles the retired instructions. Choose the ⚙ Trigger preset "打鍵 / Key press", Set it, and type a key: the trace stops from the moment the key arrives. With "only clocks with events", clocks with no retire, trap or UART activity, and no change in the interrupt lines, TLB misses, main memory, SD and so on, are skipped, so a longer span fits. Pipeline events show only on the clocks that are recorded.
レジスタRegisters
動いている間は今の値です。Logic Analyzer を止める (Hold かトリガー) と、カーソルを当てた時点の x0-x31 を 書き戻しの記録から組み立てて出します (カーソルが無ければマーカー A、トリガーの所)。黄色はその時点で書いたレジスタです。
While running these are the current values. Stop the logic analyzer (Hold or a trigger) and x0-x31 follow the cursor: they are rebuilt from the recorded writebacks (without a cursor, at marker A or the trigger). Yellow marks the register written at that point.
トラップの記録Trap log
ring の中のトラップ (新しい順、40 件まで)。T はトリガーからのサンプル数です。
Traps in the ring, newest first (up to 40). T counts samples from the trigger.
出どころとライセンスSources and licenses
- このページと模型を回す道具は soft-fpga-riscv-linux (Apache-2.0、LICENSE)。 mmRISC-2 を使った個人の試みで、mmRISC-2 の作者の公認ではありません
- mmRISC-2 (Munetomo Maruyama) の RTL と起動の物一式。 Apache-2.0 (LICENSE、NOTICE)
- 保存した状態 (
state.gz) に入っている物: Linux カーネル (GPL-2.0。ソースは mmRISC-2 の Release)、 OpenSBI (BSD-2-Clause。ソース と mmRISC-2 のopensbi_patches/)、 BusyBox 1.37.0 (GPL-2.0。Debian の busybox 1:1.37.0-6 のbusybox-staticをそのまま) - Verilator の実行時ライブラリ (Verilator 5.042、LGPL-3.0 または Artistic-2.0)、 xterm.js (MIT)、 Logic Analyzer は soft-FPGA の rtlscope (MIT、LICENSE)
- This page and the tools that run the model: soft-fpga-riscv-linux (Apache-2.0, LICENSE). A personal project that uses mmRISC-2, not endorsed by the author of mmRISC-2
- The RTL and the boot files of mmRISC-2 (Munetomo Maruyama). Apache-2.0 (LICENSE, NOTICE)
- In the saved state (
state.gz): the Linux kernel (GPL-2.0; source at the mmRISC-2 release), OpenSBI (BSD-2-Clause; source andopensbi_patches/of mmRISC-2), BusyBox 1.37.0 (GPL-2.0;busybox-staticof Debian's busybox 1:1.37.0-6, unchanged) - The Verilator runtime (Verilator 5.042, LGPL-3.0 or Artistic-2.0), xterm.js (MIT), and the rtlscope logic analyzer of soft-FPGA (MIT, LICENSE)