Nuclei-Software / nuclei-sdk

Nuclei RISC-V Software Development Kit
https://doc.nucleisys.com/nuclei_sdk
Apache License 2.0
117 stars 50 forks source link

Is a bug in CTEST? #59

Closed yinqingw closed 5 months ago

yinqingw commented 5 months ago

in test_csr.c:

CTEST(core, icache)
{
    EnableICache();
    ASSERT_NOT_EQUAL(__RV_CSR_READ(CSR_MCACHE_CTL) & CSR_MCACHE_CTL_IE, 0);
    DisableICache();
    ASSERT_EQUAL(__RV_CSR_READ(CSR_MCACHE_CTL) & CSR_MCACHE_CTL_IE, 0);
}

should do

__RWMB();
__FENCE_I();

before EnableICache();andEnableICache();? Now,If my compilation option is -02,CPU may be abnormal。

fanghuaqi commented 5 months ago

Sorry, I cannot repeat it, could you provide more details for what cpu you are using, and changes you have made?

Tested on nx900fd and n900fd with -O2.

image

yinqingw commented 5 months ago

It is a possible trouble,you could only run

EnableICache();
DisableICache();
EnableICache();
DisableICache();
EnableICache();
DisableICache();

for enable and disable icache。It may have appeared.

fanghuaqi commented 5 months ago

Still works.

image

image

yinqingw commented 5 months ago

ok,thanks