私は手順に従って、RISCV ISAに新しい命令を追加したい:新しい命令を追加してシミュレートする方法(スパイク)?
Simulating a New Instruction. Adding an instruction to the simulator requires two steps:
- Describe the instructions's functional behavior in the file
riscv/insns/<new_instruction_name>.h
. Examine other instructions in that directory as a starting point.- Add the opcode and opcode mask to
riscv/opcodes.h
. Alternatively, add it to the riscv-opcodes package, and it will do so for you:$ cs ../riscv-opcodes
;vi opcodes // add a line for the new instruction
;make install
- Rebuild the sumulator.
を私はテストへの単純なアセンブリコードを記述します。
.file "hello.c"
.text
.align 2
.globl main
.type main, @function
main:
li a0, 2
mac a1, a2, a3
add a0, a0, a1
.size main, .-main
.ident "GCC: (GNU)5.2.
しかし、エラーのある新しい命令(mac a1,a2,a3
)を認識できませんssage:
$ riscv64-unknown-elf-gcc hello.s
...
hello.s:8: Error:unrecognized opcode `mac a1,a2,a3'
私はどうすればよいですか?
スクリーンショットではありません。あなたは['' riscv/riscv-tools'](https://github.com/riscv/riscv-tools)のアセンブラを変更する必要があります。メッセージは "エラー:認識できないオペコード\' mac a1、a2、a3 "そこからです。このリストは['riscv/riscv-opcodes /'](https://github.com/riscv/riscv-opcodes)にあり、実際のエラーメッセージはriscv-binutils - gas https://github.com/riscvからです/riscv-binutils-gdb/blob/master/gas/config/tc-riscv.c#L1187 – osgx
次回はスクリーンショットの代わりにテキストを投稿します。ご連絡ありがとうございます – jjlin
質問に使用された外部リソースへの正確なリンクを投稿すると役立つことがあります(https://github.com/riscv/riscv-isa-sim#simulating-a-new-instruction、テキストの部分的なスクリーンショットではありません)。私はこの質問のためにイメージ - >テキスト変換を修正しました。 – osgx