提交 6d231242 编写于 作者: Z Zihao Yu

Merge branch 'cache' into 'rv64'

Cache

See merge request projectn/nexus-am!15
#include "klib.h"
int main() {
int round = 30;
static char arr[4 * 1024 * 1024];
for (int i = 0; i < round; i++)
arr[i * 64] = i;
for (int i = 0; i < round; i++)
assert(arr[i * 64] == (char)i);
return 0;
}
#include "klib.h"
int ans[64] = {0};
#define N 64
#define CACHE_SIZE (32 * 1024)
int ans[2 * CACHE_SIZE / sizeof(int)] = {0};
int main() {
int i = 0;
for (i = 0; i < 64; i++)
ans[i] = 64 - i;
for (i = 0; i < 64; i++)
assert(ans[i] == 64 - i);
for (i = 0; i < N; i++)
ans[i] = i;
int start = CACHE_SIZE / sizeof(int);
for (i = 0; i < N; i++)
ans[start + i] = start + i;
for (i = 0; i < N; i++) {
assert(ans[i] == i);
assert(ans[start + i] == start + i);
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册