Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
NEMU
提交
83d70c32
N
NEMU
项目概览
OpenXiangShan
/
NEMU
11 个月 前同步成功
通知
7
Star
171
Fork
67
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NEMU
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
83d70c32
编写于
4月 20, 2020
作者:
Z
Zihao Yu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
engine,rv64,spill: no need to writeback s0/s1
* they are only valid during the translation of a single instruction
上级
d4f63d3d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
5 deletion
+26
-5
src/engine/rv64/spill.c
src/engine/rv64/spill.c
+23
-4
src/engine/rv64/spill.h
src/engine/rv64/spill.h
+0
-1
src/engine/rv64/tran.c
src/engine/rv64/tran.c
+3
-0
未找到文件。
src/engine/rv64/spill.c
浏览文件 @
83d70c32
...
@@ -16,11 +16,14 @@ void spill_init() {
...
@@ -16,11 +16,14 @@ void spill_init() {
tmp_regs
[
1
].
rvidx
=
TMP_REG_2
;
tmp_regs
[
1
].
rvidx
=
TMP_REG_2
;
}
}
void
spill_flush
(
int
tmpidx
)
{
tmp_regs
[
tmpidx
].
spmidx
=
0
;
tmp_regs
[
tmpidx
].
dirty
=
0
;
}
void
spill_reset
()
{
void
spill_reset
()
{
tmp_regs
[
0
].
spmidx
=
0
;
spill_flush
(
0
);
tmp_regs
[
0
].
dirty
=
0
;
spill_flush
(
1
);
tmp_regs
[
1
].
spmidx
=
0
;
tmp_regs
[
1
].
dirty
=
0
;
}
}
int
spmidx2tmpidx
(
uint32_t
spmidx
)
{
int
spmidx2tmpidx
(
uint32_t
spmidx
)
{
...
@@ -146,3 +149,19 @@ void spill_set_dirty_rvidx(uint32_t rvidx) {
...
@@ -146,3 +149,19 @@ void spill_set_dirty_rvidx(uint32_t rvidx) {
int
tmpidx
=
rvidx2tmpidx
(
rvidx
);
int
tmpidx
=
rvidx2tmpidx
(
rvidx
);
if
(
tmpidx
!=
-
1
)
spill_set_dirty
(
tmpidx
);
if
(
tmpidx
!=
-
1
)
spill_set_dirty
(
tmpidx
);
}
}
// this will be called after every translation of an instruction
// to flush RTL tmp registers, since their life-cycle is only
// valid during the translation of a single instruction
static
void
spill_flush_local_internal
(
DecodeExecState
*
s
,
const
rtlreg_t
*
dest
)
{
uint32_t
varidx
=
rtlreg2varidx
(
s
,
dest
);
for
(
int
i
=
0
;
i
<
TMP_REG_NUM
;
i
++
)
{
if
(
tmp_regs
[
i
].
spmidx
==
varidx
&&
tmp_regs
[
i
].
dirty
)
spill_flush
(
i
);
}
}
void
spill_flush_local
()
{
DecodeExecState
state
;
// only used in rtlreg2varidx()
DecodeExecState
*
s
=
&
state
;
spill_flush_local_internal
(
s
,
s0
);
spill_flush_local_internal
(
s
,
s1
);
}
src/engine/rv64/spill.h
浏览文件 @
83d70c32
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
uint32_t
spmidx2rvidx
(
uint32_t
);
uint32_t
spmidx2rvidx
(
uint32_t
);
uint32_t
spill_out_and_remap
(
DecodeExecState
*
,
uint32_t
);
uint32_t
spill_out_and_remap
(
DecodeExecState
*
,
uint32_t
);
void
spill_flush
(
uint32_t
);
void
spill_flush_all
();
void
spill_flush_all
();
void
cal_suffix_inst
();
void
cal_suffix_inst
();
void
spill_writeback_all
();
void
spill_writeback_all
();
...
...
src/engine/rv64/tran.c
浏览文件 @
83d70c32
...
@@ -18,6 +18,7 @@ void asm_print(vaddr_t ori_pc, int instr_len, bool print_flag);
...
@@ -18,6 +18,7 @@ void asm_print(vaddr_t ori_pc, int instr_len, bool print_flag);
vaddr_t
rv64_exec_trans_buffer
(
void
*
buf
,
int
nr_instr
,
int
npc_type
);
vaddr_t
rv64_exec_trans_buffer
(
void
*
buf
,
int
nr_instr
,
int
npc_type
);
void
guest_getregs
(
CPU_state
*
cpu
);
void
guest_getregs
(
CPU_state
*
cpu
);
void
spill_reset
();
void
spill_reset
();
void
spill_flush_local
();
typedef
struct
TB
{
typedef
struct
TB
{
vaddr_t
pc
;
vaddr_t
pc
;
...
@@ -103,6 +104,8 @@ void mainloop() {
...
@@ -103,6 +104,8 @@ void mainloop() {
__attribute__
((
unused
))
vaddr_t
seq_pc
=
isa_exec_once
();
__attribute__
((
unused
))
vaddr_t
seq_pc
=
isa_exec_once
();
guest_nr_instr
++
;
guest_nr_instr
++
;
spill_flush_local
();
if
(
nemu_state
.
state
!=
NEMU_RUNNING
)
tran_next_pc
=
NEXT_PC_END
;
if
(
nemu_state
.
state
!=
NEMU_RUNNING
)
tran_next_pc
=
NEXT_PC_END
;
#ifdef DEBUG
#ifdef DEBUG
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录