riscv assembler and disassembler

  To riscv instruction set, we need to compile and disassembly tool to analyze the instruction format.

  You can use the following two tools to assemble and disassemble, download links: https://pan.baidu.com/s/1eUbBlVc

  riscv-none-embed-as.exe -c mm.s -o mm.o --march=rv32g

mm.s

addi x10, x6, 20
addi x11, x6, 20
addi x10, x6, 20
addi x10, x6, 20
beq  x10,x11,label
addi x12, x6, 20
addi x12, x6, 20
label:
addi x12, x6, 20
addi x12, x6, 20
addi x12, x6, 20

   riscv-none-embed-objdump.exe -d mm.o -M no-aliases,numeric

Disassembly code is:

mm.o:     file format elf32-littleriscv


Disassembly of section .text:

00000000 <label-0x1c>:
   0:   01430513                addi    x10,x6,20
   4:   01430593                addi    x11,x6,20
   8:   01430513                addi    x10,x6,20
   c:   01430513                addi    x10,x6,20
  10:   00b50663                beq     x10,x11,1c <label>
  14:   01430613                addi    x12,x6,20
  18:   01430613                addi    x12,x6,20

0000001c <label>:
  1c:   01430613                addi    x12,x6,20
  20:   01430613                addi    x12,x6,20
  24:   01430613                addi    x12,x6,20

Guess you like

Origin www.cnblogs.com/mikewolf2002/p/11163501.html