Git Product home page Git Product logo

gem5-learn's Introduction

This repository has been designed for use in gem5 tutorials. It has been built with the assumption users will utilize Codespaces to learn gem5.

The repository contains the following directories:

  • docker : The source code for the Docker image used by .devcontainer/Dockerfile to create the Codespace Docker container.
  • gem5 : v22.0.0.1 of gem5.
  • gem5-resources : gem5-resources which may be used with v22.0 of gem5.
  • materials: Example materials used as part of the tutorial.
  • modules: Source for the accompying website: https://gem5bootcamp.github.io/gem5-bootcamp-env The website contains links to slides, presentation videos, and notes for the tutorials.

Note: 'gem5' and 'gem5-resources' are submodules though the .devcontainer/devcontainer.json file specifies that a git module update --init --recursive command is executed when the Codespace Docker container is created.

The container used by Codespaces is built from .devcontainer/Dockerfile. It contains:

  • All gem5 dependencies (inc. optional dependencies).
  • Prebuilt gem5 binaries:
    • /usr/local/bin/gem5-x86
    • /usr/local/bin/gem5-arm
    • /usr/local/bin/gem5-riscv
  • A RISCV64 and an AARCH64 GNU cross-compiler:
    • RISCV64 GNU cross-compiler found in /opt/cross-compiler/riscv64-linux/.
    • AARCH64 GNU cross-compiler found in /opt/cross-compiler/aarch64-linux/.

Beginners' example

The following can be used within the Codespace container to run a basic gem5 simulation straight away:

gem5-arm gem5/configs/example/gem5_library/arm-hello.py

This will execute a "Hello world!" program inside a simulated ARM system.

Updating submodules

In this project we have two submodules: 'gem5' and 'gem5-resources'. These are automatically obtained when the codespaces is initialized. At the time of writing the 'gem5' directory is checked out to the stable branch at v22.0.0.1. The 'gem5-resources' repository is checkoued out to revision '871e715', which should contain resources with known compatibility with gem5 v22.0.

To update the git submodules to be in-sync with their remote origins (that hosted on our googlesource), execute the following command:

git submodule update --remote

This repository may be updated to these in-sync submodules by running the following (this assumes you have correct permissions to do so):

git add gem5 gem5-resources
git commit -m "git submodules updated"
git push

Best practises

Using branches

A good strategy when working with gem5 is to use branches. In the 'gem5' directory, you can use branches to segregate your development. A typical workflow would be as follows.

  1. Start from the stable branch. This will ensure you are starting from a clean, stable version of gem5.
git checkout stable
  1. Create another branch to work on. Initially this branch will be idential to stable but with a name of your choosing.
git branch example-1 # Creating a new branch named 'example-1'.
  1. Checkout this branch:
git checkout example-`
  1. Make changes on this branch and commit the changes. For example:
echo "Create a test commit" >test.txt
git add test.txt
git commit -m "misc: Adding a test commit"
  1. When done, or wishing to move onto something else, checkout stable. This effectively reverts the changes made on the branch.
git checkout stable
  1. You may return to this branch whenever you want.
git checkout example-1

To see a list of all available branches you can execute:

git branch

gem5-learn's People

Contributors

guo-hy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.