Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2021-03

Is RV32I instruction set for RISC-V (embedded) supported?

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Mueller

Hello,

I would like to use fpc to program a FPGA softcore RISC-V cpu. The softcore has the RV32I instruction set implemented.

I modified the Makefile in rtl/embedded, so that the known SUBARCH rv32imac replaces the option -Cprv32imac with now -Cprv32i. But this leads to the following error message, when I try to compile the crosscompiler/rtl:

/home/bernd/fpc/fpc331/48875/src/compiler/ppcrossrv32 -Ur -Cprv32i -Tembedded -Priscv32 -XPriscv32-embedded- -Ur -Xs -O2 -n -Fi../inc -Fi../riscv32 -FE.
-FU/home/bernd/fpc/fpc331/48875/src/rtl/units/riscv32-embedded -Fl/home/bernd/riscv/riscv_2008/lib/gcc/riscv64-unknown-elf/10.1.0/rv64imafdc/lp64d -driscv32 -dRELEASE -al -Us -Sg system.pp @system.cfg /home/bernd/fpc/fpc331/48875/src/rtl/units/riscv32-embedded/system.s: Assembler messages:
/home/bernd/fpc/fpc331/48875/src/rtl/units/riscv32-embedded/system.s:39578: Error: unrecognized opcode `mul x11,x11,x10'

Is this expected, since RV32I is not supported, or should this work?

Regards, Bernd.

Florian Klämpfl
to Bernd Mueller
Bernd Mueller wrote 23 lines
Hello, I would like to use fpc to program a FPGA softcore RISC-V cpu. The softcore has the RV32I instruction set implemented. I modified the Makefile in rtl/embedded, so that the known SUBARCH rv32imac replaces the option -Cprv32imac with now -Cprv32i.  But this leads to the following error message, when I try to compile the crosscompiler/rtl: /home/bernd/fpc/fpc331/48875/src/compiler/ppcrossrv32 -Ur -Cprv32i -Tembedded -Priscv32 -XPriscv32-embedded- -Ur -Xs -O2 -n -Fi../inc -Fi../riscv32 -FE. -FU/home/bernd/fpc/fpc331/48875/src/rtl/units/riscv32-embedded -Fl/home/bernd/riscv/riscv_2008/lib/gcc/riscv64-unknown-elf/10.1.0/rv64imafdc/lp64d -driscv32 -dRELEASE -al  -Us -Sg system.pp @system.cfg /home/bernd/fpc/fpc331/48875/src/rtl/units/riscv32-embedded/system.s: Assembler messages: /home/bernd/fpc/fpc331/48875/src/rtl/units/riscv32-embedded/system.s:39578: Error: unrecognized opcode `mul x11,x11,x10' Is this expected, since RV32I is not supported, or should this work?

It is not expected that it works as RiscV support is still work in progress, but it should work ;) I'll look into it.

Bernd Mueller
to Florian Klämpfl

I saw your changes in revision 48881, downloaded latest trunk, compiled with
make crosszipinstall CPU_TARGET=riscv32 OS_TARGET=embedded SUBARCH=rv32i

but the problem remains:

make[4]: Entering directory '/home/bernd/fpc/fpc331/48882/src/rtl/embedded' /bin/mkdir -p /home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded /home/bernd/fpc/fpc331/48882/src/compiler/ppcrossrv32 -Ur -Cprv32i -Tembedded -Priscv32 -XPriscv32-embedded- -Ur -Xs -O2 -n -Fi../inc -Fi../riscv32 -FE.
-FU/home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded -Fl/home/bernd/riscv/riscv_2008/lib/gcc/riscv64-unknown-elf/10.1.0/rv64imafdc/lp64d -driscv32 -dRELEASE -al -Us -Sg system.pp @system.cfg /home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded/system.s: Assembler messages:
/home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded/system.s:39578: Error: unrecognized opcode `mul x11,x11,x10'
...
system.pp(311) Error: Error while assembling exitcode 1 system.pp(311) Fatal: There were 2 errors compiling module, stopping

The compiler still seems to produce mul opcodes.

Regards, Bernd.

Florian Klämpfl
to Bernd Mueller
Bernd Mueller wrote 25 lines
I saw your changes in revision 48881, downloaded latest trunk, compiled with make crosszipinstall CPU_TARGET=riscv32 OS_TARGET=embedded SUBARCH=rv32i but the problem remains: make[4]: Entering directory '/home/bernd/fpc/fpc331/48882/src/rtl/embedded' /bin/mkdir -p /home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded /home/bernd/fpc/fpc331/48882/src/compiler/ppcrossrv32 -Ur -Cprv32i -Tembedded -Priscv32 -XPriscv32-embedded- -Ur -Xs -O2 -n -Fi../inc -Fi../riscv32 -FE. -FU/home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded -Fl/home/bernd/riscv/riscv_2008/lib/gcc/riscv64-unknown-elf/10.1.0/rv64imafdc/lp64d -driscv32 -dRELEASE -al  -Us -Sg system.pp @system.cfg /home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded/system.s: Assembler messages: /home/bernd/fpc/fpc331/48882/src/rtl/units/riscv32-embedded/system.s:39578: Error: unrecognized opcode `mul x11,x11,x10' ... system.pp(311) Error: Error while assembling exitcode 1 system.pp(311) Fatal: There were 2 errors compiling module, stopping The compiler still seems to produce mul opcodes.

Yes, it is not finished yet :)

Florian Klämpfl
to Bernd Mueller
Show quoted text 9 lines
Am 10.03.2021 um 10:28 schrieb Bernd Mueller via fpc-pascal : On 3/5/21 6:22 PM, Florian Klämpfl via fpc-pascal wrote: > It is not expected that it works as RiscV support is still work in > progress, but it should work ;) I'll look into it. Thank you. For me, the compiler for RV32I/RV32IMAC works already pretty well.

Yes, the mul problem should be fixed meanwhile.

Show quoted text 6 lines
Regards, Bernd. _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal