Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V...

19
#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/ Practical Computer Architecture Education with RISC-V Stefan Wallentowitz Professor Munich University of Applied Sciences @wallento

Transcript of Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V...

Page 1: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Practical Computer Architecture Education with RISC-VStefan WallentowitzProfessorMunich University of Applied Sciences@wallento

Page 2: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

About Me

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

•Graduated from RWTH Aachen and TU Munich, EE/Computer Engineering

•Research Interests: Manycore SoC, physical hardware security, verification

•Professor at Munich University of Applied Sciences since March 2019

Professional

•Long time user and contributor to OpenRISC, then RISC-V

•Many open source projects (HDL, Tools, …)

Hobbyist

•Director at Free and Open Source Silicon Foundation

Advocacy & Community

Page 3: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Munich University of Applied Sciences

► 18400 Students, 14 Departments

► Characteristics

• Primarily Bachelor and Masters Degrees

• Strong Focus on Practice and Application

• Application-oriented Research

• Small Class Sizes (5-40 students)

• Compulsory Industry Internship

• Professors: Min. 5 years industry experience

► (Comparable) Strategic Partners: Cal Poly (San Luis Obispo), TAMK (Tampere, Finland), UAS Vienna and Zurich

► My Faculty: Computer Science & Mathematics

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Page 4: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

My First Course: Computer Architecture

► 4th Semester Bachelor

► Classic Curriculum

• Pipelining Basics

• How we got to large IPCs(BP, Superscalar, OoO)

• Memory, Interconnect, …

► Lecture & Integrated Laboratory

► … and all this cool open source stuff out there!

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Page 5: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction
Page 6: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

How I see Computer Architecture

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

© W

ikim

edia

/web

alys

, C

C-B

Y 4

.0

Page 7: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

How my CS Students see Computer Architecture

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

© W

ikim

edia

/Ru

ben

de

Rijc

ke, C

C-B

Y-SA

3.0

© W

ikim

edia

/Sae

19

62

, CC

-BY-

SA 3

.0

Page 8: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

The Lecture

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Page 9: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

The Laboratory

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

• Refresher in Computer Systems, RISCV Instruction Set and Assembly

• Tools: rv8, spike, Venus

RISC-V Basics

• DLX Pipeline: Ripes Simulator

• Simulators, Emulators, Levels of Abstraction

• RTL Simulations of popular open source CPUs(ibex, SCR-1, Rocket, Ariane, BOOM)

Computer Architecture

• Nexys A7 FPGA board with different open source CPUs

FPGA Platform

Page 10: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

RISC-V Basics

► Refresh Assembly Skills

► Small programs, calling conventions etc.

► Venus simulator (JavaScript in Browser)

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Venus Simulator: https://www.kvakil.me/venus/

Page 11: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Basic DLX Pipeline

► Move away from pure functional (instruction accurate)

► Understand basic (DLX) pipeline principle

► Ripes simulator (awesome project!)

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Ripes Simulator: https://github.com/mortbopet/Ripes

Page 12: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Simulators, Emulators, Level of Abstraction

► Step from visual simulators to other types of simulation/emulation

► rv8: Different modes, understand user mode emulation etc.

► Understand levels of abstraction

► RTL simulation (Verilator) and gtkwave: Syntacore SCR-1

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Syntacore SCR-1: https://github.com/syntacore/scr1

Page 13: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Computer Architecture Insights

► Goal: Understand Computer Architecture concepts

► Insights into core implementations without waveforms etc.but with real processor cores!

► Example of existing tools: BOOM and gem5 O3 pipeline viewer

► THAT, but with much moreµ-architectural details!

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Page 14: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Pipeline Viewer

► Python: pip install pipeline-viewer

► Re-implementation of basic pipeline viewer, but with extra modes

► Extensions of core simulation environment with DPI

► Example: Ariane 64-bit core

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Testbench

Ariane

DP

I µar

chTr

acer

Minimal extensions to ease tracking of instructions (may become obsolete)

Observe microarchitecture and trace events

Trace File

CTF (binary trace) or text file

pipeline-viewer

Page 15: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Pipeline Viewer: Instruction Trace

► Assignment: Observe instructions in pipeline, determine IPC

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Instruction lifecycle over time

Total retired instructions

DurationPC &

Disassembly

Page 16: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Pipeline Viewer: Branch Predictor

► Assignment: Compare expected behavior, impact of difference sizes

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Branch prediction and updates to the

predictor

Page 17: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Work-in-Progress: FPGA Integration

► Implement cores in FPGA and add micro-architecture trace

► Ran out of time in spring 2019, will be added in spring 2020

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

FPGA

Core

µar

chTr

acer

CTFpipeline-viewer

Open SoC Debug

Page 18: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Outlook: Computer System Basics

► Course in Computer System Fundamentals

► Currently MMIX & VMB

► Switch to RISC-V

► Plan: Extend Venus simulator for example with I/O visualization

► ETA: Summer 2020

► Also: Benchmarking with Embench

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/

Page 19: Practical Computer Architecture Education with RISC-V€¦ · •Tools: rv8, spike, Venus RISC-V Basics •DLX Pipeline: Ripes Simulator •Simulators, Emulators, Levels of Abstraction

Summary

► Computer Architecture Teaching with Real Processor Cores

► Accessible to non-EE students, no need to touch HDL/waveforms

► Reusable infrastructure, WIP even for FPGACores: lowRISC Ibex, Syntacore SCR-1, ETH Ariane, Berkeley BOOM

► Laboratory Curriculum

► Soon available online: https://github.com/wallento/riscv-ca-teaching

► Get in touch!

[email protected] @wallento

#RISCVSUMMIT | tmt.knect365.com/risc-v-summit/