Add zephyr tests

This commit is contained in:
Charles Papon 2019-04-21 02:56:44 +02:00
parent 5cd74d2845
commit edde3e3011
5 changed files with 103 additions and 10 deletions

View File

@ -122,6 +122,7 @@ cd cpio
cpio -idv < ../rootfs.cpio
cd ..
make clean run IBUS=CACHED DBUS=CACHED DEBUG_PLUGIN=STD DHRYSTONE=yes SUPERVISOR=yes MMU=yes CSR=yes COMPRESSED=no MUL=yes DIV=yes LRSC=yes AMO=yes REDO=10 TRACE=no COREMARK=yes LINUX_REGRESSION=yes RUN_HEX=~/pro/riscv/zephyr/samples/synchronization/build/zephyr/zephyr.hex
*/

View File

@ -1675,12 +1675,15 @@ public:
*error = addr == 0xF00FFF60u;
}
virtual void dutPutChar(char c){}
virtual void dBusAccess(uint32_t addr,bool wr, uint32_t size,uint32_t mask, uint32_t *data, bool *error) {
if(wr){
switch(addr){
case 0xF0010000u: {
cout << (char)*data;
logTraces << (char)*data;
dutPutChar((char)*data);
break;
}
#ifdef EXTERNAL_INTERRUPT
@ -1695,6 +1698,7 @@ public:
case 0xF00FFF00u: {
cout << (char)*data;
logTraces << (char)*data;
dutPutChar((char)*data);
break;
}
#ifndef DEBUG_PLUGIN_EXTERNAL
@ -1755,6 +1759,34 @@ public:
};
class ZephyrRegression : public WorkspaceRegression{
public:
uint32_t regFileWriteRefIndex = 0;
char *target = "PROJECT EXECUTION SUCCESSFUL", *hit = target;
ZephyrRegression(string name) : WorkspaceRegression(name) {
cout << endl << endl;
}
virtual void dutPutChar(char c){
if(*hit == c) hit++; else hit = target;
if(*hit == NULL) {
cout << endl << "T=" << i <<endl;
cout << endl;
pass();
}
}
};
#ifdef IBUS_SIMPLE
class IBusSimple : public SimElement{
public:
@ -3309,6 +3341,19 @@ string freeRtosTests[] = {
};
string zephyrTests[] = {
"tests_kernel_stack_stack_api",
// "tests_kernel_mutex_mutex", //Too long
"tests_kernel_context",
// "tests_kernel_critical", //Too long
"tests_kernel_fifo_fifo_api",
"tests_kernel_mbox_mbox_usage",
"tests_kernel_mem_pool_mem_pool_threadsafe",
"tests_kernel_sleep",
"tests_kernel_timer_timer_api"
};
string riscvComplianceMain[] = {
"I-IO",
@ -3756,7 +3801,10 @@ int main(int argc, char **argv, char **env) {
}
#endif
#ifdef FREERTOS
{
#ifdef SEED
srand48(SEED);
#endif
@ -3768,14 +3816,14 @@ int main(int argc, char **argv, char **env) {
tasks.push_back([=]() { WorkspaceRegression(name + "_rv32i_O0").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32i_O0.hex")->bootAt(0x80000000u)->run(4e6*15);});
tasks.push_back([=]() { WorkspaceRegression(name + "_rv32i_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32i_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
#ifdef COMPRESSED
// tasks.push_back([=]() { Workspace(name + "_rv32ic_O0").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32ic_O0.hex")->bootAt(0x80000000u)->run(5e6*15);});
tasks.push_back([=]() { Workspace(name + "_rv32ic_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32ic_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
// tasks.push_back([=]() { WorkspaceRegression(name + "_rv32ic_O0").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32ic_O0.hex")->bootAt(0x80000000u)->run(5e6*15);});
tasks.push_back([=]() { WorkspaceRegression(name + "_rv32ic_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32ic_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
#endif
#if defined(MUL) && defined(DIV)
// #ifdef COMPRESSED
// tasks.push_back([=]() { Workspace(name + "_rv32imac_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32imac_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
// tasks.push_back([=]() { WorkspaceRegression(name + "_rv32imac_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32imac_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
// #else
tasks.push_back([=]() { Workspace(name + "_rv32im_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32im_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
tasks.push_back([=]() { WorkspaceRegression(name + "_rv32im_O3").withRiscvRef()->loadHex("../../resources/freertos/" + name + "_rv32im_O3.hex")->bootAt(0x80000000u)->run(4e6*15);});
// #endif
#endif
}
@ -3788,6 +3836,38 @@ int main(int argc, char **argv, char **env) {
queue <std::function<void()>> tasksSelected(std::deque<std::function<void()>>(tasks.begin(), tasks.end()));
multiThreadedExecute(tasksSelected);
}
#endif
#ifdef ZEPHYR
{
#ifdef SEED
srand48(SEED);
#endif
//redo(1,WorkspaceRegression("freeRTOS_demo").loadHex("../../resources/hex/freeRTOS_demo.hex")->bootAt(0x80000000u)->run(100e6);)
vector <std::function<void()>> tasks;
/*for(int redo = 0;redo < 4;redo++)*/{
for(const string &name : zephyrTests){
#ifdef COMPRESSED
tasks.push_back([=]() { ZephyrRegression(name + "_rv32ic").withRiscvRef()->loadHex("../../resources/VexRiscvRegressionData/sim/zephyr/" + name + "_rv32ic.hex")->bootAt(0x80000000u)->run(180e6);});
#else
tasks.push_back([=]() { ZephyrRegression(name + "_rv32i").withRiscvRef()->loadHex("../../resources/VexRiscvRegressionData/sim/zephyr/" + name + "_rv32i.hex")->bootAt(0x80000000u)->run(180e6);});
#endif
#if defined(MUL) && defined(DIV)
tasks.push_back([=]() { ZephyrRegression(name + "_rv32im").withRiscvRef()->loadHex("../../resources/VexRiscvRegressionData/sim/zephyr/" + name + "_rv32im.hex")->bootAt(0x80000000u)->run(180e6);});
#endif
}
}
while(tasks.size() > ZEPHYR_COUNT){
tasks.erase(tasks.begin() + (VL_RANDOM_I(32)%tasks.size()));
}
queue <std::function<void()>> tasksSelected(std::deque<std::function<void()>>(tasks.begin(), tasks.end()));
multiThreadedExecute(tasksSelected);
}
#endif
#if defined(LINUX_REGRESSION)

View File

@ -23,7 +23,8 @@ RUN_HEX=no
CUSTOM_SIMD_ADD?=no
CUSTOM_CSR?=no
DHRYSTONE=yes
FREERTOS=no
FREERTOS?=no
ZEPHYR?=no
REDO?=10
REF=no
TRACE_WITH_TIME=no
@ -241,6 +242,17 @@ ifneq ($(FREERTOS),no)
endif
endif
ifeq ($(ZEPHYR),yes)
ADDCFLAGS += -CFLAGS -DZEPHYR
ADDCFLAGS += -CFLAGS -DZEPHYR_COUNT=99999
else
ifneq ($(ZEPHYR),no)
ADDCFLAGS += -CFLAGS -DZEPHYR
ADDCFLAGS += -CFLAGS -DZEPHYR_COUNT=$(ZEPHYR)
endif
endif
all: clean run
run: compile

@ -1 +1 @@
Subproject commit 77b66d304f888369176fb9ac2f9d6302dd4d276d
Subproject commit f9dff4688dea851f41892a3f88cae8d1e513cc93

View File

@ -434,13 +434,13 @@ class MmuDimension extends VexRiscvDimension("DBus") {
trait CatchAllPosition
class CsrDimension(freertos : String) extends VexRiscvDimension("Csr") {
class CsrDimension(freertos : String, zephyr : String) extends VexRiscvDimension("Csr") {
override def randomPositionImpl(universes: Seq[ConfigUniverse], r: Random) = {
val catchAll = universes.contains(VexRiscvUniverse.CATCH_ALL)
if(catchAll){
new VexRiscvPosition("All") with CatchAllPosition{
override def applyOn(config: VexRiscvConfig): Unit = config.plugins += new CsrPlugin(CsrPluginConfig.linuxFull(0x80000020l))
override def testParam = s"FREERTOS=$freertos LINUX_REGRESSION=yes SUPERVISOR=yes"
override def testParam = s"FREERTOS=$freertos ZEPHYR=$zephyr LINUX_REGRESSION=yes SUPERVISOR=yes"
}
} else if(r.nextDouble() < 0.2){
new VexRiscvPosition("AllNoException") with CatchAllPosition{
@ -516,7 +516,7 @@ class TestIndividualFeatures extends FunSuite {
new HazardDimension,
new RegFileDimension,
new SrcDimension,
new CsrDimension("no"),//sys.env.getOrElse("VEXRISCV_REGRESSION_FREERTOS_COUNT", "4")), TODO
new CsrDimension("no", sys.env.getOrElse("VEXRISCV_REGRESSION_ZEPHYR_COUNT", "4")),//sys.env.getOrElse("VEXRISCV_REGRESSION_FREERTOS_COUNT", "4")), TODO
new DecoderDimension,
new DebugDimension,
new MmuDimension
@ -554,7 +554,7 @@ class TestIndividualFeatures extends FunSuite {
test(prefix + name + "_test") {
val debug = true
val stdCmd = (s"make clean run WITH_USER_IO=no REDO=10 TRACE=${if(debug) "yes" else "no"} TRACE_START=9999924910246l FLOW_INFO=no STOP_ON_ERROR=no DHRYSTONE=yes COREMARK=yes THREAD_COUNT=${sys.env.getOrElse("VEXRISCV_REGRESSION_THREAD_COUNT", Runtime.getRuntime().availableProcessors().toString)} ") + s" SEED=${testSeed} "
val stdCmd = (s"make clean run WITH_USER_IO=no REDO=10 TRACE=${if(debug) "yes" else "no"} TRACE_START=9999924910246l FLOW_INFO=no STOP_ON_ERROR=no DHRYSTONE=yes COREMARK=yes THREAD_COUNT=${sys.env.getOrElse("VEXRISCV_REGRESSION_THREAD_COUNT", 1)} ") + s" SEED=${testSeed} "
// val stdCmd = "make clean run REDO=40 DHRYSTONE=no STOP_ON_ERROR=yes TRACE=yess "
val testCmd = stdCmd + (positionsToApply).map(_.testParam).mkString(" ")