microsoft / cheriot-ibex

cheriot-ibex is a RTL implementation of CHERIoT ISA based on LowRISC's Ibex core.
Apache License 2.0
73 stars 14 forks source link

Unable to build Arty A7 example (shows module not found errors) #17

Closed Thingybob8055 closed 7 months ago

Thingybob8055 commented 11 months ago

Hello, I am investigating in using ibex for my University research project and I have some problems trying to get the example (targeting Artix A7-100T) to build correctly. I took a look in the examples folder: examples/fpga/artya7 and ran the make command from the project root: make build-arty-100 program-arty but throws errors while building and it fails. I will paste the message log in this post.

Tools:

Operating System

Ibex Repository commit

Latest commit at the time of writing: ba458abd6f20a558b15bfb763eb533884bf7759f

Build Message

cd examples/sw/led && make
make[1]: Entering directory '/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/examples/sw/led'
/home/akshay/Downloads/lowrisc-toolchain-gcc-rv32imcb-20230811-1/bin/riscv32-unknown-elf-gcc -march=rv32imc -mabi=ilp32 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -Wall -g -Os -MMD -c  -o led.o led.c
/home/akshay/Downloads/lowrisc-toolchain-gcc-rv32imcb-20230811-1/bin/riscv32-unknown-elf-gcc -march=rv32imc -mabi=ilp32 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -Wall -g -Os -MMD -c  -o crt0.o crt0.S
/home/akshay/Downloads/lowrisc-toolchain-gcc-rv32imcb-20230811-1/bin/riscv32-unknown-elf-gcc -march=rv32imc -mabi=ilp32 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -Wall -g -Os -T link.ld led.o crt0.o -o led.elf 
/home/akshay/Downloads/lowrisc-toolchain-gcc-rv32imcb-20230811-1/bin/riscv32-unknown-elf-objcopy -O binary led.elf led.bin
srec_cat led.bin -binary -offset 0x0000 -byte-swap 4 -o led.vmem -vmem
/home/akshay/Downloads/lowrisc-toolchain-gcc-rv32imcb-20230811-1/bin/riscv32-unknown-elf-objdump -SD led.elf > led.dis
make[1]: Leaving directory '/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/examples/sw/led'
fusesoc --cores-root=. run --target=synth --setup --build \
    lowrisc:ibex:top_artya7 --part xc7a100tcsg324-1
INFO: Preparing lowrisc:dv:crypto_prince_ref:0.1
INFO: Preparing lowrisc:dv:dv_fcov_macros:0
INFO: Preparing lowrisc:dv:secded_enc:0
INFO: Preparing lowrisc:ibex:ibex_pkg:0.1
INFO: Preparing lowrisc:prim:assert:0.1
INFO: Preparing lowrisc:prim:cipher_pkg:0.1
INFO: Preparing lowrisc:prim:primgen:0.1
INFO: Preparing lowrisc:prim:ram_1p_pkg:0
INFO: Preparing lowrisc:prim:ram_2p_pkg:0
INFO: Preparing lowrisc:prim:secded:0.1
INFO: Preparing lowrisc:prim:util:0.1
INFO: Preparing lowrisc:prim:util_get_scramble_params:0
INFO: Preparing lowrisc:tool:check_tool_requirements:0.1
INFO: Preparing lowrisc:dv:scramble_model:0
INFO: Preparing lowrisc:dv_verilator:memutil_dpi:0
INFO: Preparing lowrisc:ibex:ibex_icache:0.1
INFO: Preparing lowrisc:prim:cipher:0
INFO: Preparing lowrisc:prim:lfsr:0.1
INFO: Preparing lowrisc:prim:prim_pkg:0.1
INFO: Preparing lowrisc:dv_verilator:memutil_dpi_scrambled:0
INFO: Preparing lowrisc:prim:buf:0
INFO: Preparing lowrisc:prim:clock_gating:0
INFO: Preparing lowrisc:prim:clock_mux2:0
INFO: Preparing lowrisc:prim:flop:0
INFO: Preparing lowrisc:prim:ram_1p:0
INFO: Preparing lowrisc:prim:ram_2p:0
INFO: Preparing lowrisc:ibex:fpga_xilinx_shared:0
INFO: Preparing lowrisc:ibex:ibex_core:0.1
INFO: Preparing lowrisc:prim:ram_1p_adv:0.1
INFO: Preparing lowrisc:prim:ram_1p_scr:0.1
INFO: Preparing lowrisc:ibex:ibex_top:0.1
INFO: Preparing lowrisc:ibex:top_artya7:0.1
INFO: Generating lowrisc:prim:prim_pkg-impl:0.1
Creating prim_pkg.sv
Core file written to prim_pkg.core.
INFO: Generating lowrisc:prim:buf-impl:0
Implementations for primitive buf: generic, xilinx
Inspecting generic module /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_buf.sv
No module named 'anytree'
Verible parser failed, using regex fallback instead.
Creating SystemVerilog module for abstract primitive
Abstract primitive written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_buf-impl_0/prim_buf.sv
Creating core file for primitive buf.
Core file written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_buf-impl_0/prim_buf.core
INFO: Generating lowrisc:prim:clock_gating-impl:0
Implementations for primitive clock_gating: xilinx, generic
Inspecting generic module /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_clock_gating.sv
No module named 'anytree'
Verible parser failed, using regex fallback instead.
Creating SystemVerilog module for abstract primitive
Abstract primitive written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_clock_gating-impl_0/prim_clock_gating.sv
Creating core file for primitive clock_gating.
Core file written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_clock_gating-impl_0/prim_clock_gating.core
INFO: Generating lowrisc:prim:clock_mux2-impl:0
Implementations for primitive clock_mux2: generic, xilinx
Inspecting generic module /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_clock_mux2.sv
No module named 'anytree'
Verible parser failed, using regex fallback instead.
Creating SystemVerilog module for abstract primitive
Abstract primitive written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_clock_mux2-impl_0/prim_clock_mux2.sv
Creating core file for primitive clock_mux2.
Core file written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_clock_mux2-impl_0/prim_clock_mux2.core
INFO: Generating lowrisc:prim:flop-impl:0
Implementations for primitive flop: generic, xilinx
Inspecting generic module /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/ve
ndor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_flop.sv
No module named 'anytree'
Verible parser failed, using regex fallback instead.
Creating SystemVerilog module for abstract primitive
Abstract primitive written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_flop-impl_0/prim_flop.sv
Creating core file for primitive flop.
Core file written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_flop-impl_0/prim_flop.core
INFO: Generating lowrisc:prim:ram_1p-impl:0
Implementations for primitive ram_1p: badbit, generic
Inspecting generic module /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_ram_1p.sv
No module named 'anytree'
Verible parser failed, using regex fallback instead.
Creating SystemVerilog module for abstract primitive
Abstract primitive written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_ram_1p-impl_0/prim_ram_1p.sv
Creating core file for primitive ram_1p.
Core file written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_ram_1p-impl_0/prim_ram_1p.core
INFO: Generating lowrisc:prim:ram_2p-impl:0
Implementations for primitive ram_2p: generic
Inspecting generic module /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_ram_2p.sv
No module named 'anytree'
Verible parser failed, using regex fallback instead.
Creating SystemVerilog module for abstract primitive
Abstract primitive written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_ram_2p-impl_0/prim_ram_2p.sv
Creating core file for primitive ram_2p.
Core file written to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/generated/lowrisc_prim_ram_2p-impl_0/prim_ram_2p.core
INFO: Wrote dependency graph to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/lowrisc_ibex_top_artya7_0.1.deps-after-generators.dot
INFO: Wrote Makefile fragment to /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/core-deps.mk
INFO: Setting up project

INFO: Building
INFO: make[1]: Entering directory '/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado'
vivado -notrace -mode batch -source lowrisc_ibex_top_artya7_0.1.tcl

****** Vivado v2022.2 (64-bit)
  **** SW Build 3671981 on Fri Oct 14 04:59:54 MDT 2022
  **** IP Build 3669848 on Fri Oct 14 08:30:02 MDT 2022
    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.

source lowrisc_ibex_top_artya7_0.1.tcl -notrace
create_project: Time (s): cpu = 00:00:07 ; elapsed = 00:00:06 . Memory (MB): peak = 1333.227 ; gain = 120.992 ; free physical = 2449 ; free virtual = 37689
INFO: [Common 17-206] Exiting Vivado at Mon Oct  9 16:40:34 2023...
vivado -notrace -mode batch -source lowrisc_ibex_top_artya7_0.1_run.tcl lowrisc_ibex_top_artya7_0.1.xpr

****** Vivado v2022.2 (64-bit)
  **** SW Build 3671981 on Fri Oct 14 04:59:54 MDT 2022
  **** IP Build 3669848 on Fri Oct 14 08:30:02 MDT 2022
    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.

open_project lowrisc_ibex_top_artya7_0.1.xpr
INFO: [filemgmt 56-3] Default IP Output Path : Could not find the directory '/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/lowrisc_ibex_top_artya7_0.1.gen/sources_1'.
Scanning sources...
Finished scanning sources
open_project: Time (s): cpu = 00:00:07 ; elapsed = 00:00:06 . Memory (MB): peak = 1334.227 ; gain = 120.992 ; free physical = 2389 ; free virtual = 37642
source lowrisc_ibex_top_artya7_0.1_run.tcl -notrace
[Mon Oct  9 16:40:53 2023] Launched synth_1...
Run output will be captured here: /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/lowrisc_ibex_top_artya7_0.1.runs/synth_1/runme.log
[Mon Oct  9 16:40:53 2023] Launched impl_1...
Run output will be captured here: /home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado/lowrisc_ibex_top_artya7_0.1.runs/impl_1/runme.log
[Mon Oct  9 16:40:53 2023] Waiting for impl_1 to finish...
[Mon Oct  9 16:41:26 2023] impl_1 finished
WARNING: [Vivado 12-13638] Failed runs(s) : 'synth_1'
 'synth_1' run failed with below errors.
ERROR: [Synth 8-439] module 'cheri_tbre_wrapper' not found [/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_core.sv:1081]

ERROR: [Synth 8-6156] failed synthesizing module 'ibex_core' [/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_core.sv:22]

ERROR: [Synth 8-6156] failed synthesizing module 'ibex_top' [/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:15]

ERROR: [Synth 8-6156] failed synthesizing module 'top_artya7' [/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/src/lowrisc_ibex_top_artya7_0.1/rtl/top_artya7.sv:5]

ERROR: [Common 17-69] Command failed: Synthesis failed - please see the console or run log file for details

wait_on_runs: Time (s): cpu = 00:00:35 ; elapsed = 00:00:33 . Memory (MB): peak = 1334.301 ; gain = 0.000 ; free physical = 2090 ; free virtual = 37461
Bitstream generation completed
ERROR: Implementation and bitstream generation step failed.
INFO: [Common 17-206] Exiting Vivado at Mon Oct  9 16:41:26 2023...
make[1]: Leaving directory '/home/akshay/Documents/CE301/lowrisc/ciot/cheriot-ibex/build/lowrisc_ibex_top_artya7_0.1/synth-vivado'

ERROR: make[1]: *** [Makefile:16: lowrisc_ibex_top_artya7_0.1.bit] Error 1

ERROR: Failed to build lowrisc:ibex:top_artya7:0.1 : '['make']' exited with an error: 2
make: *** [Makefile:74: build-arty-100] Error 1

This is my first time posting an issue on GitHub, so please let me know if there is anything I can do to improve the post, and please do not hesitate to ask for more details!

kliuMsft commented 11 months ago

My apologies - the FPGA build setup in this repo is merely a carryover from the original lowRISC ibex repo and has not been updated to supported CHERIoT yet. We have released a separate FPGA repo for CHERIoT at https://github.com/microsoft/cheriot-safe. Right now it only contains RTL design but we hope in a couple of weeks it would be updated with the build and simulation setup.

Thingybob8055 commented 11 months ago

Hi, I managed to get it built and upload to the FPGA. I had to make the following quick changes:

After these quick changes, the Arty A7 example was able to synthesise, implement and generate the bit stream and the LEDs blinked in an alternate pattern just like the README.md said.

Is this fine to get the cheriot-ibex running on an FPGA such as the Arty A7?

kliuMsft commented 11 months ago

This is very interesting indeed. I didn't quite expect it to work this way so it is a bit surprise, although a good one. Basically by doing this, you are tying all unmapped inputs on ibex_top to '0' and thus setting up cheriot-ibex in "backward compatibility mode", where it behaves exactly as the unmodified ibex (which supports RV32IMC). That's why you can build the FPGA and run the examples, even though they are just carryovers from the original ibex. However to take advantage of the CHERIoT extension, you will need to make some modifications to the memory system (that's what cheriot-safe does) and use the CHERIoT compiler (https://github.com/CTSRD-CHERI/llvm-project/tree/cheriot) to build C/C++ code. We are working on putting together more information and examples in cheriot-safe as well.

kliuMsft commented 11 months ago

BTW I also updated the top_artya7.sv per your comments. Thanks for pointing it out!

Thingybob8055 commented 11 months ago

Hello, Thanks a lot for your detailed answer! Do you have an approximate timeline when I can test out cheriot-safe on an FPFA (as well as software running baremetal on the core). If its no trouble, can you give brief instructions on how I can go about doing it myself for now?

kliuMsft commented 11 months ago

No problem. I want to say very soon - we already have the full RTL in the repo, some barebone documentation and readme /examples on how to run verilator simulations. Next we will add more scripts/examples on how to build FPGA and build software..

I'd say the logical next step for you is to download and install the cheriot LLVM compiler at the link above, which might take a little effort the first time.

kliuMsft commented 7 months ago

I am closing the issue since it's more about the cheriot-safe FPGA (where there are realted discussions already).