Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard-coded ISA string for building all first_party tests #806

Open
trdthg opened this issue Mar 19, 2025 · 2 comments
Open

Hard-coded ISA string for building all first_party tests #806

trdthg opened this issue Mar 19, 2025 · 2 comments
Labels
configuration Additional configuration settings needed for the model enhancement New feature or request

Comments

@trdthg
Copy link
Contributor

trdthg commented Mar 19, 2025

When -C (disable-rvc) is enabled, the test falls into an infinite loop

  • test asm:
    .global main
    main:
       ret
    
  • cmd: ./build/c_emulator/riscv_sim_rv64d -C ./build/test/first_party/rv64d_test_empty.S.elf > log.txt

log

Running file ./build/test/first_party/rv64d_test_empty.S.elf.
ELF Entry @ 0x80002040
CSR mstatus <- 0x0000000A00000000 (input: 0x0000000000000000)
mem[X,0x0000000000001000] -> 0x0297
mem[X,0x0000000000001002] -> 0x0000
[0] [M]: 0x0000000000001000 (0x00000297) auipc t0, 0x0
x5 <- 0x0000000000001000
mem[X,0x0000000000001004] -> 0x8593
mem[X,0x0000000000001006] -> 0x0202
[1] [M]: 0x0000000000001004 (0x02028593) addi a1, t0, 0x20
x11 <- 0x0000000000001020
mem[X,0x0000000000001008] -> 0x2573
mem[X,0x000000000000100A] -> 0xF140
[2] [M]: 0x0000000000001008 (0xF1402573) csrrs a0, mhartid, zero
CSR mhartid -> 0x0000000000000000
x10 <- 0x0000000000000000
mem[X,0x000000000000100C] -> 0xB283
mem[X,0x000000000000100E] -> 0x0182
[3] [M]: 0x000000000000100C (0x0182B283) ld t0, 0x18(t0)
mem[R,0x0000000000001018] -> 0x0000000080002040
x5 <- 0x0000000080002040
mem[X,0x0000000000001010] -> 0x8067
mem[X,0x0000000000001012] -> 0x0002
[4] [M]: 0x0000000000001010 (0x00028067) jalr zero, 0x0(t0)
mem[X,0x0000000080002040] -> 0x006F
mem[X,0x0000000080002042] -> 0x0D40
[5] [M]: 0x0000000080002040 (0x0D40006F) jal zero, 0xd4
mem[X,0x0000000080002114] -> 0x4081
[6] [M]: 0x0000000080002114 (0x4081) c.illegal 0x4081
trapping from M to M to handle illegal-instruction
handling exc#0x02 at priv M with tval 0x0000000000000000
CSR mstatus <- 0x0000000A00001800
within_phys_mem: 0x0000000000000000 not within phys-mem:
  plat_rom_base: 0x0000000000001000
  plat_rom_size: 0x0000000000001000
  plat_ram_base: 0x0000000080000000
  plat_ram_size: 0x0000000080000000
trapping from M to M to handle fetch-access-fault
handling exc#0x01 at priv M with tval 0x0000000000000000
CSR mstatus <- 0x0000000A00001800
within_phys_mem: 0x0000000000000000 not within phys-mem:
  plat_rom_base: 0x0000000000001000
  plat_rom_size: 0x0000000000001000
  plat_ram_base: 0x0000000080000000
  plat_ram_size: 0x0000000080000000
@trdthg trdthg changed the title Test can't stop if enavle -C option Test can't stop if enable -C option Mar 19, 2025
@jrtc27
Copy link
Collaborator

jrtc27 commented Mar 19, 2025

Well yeah, the build system passes -march=rv32/64gc:

-march=rv${xlen}gc

so if you disable instructions at run time that the assembler was told existed then you should expect things not to work. 0x4081 is (c.)li ra, 0, corresponding to:

@jrtc27 jrtc27 changed the title Test can't stop if enable -C option Hard-coded ISA string for building all first_party tests Mar 19, 2025
@jordancarlin
Copy link
Collaborator

Once the new configuration system is merged (hopefully soon), there are plans to create tests with different configuration JSON files (either embedded in the test as a comment or as a separate file). In addition to the configuration JSON for the model, these tests will also need to pass the right march string to the compiler.

@jordancarlin jordancarlin added enhancement New feature or request configuration Additional configuration settings needed for the model labels Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Additional configuration settings needed for the model enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants