43
43
sudo apt-get install -y python3 python3-pip python3-venv
44
44
sudo apt-get install -y gcc git autoconf automake libtool curl make unzip
45
45
sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev pkg-config
46
+ sudo apt-get install device-tree-compiler libboost-regex-dev libboost-system-dev
46
47
pip3 install git+https://github.com/riscv/riscof.git
47
48
48
49
- name : Build RISCV-GNU Toolchain (${{ matrix.xlen }} bit)
@@ -61,27 +62,73 @@ jobs:
61
62
run : |
62
63
cd riscv-ctg
63
64
pip3 install --editable .
64
-
65
+
66
+ - name : Get Latest Spike Commit
67
+ run : |
68
+ SPIKE_HASH=$(git ls-remote https://github.com/riscv/riscv-isa-sim.git HEAD | awk '{ print $1}')
69
+ echo "SPIKE_HASH=$SPIKE_HASH" >> "$GITHUB_ENV"
70
+
71
+ - name : Restore cached Spike
72
+ id : cache-spike-restore
73
+ uses : actions/cache/restore@v4
74
+ with :
75
+ path : ${{ github.workspace }}/spike
76
+ key : spike-${{ env.SPIKE_HASH }}-RV${{ matrix.xlen }}
77
+
65
78
- name : Install Spike
79
+ if : steps.cache-spike-restore.outputs.cache-hit != 'true'
66
80
run : |
67
81
git clone https://github.com/riscv/riscv-isa-sim.git
68
- sudo apt-get install device-tree-compiler libboost-regex-dev libboost-system-dev
69
82
cd riscv-isa-sim
70
83
mkdir build
71
84
cd build
72
- ../configure --prefix=$GITHUB_WORKSPACE/riscv64
85
+ ../configure --prefix=$GITHUB_WORKSPACE/spike
73
86
make -j$(nproc)
74
- sudo make install
75
- echo $GITHUB_WORKSPACE/riscv64/bin >> $GITHUB_PATH
87
+ make install
88
+
89
+ - name : Save cached Spike
90
+ if : steps.cache-spike-restore.outputs.cache-hit != 'true'
91
+ id : cache-spike-save
92
+ uses : actions/cache/save@v4
93
+ with :
94
+ path : ${{ github.workspace }}/spike
95
+ key : ${{ steps.cache-spike-restore.outputs.cache-primary-key }}
96
+
97
+ - name : Get Latest Sail Commit
98
+ run : |
99
+ SAIL_HASH=$(git ls-remote https://github.com/riscv/sail-riscv.git HEAD | awk '{ print $1}')
100
+ echo "SAIL_HASH=$SAIL_HASH" >> "$GITHUB_ENV"
101
+
102
+ - name : Restore cached Sail
103
+ id : cache-sail-restore
104
+ uses : actions/cache/restore@v4
105
+ with :
106
+ path : ${{ github.workspace }}/sail
107
+ key : sail-${{ env.SAIL_HASH }}-RV${{ matrix.xlen }}
76
108
77
109
- name : Install Sail
110
+ if : steps.cache-sail-restore.outputs.cache-hit != 'true'
78
111
run : |
79
112
sudo mkdir -p /usr/local
80
113
curl --location https://github.com/rems-project/sail/releases/download/0.18-linux-binary/sail.tar.gz | sudo tar xvz --directory=/usr/local --strip-components=1
81
114
git clone https://github.com/riscv/sail-riscv.git
82
115
cd sail-riscv
83
116
ARCH=RV${{ matrix.xlen }} make
84
- echo $PWD/c_emulator >> $GITHUB_PATH
117
+ mkdir -p $GITHUB_WORKSPACE/sail
118
+ mv c_emulator/riscv_sim_RV${{ matrix.xlen }} $GITHUB_WORKSPACE/sail/riscv_sim_RV${{ matrix.xlen }}
119
+
120
+ - name : Save cached Sail
121
+ if : steps.cache-sail-restore.outputs.cache-hit != 'true'
122
+ id : cache-sail-save
123
+ uses : actions/cache/save@v4
124
+ with :
125
+ path : ${{ github.workspace }}/sail
126
+ key : ${{ steps.cache-sail-restore.outputs.cache-primary-key }}
127
+
128
+ - name : Set PATH
129
+ run : |
130
+ echo $GITHUB_WORKSPACE/spike/bin >> $GITHUB_PATH
131
+ echo $GITHUB_WORKSPACE/sail >> $GITHUB_PATH
85
132
86
133
- name : Config and run riscof for RV${{ matrix.xlen }}
87
134
run : |
0 commit comments