-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.cpp
More file actions
60 lines (51 loc) · 1.55 KB
/
run.cpp
File metadata and controls
60 lines (51 loc) · 1.55 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
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#include <stdlib.h>
#include <HostLink.h>
const char* tests[] = {
"fldst", "fadd", "fdiv", "fcmp",
"fcvt_w", "fcvt", "fmove",
"addi", "beq", "bne", "lh",
"mulhsu", "sb", "slti", "sra",
"xori", "add", "bge", "jalr",
"lhu", "mulhu", "sh", "sltiu",
"srli", "xor", "andi", "bgeu",
"jal", "lui", "mul", "simple",
"slt", "srl", "and", "blt",
"lb", "lw", "ori", "slli",
"sltu", "sub", "auipc", "bltu",
"lbu", "mulh", "or", "sll",
"srai", "sw", NULL
};
int runOne(HostLink* hostLink, const char* test)
{
// Compute code filename
char codeFilename[1024];
snprintf(codeFilename, sizeof(codeFilename), "%s.code.v", test);
// Compute data filename
char dataFilename[1024];
snprintf(dataFilename, sizeof(dataFilename), "%s.data.v", test);
// Boot and run test on thread 0 only
hostLink->loadInstrsOntoCore(codeFilename, 0, 0, 0);
hostLink->loadDataViaCore(dataFilename, 0, 0, 0);
hostLink->startOne(0, 0, 0, 1);
hostLink->goOne(0, 0, 0);
// Get test result
uint32_t coreId, threadId, boardX, boardY;
uint8_t byte;
hostLink->debugLink->get(&boardX, &boardY, &coreId, &threadId, &byte);
return byte;
}
int main()
{
HostLink hostLink;
for (int i = 0; ; i++) {
if (tests[i] == NULL) break;
printf("%s\t", tests[i]);
int result = runOne(&hostLink, tests[i]);
if (result&1)
printf("PASSED\n");
else
printf("FAILED #%i\n", result>>1);
}
return 0;
}