VOOZH about

URL: https://qiita.com/varmil/items/be190fe50516c52aab3e

⇱ 自作CPUを創る際に効率よくテストケースを準備する方法 #Verilog - Qiita


👁 Image
3

Go to list of users who liked

1

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@varmil(Akihiro Yamamoto)

自作CPUを創る際に効率よくテストケースを準備する方法

3
Posted at

CPUを自作する際に、もっとも重要なのは一歩一歩テスト駆動開発していくことだ。なぜなら非常にデバッグが辛いから。バグを早期にあぶり出すのが結果的にリードタイム向上につながるのである。(自論)

既存リポジトリ

(私はいまMIPS Release 1を自作しているので)このへんがめちゃいいのである。車輪の再発明、ダメ。
https://github.com/YurongYou/MIPS-CPU-Test-Cases

自分でテストケースを作る場合は

mipsel-sde-elf-gcc -c foo.c
mipsel-sde-elf-objcopy -j .text -O binary foo.o foo.bin

とすればRAWバイナリが生成される。勿論、gccに食わせるのはasmファイルでも構わない。結果は od -x foo.bin 等で確認できる。modelsimなどシミュレータで使用するなら、4バイト毎に改行してほしいので

od -An -tx4 -w4 foo.bin | tr -d ' '

でOK(唐突なシェル芸)

20020004
20030004
10430002
20040004
.....

こんな感じで機械語が良い感じに出力される。

3

Go to list of users who liked

1
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3

Go to list of users who liked

1