Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
NEMU
提交
7f83b501
N
NEMU
项目概览
OpenXiangShan
/
NEMU
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
7f83b501
编写于
9月 05, 2019
作者:
P
Parallels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass qemu diff-test, improve code style
上级
495c2d73
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
36 addition
and
41 deletion
+36
-41
include/common.h
include/common.h
+1
-1
src/isa/riscv64/exec/compute.c
src/isa/riscv64/exec/compute.c
+5
-15
src/isa/riscv64/exec/ldst.c
src/isa/riscv64/exec/ldst.c
+1
-3
src/isa/riscv64/exec/muldiv.c
src/isa/riscv64/exec/muldiv.c
+5
-15
src/monitor/diff-test/diff-test.c
src/monitor/diff-test/diff-test.c
+1
-0
tools/qemu-diff/src/diff-test.c
tools/qemu-diff/src/diff-test.c
+3
-1
tools/qemu-diff/src/gdb-host.c
tools/qemu-diff/src/gdb-host.c
+1
-0
tools/qemu-diff/src/isa/riscv64/include/isa.h
tools/qemu-diff/src/isa/riscv64/include/isa.h
+3
-3
tools/qemu-diff/src/isa/riscv64/init.c
tools/qemu-diff/src/isa/riscv64/init.c
+16
-3
未找到文件。
include/common.h
浏览文件 @
7f83b501
...
...
@@ -2,7 +2,7 @@
#define __COMMON_H__
#define DEBUG
//
#define DIFF_TEST
#define DIFF_TEST
#define ISA64
...
...
src/isa/riscv64/exec/compute.c
浏览文件 @
7f83b501
...
...
@@ -100,9 +100,7 @@ make_EHelper(lui) {
make_EHelper
(
addw
)
{
rtl_add
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
addw
);
...
...
@@ -110,9 +108,7 @@ make_EHelper(addw) {
make_EHelper
(
subw
)
{
rtl_sub
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
subw
);
...
...
@@ -121,9 +117,7 @@ make_EHelper(subw) {
make_EHelper
(
sllw
)
{
rtl_andi
(
&
id_src2
->
val
,
&
id_src2
->
val
,
0x1f
);
rtl_shl
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
sllw
);
...
...
@@ -133,9 +127,7 @@ make_EHelper(srlw) {
if
(
decinfo
.
isa
.
instr
.
funct7
==
32
)
{
// sraw
rtl_sar
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
print_asm_template3
(
sraw
);
}
else
{
...
...
@@ -143,9 +135,7 @@ make_EHelper(srlw) {
rtl_andi
(
&
id_src2
->
val
,
&
id_src2
->
val
,
0x1f
);
rtl_shr64
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
print_asm_template3
(
srlw
);
}
...
...
src/isa/riscv64/exec/ldst.c
浏览文件 @
7f83b501
...
...
@@ -5,9 +5,7 @@ make_EHelper(ld) {
#ifdef ISA64
if
(
decinfo
.
width
==
4
)
{
// for lw
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
}
#endif
...
...
src/isa/riscv64/exec/muldiv.c
浏览文件 @
7f83b501
...
...
@@ -55,9 +55,7 @@ make_EHelper(remu) {
make_EHelper
(
mulw
)
{
rtl_imul_lo
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
mulw
);
...
...
@@ -65,9 +63,7 @@ make_EHelper(mulw) {
make_EHelper
(
divw
)
{
rtl_idiv_q64
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
div
);
...
...
@@ -75,9 +71,7 @@ make_EHelper(divw) {
make_EHelper
(
remw
)
{
rtl_idiv_r64
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
remw
);
...
...
@@ -85,9 +79,7 @@ make_EHelper(remw) {
make_EHelper
(
divuw
)
{
rtl_div_q64
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
divuw
);
...
...
@@ -95,9 +87,7 @@ make_EHelper(divuw) {
make_EHelper
(
remuw
)
{
rtl_idiv_r64
(
&
s0
,
&
id_src
->
val
,
&
id_src2
->
val
);
rtl_li
(
&
s1
,
32
);
rtl_shl
(
&
s0
,
&
s0
,
&
s1
);
rtl_sar64
(
&
s0
,
&
s0
,
&
s1
);
rtl_sext
(
&
s0
,
&
s0
,
4
);
rtl_sr
(
id_dest
->
reg
,
&
s0
,
4
);
print_asm_template3
(
remuw
);
...
...
src/monitor/diff-test/diff-test.c
浏览文件 @
7f83b501
...
...
@@ -67,6 +67,7 @@ void init_difftest(char *ref_so_file, long img_size) {
"If it is not necessary, you can turn it off in include/common.h."
,
ref_so_file
);
ref_difftest_init
();
Log
(
"Init done
\n
"
);
ref_difftest_memcpy_from_dut
(
PC_START
,
guest_to_host
(
IMAGE_START
),
img_size
);
ref_difftest_setregs
(
&
cpu
);
}
...
...
tools/qemu-diff/src/diff-test.c
浏览文件 @
7f83b501
...
...
@@ -31,7 +31,9 @@ void difftest_setregs(const void *r) {
}
void
difftest_exec
(
uint64_t
n
)
{
while
(
n
--
)
gdb_si
();
while
(
n
--
)
{
gdb_si
();
}
}
void
difftest_init
(
void
)
{
...
...
tools/qemu-diff/src/gdb-host.c
浏览文件 @
7f83b501
...
...
@@ -90,6 +90,7 @@ bool gdb_setregs(union isa_gdb_regs *r) {
}
bool
gdb_si
(
void
)
{
char
buf
[]
=
"vCont;s:1"
;
gdb_send
(
conn
,
(
const
uint8_t
*
)
buf
,
strlen
(
buf
));
size_t
size
;
...
...
tools/qemu-diff/src/isa/riscv64/include/isa.h
浏览文件 @
7f83b501
...
...
@@ -8,11 +8,11 @@
union
isa_gdb_regs
{
struct
{
uint
64
_t
gpr
[
32
];
uint
64
_t
pc
;
uint
32
_t
gpr
[
32
];
uint
32
_t
pc
;
};
struct
{
uint
64
_t
array
[
77
];
uint
32
_t
array
[
77
];
};
};
...
...
tools/qemu-diff/src/isa/riscv64/init.c
浏览文件 @
7f83b501
...
...
@@ -35,17 +35,30 @@ static uint32_t initcode[] = {
void
init_isa
(
void
)
{
// put initcode to QEMU to setup a PMP to permit access to all of memory in S mode
bool
ok
=
gdb_memcpy_to_qemu
(
0x
00000000
80000000
,
initcode
,
sizeof
(
initcode
));
bool
ok
=
gdb_memcpy_to_qemu
(
0x80000000
,
initcode
,
sizeof
(
initcode
));
assert
(
ok
==
1
);
union
isa_gdb_regs
r
;
gdb_getregs
(
&
r
);
r
.
pc
=
0x
00000000
80000000
;
r
.
pc
=
0x80000000
;
ok
=
gdb_setregs
(
&
r
);
assert
(
ok
==
1
);
gdb_getregs
(
&
r
);
/*
int i;
printf("print regs:\n");
for (i = 0; i < 32; i++) {
printf("0x%x\n", r.gpr[i]);
}
printf("0x%x\nend print\n", r.pc);
fflush(stdout);*/
// execute enough instructions
difftest_exec
(
20
);
difftest_exec
(
19
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录