Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
fba1b3d9
X
XiangShan
项目概览
OpenXiangShan
/
XiangShan
大约 1 年 前同步成功
通知
1183
Star
3914
Fork
526
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
XiangShan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fba1b3d9
编写于
12月 19, 2020
作者:
Y
Yinan Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
emu: add --no-snapshot option to disable saving snapshots
上级
c0bc6fd8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
10 deletion
+15
-10
src/test/csrc/emu.cpp
src/test/csrc/emu.cpp
+13
-10
src/test/csrc/emu.h
src/test/csrc/emu.h
+2
-0
未找到文件。
src/test/csrc/emu.cpp
浏览文件 @
fba1b3d9
...
...
@@ -15,15 +15,16 @@ void set_nemu_this_pc(uint64_t pc);
static
inline
void
print_help
(
const
char
*
file
)
{
printf
(
"Usage: %s [OPTION...]
\n
"
,
file
);
printf
(
"
\n
"
);
printf
(
" -s, --seed=NUM use this seed
\n
"
);
printf
(
" -C, --max-cycles=NUM execute at most NUM cycles
\n
"
);
printf
(
" -I, --max-instr=NUM execute at most NUM instructions
\n
"
);
printf
(
" -i, --image=FILE run with this image file
\n
"
);
printf
(
" -b, --log-begin=NUM display log from NUM th cycle
\n
"
);
printf
(
" -e, --log-end=NUM stop display log at NUM th cycle
\n
"
);
printf
(
" -s, --seed=NUM
use this seed
\n
"
);
printf
(
" -C, --max-cycles=NUM
execute at most NUM cycles
\n
"
);
printf
(
" -I, --max-instr=NUM
execute at most NUM instructions
\n
"
);
printf
(
" -i, --image=FILE
run with this image file
\n
"
);
printf
(
" -b, --log-begin=NUM
display log from NUM th cycle
\n
"
);
printf
(
" -e, --log-end=NUM
stop display log at NUM th cycle
\n
"
);
printf
(
" --load-snapshot=PATH load snapshot from PATH
\n
"
);
printf
(
" --dump-wave dump waveform when log is enabled
\n
"
);
printf
(
" -h, --help print program help info
\n
"
);
printf
(
" --no-snapshot disable saving snapshots
\n
"
);
printf
(
" --dump-wave dump waveform when log is enabled
\n
"
);
printf
(
" -h, --help print program help info
\n
"
);
printf
(
"
\n
"
);
}
...
...
@@ -33,6 +34,7 @@ inline EmuArgs parse_args(int argc, const char *argv[]) {
const
struct
option
long_options
[]
=
{
{
"load-snapshot"
,
1
,
NULL
,
0
},
{
"dump-wave"
,
0
,
NULL
,
0
},
{
"no-snapshot"
,
0
,
NULL
,
0
},
{
"seed"
,
1
,
NULL
,
's'
},
{
"max-cycles"
,
1
,
NULL
,
'C'
},
{
"max-instr"
,
1
,
NULL
,
'I'
},
...
...
@@ -51,6 +53,7 @@ inline EmuArgs parse_args(int argc, const char *argv[]) {
switch
(
long_index
)
{
case
0
:
args
.
snapshot_path
=
optarg
;
continue
;
case
1
:
args
.
enable_waveform
=
true
;
continue
;
case
2
:
args
.
enable_snapshot
=
false
;
continue
;
}
// fall through
default:
...
...
@@ -129,7 +132,7 @@ Emulator::~Emulator() {
ram_finish
();
#ifdef VM_SAVABLE
if
(
trapCode
!=
STATE_GOODTRAP
&&
trapCode
!=
STATE_LIMIT_EXCEEDED
)
{
if
(
args
.
enable_snapshot
&&
trapCode
!=
STATE_GOODTRAP
&&
trapCode
!=
STATE_LIMIT_EXCEEDED
)
{
printf
(
"Saving snapshots to file system. Please wait.
\n
"
);
snapshot_slot
[
0
].
save
();
snapshot_slot
[
1
].
save
();
...
...
@@ -321,7 +324,7 @@ uint64_t Emulator::execute(uint64_t max_cycle, uint64_t max_instr) {
}
#ifdef VM_SAVABLE
static
int
snapshot_count
=
0
;
if
(
trapCode
!=
STATE_GOODTRAP
&&
t
-
lasttime_snapshot
>
6000
*
SNAPSHOT_INTERVAL
)
{
if
(
args
.
enable_snapshot
&&
trapCode
!=
STATE_GOODTRAP
&&
t
-
lasttime_snapshot
>
6000
*
SNAPSHOT_INTERVAL
)
{
// save snapshot every 60s
time_t
now
=
time
(
NULL
);
snapshot_save
(
snapshot_filename
(
now
));
...
...
src/test/csrc/emu.h
浏览文件 @
fba1b3d9
...
...
@@ -14,6 +14,7 @@ struct EmuArgs {
const
char
*
image
;
const
char
*
snapshot_path
;
bool
enable_waveform
;
bool
enable_snapshot
;
EmuArgs
()
{
seed
=
0
;
...
...
@@ -24,6 +25,7 @@ struct EmuArgs {
snapshot_path
=
NULL
;
image
=
NULL
;
enable_waveform
=
false
;
enable_snapshot
=
true
;
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录