Skip to content

Commit

Permalink
merge master into vega
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasquale Davide Schiavone committed Jun 25, 2019
2 parents a303717 + b24b102 commit e5940cf
Show file tree
Hide file tree
Showing 22 changed files with 345 additions and 663 deletions.
1 change: 0 additions & 1 deletion Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ sources:
- rtl/riscv_compressed_decoder.sv
- rtl/riscv_controller.sv
- rtl/riscv_cs_registers.sv
- rtl/riscv_debug_unit.sv
- rtl/riscv_decoder.sv
- rtl/riscv_int_controller.sv
- rtl/riscv_ex_stage.sv
Expand Down
64 changes: 64 additions & 0 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
node ('centos7' + ' && !vm1-centos7'){
try {
stage('Preparation') {
withEnv(['PATH+WHATEVER=/home/balasr/.local/bin:/home/balasr/.riscv/bin']) {
checkout scm
sh 'pip install --user junit-xml'
sh 'git submodule update --init --recursive'
dir("tb/core") {
sh 'make fpnew/src/fpnew_pkg.sv'
}
}
}
stage('Build Firmware') {
withEnv(['PATH+WHATEVER=/home/balasr/.local/bin:/home/balasr/.riscv/bin',
'RISCV=/home/balasr/.riscv']) {
dir("tb/core") {
sh "make firmware/firmware.hex"
}
dir("tb/dm") {
sh "make prog/test.hex"
}
}
}
stage('Build RTL') {
dir("tb/core") {
sh "make vsim-all"
}
dir("tb/dm") {
sh "make vsim-all"
}
}

stage('Run Tests') {
dir("tb/core") {
sh "make firmware-vsim-run 2>&1 | tee test.log"
}
sh "./ci/rv32tests-to-junit.py -i tb/core/test.log -o rv32_test_report.xml"

withEnv(['PATH+WHATEVER=/home/balasr/.local/bin:/home/balasr/.riscv/bin',
'RISCV=/home/balasr/.riscv']) {
sh "./ci/run-openocd-compliance.sh"
sh "./ci/openocd-to-junit.py -i openocd.log -o openocd_test_report.xml"

}
}

} catch (e) {
currentBuild.result = "FAILED"
echo "SENDING E-MAIL"
notifyFailed()
throw e
} finally {
junit '*.xml'
}
}

def notifyFailed() {
emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
3 changes: 0 additions & 3 deletions ci/dummy.csh

This file was deleted.

2 changes: 1 addition & 1 deletion ci/get-openocd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fi

if ! [ -e $RISCV/bin/openocd ]; then
if ! [ -e $RISCV/riscv-openocd ]; then
git clone --depth 1 https://github.com/riscv/riscv-openocd.git
git clone https://github.com/riscv/riscv-openocd.git
fi
check_version automake 1.14 "OpenOCD build"
check_version autoconf 2.64 "OpenOCD build"
Expand Down
62 changes: 62 additions & 0 deletions ci/openocd-to-junit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env python3
import sys, getopt
from junit_xml import *


def main(argv):
inputfile = ''
outputfile = ''

try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.GetoptError:
print ('openocd-to-junit.py -i <inputfile> -o <outputfile>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('openocd-to-junit.py -i <inputfile> -o <outputfile>')
sys.exit()
elif opt in ("-i", "--ifile"):
inputfile = arg
elif opt in ("-o", "--ofile"):
outputfile = arg

test_strings = defaultdict(list)
test_timestamps = {}
current_testname = ''

test_cases = []
current_test_case = None

ocd_stdout = ''

with open(inputfile, 'r') as infile:
for line in infile:
if 'Info' in line and 'riscv013_test_compliance()' in line:
print(line.split(' '))
current_testname = ' '.join(line.split(' ')[7:])
test_strings[current_testname].append(line)
test_timestamps[current_testname] = line.split(' ')[3]

ocd_stdout += line

for k,v in test_strings.items():
current_test_case = TestCase(k, stdout=''.join(v),
timestamp=test_timestamps[k])
error_msg = ""
for line in v:
if 'FAILED' in line:
error_msg += line;

if error_msg:
current_test_case.add_error_info(error_msg)

test_cases.append(current_test_case)

ts = TestSuite("openocd-compliance", test_cases, stdout=ocd_stdout)
# pretty printing is on by default but can be disabled using prettyprint=False
with open(outputfile, 'w') as outfile:
TestSuite.to_file(outfile, [ts])

if __name__ == "__main__":
main(sys.argv[1:])
46 changes: 30 additions & 16 deletions ci/run-openocd-compliance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,44 @@ set -e

ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)

vsim_out=$(mktemp)
openocd_out=$(mktemp)
if [ -z "${RISCV}" ]
then
echo "RISCV is empty"
exit 1
fi

function clean_up {
rm ${vsim_out}
rm ${openocd_out}
kill 0
function cleanup {
echo "cleaning up processes and tmp files"
sleep 2
echo "vsim pid is:${vsim_pid} pgid:${vsim_pgid}"
if ps -p "${vsim_pid}" > /dev/null
then
echo "vsim pid exists, killing it"
kill -- -"${vsim_pgid}"
fi
rm "${vsim_out}"
}

# kill all children if this script exits
trap "exit" INT TERM
trap clean_up EXIT
trap cleanup EXIT

vsim_out=$(mktemp)
openocd_out=openocd.log

make -C ${ROOT}/tb/dm clean
make -C ${ROOT}/tb/dm tb-all
make -C ${ROOT}/tb/dm prog/test.hex
make -C ${ROOT}/tb/dm prog-run &> ${vsim_out}&
make -C "${ROOT}"/tb/dm vsim-run &> "${vsim_out}"&
# record vsim pid/pgid to kill it if it survives this script
vsim_pid=$!
vsim_pgid=$(ps -o pgid= ${vsim_pid} | grep -o [0-9]*)

( tail -f -n0 ${vsim_out} & ) | grep -m 1 "Listening on port"
# block until we get "Listening on port" so that we are safe to connect openocd
coproc grep -m 1 "Listening on port"
tail -f -n0 "${vsim_out}" --pid "$COPROC_PID" >&"${COPROC[1]}"

echo "Starting openocd"
${RISCV}/bin/openocd -f ${ROOT}/tb/dm/pulpissimo_compliance_test.cfg |& tee ${openocd_out}
"${RISCV}"/bin/openocd -f "${ROOT}"/tb/dm/pulpissimo_compliance_test.cfg |& tee "${openocd_out}"


if grep -q "ALL TESTS PASSED" ${openocd_out}; then
if grep -q "ALL TESTS PASSED" "${openocd_out}"; then
exit 0
fi
exit 1

58 changes: 58 additions & 0 deletions ci/rv32tests-to-junit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3
import sys, getopt
from junit_xml import *


def main(argv):
inputfile = ''
outputfile = ''

try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.GetoptError:
print ('rv32tests-to-junit.py -i <inputfile> -o <outputfile>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('rv32tests-to-junit.py -i <inputfile> -o <outputfile>')
sys.exit()
elif opt in ("-i", "--ifile"):
inputfile = arg
elif opt in ("-o", "--ofile"):
outputfile = arg

test_strings = defaultdict(list)
current_testname = ''

test_cases = []
current_test_case = None

with open(inputfile, 'r') as infile:
for line in infile:
if 'Test Begin' in line:
current_testname = line.split('#')[1]
if 'Test End' in line:
current_testname = ""
if current_testname != "":
test_strings[current_testname].append(line)

for k,v in test_strings.items():
#test_cases.append(TestCase('Test1', stdout=''.join(v)))
current_test_case = TestCase(k, stdout=''.join(v))
error_msg = ""
for line in v:
if 'Assertion violation' in line:
error_msg += line;

if error_msg:
current_test_case.add_error_info(error_msg)

test_cases.append(current_test_case)

ts = TestSuite("riscv-compliance", test_cases)
# pretty printing is on by default but can be disabled using prettyprint=False
with open(outputfile, 'w') as outfile:
TestSuite.to_file(outfile, [ts])

if __name__ == "__main__":
main(sys.argv[1:])
Binary file modified doc/user_manual.doc
Binary file not shown.
4 changes: 2 additions & 2 deletions rtl/include/riscv_defines.sv
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ parameter bit C_RVD = 1'b0; // Is D extension enabled - NOT SUPPORTED CURRENTLY

// Transprecision floating-point extensions configuration
parameter bit C_XF16 = 1'b0; // Is half-precision float extension (Xf16) enabled
parameter bit C_XF16ALT = 1'b1; // Is alternative half-precision float extension (Xf16alt) enabled
parameter bit C_XF16ALT = 1'b0; // Is alternative half-precision float extension (Xf16alt) enabled
parameter bit C_XF8 = 1'b0; // Is quarter-precision float extension (Xf8) enabled
parameter bit C_XFVEC = 1'b1; // Is vectorial float extension (Xfvec) enabled
parameter bit C_XFVEC = 1'b0; // Is vectorial float extension (Xfvec) enabled

// FPnew configuration
parameter C_FPNEW_OPBITS = fpnew_pkg::OP_BITS;
Expand Down
Loading

0 comments on commit e5940cf

Please sign in to comment.