-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathisaref.cpp
56 lines (43 loc) · 1.1 KB
/
isaref.cpp
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
48
49
50
51
52
53
54
55
56
extern "C" {
#include "acpp.h"
}
#include "ISARef.h"
#include <iostream>
#include <cstdint>
int
main(int argc, char **argv) {
acppInit(0);
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " <modelname.ac>\n";
return -1;
}
if (!acppLoad(argv[1])) {
std::cerr << "Could not open ISA input file: " << argv[1] << "\n";
std::cerr << "Parser terminated unsuccessfully.\n";
return -1;
}
if (acppRun()) {
std::cerr << "Parser terminated unsuccessfully.\n";
return -1;
}
acppUnload();
if (isa_filename == nullptr) {
std::cerr << "No ISA file defined";
}
if (!acppLoad(isa_filename)) {
std::cerr << "Could not open ISA input file: " << isa_filename << "\n";
std::cerr << "Parser terminated unsuccessfully.\n";
return -1;
}
if (acppRun()) {
std::cerr << "Parser terminated unsuccessfully for " << isa_filename
<< "\n";
}
if (wordsize == 0) {
std::cerr << "Warning: No wordsize defined. Default value is 32 bits.\n";
wordsize = 32;
}
ISARef Ref(format_ins_list, instr_list, isa_filename);
acppUnload();
return 0;
}