@@ -17,104 +17,158 @@ Framework for a hybrid system with RISC-V and CGRA, including:
1717
1818### Dependencies
1919
20- ##### Chipyard
2120
22- ##### LLVM-10.0.0 with Polly included
21+ #### Chipyard 1.5.0
2322
23+ 1 . install dependence tools
24+
25+ ``` sh
26+ sudo apt-get install -y build-essential bison flex software-properties-common curl
27+ sudo apt-get install -y libgmp-dev libmpfr-dev libmpc-dev zlib1g-dev vim default-jdk default-jre
28+ sudo apt-get install -y texinfo gengetopt
29+ sudo apt-get install -y libexpat1-dev libusb-dev libncurses5-dev cmake
30+ sudo apt-get install -y python3.8 patch diffstat texi2html texinfo subversion chrpath wget
31+ sudo apt-get install -y libgtk-3-dev gettext
32+ sudo apt-get install -y python3-pip python3.8-dev rsync libguestfs-tools expat ctags
33+ sudo apt-get install -y device-tree-compiler
34+ ```
35+
36+ 2 . clone repo and build
37+
38+ ``` sh
39+ git clone https://github.com/ucb-bar/chipyard.git
40+ cd chipyard
41+ git checkout 1.5.0
42+ ./scripts/init-submodules-no-riscv-tools.sh
43+ ./scripts/build-toolchains.sh esp-tools --ignore-qemu
44+ ```
45+
46+
47+ #### LLVM-10.0.0 with Polly included
48+
49+
50+ 1 . download llvm source codes from https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-10.0.0.tar.gz
51+
52+ extract and change directory name
53+
54+ ``` sh
55+ tar xvf llvmorg-10.0.0.tar.gz
56+ mv llvmorg-10.0.0 llvm-project-10.0.0
57+ ```
58+
59+ 2 . build llvm
60+
61+ ``` sh
62+ mkdir llvm-10.0.0-built
63+ cd llvm-project-10.0.0
64+ mkdir build
65+ cd build
66+ cmake -DLLVM_ENABLE_PROJECTS=' polly;clang' -G " Unix Makefiles" ../llvm
67+ # multi-thread consumes lots of memory, e.g. -j4 : 30G+
68+ make -j4
69+ # DESTDIR set install directory
70+ make install DESTDIR=/xxx/llvm/llvm-10.0.0-built
71+ ```
72+
73+ 3 . set llvm env
74+
75+ ``` sh
76+ # add following env to .bashrc and then source ~/.bashrc.
77+ # or directly export the env
78+ export LLVM_HOME=/xxx/llvm/llvm-10.0.0-built/usr/local/bin
79+ export PATH=$LLVM_HOME :$PATH
80+ # or set the LLVM path in the CMakeLists.txt
81+ set(LLVM_INCLUDE_DIRS " /xxx/llvm-10.0.0-built/usr/local/include" )
82+ set(LLVM_LIBRARY_DIRS " /xxx/llvm-10.0.0-built/usr/local/lib" )
83+ ```
2484
2585
2686### CGRA-MG
2787
88+
2889#### Setup
2990
91+
30921 . copy this repo to the chipyard/generators/ directory
3193
32942 . Add the following configuration in the chipyard/build.sbt file
3395
3496```
35- lazy val chipyard = (project in file("generators/chipyard"))
36- .dependsOn(
37- ...
38- fdra
39- )
40-
41- lazy val fdra = (project in file("generators/fdra/cgra-mg"))
42- .dependsOn(testchipip, rocketchip)
43- .settings(libraryDependencies ++= rocketLibDeps.value)
44- .settings(chiselTestSettings)
45- .settings(commonSettings)
46-
97+ lazy val chipyard = (project in file("generators/chipyard"))
98+ .dependsOn(
99+ ...
100+ fdra
101+ )
102+
103+ lazy val fdra = (project in file("generators/fdra/cgra-mg"))
104+ .dependsOn(testchipip, rocketchip)
105+ .settings(libraryDependencies ++= rocketLibDeps.value)
106+ .settings(chiselTestSettings)
107+ .settings(commonSettings)
47108```
48109
491103 . copy config file to chipyard
50111
51112``` sh
52- cd chipyard/generators/fdra
53- ./scripts/setup-paths.sh
113+ cd chipyard/generators/fdra
114+ ./scripts/setup-paths.sh
54115```
55116
56117#### Build and run
57118
581191 . build verilog
59120
60121``` sh
61- source env.sh
62- cd generators/fdra
63- ./scripts/build-verilog.sh
122+ source env.sh
123+ cd generators/fdra
124+ ./scripts/build-verilog.sh
64125```
65126
661272 . build simulator based on Verilator
67128
68129``` sh
69- ./scripts/build-verilator.sh
130+ ./scripts/build-verilator.sh
70131```
71132
72133### App-Compiler
73134
74135#### Setup
75-
76- Download LLVM-10.0.0 and build
77-
78- Set LLVM env
136+ Download LLVM-10.0.0 and build
137+ Set LLVM env
79138
80139#### Build and Run
81-
82- Using the script build.sh in this app-compiler directory. The internal path should be changed.
140+ Using the script build.sh in this app-compiler directory. The internal path should be changed.
83141
84142``` sh
85- ./build.sh
143+ ./build.sh
86144```
87145
88146
89147### CGRA-Compiler
90148
91149#### Build
92-
93- Using the script build.sh
150+ Using the script build.sh
94151``` sh
95- cd cgra-compiler
96- ./build.sh
152+ cd cgra-compiler
153+ ./build.sh
97154```
98155
99156#### Run
100-
101- Using the script run.sh
157+ Using the script run.sh
102158``` sh
103- ./run.sh
159+ ./run.sh
104160```
105161
106- Change the benchmark file path as you need.
107- The generated result files are in the same directory as the benchmark.
162+ Change the benchmark file path as you need.
163+ The generated result files are in the same directory as the benchmark.
108164
109165
110166
111167### Build & Run Application on SoC
112168
113169#### SoC application code generation
114-
115- Automatically generate with CGRA Compiler, or
116-
117- Manually replace the target loop kernel with CGRA call function and binding codes generated by CGRA Mapper
170+ Automatically generate with CGRA Compiler, or
171+ Manually replace the target loop kernel with CGRA call function and binding codes generated by CGRA Mapper
118172
119173
120174#### Compile SoC application code with RISC-V toolchain
@@ -129,6 +183,6 @@ Manually replace the target loop kernel with CGRA call function and binding code
129183#### Run SoC application with simulator
130184
131185``` sh
132- cd generators/fdra
133- ./scripts/run-verilator.sh app-name
186+ cd generators/fdra
187+ ./scripts/run-verilator.sh app-name
134188```
0 commit comments