tests: add delay for llcop test

MMIO llcop takes time to take effect. Delay needs to be added before
checking llcop result.
This commit is contained in:
William Wang 2022-05-15 14:17:44 +08:00
parent 94eae1a027
commit ba11b3ce16
1 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,13 @@ unsigned int log2(unsigned int n) {
return result;
}
void wait(int cycle) {
volatile int i = cycle;
while(i > 0){
i--;
}
}
volatile uint64_t test_buffer[TEST_BUFFER_SIZE] __attribute__((aligned(64))) = {0};
void success() {
@ -55,6 +62,7 @@ void test1() {
test_buffer[0] = 1;
asm("fence\n");
(*(uint64_t*)CACHE_CMD_BASE) = CMD_CMO_INV;
wait(100);
printf("huancun op invalid done\n");
printf("data %lx\n", test_buffer[0]);
if (test_buffer[0] == 1) {
@ -67,6 +75,7 @@ void test2() {
test_buffer[0] = 2;
asm("fence\n");
(*(uint64_t*)CACHE_CMD_BASE) = CMD_CMO_CLEAN;
wait(100);
printf("huancun op clean done\n");
printf("data %lx\n", test_buffer[0]);
if (test_buffer[0] != 2) {
@ -79,6 +88,7 @@ void test3() {
test_buffer[0] = 3;
asm("fence\n");
(*(uint64_t*)CACHE_CMD_BASE) = CMD_CMO_FLUSH;
wait(100);
printf("huancun op flush done\n");
printf("data %lx\n", test_buffer[0]);
if (test_buffer[0] != 3) {