Skip to content

Commit 80b48c5

Browse files
committed
Merge branch 'tc-l2' into dev
2 parents 9ed6060 + 495b6f5 commit 80b48c5

File tree

7 files changed

+237
-120
lines changed

7 files changed

+237
-120
lines changed

CONTRIBUTING.md

Whitespace-only changes.

README.md

Lines changed: 86 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
<p align="center">
22
<img width="200px" src="./.images/tree_core_logo.svg" align="center" alt="Tree Core CPU" />
3-
<h1 align="center">TreeCore CPU</h1>
4-
<p align="center">A series of RISCV soft core processors written from scratch</p>
3+
<h2 align="center">TreeCore CPU: A series of riscv processors written from scratch</h2>
54
</p>
65
<p align="center">
76
<a href="./LICENSE">
8-
<img alt="license" src="https://img.shields.io/github/license/microdynamics-cpu/tree_core_cpu.svg" />
7+
<img src="https://img.shields.io/github/license/microdynamics-cpu/tree_core_cpu?color=brightgreen&logo=github&style=flat-square">
8+
</a>
9+
<a href="https://github.com/microdynamics-cpu/tree-core-cpu">
10+
<img alt="stars" src="https://img.shields.io/github/stars/microdynamics-cpu/tree_core_cpu?color=blue&style=flat-square" />
11+
</a>
12+
<a href="https://github.com/microdynamics-cpu/tree-core-cpu">
13+
<img src="https://img.shields.io/badge/total%20lines-7k-red?style=flat-square">
14+
</a>
15+
<a href="https://github.com/OSCPU">
16+
<img src="https://img.shields.io/badge/sim%20framework-verilator%20NEMU%20difftest-red?style=flat-square">
17+
</a>
18+
<a href="./CONTRIBUTING.md">
19+
<img src="https://img.shields.io/badge/contribution-welcome-brightgreen?style=flat-square">
920
</a>
10-
<img alt="stars" src="https://img.shields.io/github/stars/microdynamics-cpu/tree_core_cpu.svg" />
11-
<img alt="forks" src="https://img.shields.io/github/forks/microdynamics-cpu/tree_core_cpu.svg" />
12-
<img alt="version" src="https://img.shields.io/badge/version-1.0.0-FF69B4.svg" />
13-
<img alt="build" src="https://travis-ci.org/microdynamics-cpu/tree_core_cpu.svg?branch=main" />
1421
</p>
1522

16-
<p align="center">
17-
<a href="./README.md">English</a>·
18-
<a href="./README_zh-CN.md">简体中文</a>
19-
</p>
2023

2124
## Overview
22-
The TreeCore processors are the riscv64 software core developed under the [Open Source Chip Project by University (OSCPU)](https://github.com/OSCPU). OSCPU was initiated by ICTCAS(**_Institute of computing Technology, Chinese Academy of Sciences_**), which aims to make students use all open-source toolchain to design, develop open-source chips by themselves. It also can be called "One Life, One Chip" project in Chinese which has achieved two season. Now Season 3 is in progress in 2021.
25+
The TreeCore processors are the riscv64 cores developed under the [Open Source Chip Project by University (OSCPU)](https://github.com/OSCPU). OSCPU was initiated by ICTCAS(**_Institute of computing Technology, Chinese Academy of Sciences_**), which aims to make students use all open-source toolchain to design, develop open-source chips by themselves. It also can be called "One Life, One Chip" project in Chinese which has achieved two season. Now Season 3 is in progress in 2021.
2326

24-
Now the TreeCore has two version, TreeCoreL1(**_TreeCore Learning Core 1_**) and TreeCoreL2(**_TreeCore Learning Core 2_**). The TreeCore project is aim to help students to develop a series of riscv processor by step-to-step materials, So not just for high performance. Not like textbooks exhibit the all the knowledges in one time. TreeCore start a very simple model. provide necessary new concepts or knowledge you need to learn.
27+
Now the TreeCore has two version, TreeCoreL1(**_TreeCore Learning 1_**) and TreeCoreL2(**_TreeCore Learning 2_**). The TreeCore project is aim to help students to develop a series of riscv processor by step-to-step materials, So not just for high performance. Not like textbooks exhibit the all the knowledges in one time. TreeCore start a very simple model. provide necessary new concepts or knowledge you need to learn.
2528

2629

30+
## Motivation
31+
I heard the word **_RISCV_** first time in the second semester of my junior year(that is, the summer of 2016). My roommate participated in the pilot class of "Computer Architecture" organized by the college, and **their task was to design a simple soft-core CPU based on the RISCV instruction set**. At that time, I only knew that it was an open source RISC instruction set launched by the University of Berkeley. I felt that it was similar to the MIPS, so I didn't take it too seriously. But what is unexpected is that after just a few period of development, the RISCV has been supported by many Internet and semiconductor giants around the world, and more and more research institutions, start-ups begin to design their own proprietary processors based on it. Although now the performance and application of RISCV are still limited, **I believe RISCV will usher in a revolution that can change the old pattern in someday**.
32+
33+
The ancients once said: **it’s always shallow on paper, and you must do it yourself**. For the learn of the computer architecture, there is no better way to realize it from scratch. So I started to collect materials from the Internet, and I found the learning threshold and cost is very high. In addition, in order to pursue the performance, some open-source CPU cores are very complex(such as using mulit-pipelines, multi-core processing, out-of-order execution technology, etc), it is very difficult for beginners to get started. So I decided to design a series of open source processors from scratch, which has **simple, understandable architecture, high-quality code with step-to-step tutorial**.
34+
35+
I hope it can become a ABC project like Arduino and make more processor enthusiasts or computer related specialized students enter into the computer architecture field. In the future, under the mutual promotion of the software and hardware ecosystem, I believe more people will like CPU development and be willing to spend time on it.
2736

2837
## Feature
29-
TreeCoreL1
38+
TreeCoreL1(**under development**)
3039
* 64-bits single period riscv core
3140
* written by verilog
3241

@@ -36,18 +45,18 @@ TreeCoreL2
3645
* support RISCV integer(I) instruction set
3746
* supports machine mode privilege levels
3847
* supports AXI4 inst and mem acess
39-
* supports ICache and DCache
40-
* supports branch prediction
48+
* supports dynamics branch prediction
4149
* can boot rt-thread
4250
* develop under all open-source toolchain
4351

4452
TreeCoreL3(**under development**)
45-
* 64-bits two-issue, eight-stage pipeline riscv core
53+
* 64-bits five-stage pipeline riscv core
4654
* written by chisel3
4755
* support RV64IMAC instruction set
4856
* supports machine mode privilege levels
4957
* supports AXI4 inst and mem acess
50-
* can boot linux
58+
* supports ICache, DCache(directed-map)
59+
* can boot rt-thread, xv6 and linux
5160
* develop under all open-source toolchain
5261

5362
## Develop Schedule
@@ -73,29 +82,71 @@ Now, the develop schedule is recorded by the **Tencent Document**. You can click
7382

7483
## Usage
7584

76-
### Getting Started
77-
#### Enviroment setup(ubuntu 20.04 LTS)
78-
install verilator, mill and dep lib:
85+
### Enviroment Setup
86+
> NOTE: All of the components are installed under linux operation system. To gurantee the compatibility and stability, I strongly recommend using `ubuntu 20.04 LTS`.
87+
88+
First, you need to install verilator, mill and dependency libraries:
7989
```bash
80-
make install
81-
make setup
90+
$ cd rtl
91+
$ make install
8292
```
83-
change the sim memory from 8G to 256MB. need to enter 'make menuconfig' and modify [Memory - Configuration]->[Memory size] to '0x10000000' manually.
84-
cd in root rtl dir
93+
Then, download and configuare all components from the github:
8594
```bash
86-
make nemuBuild
87-
make dramsim3Build
88-
make simpleTestBuild
89-
make riscvTestBuild
90-
make cpuTestBuild
91-
make amTestBuild
95+
$ make setup
96+
```
97+
After that, you need to set the `NEMU_HOME` and `NOOP_HOME` environment variables:
98+
```bash
99+
$ NEMU_HOME=$(pwd)/dependency/NEMU
100+
$ NOOP_HOME=$(pwd)/dependency
92101
```
93102

94-
### Software test
103+
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:
104+
105+
```bash
106+
$ cd dependency/NEMU
107+
$ make menuconfig
108+
```
109+
> 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`.
110+
111+
<p align="center">
112+
<img src="https://raw.githubusercontent.com/microdynamics-cpu/tree-core-cpu-res/main/nemu-build.png"/>
113+
<p align="center">
114+
<em>The main configuration menu</em>
115+
</p>
116+
</p>
95117

96-
- #### Instruction test
118+
Usually, 256MB memory address space is enough for simulation. You need to switch into `[Memory - Configuration]` menu and change `[Memory size]` value into `0x10000000` manually as follow picture shows. It can adjust difftest's simulation memory size from 8G to 256MB.
97119

98-
- #### Program test
120+
<p align="center">
121+
<img src="https://raw.githubusercontent.com/microdynamics-cpu/tree-core-cpu-res/main/nemu-build-mem.png"/>
122+
<p align="center">
123+
<em>The memory address size menu</em>
124+
</p>
125+
</p>
126+
127+
Last, remember to type `Save` button in bottom menu to save the `.config` file. Then, type `Exit` to exit the menuconfig.
128+
129+
### Compile runtime libraries
130+
If you already run above steps correctly, you need to compile runtime libraries as follow:
131+
132+
```bash
133+
$ make nemuBuild
134+
$ make dramsim3Build
135+
```
136+
137+
### Recursive test
138+
When you modify the processor design, you
139+
```bash
140+
$ make riscvTestBuild
141+
$ make cpuTestBuild
142+
```
143+
144+
### Software test
145+
```bash
146+
$ make amTestBuild
147+
```
148+
149+
### SoC test
99150

100151
### Hardware test
101152

@@ -105,17 +156,10 @@ make amTestBuild
105156

106157
## Summary
107158

108-
## Documention
109-
110159
## Plan
111160

112161
## Update
113162

114163
## License
164+
All of the TreeCore codes are release under the [GPL-3.0 License](LICENSE).
115165

116-
## Story
117-
I heard the word **_RISCV_** first time in the second semester of my junior year(that is, the summer of 2016). My roommate participated in the pilot class of "Computer Architecture" organized by the college, and **their task was to design a simple soft-core CPU based on the RISCV instruction set**. At that time, I only knew that it was an open source RISC instruction set launched by the University of Berkeley. I felt that it was similar to the MIPS, so I didn't take it too seriously. But what is unexpected is that after just a few period of development, the RISCV has been supported by many Internet and semiconductor giants around the world, and more and more research institutions, start-ups begin to design their own proprietary processors based on it. Although now the performance and application of RISCV are still limited, **I believe RISCV will usher in a revolution that can change the old pattern in someday**.
118-
119-
The ancients once said: **it’s always shallow on paper, and you must do it yourself**. For the learn of the computer architecture, there is no better way to realize it from scratch. So I started to collect materials from the Internet, and I found the learning threshold and cost is very high. In addition, in order to pursue the performance, some open-source CPU cores are very complex(such as using mulit-pipelines, multi-core processing, out-of-order execution technology, etc), it is very difficult for beginners to get started. So I decided to design a series of open source processors from scratch, which has **simple, understandable architecture, high-quality code with step-to-step tutorial**.
120-
121-
I hope it can become a ABC project like Arduino and make more processor enthusiasts or computer related specialized students enter into the computer architecture field. In the future, under the mutual promotion of the software and hardware ecosystem, I believe more people will like CPU development and be willing to spend time on it.

README_zh-CN.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

rtl/Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ endef
8181

8282
###### dev env target ######
8383
install:
84-
./scripts/install.sh -g -c
84+
@./scripts/install.sh -g -c
8585

8686
setup:
87-
./scripts/setup.sh -a
87+
@./scripts/setup.sh -a
88+
89+
###### project template target ######
90+
template:
91+
@./scripts/template.sh -t $(CHIP_TARGET)
8892

8993
###### chisel target ######
9094
millTest:
@@ -235,7 +239,7 @@ $(cpuTestLogFile):
235239
$(shell echo 0 > $(CPUTEST_HOME)/build/log/passcasenum-log.txt)
236240

237241
$(cpuTestCaseName): cputest-%: $(CPUTEST_HOME)/build/%-riscv64-mycpu.bin
238-
$(call getRecursiveTestRes, $(CPUTEST_HOME), 34)
242+
$(call getRecursiveTestRes, $(CPUTEST_HOME), 33)
239243

240244
unit-test: simBuild riscvRecursiveTest cpuRecursiveTest
241245

@@ -296,7 +300,8 @@ cleanDepRepo:
296300
cleanAll: cleanBuild cleanMillOut cleanDepRepo
297301

298302

299-
.PHONY: install, setup,
303+
.PHONY: install setup \
304+
template \
300305
millTest chiselBuild chiselHelp millCompile millBsp format checkformat \
301306
nemuBuild dramsim3Build difftestBuild changeTargetToSimTop changeTargetToSoCTop simBuild \
302307
simpleTestBuild riscvTestBuild cpuTestBuild amTestBuild coremarkTestBuild \

rtl/build.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object tc_l2 extends ScalaModule with ScalafmtModule { m =>
3434

3535
object difftest extends ScalaModule {
3636
override def scalaVersion = "2.12.13"
37-
override def millSourcePath = os.pwd / "tc_l2" / "difftest"
37+
override def millSourcePath = os.pwd / "dependency" / "difftest"
3838
override def ivyDeps = Agg(
3939
ivy"edu.berkeley.cs::chisel3:3.4.3"
4040
)

0 commit comments

Comments
 (0)