URL
https://opencores.org/ocsvn/minsoc/minsoc/trunk
Subversion Repositories minsoc
Compare Revisions
- This comparison shows the changes necessary to convert path
/minsoc/branches/verilator/sim
- from Rev 139 to Rev 140
- ↔ Reverse comparison
Rev 139 → Rev 140
/verilator/generate_verilator_bench
0,0 → 1,87
#!/bin/bash |
|
set -o errexit |
set -o nounset |
set -o pipefail |
set -o posix # Make command substitution subshells inherit the errexit option. |
# Otherwise, the 'command' in this example will not fail for non-zero exit codes: echo "$(command)" |
|
# Returns the number of processors + 1. Probably not the best value for make -j . |
|
get_make_j_val () |
{ |
# $1 = name of the variable name to return the value in |
|
local GET_MAKE_J_VAL_RET_VAR_NAME="$1" |
local -i GET_MAKE_J_VAL_RET_VALUE |
|
local -i GET_MAKE_J_VAL_PROCESSOR_COUNT |
|
# Environment variable NUMBER_OF_PROCESSORS is always set under Windows. |
if [ "${NUMBER_OF_PROCESSORS:-first}" == "${NUMBER_OF_PROCESSORS:-second}" ] |
then |
|
GET_MAKE_J_VAL_PROCESSOR_COUNT=$NUMBER_OF_PROCESSORS |
|
else |
|
GET_MAKE_J_VAL_PROCESSOR_COUNT="$(getconf _NPROCESSORS_ONLN)" |
|
fi |
|
if [ $GET_MAKE_J_VAL_PROCESSOR_COUNT -lt 1 ] |
then |
abort "Cannot determine the number of processors." |
fi |
|
GET_MAKE_J_VAL_RET_VALUE=$(( GET_MAKE_J_VAL_PROCESSOR_COUNT + 1 )) |
|
eval "$GET_MAKE_J_VAL_RET_VAR_NAME=\$GET_MAKE_J_VAL_RET_VALUE" |
} |
|
|
VERILATOR_OUTPUT_DIR="verilator_output" |
|
# This makes sure the filenames in all warning and error messages are absolute paths, |
# so that clicking on them in your favourite environment will always find the right file. |
CURDIR="$(pwd)" |
|
# TODO: integrate this list with MinSoC's project generator. |
declare -a INCLUDE_PATHS=( |
-I$CURDIR/../../bench/verilator |
-I$CURDIR/../../bench/verilog |
-I$CURDIR/../../bench/verilator/jtag_dpi |
-I$CURDIR/../../bench/verilator/uart_dpi |
-I$CURDIR/../../backend |
-I$CURDIR/../../rtl/verilog/or1200/rtl/verilog |
-I$CURDIR/../../rtl/verilog |
-I$CURDIR/../../rtl/verilog/adv_debug_sys/Hardware/adv_dbg_if/rtl/verilog |
-I$CURDIR/../../rtl/verilog/adv_debug_sys/Hardware/jtag/tap/rtl/verilog |
-I$CURDIR/../../rtl/verilog/uart16550/rtl/verilog |
-I$CURDIR/../../rtl/verilog/ethmac/rtl/verilog |
) |
|
TOP_LEVEL_MODULE="minsoc_bench_core" |
|
verilator \ |
-y "$CURDIR" \ |
"${INCLUDE_PATHS[@]}" \ |
--Mdir "$VERILATOR_OUTPUT_DIR" \ |
-sv --cc --exe \ |
-Wall -Wno-fatal \ |
-O3 --assert \ |
"$TOP_LEVEL_MODULE.v" \ |
$CURDIR/../../bench/verilator/jtag_dpi/jtag_dpi.cpp \ |
$CURDIR/../../bench/verilator/jtag_dpi/minsoc/verilator_main.cpp \ |
$CURDIR/../../bench/verilator/uart_dpi/uart_dpi.cpp \ |
-o "$TOP_LEVEL_MODULE.exe" |
|
pushd $VERILATOR_OUTPUT_DIR >/dev/null |
|
get_make_j_val MAKE_J_VAL |
|
export OPT="-O3 -Wall -Wwrite-strings -DDEBUG" |
|
make -f "V$TOP_LEVEL_MODULE.mk" -j "$MAKE_J_VAL" |
|
popd >/dev/null |
verilator/generate_verilator_bench
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: verilator/run_verilator_bench
===================================================================
--- verilator/run_verilator_bench (nonexistent)
+++ verilator/run_verilator_bench (revision 140)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+set -o posix # Make command substitution subshells inherit the errexit option.
+ # Otherwise, the 'command' in this example will not fail for non-zero exit codes: echo "$(command)"
+
+VERILATOR_OUTPUT_DIR="verilator_output"
+
+# A word count should always deliver the number of bytes in the hex file,
+# regardless of the number of hex bytes per line.
+FIRMWARE_SIZE_IN_BYTES="$(wc -w <"$1")"
+
+time "$VERILATOR_OUTPUT_DIR/minsoc_bench_core.exe" "+file_name=$1" +firmware_size="$FIRMWARE_SIZE_IN_BYTES"
verilator/run_verilator_bench
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property