summaryrefslogtreecommitdiff
path: root/test
blob: d70c720a193076bd184b11b6026a0a6dc281e73f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

set -eu

FILTER=()

while [[ $# != 0 ]]; do
    if [[ $1 == "-h" ]]; then
        cat <<END
Usage: ./test [options ...] [tests ...]

Options:
    -h      This help message
    -e      Show emit rows
    -f      Show fetch rows
    -i      Show instruction rows
    -m      Show rows with memory traffic
    -r      Show rows with writeback (retire)

For the filtering options: if one or more filters are set, then rows which
match any filter are shown. If no filter is set, then all rows are shown.
END
        exit
    elif [[ $1 == "-e" ]]; then
        shift
        FILTER+=("*")
    elif [[ $1 == "-f" ]]; then
        shift
        FILTER+=("F")
    elif [[ $1 == "-i" ]]; then
        shift
        FILTER+=("D")
    elif [[ $1 == "-m" ]]; then
        shift
        FILTER+=("f" "s")
    elif [[ $1 == "-r" ]]; then
        shift
        FILTER+=("W")
    else
        break
    fi
done

if [[ $# == 0 ]]; then
    for TEST in $(ls -1 tests); do
        set -- "$@" "${TEST%.hex}"
    done
fi

make

for TEST in "$@"; do
    make "build/tests/$TEST.bin"
    (
        echo "$TEST"
        ./procmodel "build/tests/$TEST.bin" | ./pt "${FILTER[@]}"
    ) | less -S
done