Add self checked dhrystone test
This commit is contained in:
parent
31db6511dc
commit
5e9da0f27a
|
@ -35,4 +35,7 @@ bin/
|
|||
*.vcd
|
||||
!tester/src/test/resources/*.vhd
|
||||
obj_dir
|
||||
*.logTrace
|
||||
*.memTrace
|
||||
*.regTrace
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class DecoderSimplePlugin extends Plugin[VexRiscv] with DecoderService {
|
|||
offset = 0
|
||||
stageables.foreach(e => {
|
||||
insert(e).assignFromBits(decodedBits(offset, e.dataType.getBitsWidth bits))
|
||||
// insert(e).assignFromBits(RegNext(decodedBits(offset, e.dataType.getBitsWidth bits)))
|
||||
// insert(e).assignFromBits(RegNext(decodedBits(offset, e.dataType.getBitsWidth bits)))
|
||||
offset += e.dataType.getBitsWidth
|
||||
})
|
||||
}
|
||||
|
|
|
@ -40,8 +40,9 @@ object TopLevel {
|
|||
new FullBarrielShifterPlugin,
|
||||
// new LightShifterPlugin,
|
||||
new DBusSimplePlugin,
|
||||
// new HazardSimplePlugin(false, true, false, true),
|
||||
new HazardSimplePlugin(true, true, true, true),
|
||||
new HazardSimplePlugin(false, true, false, true),
|
||||
// new HazardSimplePlugin(true, true, true, true),
|
||||
// new HazardSimplePlugin(false, false, false, false),
|
||||
new MulPlugin,
|
||||
new DivPlugin,
|
||||
new NoPredictionBranchPlugin(false)
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
Dhrystone Benchmark, Version 2.1 (Language: C)
|
||||
|
||||
Program compiled without 'register' attribute
|
||||
|
||||
Please give the number of runs through the benchmark:
|
||||
Execution starts, 200 runs through Dhrystone
|
||||
Execution ends
|
||||
|
||||
Final values of the variables used in the benchmark:
|
||||
|
||||
Int_Glob: 5
|
||||
should be: 5
|
||||
Bool_Glob: 1
|
||||
should be: 1
|
||||
Ch_1_Glob: A
|
||||
should be: A
|
||||
Ch_2_Glob: B
|
||||
should be: B
|
||||
Arr_1_Glob[8]: 7
|
||||
should be: 7
|
||||
Arr_2_Glob[8][7]: 210
|
||||
should be: Number_Of_Runs + 10
|
||||
Ptr_Glob->
|
||||
Ptr_Comp: 1073807824
|
||||
should be: (implementation-dependent)
|
||||
Discr: 0
|
||||
should be: 0
|
||||
Enum_Comp: 2
|
||||
should be: 2
|
||||
Int_Comp: 17
|
||||
should be: 17
|
||||
Str_Comp: DHRYSTONE PROGRAM, SOME STRING
|
||||
should be: DHRYSTONE PROGRAM, SOME STRING
|
||||
Next_Ptr_Glob->
|
||||
Ptr_Comp: 1073807824
|
||||
should be: (implementation-dependent), same as above
|
||||
Discr: 0
|
||||
should be: 0
|
||||
Enum_Comp: 1
|
||||
should be: 1
|
||||
Int_Comp: 18
|
||||
should be: 18
|
||||
Str_Comp: DHRYSTONE PROGRAM, SOME STRING
|
||||
should be: DHRYSTONE PROGRAM, SOME STRING
|
||||
Int_1_Loc: 5
|
||||
should be: 5
|
||||
Int_2_Loc: 13
|
||||
should be: 13
|
||||
Int_3_Loc: 7
|
||||
should be: 7
|
||||
Enum_Loc: 1
|
||||
should be: 1
|
||||
Str_1_Loc: DHRYSTONE PROGRAM, 1'ST STRING
|
||||
should be: DHRYSTONE PROGRAM, 1'ST STRING
|
||||
Str_2_Loc: DHRYSTONE PROGRAM, 2'ND STRING
|
||||
should be: DHRYSTONE PROGRAM, 2'ND STRING
|
|
@ -140,6 +140,7 @@ public:
|
|||
|
||||
ofstream regTraces;
|
||||
ofstream memTraces;
|
||||
ofstream logTraces;
|
||||
|
||||
|
||||
Workspace(string name){
|
||||
|
@ -148,6 +149,7 @@ public:
|
|||
top = new VVexRiscv;
|
||||
regTraces.open (name + ".regTrace");
|
||||
memTraces.open (name + ".memTrace");
|
||||
logTraces.open (name + ".logTrace");
|
||||
}
|
||||
|
||||
virtual ~Workspace(){
|
||||
|
@ -161,8 +163,8 @@ public:
|
|||
|
||||
virtual void postReset() {}
|
||||
virtual void checks(){}
|
||||
void pass(){ throw success();}
|
||||
void fail(){ throw std::exception();}
|
||||
virtual void pass(){ throw success();}
|
||||
virtual void fail(){ throw std::exception();}
|
||||
|
||||
Workspace* run(uint32_t timeout = 5000){
|
||||
// cout << "Start " << name << endl;
|
||||
|
@ -223,10 +225,13 @@ public:
|
|||
}
|
||||
|
||||
switch(addr){
|
||||
case 0xF00FFF00u:
|
||||
case 0xF00FFF00u: {
|
||||
cout << mem[0xF00FFF00u];
|
||||
logTraces << (char)mem[0xF00FFF00u];
|
||||
break;
|
||||
}
|
||||
case 0xF00FFF20u: pass(); break;
|
||||
}
|
||||
}else{
|
||||
for(uint32_t b = 0;b < (1 << top->dCmd_payload_size);b++){
|
||||
uint32_t offset = (addr+b)&0x3;
|
||||
|
@ -258,8 +263,8 @@ public:
|
|||
|
||||
top->eval();
|
||||
if(top->clk == 0){
|
||||
top->iCmd_ready = VL_RANDOM_I(1) | 1;
|
||||
top->dCmd_ready = VL_RANDOM_I(1) | 1;
|
||||
top->iCmd_ready = VL_RANDOM_I(1) | 0;
|
||||
top->dCmd_ready = VL_RANDOM_I(1) | 0;
|
||||
if(top->VexRiscv->writeBack_RegFilePlugin_regFileWrite_valid == 1 && top->VexRiscv->writeBack_RegFilePlugin_regFileWrite_payload_address != 0){
|
||||
regTraces << currentTime << " : reg[" << (uint32_t)top->VexRiscv->writeBack_RegFilePlugin_regFileWrite_payload_address << "] = " << top->VexRiscv->writeBack_RegFilePlugin_regFileWrite_payload_data << endl;
|
||||
}
|
||||
|
@ -365,6 +370,29 @@ public:
|
|||
virtual void checks(){
|
||||
|
||||
}
|
||||
|
||||
virtual void pass(){
|
||||
FILE *refFile = fopen("Dhrystone.logRef", "r");
|
||||
fseek(refFile, 0, SEEK_END);
|
||||
uint32_t refSize = ftell(refFile);
|
||||
fseek(refFile, 0, SEEK_SET);
|
||||
char* ref = new char[refSize];
|
||||
fread(ref, 1, refSize, refFile);
|
||||
|
||||
|
||||
logTraces.flush();
|
||||
FILE *logFile = fopen("Dhrystone.logTrace", "r");
|
||||
fseek(logFile, 0, SEEK_END);
|
||||
uint32_t logSize = ftell(logFile);
|
||||
fseek(logFile, 0, SEEK_SET);
|
||||
char* log = new char[logSize];
|
||||
fread(log, 1, logSize, logFile);
|
||||
|
||||
if(refSize > logSize || memcmp(log,ref,refSize))
|
||||
fail();
|
||||
else
|
||||
Workspace::pass();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -464,7 +492,7 @@ int main(int argc, char **argv, char **env) {
|
|||
RiscvTest(name).run();
|
||||
}
|
||||
#endif
|
||||
Dhrystone().run(0.3e6);
|
||||
Dhrystone().run(0.8e6);
|
||||
}
|
||||
|
||||
uint64_t duration = timer_end(startedAt);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue