Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
NEMU
提交
c687cd30
N
NEMU
项目概览
OpenXiangShan
/
NEMU
9 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
c687cd30
编写于
5月 09, 2021
作者:
Z
Zhou Yaoyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gem5: clean up code style, forward declearation style to build it in
gem5
上级
66a3856f
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
76 addition
and
29 deletion
+76
-29
.gitignore
.gitignore
+3
-0
SConstruct
SConstruct
+1
-2
include/base/output.h
include/base/output.h
+5
-0
include/checkpoint/profiler.h
include/checkpoint/profiler.h
+1
-1
include/checkpoint/simpoint.h
include/checkpoint/simpoint.h
+5
-2
include/debug.h
include/debug.h
+0
-2
include/monitor/difftest.h
include/monitor/difftest.h
+10
-3
src/base/output.cpp
src/base/output.cpp
+4
-0
src/checkpoint/profiler.cpp
src/checkpoint/profiler.cpp
+2
-0
src/checkpoint/simpoint.cpp
src/checkpoint/simpoint.cpp
+8
-2
src/isa/riscv64/difftest/dut.c
src/isa/riscv64/difftest/dut.c
+2
-0
src/isa/riscv64/exec/exec.c
src/isa/riscv64/exec/exec.c
+1
-1
src/isa/riscv64/exec/fp.h
src/isa/riscv64/exec/fp.h
+20
-8
src/isa/riscv64/exec/muldiv.h
src/isa/riscv64/exec/muldiv.h
+2
-0
src/main.c
src/main.c
+1
-1
src/monitor/cpu-exec.c
src/monitor/cpu-exec.c
+1
-1
src/monitor/debug/expr.c
src/monitor/debug/expr.c
+1
-0
src/monitor/debug/ui.c
src/monitor/debug/ui.c
+3
-4
src/monitor/difftest/dut.c
src/monitor/difftest/dut.c
+4
-0
src/monitor/monitor.c
src/monitor/monitor.c
+2
-2
未找到文件。
.gitignore
浏览文件 @
c687cd30
...
...
@@ -19,3 +19,6 @@ outputs*
/src/iostream3/SConscript
/src/iostream3/TODO
/src/iostream3/test.cc
*.o
*.d
.sconsign.dblite
SConstruct
浏览文件 @
c687cd30
...
...
@@ -11,6 +11,7 @@ env = Environment(
CPPDEFINES
=
{
'__DIFF_REF_QEMU__'
:
None
,
'XIANGSHAN'
:
1
,
# 'SHARE': 1,
},
CC
=
'g++'
,
CXX
=
'g++'
,
...
...
@@ -25,8 +26,6 @@ env = Environment(
CFLAGS
=
shared_flags
,
)
env
.
Append
(
CPPDEFINES
=
{
# '__DIFF_REF_QEMU__': None,
# 'XIANGSHAN': 1,
'__ENGINE_interpreter__'
:
None
,
'__SIMPOINT'
:
None
,
...
...
include/base/output.h
浏览文件 @
c687cd30
...
...
@@ -51,6 +51,8 @@
#include <map>
#include <string>
namespace
NEMUNS
{
class
OutputDirectory
;
class
OutputStream
...
...
@@ -304,4 +306,7 @@ class OutputDirectory
extern
OutputDirectory
simout
;
};
#endif // __BASE_OUTPUT_HH__
include/checkpoint/profiler.h
浏览文件 @
c687cd30
...
...
@@ -36,7 +36,7 @@ class SiameseProfiler
uint64_t
intervalDrift
;
OutputStream
*
outStream
;
typename
NEMUNS
::
OutputStream
*
outStream
;
unsigned
footprintPeriodSize
;
...
...
include/checkpoint/simpoint.h
浏览文件 @
c687cd30
...
...
@@ -73,6 +73,8 @@ struct hash<BasicBlockRange>
};
}
namespace
SimPointNS
{
class
SimPoint
{
public:
...
...
@@ -102,7 +104,7 @@ class SimPoint
/** Excess inst count from previous interval*/
uint64_t
intervalDrift
;
/** Pointer to SimPoint BBV output stream */
OutputStream
*
simpointStream
;
NEMUNS
::
OutputStream
*
simpointStream
;
/** Basic Block information */
struct
BBInfo
...
...
@@ -124,7 +126,8 @@ class SimPoint
};
};
extern
SimPoint
simPoint
;
extern
SimPoint
NS
::
SimPoint
simPointObj
;
#endif // __CPU_SIMPLE_PROBES_SIMPOINT_HH__
include/debug.h
浏览文件 @
c687cd30
...
...
@@ -17,9 +17,7 @@ extern "C" void isa_reg_display();
fprintf(stderr, "\33[1;31m"); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\33[0m\n"); \
extern void monitor_statistic(); \
isa_reg_display(); \
monitor_statistic(); \
assert(cond); \
} \
} while (0)
...
...
include/monitor/difftest.h
浏览文件 @
c687cd30
...
...
@@ -3,16 +3,21 @@
#include <common.h>
namespace
NEMUASDUT
{
#ifdef DIFF_TEST
void
difftest_skip_ref
(
void
);
void
difftest_skip_dut
(
int
nr_ref
,
int
nr_dut
);
void
difftest_step
(
vaddr_t
ori_pc
,
vaddr_t
next_pc
);
extern
void
difftest_skip_ref
(
void
);
extern
void
difftest_skip_dut
(
int
nr_ref
,
int
nr_dut
);
extern
void
difftest_step
(
vaddr_t
ori_pc
,
vaddr_t
next_pc
);
#else
#define difftest_skip_ref()
#define difftest_skip_dut(nr_ref, nr_dut)
#define difftest_step(ori_pc, next_pc)
#endif
extern
void
difftest_detach
();
extern
void
difftest_attach
();
extern
void
init_difftest
(
char
*
ref_so_file
,
long
img_size
,
int
port
);
extern
void
(
*
ref_difftest_memcpy_from_dut
)(
paddr_t
dest
,
void
*
src
,
size_t
n
);
extern
void
(
*
ref_difftest_getregs
)(
void
*
c
);
extern
void
(
*
ref_difftest_setregs
)(
const
void
*
c
);
...
...
@@ -20,6 +25,8 @@ extern void (*ref_difftest_get_mastatus)(void *c);
extern
void
(
*
ref_difftest_set_mastatus
)(
const
void
*
c
);
extern
void
(
*
ref_difftest_exec
)(
uint64_t
n
);
}
static
inline
nemu_bool
difftest_check_reg
(
const
char
*
name
,
vaddr_t
pc
,
rtlreg_t
ref
,
rtlreg_t
dut
)
{
if
(
ref
!=
dut
)
{
Log
(
"%s is different after executing instruction at pc = "
FMT_WORD
", right = "
FMT_WORD
", wrong = "
FMT_WORD
,
...
...
src/base/output.cpp
浏览文件 @
c687cd30
...
...
@@ -60,6 +60,8 @@
#include <debug.h>
#include <iostream>
namespace
NEMUNS
{
using
namespace
std
;
OutputDirectory
simout
;
...
...
@@ -342,3 +344,5 @@ OutputDirectory::remove(const string &name, bool recursive)
}
}
}
};
src/checkpoint/profiler.cpp
浏览文件 @
c687cd30
...
...
@@ -7,6 +7,7 @@
#include <numeric>
#include <vector>
#include <base/output.h>
#include <base/sized_ranker.h>
#include <checkpoint/path_manager.h>
#include <checkpoint/profiler.h>
...
...
@@ -125,6 +126,7 @@ void SiameseProfiler::init()
intervalSize
=
profiling_interval
;
Log
(
"Doing betapoint profiling with interval %lu"
,
intervalSize
);
auto
path
=
pathManager
.
getWorkloadPath
()
+
"/betapoint.csv.gz"
;
using
NEMUNS
::
simout
;
outStream
=
simout
.
create
(
path
,
false
);
if
(
!
outStream
)
xpanic
(
"unable to open Betapoint profile_file %s
\n
"
,
path
.
c_str
());
...
...
src/checkpoint/simpoint.cpp
浏览文件 @
c687cd30
...
...
@@ -44,10 +44,13 @@
#include <algorithm>
#include <iostream>
#include <base/output.h>
#include <checkpoint/simpoint.h>
#include <debug.h>
#include <monitor/monitor.h>
namespace
SimPointNS
{
SimPoint
::
SimPoint
()
:
intervalCount
(
0
),
intervalDrift
(
0
),
...
...
@@ -66,6 +69,7 @@ SimPoint::init() {
intervalSize
=
profiling_interval
;
Log
(
"Doing simpoint profiling with interval %lu"
,
intervalSize
);
auto
path
=
pathManager
.
getOutputPath
()
+
"/simpoint_bbv.gz"
;
using
NEMUNS
::
simout
;
simpointStream
=
simout
.
create
(
path
,
false
);
if
(
!
simpointStream
)
xpanic
(
"unable to open SimPoint profile_file %s
\n
"
,
path
.
c_str
());
...
...
@@ -140,9 +144,11 @@ SimPoint::profile(Addr pc, bool is_control, bool is_last_uop) {
}
}
SimPoint
simPoint
;
}
SimPointNS
::
SimPoint
simPointObj
;
void
init_simpoint
()
{
simPoint
.
init
();
simPoint
Obj
.
init
();
}
src/isa/riscv64/difftest/dut.c
浏览文件 @
c687cd30
...
...
@@ -18,6 +18,8 @@ nemu_bool isa_difftest_checkregs(CPU_state *ref_r, vaddr_t pc) {
}
void
isa_difftest_attach
(
void
)
{
using
NEMUASDUT
::
ref_difftest_memcpy_from_dut
;
using
NEMUASDUT
::
ref_difftest_setregs
;
ref_difftest_memcpy_from_dut
(
PMEM_BASE
,
guest_to_host
(
0
),
PMEM_SIZE
);
ref_difftest_setregs
(
&
cpu
);
}
src/isa/riscv64/exec/exec.c
浏览文件 @
c687cd30
...
...
@@ -287,7 +287,7 @@ vaddr_t isa_exec_once() {
extern
uint64_t
g_nr_guest_instr
;
profiler
.
profile
(
s
,
g_nr_guest_instr
);
}
else
if
(
profiling_state
==
SimpointProfiling
&&
xpoint_profiling_started
)
{
simPoint
.
profile
(
s
.
seq_pc
,
s
.
is_control
,
true
);
simPoint
Obj
.
profile
(
s
.
seq_pc
,
s
.
is_control
,
true
);
}
...
...
src/isa/riscv64/exec/fp.h
浏览文件 @
c687cd30
...
...
@@ -265,16 +265,25 @@ static inline make_EHelper(fsgnj) {
switch
(
rm
)
{
case
0
:
// sgnj
if
(
s
->
width
==
4
)
print_asm_template3
(
fsgnj
.
s
);
else
print_asm_template3
(
fsgnj
.
d
);
if
(
s
->
width
==
4
)
{
print_asm_template3
(
fsgnj
.
s
);
}
else
{
print_asm_template3
(
fsgnj
.
d
);
}
break
;
case
1
:
// sgnjn
if
(
s
->
width
==
4
)
print_asm_template3
(
fsgnjn
.
s
);
else
print_asm_template3
(
fsgnjn
.
d
);
if
(
s
->
width
==
4
)
{
print_asm_template3
(
fsgnjn
.
s
);
}
else
{
print_asm_template3
(
fsgnjn
.
d
);
}
break
;
case
2
:
// sgnjx
if
(
s
->
width
==
4
)
print_asm_template3
(
fsgnjx
.
s
);
else
print_asm_template3
(
fsgnjx
.
d
);
if
(
s
->
width
==
4
)
{
print_asm_template3
(
fsgnjx
.
s
);
}
else
{
print_asm_template3
(
fsgnjx
.
d
);
}
break
;
default:
assert
(
0
);
...
...
@@ -291,8 +300,11 @@ static inline make_EHelper(fmv_F_to_G) {
if
(
rm
==
0
){
// fmv fpr to gpr
rtl_sext
(
s
,
s0
,
dsrc1
,
s
->
width
);
if
(
s
->
width
==
4
)
print_asm_template2
(
fmv
.
x
.
w
);
else
print_asm_template2
(
fmv
.
x
.
d
);
if
(
s
->
width
==
4
)
{
print_asm_template2
(
fmv
.
x
.
w
);
}
else
{
print_asm_template2
(
fmv
.
x
.
d
);
}
}
else
{
// fclass
if
(
s
->
width
==
4
){
...
...
src/isa/riscv64/exec/muldiv.h
浏览文件 @
c687cd30
#include<limits>
static
inline
make_EHelper
(
mul
)
{
rtl_mul_lo
(
s
,
ddest
,
dsrc1
,
dsrc2
);
print_asm_template3
(
mul
);
...
...
src/main.c
浏览文件 @
c687cd30
...
...
@@ -9,7 +9,7 @@ void init_simpoint();
void
init_profiler
();
void
init_serializer
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
nemu_
main
(
int
argc
,
char
*
argv
[])
{
/* Initialize the monitor. */
init_monitor
(
argc
,
argv
);
...
...
src/monitor/cpu-exec.c
浏览文件 @
c687cd30
...
...
@@ -37,7 +37,7 @@ void monitor_statistic(void) {
}
nemu_bool
log_enable
(
void
)
{
return
(
g_nr_guest_instr
>=
LOG_START
)
&&
(
g_nr_guest_instr
<=
LOG_END
)
;
return
false
;
}
void
display_inv_msg
(
vaddr_t
pc
)
{
...
...
src/monitor/debug/expr.c
浏览文件 @
c687cd30
...
...
@@ -102,6 +102,7 @@ static nemu_bool make_token(char *e) {
case
TK_NOTYPE
:
break
;
case
TK_NUM
:
case
TK_REG
:
sprintf
(
tokens
[
nr_token
].
str
,
"%.*s"
,
substr_len
,
substr_start
);
__attribute__
((
fallthrough
));
default:
tokens
[
nr_token
].
type
=
rules
[
i
].
token_type
;
nr_token
++
;
}
...
...
src/monitor/debug/ui.c
浏览文件 @
c687cd30
#include <checkpoint/serializer.h>
#include <monitor/difftest.h>
#include <isa.h>
#include <memory/paddr.h>
...
...
@@ -147,15 +148,13 @@ static int cmd_q(char *args) {
static
int
cmd_help
(
char
*
args
);
void
difftest_detach
();
void
difftest_attach
();
static
int
cmd_detach
(
char
*
args
)
{
difftest_detach
();
NEMUASDUT
::
difftest_detach
();
return
0
;
}
static
int
cmd_attach
(
char
*
args
)
{
difftest_attach
();
NEMUASDUT
::
difftest_attach
();
return
0
;
}
...
...
src/monitor/difftest/dut.c
浏览文件 @
c687cd30
...
...
@@ -4,6 +4,8 @@
#include <memory/paddr.h>
#include <monitor/monitor.h>
namespace
NEMUASDUT
{
void
(
*
ref_difftest_memcpy_from_dut
)(
paddr_t
dest
,
void
*
src
,
size_t
n
)
=
NULL
;
void
(
*
ref_difftest_getregs
)(
void
*
c
)
=
NULL
;
void
(
*
ref_difftest_setregs
)(
const
void
*
c
)
=
NULL
;
...
...
@@ -134,3 +136,5 @@ void difftest_attach() {
isa_difftest_attach
();
}
};
src/monitor/monitor.c
浏览文件 @
c687cd30
#include <checkpoint/serializer.h>
#include <monitor/difftest.h>
#include <isa.h>
#include <memory/paddr.h>
...
...
@@ -13,7 +14,6 @@ void init_regex();
void
init_wp_pool
();
void
init_device
();
void
init_engine
();
void
init_difftest
(
char
*
ref_so_file
,
long
img_size
,
int
port
);
static
char
*
log_file
=
NULL
;
static
char
*
diff_so_file
=
NULL
;
...
...
@@ -230,7 +230,7 @@ void init_monitor(int argc, char *argv[]) {
if
(
!
checkpointRestoring
)
{
/* Initialize differential testing. */
init_difftest
(
diff_so_file
,
img_size
,
difftest_port
);
NEMUASDUT
::
init_difftest
(
diff_so_file
,
img_size
,
difftest_port
);
}
/* Display welcome message. */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录