1 Star 0 Fork 8

chamgj/NWPU-gem5-CSArch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

CS Arch Lab of NWPU

Introduction

This repo is for the course U10M11007 of NWPU, Computer Organization and Architecture, which partially supported by University-Industry Collaborative Education Program, Ministy of Education (Phytium-NWPU).

Lab experiment includes:

  1. ARM and RISCV Instructions & GEM5
  2. Debugging Trace and stats
  3. Cache Sub-System
  4. ARM Software Flow with GEM5 SE
  5. Out of Order Multi Instruction Parallelism

How to Use this repo

This repo includes 5 labs, which focus processor architecture using open-source simulator GEM5. The experiment of GEM5 is docker based.

Firstly, just clone https://gitee.com/nwpu-ercesi/nwpu-gem5-csarch.git to your local folder. If you use Linux or BSP liked System (such as MacOS), just follow this command line

git clone https://gitee.com/nwpu-ercesi/nwpu-gem5-csarch.git

Docker Container Image

Docker is a set of platform-as-a-service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines. In this lab project, Docker is adopted for GEM5 simulator. The image can be pull from the Docker resource repository.

docker pull gcr.io/gem5-test/ubuntu-20.04_all-dependencies:v22-0

Docker Registry Mirrors

As the understandable concern of the cyber security and the WWW resources is monopolized oversea, the Docker Hub presents the unacceptable laggy in China. The Registry mirrors which servers are located in China is a reasonable approache to speed up the PULL of image from Docker Hub.

Some userful information can be found at Zhihu. We recommand to register a personal Aliyun registry mirror and add it in the configuration file daemon.json.

{
    "registry-mirrors": [
        "https://alimirrorusername.mirror.aliyuncs.com"
    ]
}

Change the alimirrorusername to your registry username of Aliyun Docker mirror.

Build Docker Image from Dockerfile

As the gcr.io is laggy or banned for unkown reason, the Dockerfile is provided in this repo. The docker build command listed below will build the docker image which has the essential libraries of gem5. The command should be run in the dir which contains the Dockerfile, for example in our gitee repository dir.

docker build -t gem5-ercesi:latest .

How to Run Docker Container

f the Docker image has been imported, the Docker would run by the command below.

docker run -u $UID:$GID \
  --volume <gem5 directory>:/mnt/gem5arm \
  --rm -it gem5-ercesi:latest

In which, the the argument -i denotes an interactive mode of docker container execution, t implies a TTY prompt mode as while as bash is for a bash shell in command line. To keep the container clean, we recommand not to save any user file in container. So the --rm is added in the script to remove the container after exit. If you don’t use the --rm optional argument, please resume the opened container next time. <gem5 directory> in the run script is where the GEM5 source code downloaded. An example command below is for Windows users.

docker run -u gem5 --volume D://gem5_local:/mnt/gem5arm --rm -it gem5-ercesi:latest

Please note the performance of any app running in a docker container is limited by the resource assigned to the container. If any can be worked in the original OS, please do it in the original OS, such as doing git or compile in linux of mac os system.

The next step is cloning gem5 remote repo. It is recommande to use git clone from github or gitee.com.

git clone https://github.com/gem5/gem5.git

Note: Before compile the gem5, pre-commit libary is recommanded to install.

pip install pre-commit==2.20.0

Resume an Opened Container

When the end of the Docker lab, we use exit command to exit the Docker promot.

docker ps -a

To restart the seleceted container, docker start command can be used.

docker start [container ID]

If the run command used as that mentioned before, a sample command line is introdueced below.

docker exec -it [container ID] bash

Contributors

As this repo is transfered from the Inner Source, and all the old history is deleted due to the copyright consideration, the contributors of this repo are not listed in git configurations. We listed all contributors below.

Meng Zhang;

Hui Li;

Zhendi Yu

BSD 3-Clause License Copyright (c) 2022, mez62 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

GEM5-based Computer Architecture Simulation Project with ARM ISA for Computer Arch Course (U10M11007.02) of NWPU. 展开 收起
Python
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/chamgj/nwpu-gem5-csarch.git
git@gitee.com:chamgj/nwpu-gem5-csarch.git
chamgj
nwpu-gem5-csarch
NWPU-gem5-CSArch
master

搜索帮助