1:name: VexRiscv platform with a verilated CFU
2:description: This script runs CFU-Playground software using a verilated Custom Function Unit.
3
4$name?="CFU"
5
6using sysbus
7mach create $name
8machine LoadPlatformDescription @platforms/cpus/verilated/litex_vexriscv_verilated_cfu.repl
9
10$bin?=@https://dl.antmicro.com/projects/renode/verilated-cfu-test-software.elf-s_10742536-04c41fb55c3011b440a3e6eb955756268f28c151
11$cfuLinux?=@https://dl.antmicro.com/projects/renode/libVcpu_ibex-Linux-x86_64-13112907851.so-s_2251128-ab2dcb1801188d7f934bdeafa93f9c1edc60ad39
12
13showAnalyzer uart
14
15cpu.cfu0 SimulationFilePathLinux $cfuLinux
16
17# These CSR registers are mocked here to match the CPU used by the CFU-Playground project.
18cpu RegisterCustomCSR "BPM" 0xB04  User
19cpu RegisterCustomCSR "BPM" 0xB05  User
20cpu RegisterCustomCSR "BPM" 0xB06  User
21cpu RegisterCustomCSR "BPM" 0xB07  User
22cpu RegisterCustomCSR "BPM" 0xB08  User
23cpu RegisterCustomCSR "BPM" 0xB09  User
24cpu RegisterCustomCSR "BPM" 0xB0A  User
25cpu RegisterCustomCSR "BPM" 0xB0B  User
26cpu RegisterCustomCSR "BPM" 0xB0C  User
27cpu RegisterCustomCSR "BPM" 0xB0D  User
28cpu RegisterCustomCSR "BPM" 0xB0E  User
29cpu RegisterCustomCSR "BPM" 0xB0F  User
30cpu RegisterCustomCSR "BPM" 0xB10  User
31cpu RegisterCustomCSR "BPM" 0xB11  User
32cpu RegisterCustomCSR "BPM" 0xB12  User
33cpu RegisterCustomCSR "BPM" 0xB13  User
34cpu RegisterCustomCSR "BPM" 0xB14  User
35cpu RegisterCustomCSR "BPM" 0xB15  User
36
37macro reset
38"""
39    sysbus LoadELF $bin
40"""
41
42runMacro $reset
43
44echo "Software loaded. It is the `example_cfu` from CFU-Playground (https://github.com/google/CFU-Playground)."
45echo "You can test it by running `Functional CFU Test` (2) menu option."
46echo ""
47echo "To test a more advanced CFU you can use `cfu_mnv2` from https://github.com/antmicro/renode-verilator-integration/tree/master/samples/cfu_mnv2 with `mnv2_first` software from https://github.com/google/CFU-Playground/tree/main/proj/mnv2_first."
48echo "MobileNetv2 CFU will let you test models with `TfLM Models menu` (1) or `Project menu` (3)."
49