How can I insert machine code into assembly language?

40 Views Asked by At

I'm currently working on a riscv prj with custom opcode. I wanna write some asm test cases (like riscv isa test) . A piece of work has been shown below

RVTEST_CODE_BEGIN

  #-------------------------------------------------------------
  # Arithmetic tests
  #-------------------------------------------------------------
  li  TESTNUM, 2;
  li  x7, 0x00000002;
  li  x1, 0x00000002;
  00000000000000000000001011;
  bne x1, x7, fail;
  TEST_PASSFAIL

RVTEST_CODE_END

00000000000000000000001011 is a custom opcode which brings error:

riscv32-unknown-elf-gcc -march=rv32g -mabi=ilp32 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -I/home/zouzhili/riscv-tests/isa/../env/p -I/home/zouzhili/riscv-tests/isa/macros/npu -T/home/zouzhili/riscv-tests/isa/../env/p/link.ld rv32npu/vslide1down.S -o rv32npu-p-vslide1down
rv32npu/vslide1down.S: Assembler messages:
rv32npu/vslide1down.S:22: Error: junk at end of line, first unrecognized character is `0'

Is there any method to tell compiler bypassing the unrecognized opcode?

0

There are 0 best solutions below