Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
CEP Release v3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Fiscarelli committed May 24, 2021
1 parent c777dbc commit 0eb7170
Show file tree
Hide file tree
Showing 180 changed files with 8,168 additions and 5,349 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img src="./doc/cep_logo.jpg" width="721" height="300">
</p>
<p align="center">
<img src="./doc/version3.2.jpg" width="98" height="60">
<img src="./doc/version3.3.jpg" width="98" height="60">
</p>
<p align="center">
Copyright 2021 Massachusetts Institute of Technology
Expand All @@ -25,7 +25,7 @@ For CEP v3.1+, the full LLKI has been added. This includes the Surrogate Root o

### Please check the [Release Notes](./RELEASE_NOTES.md) to understand what has changed and a list of known issues.

<br/><br/>
<br/>

<p align="center">
<img src="./doc/cep_v3.1_architecture.jpg">
Expand Down Expand Up @@ -341,7 +341,7 @@ You should see the following logo/text appear:
./+++++++++++oo+++: +oo++o++++o+o+oo+oo.- `s+++s`-
.--:---:-:-::-::` -::::::::::::::::::. :::::.
Common Evaluation Platform v3.20
Common Evaluation Platform v3.30
Copyright 2021 Massachusetts Institute of Technology
Built upon the SiFive Freedom U500 Platform using
Expand All @@ -364,7 +364,7 @@ At the command prompt, you can run the CEP diagnostics by commanding `cep_diag`.
A partial output should be similar to:

```sh
*** CEP Tag=CEPTest CEP HW VERSION = v3.20 was built on Apr 15 2021 09:22:15 ***
*** CEP Tag=CEPTest CEP HW VERSION = v3.30 was built on Apr 15 2021 09:22:15 ***
CEP FPGA Physical: cepReg/ddr3/other/sys -> Virtual=0x0000000700000000, 0x0000000800000000, 0x0000000600000000, 0x0000000c00000000 ScratchPad=0x0000002000800000
gSkipInit=0/0
gverbose=0/0
Expand Down
10 changes: 10 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,14 @@ v3.2 - (16 April 2021)
* Linux tests updated and expanded
* New tests added to cosim focused on LLKI and Scratchpad RAM

v3.3 - (19 May 2021)
* Increased capacity for LLKI key size including larger KeyRAM (2048 64-bit words)
* Added Cosim JTAG/OpenOCD
* Stability fixes for cep_diag under Linux
* Virtual Address TLB test suite is added to regression (not 100% complete)
* Expanded cep_diag
* New simulation ONLY interrupt tests for CLINT and PLIC modules (on going)
* Re-capture vectors for unit sim due to changes in LLKI key size
* Bootrom size is increased to 32K bytes (8kx32) to accomodate new built-in test (execute codes out of bootrom without main memory)

#### Return to the root CEP [README](./README.md)
2 changes: 1 addition & 1 deletion cosim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SIM_DIR = ${DUT_TOP_DIR}/${COSIM_NAME}
TEST_GROUP = bareMetalTests \
bfmTests \
isaTests \

vBareTest \

runAll:
make cleanAll
Expand Down
53 changes: 50 additions & 3 deletions cosim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Several environments are supported:
* Linux Mode (tests run on xilinx VC707 development card). Build and installation instructions can be found in: [../README.md](../README.md)
* Benchmarking on Linux (TBA)
* Cycle-accurate and translation-level accurate unit level simulations.
* JTAG support to inferace with Openocd tool (via bitbang adapter) for Open On-Chip debugger (version 3.3 or later)

## Benefits: ##

Expand Down Expand Up @@ -53,7 +54,7 @@ Assuming you already have the CEP-master (version 2.0 or later) sandbox pulled f
isaTests/rv64mi-p-access
isaTests/rv64ud-p-ldst
```
NOTE: All tests (including the above failed tests) are now passing with version 2.8 or later under Linux machine..
**NOTE**: All tests (including the above failed tests) are now passing with version 2.8 or later under Linux machine..

## Verify environment settings and tools: ##

Expand Down Expand Up @@ -330,10 +331,11 @@ During simulation, you will notice each of the core will print out its PC (Progr

Also, there are riscv_wrapper.dump (created from objdump to help track the PC), riscv_wrapper.elf (to preload to main memory) and riscv_wrapper.hex files are created by Make under each test directory.

**Note**: for version 3.3 or later, directory **.../cosim/drivers/bootbare** is removed and the official bootrom generation Makefile is adjusted to also produce the bootrom image for simulation.

## Building ISA tests for simulation ##

As of version 2.7 or later, ISA (Instruction-Set-Architecture) tests are added to simulation to improve overall chip coverages.
For version 2.7 or later, ISA (Instruction-Set-Architecture) tests are added to simulation to improve overall chip coverages.

**All ISA tests are re-used from https://github.com/riscv/riscv-tests.git repository**.

Expand Down Expand Up @@ -401,7 +403,7 @@ And now you are ready to do the build as follows
cd <CEP_ROOT>/software/riscv-tests
autoconf
./configure
make isa <-- only need to make ISA, without argument benchmark tests will be included (benchmarks have NOT be ported)
make isa <-- only need to make ISA, without argument benchmark tests will also be included (benchmarks have NOT been ported)
```

The make command above will compile **mostly** assembly tests in the directory **isa** under it. These are the ones will be re-used to run in our simulation. **NOTE**: only RV64*-p/v-* tests are used since the cores are 64-bit cores.
Expand All @@ -419,6 +421,43 @@ Next step is to port and prepare those ISA tests above for simulation.

And we are now done for this ISA porting.

## About JTAG/Debug port testing and Openocd ##

To test JTAG port in simulation, openocd tool is needed. The Makefile will check for the present of such tool before any jtag related test is allowed to run.

This JTAG port is connected to the CEP's DTM (DebugTransportModule). It is used to facilitate debugging via GDB. Openocd acts as transport layer between the internal DTM and GDB.

A short description of what openocd is about:

```
OpenOCD provides on-chip programming and debugging support with a
layered architecture of JTAG interface and TAP support including:
- (X)SVF playback to facilitate automated boundary scan and FPGA/CPLD
programming;
- debug target support (e.g. ARM, MIPS): single-stepping,
breakpoints/watchpoints, gprof profiling, etc;
- flash chip drivers (e.g. CFI, NAND, internal flash);
- embedded TCL interpreter for easy scripting.
```

To support simulation, DPI & remote-bitbang must be enable when building openocd tool.

Download openocd via this link: **https://github.com/riscv/riscv-openocd**

And follow the README file in there to build the tool or for more details how to use the tool. Instructions are cut/paste below for quick reference:

```
To build OpenOCD, use the following sequence of commands:
./bootstrap (when building from the git repository)
./configure -enable-remote-bitbang --enable-jtag_dpi [options]
make
sudo make install
```

To see how this works, run this test: **<...>/cosim/isaTests/dtmTest**

## How to add your new test for regression ##

Open ../Makefile (one level up where your test directory is located).
Expand Down Expand Up @@ -494,3 +533,11 @@ make CADENCE=1 mergeAll <-- merge all coverage data and report in HTLM format
* By default, under each test directory, one file will be created **if and only if** it is not yet there: **vsim.do**. It is used when **vsim** command is called to control the wave capturing.. If there is a need to override, users are free to modify and change it to anyway to fit the needs. Makefile will not overwrite it as long as it is there.

* Under bare metal mode, some of main memory locations are used as mailbox to help RISCV core tracking and printing. See .**../cosim/dvt/cep_adrMap.incl** file. **NOTE**: there is also a file under .../cosim/include/cep_adrMap.h This file is auto-generated from the cep_adrMap.incl mentioned. Therefore, any modification should be made to the cep_adrMap.incl file.

* Below is the short-cut to quickly build cep_diag application for Linux:

```
cd <...>/cosim/drivers/linux
make buildMe
```

3 changes: 3 additions & 0 deletions cosim/bareMetalTests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ BARE_TEST_LIST = \
fragmemter \
csrTest \
srotMemTest \
bootViaScratch \
clintIntr \
plicPrioIntr \


TESTINFO_LIST := $(sort $(foreach t,${TALUS_TEST_LIST},${BLD_DIR}/${t}/testInfo.txt))
Expand Down
32 changes: 32 additions & 0 deletions cosim/bareMetalTests/bootViaScratch/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#//************************************************************************
#// Copyright 2021 Massachusetts Institute of Technology
#// SPDX short identifier: BSD-2-Clause
#//
#// File Name:
#// Program: Common Evaluation Platform (CEP)
#// Description:
#// Notes:
#//
#//************************************************************************
#
#
#
COSIM_NAME = $(shell cd ../..; basename `pwd`)
DUT_TOP_DIR = $(shell cd ../../..; pwd | ./${COSIM_NAME}/bin/strip_net.pl )
BLD_DIR = $(shell cd ..; pwd | ../bin/strip_net.pl )
TEST_SUITE = $(shell basename ${BLD_DIR})
TEST_DIR = $(shell cd .; pwd | ../../bin/strip_net.pl )
TEST_NAME = $(shell basename `pwd`)
SIM_DIR = ${DUT_TOP_DIR}/${COSIM_NAME}


#
# Top target!!!
#
all: .vrun_flag riscv_wrapper.elf

#
# override anything here before calling the common file
#
include ${BLD_DIR}/common.make

126 changes: 126 additions & 0 deletions cosim/bareMetalTests/bootViaScratch/c_dispatch.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
//************************************************************************
// Copyright 2021 Massachusetts Institute of Technology
// SPDX short identifier: BSD-2-Clause
//
// File Name:
// Program: Common Evaluation Platform (CEP)
// Description:
// Notes:
//
//************************************************************************
#include <unistd.h>
#include "v2c_cmds.h"
#include "access.h"
#include "c_dispatch.h"
#include "c_module.h"
#include "cep_apis.h"
#include "cep_adrMap.h"
#include "simPio.h"
/*
* main
*/
int main(int argc, char *argv[])
{

/* ===================================== */
/* SETUP SECTION FOR SIMULATION */
/* ===================================== */
unsigned long seed;
sscanf(argv[1],"0x%x",&seed);
printf("Seed = 0x%x\n",seed);
int errCnt = 0;
int verbose = 0x1f;

/* ===================================== */
/* spawn all the paralle threads */
/* ===================================== */
int activeSlot=0; // only 1 board
//
// ============================
// fork all the tests here
// ============================
//
shPthread thr;
//
// max number of cores not include the system thread
//
int maxHost = MAX_CORES; // number of cores/threads
//
// each bit is to turn on the given core (bit0 = core0, bit1=core1, etc..)
//
long unsigned int mask = 0xF;
//
// Set the active CPU mask before spawn the threads...
//
thr.SetActiveMask(mask);
//
// c_module is the threead to run
//
for (int i=0;i<maxHost;i++) {
if ((long unsigned int)(1 << i) & mask) {
thr.ForkAThread(activeSlot,i,verbose, seed * (1+i), c_module);
}
}
//
// lastly: Added system thread always
//
thr.AddSysThread(SYSTEM_SLOT_ID,SYSTEM_CPU_ID);
//
// ============================
// Turn on the wave here
// ============================
//
int cycle2start=0;
int cycle2capture=-1; // til end
int wave_enable=1;
#ifndef NOWAVE
dump_wave(cycle2start, cycle2capture, wave_enable);
#endif
//
// Enable main memory logging
//
//DUT_WRITE_DVT(DVTF_ENABLE_MAIN_MEM_LOGGING, DVTF_ENABLE_MAIN_MEM_LOGGING, 1);
//
// wait for calibration??
//
#if 1
//int calibDone = calibrate_ddr3(50);
int backdoor_on = 1;
int verify = 0;
int srcOffset = 0x1000;
int destOffset = 0;
errCnt += load_mainMemory((char *)"./riscv_wrapper.elf", ddr3_base_adr,srcOffset, destOffset, backdoor_on, verify);
#endif
DUT_WRITE_DVT(DVTF_DISABLE_MAIN_MEM_LOGGING, DVTF_DISABLE_MAIN_MEM_LOGGING, 1);
//
// log the write only
DUT_WRITE_DVT(DVTF_ENABLE_MAIN_MEMWR_LOGGING, DVTF_ENABLE_MAIN_MEMWR_LOGGING, 1);
//
// ============================
// wait until all the threads are done
// ============================
//
int Done = 0;
while (!Done) {
Done = thr.AllThreadDone();
sleep(2);
}
//
toggleDmiReset();
//

/* ===================================== */
/* END-OF-TEST CHECKING */
/* ===================================== */
errCnt += thr.GetErrorCount();
if (errCnt != 0) {
LOGE("======== TEST FAIL ========== %x\n",errCnt);
} else {
LOGI("%s ======== TEST PASS ========== \n",__FUNCTION__);
}
//
// shutdown HW side
// dont call this DUT_SetInActiveStatus is used
thr.Shutdown();
return(errCnt);
}
23 changes: 23 additions & 0 deletions cosim/bareMetalTests/bootViaScratch/c_dispatch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//************************************************************************
// Copyright 2021 Massachusetts Institute of Technology
// SPDX short identifier: BSD-2-Clause
//
// File Name:
// Program: Common Evaluation Platform (CEP)
// Description:
// Notes:
//
//************************************************************************
#ifndef __C_DISPATCH_H
#define __C_DISPATCH_H


// Dispatch setup
#ifdef LONGTEST
#define MAX_LOOP 50
#else
#define MAX_LOOP 5
#endif

#endif

Loading

0 comments on commit 0eb7170

Please sign in to comment.