Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
nexus-am
提交
c1152ec7
N
nexus-am
项目概览
OpenXiangShan
/
nexus-am
9 个月 前同步成功
通知
0
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,体验更适合开发者的 AI 搜索 >>
提交
c1152ec7
编写于
8月 26, 2022
作者:
W
William Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
llcop: add flush_to_memory example
上级
9fc70ba4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
0 deletion
+20
-0
tests/cacheoptest/llc/src/huancunop.c
tests/cacheoptest/llc/src/huancunop.c
+20
-0
未找到文件。
tests/cacheoptest/llc/src/huancunop.c
浏览文件 @
c1152ec7
...
@@ -97,6 +97,26 @@ void test3() {
...
@@ -97,6 +97,26 @@ void test3() {
}
}
}
}
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
;
unsigned
int
set_len
=
log2
(
set_size
);
// printf("nr_set is %u, set_len is %u\n", set_size, set_len);
/* In our LLC design, full address is passed by CtrlUnit to one of the SliceCtrls according to BankBits
* Afterwards, BankBits are truncated in SliceCtrl to generate real MSHR request
* So we should provide full address here
*/
uint64_t
tag
=
(
paddr
>>
OFFSET_LEN
)
>>
set_len
;
// paddr to l3 tag
uint64_t
set
=
(
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);
asm
(
"fence
\n
"
);
(
*
(
uint64_t
*
)
CACHE_CMD_BASE
)
=
CMD_CMO_CLEAN
;
// or CMD_CMO_FLUSH
wait
(
100
);
}
int
main
()
{
int
main
()
{
printf
(
"HuanCun op (mmio based) test. Note that --no-diff is required!
\n
"
);
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
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录