, 나는 단계를 수행 :새 명령어를 추가하고 시뮬레이트하는 방법 (스파이크)?
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)의 어셈블러를 "Error : unoperognized opcode \'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