Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
nexus-am
提交
f691577f
N
nexus-am
项目概览
OpenXiangShan
/
nexus-am
大约 1 年 前同步成功
通知
2
Star
21
Fork
25
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nexus-am
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f691577f
编写于
8月 29, 2022
作者:
W
William Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
llcop: add flush_region_to_memory func
上级
beb930f1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
0 deletion
+26
-0
tests/cacheoptest/llc/src/huancunop.c
tests/cacheoptest/llc/src/huancunop.c
+26
-0
未找到文件。
tests/cacheoptest/llc/src/huancunop.c
浏览文件 @
f691577f
...
...
@@ -97,6 +97,7 @@ void test3() {
}
}
// Flush a cacheline (512 bit) to memory
void
flush_to_memory
(
uint64_t
paddr
)
{
// printf("l3 size is set to %d KB, nr_way is set to %d, nr_bank is set to %d, ", L3_SIZE_KB, L3_NR_WAY, L3_NR_BANK);
unsigned
int
set_size
=
L3_SIZE_KB
*
1024
/
L3_NR_BANK
/
L3_NR_WAY
/
64
;
...
...
@@ -117,6 +118,31 @@ void flush_to_memory(uint64_t paddr) {
wait
(
100
);
}
// Flush an n*512 bit address region to memory
void
flush_region_to_memory
(
uint64_t
start_paddr
,
uint64_t
size_in_bit
)
{
// pre-calcuated const
unsigned
int
set_size
=
L3_SIZE_KB
*
1024
/
L3_NR_BANK
/
L3_NR_WAY
/
64
;
unsigned
int
set_len
=
log2
(
set_size
);
// printf("l3 size is set to %d KB, nr_way is set to %d, nr_bank is set to %d, ", L3_SIZE_KB, L3_NR_WAY, L3_NR_BANK);
// printf("nr_set is %u, set_len is %u\n", set_size, set_len);
// flush sq and sbuffer
asm
(
"fence
\n
"
);
// send l3 cache flush op to l3 cache controller
for
(
uint64_t
current_paddr
=
start_paddr
;
current_paddr
<
(
start_paddr
+
size_in_bit
);
current_paddr
+=
512
){
uint64_t
tag
=
(
current_paddr
>>
OFFSET_LEN
)
>>
set_len
;
// paddr to l3 tag
uint64_t
set
=
(
current_paddr
>>
OFFSET_LEN
)
&
(
set_size
-
1
);
// paddr to l3 set
*
(
uint64_t
*
)(
CACHE_CTRL_BASE
+
CTRL_TAG_OFFSET
)
=
tag
;
*
(
uint64_t
*
)(
CACHE_CTRL_BASE
+
CTRL_SET_OFFSET
)
=
set
;
// printf("flush to memory: addr 0x%llx tag 0x%llx set 0x%llx\n", &test_buffer, tag, set);
(
*
(
uint64_t
*
)
CACHE_CMD_BASE
)
=
CMD_CMO_CLEAN
;
// or CMD_CMO_FLUSH
}
// wait for the last cache op to finish
wait
(
100
);
}
int
main
()
{
printf
(
"HuanCun op (mmio based) test. Note that --no-diff is required!
\n
"
);
printf
(
"HuanCun l3 size is set to %d KB, nr_way is set to %d, nr_bank is set to %d, "
,
L3_SIZE_KB
,
L3_NR_WAY
,
L3_NR_BANK
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录