Skip to content

Commit 77458a5

Browse files
committed
Merge branch 'tc-l3' into dev
2 parents 89e8130 + 5633a9d commit 77458a5

File tree

2 files changed

+38
-29
lines changed

2 files changed

+38
-29
lines changed

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,12 @@ To compatible with SoC test, All types of TreeCore have same memory map range:
9999
#### Configuration
100100

101101
## Usage
102-
adsfadfasdfasf
102+
This section introduces how to set up development environment and runs unit test for your own riscv processor.
103103
### Enviroment Setup
104104
> NOTE: All of the components and tools are installed under linux operation system. To gurantee the compatibility and stability, I strongly recommend using `ubuntu 20.04 LTS`. `ubuntu 18.04` and `ubuntu 16.04` is not supported official.
105105
106106
First, you need to install verilator, mill and dependency libraries:
107107
```bash
108-
$ su -
109108
$ cd rtl
110109
$ chmod +x scripts/install.sh
111110
$ make install
@@ -115,20 +114,20 @@ Then, download and configuare all components from the github and gitee:
115114
$ chmod +x scripts/setup.sh
116115
$ make setup
117116
```
118-
After that, you need to add the `NEMU_HOME` and `NOOP_HOME` environment variables in sh environment config file:
117+
After that, you need to add the `NEMU_HOME` and `NOOP_HOME` environment variables to your shell environment config file:
119118
```bash
120119
$ echo export NEMU_HOME=$(pwd)/dependency/NEMU >> ~/.bashrc # according to shell type your system uses
121120
$ echo export NOOP_HOME=$(pwd)/dependency >> ~/.bashrc
122-
$ exec bash
121+
$ source ~/.bashrc
123122
```
124123

125-
Becuase running the isa test don't need 8G memory, so you need to config the simulation memory size to reduce memory usage. You need to type `make menuconfig` as follow:
124+
Running the ISA test don't need 8G memory, so you can configure the `memory size` to reduce the simulation memory usage. Achieving that, you need to type `make menuconfig` as follow:
126125

127126
```bash
128127
$ cd dependency/NEMU
129128
$ make menuconfig
130129
```
131-
> NOTE: if you encount `Your display is too small to run Menuconfig!` error, you need to resize the terminal to match need as the console output: `It must be at least 19 lines by 80 columns`.
130+
> NOTE: if you encounter `Your display is too small to run Menuconfig!` error, you need to resize the terminal to match need as the console output: `It must be at least 19 lines by 80 columns`.
132131
133132
<p align="center">
134133
<img src="https://raw.githubusercontent.com/microdynamics-cpu/tree-core-cpu-res/main/nemu-build.png"/>
@@ -150,9 +149,10 @@ Usually, 256MB memory address space is enough for simulation. You need to switch
150149
Last, remember to type `Save` button in bottom menu to save the `.config` file. Then, type `Exit` to exit the menuconfig.
151150

152151
### Compile runtime libraries
153-
If you already run above commands correctly, you need to compile runtime libraries as follow:
152+
If you already run above commands correctly, you can compile runtime libraries as follow:
154153

155154
```bash
155+
$ cd ../../
156156
$ make nemuBuild
157157
$ make dramsim3Build
158158
```
@@ -164,22 +164,42 @@ $ make riscvTestBuild
164164
$ make cpuTestBuild
165165
$ make amTestBuild
166166
```
167-
> NOTE: you need to enough memory to compile the
167+
> NOTE: you need to enough memory to compile the application binaries.
168168
169169
### Recursive test
170-
or after you modify the processor design, you need to run recursive test to gurantee the
170+
After you modify the processor design, you need to run recursive unit test to gurantee the modification is correct.
171+
171172
```bash
172173
$ make unit-tests
173174
```
174-
IMG!!!!!!!!!
175+
176+
The unit tests display the progress, testcase name, PASS or FAIL and ipc value.
177+
<p align="center">
178+
<img src="https://raw.githubusercontent.com/microdynamics-cpu/tree-core-cpu-res/main/isa-unit-test.png"/>
179+
<p align="center">
180+
<em>TreeCoreL2's unit test result</em>
181+
</p>
182+
</p>
183+
184+
First, Running unit test need to download `mill` from github. If you cannot access the github correctly, you need to type below commands to configure `mill` manually:
185+
186+
```bash
187+
$ # download '0.9.9-assembly' from https://github.com/com-lihaoyi/mill/releases/download/0.9.9/0.9.9-assembly manually.
188+
$ cp 0.9.9-assembly ~/.cache/mill/download
189+
$ mv ~/.cache/mill/download/0.9.9-assembly ~/.cache/mill/download/0.9.9 # change name
190+
$ chmod +x ~/.cache/mill/download/0.9.9
191+
```
175192

176193
### Software test
177194
```bash
178195
$ make
179196
```
180197

181198
### SoC test
182-
199+
```bash
200+
$ make socBuild
201+
$ make socTest
202+
```
183203
### Customize new core project
184204

185205
## Summary

rtl/scripts/install.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ install_verilator() {
4949
which verilator >/dev/null 2>&1 && {
5050
echo "verilator has been installed."
5151
} || {
52-
git clone https://github.com/verilator/verilator /tmp/verilator # run first time
52+
mkdir -p dependency
53+
git clone https://github.com/verilator/verilator ./dependency/verilator # run first time
5354

5455
# every time you need to build:
5556
# unsetenv VERILATOR_ROOT # For csh; ignore error if on bash
5657
unset VERILATOR_ROOT # for bash
57-
cd /tmp/verilator
58+
cd dependency/verilator
5859
git pull # make sure git repository is up-to-date
59-
git tag # see what versions exist
60+
# git tag # see what versions exist
6061
#git checkout master # use development branch (e.g. recent bug fixes)
6162
#git checkout stable # use most recent stable release
6263
git checkout v4.204 # switch to specified release version
@@ -66,14 +67,6 @@ install_verilator() {
6667
make -j `nproc` # build Verilator itself (if error, try just 'make')
6768
sudo make install
6869
}
69-
70-
# dpkg -s verilator >/dev/null 2>&1 && {
71-
# echo "verilator has been installed."
72-
# } || {
73-
# wget -O /tmp/verilator_4_204_amd64.deb https://gitee.com/oscpu/install/attach_files/817254/download/verilator_4_204_amd64.deb
74-
# sudo dpkg -i /tmp/verilator_4_204_amd64.deb
75-
# rm /tmp/verilator_4_204_amd64.deb
76-
# }
7770
}
7871

7972
install_mill() {
@@ -84,19 +77,15 @@ install_mill() {
8477
echo "mill has been installed."
8578
} || {
8679
sudo sh -c "curl -L https://github.com/com-lihaoyi/mill/releases/download/0.9.9/0.9.9 > /usr/local/bin/mill && chmod +x /usr/local/bin/mill"
87-
# sudo mkdir /usr/local/bin >/dev/null 2>&1
88-
# wget -O /tmp/mill https://gitee.com/oscpu/install/raw/master/mill
89-
# sudo chmod +x /tmp/mill
90-
# sudo mv /tmp/mill /usr/local/bin/
9180
}
9281
}
9382

9483
install_verilator
9584

96-
# install libsqlite3-dev for difftest
85+
# install for difftest
9786
install_package libsqlite3-dev
98-
# install libreadline-dev libsdl2-dev bison for NEMU
99-
install_package libreadline-dev libsdl2-dev bison
87+
# install for NEMU
88+
install_package libreadline-dev libsdl2-dev bison libncurses5-dev
10089
# install cmake for DRAMsim3
10190
install_package cmake
10291
# isntall riscv toolchain

0 commit comments

Comments
 (0)