Skip to content

Commit

Permalink
Merge pull request openhwgroup#172 from XavierAubert/cv32e40p/conflic…
Browse files Browse the repository at this point in the history
…t_solve

 Cv32e40p/dev OHG sync-up with a conflict solving branch
  • Loading branch information
XavierAubert authored Feb 27, 2024
2 parents f31875d + 1d00df8 commit 50bd147
Show file tree
Hide file tree
Showing 40 changed files with 1,285 additions and 61 deletions.
19 changes: 15 additions & 4 deletions bin/run_embench.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ def main():
core_config = 'corev32'
elif args.cfg == 'pulp':
core_config = 'corev32_pulp'
elif args.cfg == 'pulp_fpu':
core_config = 'corev32_pulp_fpu'
elif args.cfg == 'pulp_fpu_zfinx':
core_config = 'corev32_pulp_fpu_zfinx'
else:
logger.info(f"Invalid config selected: {args.cfg}, must be 'default' or 'pulp'")
logger.info(f"Invalid config selected: {args.cfg}, must be 'default', 'pulp', 'pulp_fpu' or 'pulp_fpu_zfinx'")
sys.exit(1)

if args.ccomp == 'notset':
Expand Down Expand Up @@ -187,7 +191,7 @@ def main():
f'--cc={args.ccomp}',
f'--warmup-heat=0',
f'--cpu-mhz={args.cpu_mhz}',
f'--ldflags=-T{paths["bsp"]}/link.ld',
f'--ldflags=-T{paths["bsp"]}/link_gp_relax.ld',
f'--builddir={args.builddir}',
f'--logdir={args.logdir}',
f'--timeout=15',
Expand Down Expand Up @@ -229,14 +233,21 @@ def main():
logger.fatal(f"Failed to generate folder {paths['testsem']}/{folder_ext}")
sys.exit(1)

logger.debug(f"Creating folder {args.builddir}/{folder_ext}")
try:
subprocess.run(['mkdir', f"{args.builddir}/{folder_ext}"])
except:
logger.fatal(f"Failed to generate folder {args.builddir}/{folder_ext}")
sys.exit(1)

# copy test files into the tests/programs/embench directories
for file in os.listdir(f"{paths['emres']}/{folder}"):
if not file.endswith('.o'):
logger.debug(f"Copying file {file}")
try:
subprocess.run(['cp', f"{paths['emres']}/{folder}/{file}", f"{paths['testsem']}/{folder_ext}/emb_{file}.elf"])
subprocess.run(['cp', f"{paths['emres']}/{folder}/{file}", f"{args.builddir}/{folder_ext}/emb_{file}.elf"])
except:
logger.fatal(f"Copying file {file} to {paths['emres']}/{folder_ext}/ failed")
logger.fatal(f"Copying file {file} to {args.builddir}/{folder_ext}/ failed")
sys.exit(1)

break
Expand Down
112 changes: 101 additions & 11 deletions cv32e40p/regress/cv32e40p_ci_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,88 @@ name: cv32e40p_ci_check
description: Commit sanity for the cv32e40p

builds:
corev-dv:
cmd: make comp_corev-dv
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p:
cmd: make comp
cmd: make comp comp_corev-dv
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp:
cmd: make comp comp_corev-dv
cfg: pulp
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp_fpu:
cmd: make comp comp_corev-dv
cfg: pulp_fpu
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp_fpu_1cyclat:
cmd: make comp comp_corev-dv
cfg: pulp_fpu_1cyclat
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp_fpu_2cyclat:
cmd: make comp comp_corev-dv
cfg: pulp_fpu_2cyclat
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp_fpu_zfinx:
cmd: make comp comp_corev-dv
cfg: pulp_fpu_zfinx
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp_fpu_zfinx_1cyclat:
cmd: make comp comp_corev-dv
cfg: pulp_fpu_zfinx_1cyclat
dir: cv32e40p/sim/uvmt

uvmt_cv32e40p_pulp_fpu_zfinx_2cyclat:
cmd: make comp comp_corev-dv
cfg: pulp_fpu_zfinx_2cyclat
dir: cv32e40p/sim/uvmt

tests:
hello-world:
build: uvmt_cv32e40p
builds:
- uvmt_cv32e40p
- uvmt_cv32e40p_pulp
- uvmt_cv32e40p_pulp_fpu
- uvmt_cv32e40p_pulp_fpu_1cyclat
- uvmt_cv32e40p_pulp_fpu_2cyclat
- uvmt_cv32e40p_pulp_fpu_zfinx
- uvmt_cv32e40p_pulp_fpu_zfinx_1cyclat
- uvmt_cv32e40p_pulp_fpu_zfinx_2cyclat
description: UVM Hello World Test
dir: cv32e40p/sim/uvmt
cmd: make hello-world
cmd: make test COREV=YES TEST=hello-world

interrupt_test:
build: uvmt_cv32e40p
builds:
- uvmt_cv32e40p
- uvmt_cv32e40p_pulp
description: Interrupt directed test
dir: cv32e40p/sim/uvmt
cmd: make test COREV=YES TEST=interrupt_test

interrupt_test:
builds:
- uvmt_cv32e40p_pulp_fpu
- uvmt_cv32e40p_pulp_fpu_1cyclat
- uvmt_cv32e40p_pulp_fpu_2cyclat
description: Interrupt directed test
dir: cv32e40p/sim/uvmt
cmd: make test COREV=YES TEST=interrupt_test
test_cfg: floating_pt_instr_en

interrupt_test:
builds:
- uvmt_cv32e40p_pulp_fpu_zfinx
- uvmt_cv32e40p_pulp_fpu_zfinx_1cyclat
- uvmt_cv32e40p_pulp_fpu_zfinx_2cyclat
description: Interrupt directed test
dir: cv32e40p/sim/uvmt
cmd: make test COREV=YES TEST=interrupt_test

test_cfg: floating_pt_zfinx_instr_en

corev_rand_interrupt:
build: uvmt_cv32e40p
description: Interrupt random test
Expand All @@ -38,7 +98,9 @@ tests:
cmd: make test COREV=YES TEST=illegal

debug_test:
build: uvmt_cv32e40p
builds:
- uvmt_cv32e40p
- uvmt_cv32e40p_pulp
dir: cv32e40p/sim/uvmt
cmd: make test COREV=YES TEST=debug_test

Expand Down Expand Up @@ -75,3 +137,31 @@ tests:
cmd: make gen_corev-dv test COREV=YES TEST=corev_rand_jump_stress_test
num: 2

corev_rand_fp_instr_sanity_test:
builds:
- uvmt_cv32e40p_pulp_fpu
- uvmt_cv32e40p_pulp_fpu_1cyclat
- uvmt_cv32e40p_pulp_fpu_2cyclat
dir: cv32e40p/sim/uvmt
cmd: make gen_corev-dv test TEST=corev_rand_fp_instr_sanity_test
test_cfg: floating_pt_instr_en

corev_rand_fp_instr_sanity_test:
builds:
- uvmt_cv32e40p_pulp_fpu_zfinx
- uvmt_cv32e40p_pulp_fpu_zfinx_1cyclat
- uvmt_cv32e40p_pulp_fpu_zfinx_2cyclat
dir: cv32e40p/sim/uvmt
cmd: make gen_corev-dv test TEST=corev_rand_fp_instr_sanity_test
test_cfg: floating_pt_zfinx_instr_en

corev_rand_pulp_instr_test:
build: uvmt_cv32e40p_pulp
dir: cv32e40p/sim/uvmt
cmd: make gen_corev-dv test COREV=YES TEST=corev_rand_pulp_instr_test

corev_rand_pulp_hwloop_test:
build: uvmt_cv32e40p_pulp
dir: cv32e40p/sim/uvmt
cmd: make gen_corev-dv test COREV=YES TEST=corev_rand_pulp_hwloop_test

2 changes: 1 addition & 1 deletion cv32e40p/tests/embench/config/corev32/chips/size/chip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-Os', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr'
'-c', '-Os', '-ffunction-sections', '-msave-restore', '-mabi=ilp32', '-march=rv32imc_zicsr'
]

ldflags = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

void
Expand All @@ -31,8 +32,6 @@ initialise_board ()
void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{


__asm__ volatile ("li a0, 0" : : : "memory");
}

Expand All @@ -41,4 +40,4 @@ stop_trigger ()
{

}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
4 changes: 2 additions & 2 deletions cv32e40p/tests/embench/config/corev32/chips/speed/chip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32im_zicsr'
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr'
]

ldflags = [
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32im_zicsr'
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32imc_zicsr'
]
user_libs = ['-lm']

Expand Down
18 changes: 13 additions & 5 deletions cv32e40p/tests/embench/config/corev32/chips/speed/chipsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

extern void _exit();

static uint32_t start_time, stop_time;

void
initialise_board ()
{
Expand All @@ -32,20 +37,23 @@ void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{
printf("start of test \n");
//reset cycle counter
TICKS_ADDR = 0;


// Enable mcycle counter and read value
__asm__ volatile("csrci mcountinhibit, 0x1"); // mcountinhibit.cy = 0
__asm__ volatile("rdcycle %0" : "=r"(start_time));

__asm__ volatile ("li a0, 0" : : : "memory");
}

void __attribute__ ((noinline)) __attribute__ ((externally_visible))
stop_trigger ()
{
uint32_t cycle_cnt = TICKS_ADDR;
__asm__ volatile("rdcycle %0" : "=r"(stop_time));
uint32_t cycle_cnt = stop_time - start_time;
printf("end of test \n");
printf("Result is given in CPU cycles \n");
printf("RES: %d \n", cycle_cnt);

_exit(0);
}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-Os', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-c', '-Os', '-ffunction-sections', '-msave-restore', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]

ldflags = [
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-nostdlib', '-mabi=ilp32', '-march=rv32imc_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-nostdlib', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]

dummy_libs = ['crt0', 'libm', 'libc', 'libgcc']
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

void
Expand All @@ -31,8 +32,6 @@ initialise_board ()
void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{


__asm__ volatile ("li a0, 0" : : : "memory");
}

Expand All @@ -41,4 +40,4 @@ stop_trigger ()
{

}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32im_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]

ldflags = [
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32im_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]
user_libs = ['-lm']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

extern void _exit();

static uint32_t start_time, stop_time;

void
initialise_board ()
{
Expand All @@ -32,20 +37,23 @@ void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{
printf("start of test \n");
//reset cycle counter
TICKS_ADDR = 0;


// Enable mcycle counter and read value
__asm__ volatile("csrci mcountinhibit, 0x1"); // mcountinhibit.cy = 0
__asm__ volatile("rdcycle %0" : "=r"(start_time));

__asm__ volatile ("li a0, 0" : : : "memory");
}

void __attribute__ ((noinline)) __attribute__ ((externally_visible))
stop_trigger ()
{
uint32_t cycle_cnt = TICKS_ADDR;
__asm__ volatile("rdcycle %0" : "=r"(stop_time));
uint32_t cycle_cnt = stop_time - start_time;
printf("end of test \n");
printf("Result is given in CPU cycles \n");
printf("RES: %d \n", cycle_cnt);

_exit(0);
}


Loading

0 comments on commit 50bd147

Please sign in to comment.