Introduction to Computer Systems (II), Spring 2021.

Overview

Introduction to Computer Systems (II)

Spring 2021, Fudan University.

Directory Structure

  • misc/: miscellaneous files.
  • doc/: lab handouts.
  • source/: SystemVerilog source files.
  • vivado/: SoC and testbenches on Vivado.
  • verilate/: C++ source files for verilated simulation.
  • build/: temporary build files.

Commands

$ make help
Available commands:
  make verilate: synthesize/compile your RTL code with Verilator.
  make vbuild: compile Verilator simulation sources into executable file "vmain".
  make vsim: "make vbuild" first and then execute "vmain".
  make vsim-gdb: run "vmain" with GDB.
  make doc-build: build documents into "doc/book", i.e., run "mdbook build".
  make doc-serve: run "mdbook serve".
  make doc-sync: upload webpages onto "riteme.site" (requires authentication).
  make misc-sync: upload "misc/doc" onto "riteme.site" (requires authentication).
  make system-info: print information about installed system packages.
  make dump-instructions: dump all instructions during simulation (RefCPU only).

Available parameters:
  TARGET: e.g. refcpu/VTop, mycpu/VCacheTop.
  TEST: which test under misc/nscscc to simulate. Default to empty string.
  FST: where to save FST trace file.
  USE_CLANG: use LLVM clang and libc++.
  VSIM_ARGS: pass command line arguments to "vmain".
  VSIM_OPT: set to 1 to enable compiler optimization. ("-O2 -march=native -flto")
  VSIM_SANITIZE: set to 1 to enable address sanitizer and undefined behavior sanitizer.
  SV_EXTRA_FLAGS: extra synthesis flags passed to Verilator.
  CXX_EXTRA_FLAGS: extra compiler flags passed to C++ compiler.

Prerequisites

We recommend you work on a Linux distribution (Ubuntu, Manjaro, ArchLinux, etc.) or WSL2 if you stick to Microsoft Windows. We at least guarantee that all stuffs will function correctly on Ubuntu 20.04. If you find something that doesn't work, please feel free to contact TAs or consider running a virtual machine.

  • Xilinx Vivado (= 2019.2, HLx version)
  • Verilator (≥ 4.028)
  • GDB (for vsim-gdb)
  • GTKWave
  • build-essential
    • GNU make
    • C++17 capable compiler: GNU C++ (≥ 9.0.0) or LLVM clang (≥ 7.0.0)
    • corresponding libstdc++ (GNU C++) or libc++ (LLVM clang)
  • libz-dev (or the correct devel packege for zlib on your Linux distribution)
  • systemd-coredump (for coredumpctl)
  • socat: SOcket CAT
  • any serial port terminal program, e.g. uucp's cu or GNU screen

Ubuntu 20.04

apt update
apt install -y verilator gdb gtkwave build-essential libz-dev systemd-coredump screen

Run RefCPU functional test:

make vsim -j

Ubuntu 18.04

Because Verilator 3.x on Ubuntu 18.04 is outdated, we need to install a newer version from SiFive. First, download the .deb package file from https://github.com/sifive/verilator/releases (or eLearning if your network connection to GitHub is not stable) and save it to verilator4.deb. And then execute the following commands as root:

apt update
apt install -y gdb gtkwave make clang-10 libc++-10-dev libc++abi-10-dev libz-dev systemd-coredump screen
# wget -O verilator4.deb https://github.com/sifive/verilator/releases/download/4.036-0sifive2/verilator_4.036-0sifive2_amd64.deb
dpkg -i verilator4.deb
ln -s /usr/local/share/verilator /usr/share/

NOTE: there's no GCC 9 officially on Ubuntu 18.04, so we installed clang instead. As a result, every time you run make vsim, you have to specify USE_CLANG=1 in command line. For example:

make vsim -j USE_CLANG=1

Debian 10

You have to download a newer version of Verilator as in the previous section “Ubuntu 18.04”, and save it to verilator4.deb.

apt update
apt install gdb gtkwave build-essential zlib1g-dev systemd-coredump screen
# wget -O verilator4.deb https://github.com/sifive/verilator/releases/download/4.036-0sifive2/verilator_4.036-0sifive2_amd64.deb
dpkg -i verilator4.deb
ln -s /usr/local/share/verilator /usr/share/

NOTE: only GCC 8 is available on Debian 10. However, Verilator simulation can still be compiled successfully as long as you don't use the C++ library nameof, which is located at verilate/include/thirdparty/nameof.hpp.

ArchLinux/Manjaro

pacman -Sy
pacman -S verilator gdb gtkwave base-devel zlib screen

Notes on Verilator

Please use verilator --version to ensure that the version of Verilator installed is actually ≥ 4.028. We have found that some Ubuntu 20.04 on WSL2 only provides Verilator 4.016, which is incapable of compiling RefCPU, although the package manager claims it's 4.028.

If you need more recent version of Verilator, please refer to https://www.veripool.org/projects/verilator/wiki/Installing and manually build & install from source.

NSCSCC Performance Test

By default, make vsim will simulate RefCPU with NSCSCC functional test. We provide memory initialization files (.coe) of performance tests from NSCSCC. For example, if you want to run CoreMark on verilated models, you can specify the --memfile/-m and set --ref-trace/-r to empty string to disable text trace diff. Moreover, you can set TEST make argument to specify which .coe file (under directory misc/nscscc) to simulate.

make vsim -j TEST=coremark VSIM_ARGS="--no-status"

See make help and make vsim VSIM_ARGS='-h' for more details.

You might also like...
Imu_initialization - Implementation of "An Analytical Solution to the IMU Initialization Problem for Visual-Inertial Systems"

An Analytical Solution to the IMU Initialization Problem for Visual-Inertial Systems Implementation of "An Analytical Solution to the IMU Initializati

This repository Contains PPTs and Sample Codes for IoT workshop 21st to 24th Aug 2021

IoT-workshop This repository Contains PPTs and Sample Codes for IoT workshop 21st to 24th Aug 2021 Fritzing Download Link: https://www.filehorse.com/d

cs49n class materials: stanford autumn quarter 2021

CS49n (Aut, 21): using bits to control atoms. Overview This is a lab-based class. It is structured where you will write the code to control 1-2 hardwa

Everything I coded in my 1337 Piscine, August 2021.
Everything I coded in my 1337 Piscine, August 2021.

Welcome to Piscine Experience August 2021! In this repository, I shared everything I have done during the 28 days of 1337 piscine. Things to consider

Materials for CSGO Video Game Hacking workshop Google DSC 2021-2022

Intro to Video Game Hacking Workshop for UBCO Google DSC All of the code is in the Internal Cheat Project. The DSC Internal Demo was the code that we

Practical exercises for the "Advanced C++" course in 2021/22

Advanced C++ Programming - Practical Part This repository contains practical exercises to accompany the lecture. Based on Material by Alex Hirsch. Gra

June Piscine 2021 from 1337 Benguerir 42 Network.

1337 My solutions for the June Piscine 2021. Please open an issue on github if you find anything incorrect. If you have any tips I would like to hear,

🌼 Homework of Computer Systems: A Programmer's Perspective (3rd Edition) and Autolab solutions of CMU 15-513: Intro to Computer Systems
🌼 Homework of Computer Systems: A Programmer's Perspective (3rd Edition) and Autolab solutions of CMU 15-513: Intro to Computer Systems

Exercisebook of Computer Systems: A Programmer's Perspective, 3/E (CS:APP3e) CS:APP3e is written by Randal E. Bryant and David R. O'Hallaron, Carnegie

A C++ implementation of Fast Simulation of Mass-Spring Systems
A C++ implementation of Fast Simulation of Mass-Spring Systems

Fast Mass-Spring System Simulator A C++ implementation of Fast Simulation of Mass-Spring Systems [1], rendered with OpenGL. The dynamic inverse proced

System Programming 2021 Spring

sp-labs System Programming Labs 2021 Spring Repo 文件说明 lab: 实验指导书 & 题目。 answer_template: 提供对应 lab 的参考作答模板。建议将图片放至对应的img/文件夹下,使用 Markdown 编写,最后通过 Typora

2021-Spring-Capstone-Design '전기차 무선 충전 로봇'
2021-Spring-Capstone-Design '전기차 무선 충전 로봇'

2021-Capstone-Design 광운대학교 로봇학부 2021년도 1학기 캡스톤 디자인 '로부스'팀 Repository입니다. 개발 기간 : 2021.3 ~ 2021.6 팀원 구성 팀원 맡은 역할 김범수(팀장) 전체 지휘 총괄 및 일정 조율, Fuzzy 제어기 In

Examples for the "Introduction to programming" course given by me and @bzareva @ Faculty of Mathematics and Informatics, Sofia University (2021/22)

Теми от практикумите по "Увод в програмирането", зимен семестър 2021/2022, спец. "Информатика", група 5 Тема 1 (04.10.2021) : Променливи. Типове проме

CS:APP is an excellent material for learning computer systems and systems programming

CS:APP is an excellent material for learning computer systems and systems programming. However, it is inconvenient to use a virtual machine for self-learners. In this repo, I build a Docker image with most pre-requistes installed and attached all lab materials in it.

Complete introduction to size balanced trees (O(1) amortized complexity)

Size Balanced Tree A size balanced tree (SBT) is a self-balancing binary search tree (SBBST) rebalanced by examining the sizes of each node's subtrees

Code for the article Spring-It-On

Spring-It-On: The Game Developer's Spring-Roll-Call This repo contains the source code for all the demos from this article. It uses raylib or more spe

Try to implement some algorithms in the book Introduction to Algorithms in C (and maybe C++).

CAlgoIntro Try to implement some algorithms in the book Introduction to Algorithms in C (and maybe C++). Note that not every algorithm & problem in th

Every week exercises for Introduction to Algorithms and Programming

cen109-algorithms commands to compile and link C and C++ programs gcc filename.c -o executableFileName g++ filename.cpp -o executableFileName filename

42 Project as an introduction to Cyber Security Domaine.

SnowCrash Hello, This is SnowCrash project in 42. The starter projects for cyber security branch. What are you going to learn in this project ? Basic

Introduction to AWS IoT Core and a Post Messaging demo
Introduction to AWS IoT Core and a Post Messaging demo

IoT_Message_Box_Workshop Introduction to programming microcontrollers for IoT applications and interfacing them with AWS IoT Core This workshop was pr

System Programming 2021 Spring

sp-labs System Programming Labs 2021 Spring Repo 文件说明 lab: 实验指导书 & 题目。 answer_template: 提供对应 lab 的参考作答模板。建议将图片放至对应的img/文件夹下,使用 Markdown 编写,最后通过 Typora

null 45 Jan 5, 2023
Try to implement some algorithms in the book Introduction to Algorithms in C (and maybe C++).

CAlgoIntro Try to implement some algorithms in the book Introduction to Algorithms in C (and maybe C++). Note that not every algorithm & problem in th

Hans Wan 3 Sep 28, 2021
University of Bergamo - C++ Dev Course (Computer Engineering) 2021/2022

University of Bergamo - 21012 Dev Course C++ 2021/2022 This git repository contains the source code in C++ language to support the lessons of the C++

Mauro Pelucchi 11 Dec 1, 2022
哈尔滨工业大学(深圳)计算机专业课程攻略 | Guidance for courses in Department of Computer Science, Harbin Institute of Technology (Shenzhen)

哈工大(深圳)计算机专业课程攻略 受浙江大学相关项目和清华大学相关项目启发,创立了本项目。 若要下载单个文件夹,复制该文件夹的网址,粘贴入DownGit中,选择Download即可。 感谢对本项目贡献的同学:第二届院学生会学术部全体成员、hewei2001、chh13502、xyfJASON、ail

null 847 Dec 31, 2022
COMPUTER ENGINEERING - SEM 3-8 College Assignments and PPTs

Contributors ✨ Thanks goes to these wonderful people (emoji key): Subham Agrawal ?? ✅ Pritesh Kumar Tripathi ?? ✅ Sakshi Jain ?? ✅ Krithikha Bala ?? ✅

Subham Agrawal 29 Aug 3, 2022
A haskell toolbox for the Internet Computer

The Internet Computer Haskell Toolkit This repository contains a bunch of Internet-Computer related code written to support the following use cases: i

DFINITY 33 Dec 14, 2022
A project for Computer Programming (2) Course // C language

Fun-programming-project A project for Course : Computer Programming (2) “ CS181 ” presented to Dr. Abeer Alhujaylan Team work : Feda mousa leen mohamm

Feda Mousa 2 Feb 4, 2022
🐛 Pangea Software's Bugdom for modern systems

Bugdom This is Bugdom running on modern macOS, Windows and Linux! This version, at https://github.com/jorio/Bugdom, is approved by Pangea Software. Ge

Iliyas Jorio 258 Jan 2, 2023
Public Code Repository of the iRotate Active SLAM for Omnidirectional robots at the Max Planck Institute for Intelligent Systems, Tübingen

iRotate: Active Visual SLAM for Omnidirectional Robots This repository contains the code of iRotate, an active V-SLAM method submitted to RA-L + IROS2

Elia Bonetto 36 Nov 25, 2022
Pangea Software's Mighty Mike (Power Pete) for modern systems

Mighty Mike (a.k.a. Power Pete) This is Pangea Software's Mighty Mike updated to run on modern systems. Set in a toy store, this top-down action game

Iliyas Jorio 120 Dec 26, 2022