forked from tututugege/GenSimpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (41 loc) · 1.25 KB
/
main.cpp
File metadata and controls
47 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "RISCV.h"
#include "ref.h"
#include <cstdlib>
Ref_cpu ref_cpu;
int main(int argc, char *argv[]) {
SimConfig config;
// 简易参数解析
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (arg == "--image")
config.image_file = argv[++i];
// 模式选择
else if (arg == "--mode") {
std::string m = argv[++i];
if (m == "normal")
config.mode = SimMode::NORMAL;
else if (m == "bbv")
config.mode = SimMode::GEN_BBV;
else if (m == "ckpt")
config.mode = SimMode::GEN_CHECKPOINT;
else if (m == "restore")
config.mode = SimMode::RESTORE;
}
// 路径参数
else if (arg == "--out-bbv")
config.bbv_output_file = argv[++i];
else if (arg == "--points")
config.points_file = argv[++i];
else if (arg == "--weights")
config.weights_file = argv[++i]; // 虽然 exec 没用到,但可留作校验
else if (arg == "--ckpt-dir")
config.checkpoint_dir = argv[++i];
else if (arg == "--restore-file")
config.restore_file = argv[++i];
else if (arg == "--max-insts")
config.max_insts = std::stoull(argv[++i]);
}
ref_cpu.init(0, config.image_file.c_str(), PHYSICAL_MEMORY_LENGTH);
ref_cpu.exec(config);
return 0;
}