FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

RISC-Vについて

RISC-V は命令セットからオープンな命令セットアーキテクチャである。
なかなか面白いので最近はまっている。

http://riscv.org/

命令セットを見る限り、あまりMIPSとの差は見られないのだが、顕著なものとして、ハードウェアに落としたときに性能を出しやすい構成になっているようで、

  • 遅延スロットは存在しない
  • 命令セットは単純
  • フラグは存在しない(これはMIPSも)
  • HI/LOレジスタは存在しない(これはリネーム管理するときにやっかいだった...)

現在、RISC-V用のISSを作ってみているが、これはMIPSの自作シミュレータを土台にした。まあ土台がひどいので改修にかなり苦労してはいるが。
例外回りなど、まだ理解できていないことが多い。
まずは、例外回りや特殊な動作を除いた、シンプルなシミュレータを作ってみて、動作を見てみようと思う。
Coremarkのコンパイルはできたので、Coremarkが完走するところまでを目標に。

Coremarkのビルド方法、移植の方法などは別途書くことにしよう。

2016/07/18 RISC-Vについて追記

ARM買収に際して、代替手段としてRISC-Vが少し注目されて来たので、、、ちょっとだけ追記。

RISC-Vにはいくつかのアーキテクチャレベルが存在する。整数、浮動小数点のアーキテクチャセットの区別はもちろん(RV32I, RV32-Fみたいな)、64ビット整数命令、64ビット倍精度浮動小数点命令、さらには128ビット整数命令まで定義されている。

RISC-V Spec 2.1を改めて読み直すと、いろいろアーキテクチャレベルが追記されていて自分でもビックリした。

Specifications - RISC-V Foundation

  • RV32I : base integer instruction set
  • RV32E : base integer instruction set, which is a reduced version of RV32I designed for embedded systems. The main change is to reduce the number of integer registers to 16, and to remove the counters that are mandatory in RV32I.
  • RV64I : base integer instruction set, which builds upon the RV32I.
  • "M" Standard Extension : standard integer multiplication and division instruction extension, which is named \M" and contains instructions that multiply or divide values held in two integer registers.
  • "A" Standard Extension : standard atomic instruction extension.
  • "F" Standard Extension : standard instruction-set extension for single-precision floating-point.
  • "D" Standard Extension : standard double-precision floating-point instruction-set extension.
  • "Q" Standard Extension : standard extension for 128-bit binary floating-point instructions.
  • "L" Standard Extension : support decimal floating-point arithmetic ← まだ詳細は定義されていないが。
  • "C" Standard Extension : draft proposal for the RISC-V standard compressed instruction. ← RV32Eよりもより小さくした命令セットかな。
  • "V" Standard Extension : vector instructions. ← まだ定義されていない。
  • "B" Standard Extension : future standard extension to provide bit manipulation instructions ← まだ定義されていない。
  • "T" Standard Extension : transactional memory operations. ← まだ定義されていない。
  • "P" Standard Extension : standard packed-SIMD extension for RISC-V ← 命令セットの空間だけは予約してある?
  • RV128I : variant of the RISC-V ISA supporting a flat 128-bit address space

ちなみに、システムレベル命令(システムコールとか、割り込み)などは別の仕様書に定義されている。

Draft Privileged ISA Specification v1.9 - RISC-V Foundation

これも、Hypervisor命令についてはまだ定義されていなくて、今後の拡張が必要だ。

RISC-V対応Linux

Yocto/OpenEmbedded RISC-V Port - RISC-V Foundation をまずは参照して欲しい。Linuxのポーティングも実施されており、コンパイラGCCおよびLLVMが用意されている。
またZedBoardでの実装も行われており、僕のブログでも言及している。

msyksphinz.hatenablog.com

msyksphinz.hatenablog.com

msyksphinz.hatenablog.com

Coremarkとか、ベンチマークプログラムもFPGA上で動作させることが出来ており、当時から開発環境としては割と充実している。

手前味噌のISS

こちらもオススメだよ!(宣伝)

github.com