CS152: Discussion Section 1 Introduction / Microprogramming / Lab 1 - - PowerPoint PPT Presentation

cs152 discussion section 1
SMART_READER_LITE
LIVE PREVIEW

CS152: Discussion Section 1 Introduction / Microprogramming / Lab 1 - - PowerPoint PPT Presentation

Welcome Arch vs arch Microcode Lab 1 Overview CS152: Discussion Section 1 Introduction / Microprogramming / Lab 1 Overview Albert Ou, Yue Dai Department of Electrical Engineering and Computer Sciences University of California, Berkeley


slide-1
SLIDE 1

Welcome Arch vs µarch Microcode Lab 1 Overview

CS152: Discussion Section 1

Introduction / Microprogramming / Lab 1 Overview Albert Ou, Yue Dai

Department of Electrical Engineering and Computer Sciences University of California, Berkeley

January 31, 2020

CS152 Section 1 2020-01-31 1 / 32

slide-2
SLIDE 2

Welcome Arch vs µarch Microcode Lab 1 Overview

Welcome

CS152 Section 1 2020-01-31 2 / 32

slide-3
SLIDE 3

Welcome Arch vs µarch Microcode Lab 1 Overview

Meet your GSIs

Albert Ou

  • Email: aou@eecs.berkeley.edu
  • Office Hours: Monday 3pm-4pm, 326 Soda Hall
  • PhD student (advised by Krste Asanovi´

c)

  • Research focus: Vector architectures, data-parallel accelerators
  • CS152 survivor from long ago (2012)

CS152 Section 1 2020-01-31 3 / 32

slide-4
SLIDE 4

Welcome Arch vs µarch Microcode Lab 1 Overview

Meet your GSIs

Yue Dai

  • Email: yuedai96@berkeley.edu
  • Office Hours: Tuesday 4:30pm-5:30pm, 347 Soda Hall
  • PhD student (advised by Borivoje Nikoli´

c)

  • Research focus: Massive MIMO transceiver baseband system (6+G)

CS152 Section 1 2020-01-31 4 / 32

slide-5
SLIDE 5

Welcome Arch vs µarch Microcode Lab 1 Overview

Agenda

1 Architecture vs microarchitecture 2 Microcoding review 3 Lab 1 overview

CS152 Section 1 2020-01-31 5 / 32

slide-6
SLIDE 6

Welcome Arch vs µarch Microcode Lab 1 Overview

Administrivia

  • Problem Set 1 due at 10:30am Mon, Feb 10
  • Lab 1 due at 10:30am Wed, Feb 19
  • Submit assignments through Gradescope
  • https://www.gradescope.com/courses/84575
  • Join with code 9VZ526
  • Check course webpage for schedule
  • http://www-inst.eecs.berkeley.edu/~cs152/sp20/
  • Sign up for Piazza
  • http://piazza.com/berkeley/spring2020/cs152

CS152 Section 1 2020-01-31 6 / 32

slide-7
SLIDE 7

Welcome Arch vs µarch Microcode Lab 1 Overview

Arch vs µarch

CS152 Section 1 2020-01-31 7 / 32

slide-8
SLIDE 8

Welcome Arch vs µarch Microcode Lab 1 Overview

What is an ISA?

“The term architecture is used here to describe the attributes of a system as seen by the programmer, i.e., the conceptual structure and functional behavior, as distinct from the organization of the data flow and control, the logic design, and the physical implementation.”

  • G. M. Amdahl, G. A. Blaauw, and F. P. Brooks, “Architecture of the IBM system/360,”

IBM Journal of Research and Development, vol. 8, no. 2, pp. 87–101, Apr. 1964

CS152 Section 1 2020-01-31 8 / 32

slide-9
SLIDE 9

Welcome Arch vs µarch Microcode Lab 1 Overview

Architecture vs Microarchitecture

Architecture: the instruction set Q: What are some examples of ISAs? (What might you find in a server? In a mobile device?) Microarchitecture: the implementation (organization) of an architecture Q: Is it necessarily hardware? Q: What might be the fastest RISC-V implementation publically available?

CS152 Section 1 2020-01-31 9 / 32

slide-10
SLIDE 10

Welcome Arch vs µarch Microcode Lab 1 Overview

What does it mean to be architecturally visible?

Instructions perform operations on architecturally visible state to do useful work. Q: Is the following exposed by the architecture (true/false)?

1 Register file entries in a classical RISC

pipeline

2 The stack in a stack architecture 3 Pipeline registers 4 Branch-delay/load-delay slots 5 NOPs 6 Pipeline bubbles 7 Condition code/flags 8 Memory address width 9 Instruction/data caches

CS152 Section 1 2020-01-31 10 / 32

slide-11
SLIDE 11

Welcome Arch vs µarch Microcode Lab 1 Overview

Classifying ISAs based on addressing modes

(Computer Architec- ture, A Quantitative Approach: Appendix A)

CS152 Section 1 2020-01-31 11 / 32

slide-12
SLIDE 12

Welcome Arch vs µarch Microcode Lab 1 Overview

Power of Abstraction

ISA – “most important interface in computer system”

  • Where hardware meets software
  • Simple does not necessarily mean less functional
  • Just 101 RISC-V instructions are sufficient to run a full OS (GNU/Linux) and

applications!

  • User-level: RV64I (40+15) + M (8+5) + A (11+11)
  • Privileged: Sv39 (7+4)
  • Optional: F (26+4) + D (26+6) + C (45)

CS152 Section 1 2020-01-31 12 / 32

slide-13
SLIDE 13

Welcome Arch vs µarch Microcode Lab 1 Overview

Power of Abstraction

How to bootstrap a new ISA

  • How many lines of code (C, assembly) needed to port a kernel and toolchain?

Linux : 113 files changed, 10307 insertions(+), 1 deletion(-) gcc : 67 files changed, 10295 insertions(+), 11 deletions(-) binutils : 56 files changed, 9982 insertions(+), 20 deletions(-) glibc : 178 files changed, 15169 insertions(+), 5 deletions(-)

  • ∼ 90% of Debian packages built for RV64 (Q2 2019; “buster”)
  • Out of 25,283 source packages
  • Out of 1,018,427,218 source lines of code

CS152 Section 1 2020-01-31 13 / 32

slide-14
SLIDE 14

Welcome Arch vs µarch Microcode Lab 1 Overview

So easy a dozen grad students can do it!

  • EOS22 tape-out (2014)
  • IBM 45nm SOI process
  • 1.65 GHz core frequency
  • 1st or 2nd RISC-V chip

to boot Linux

  • C. Sun, M. T. Wade,
  • Y. Lee, et al., “Single-chip

microprocessor that communicates directly using light,” Nature, vol. 528, p. 534, Dec. 2015

CS152 Section 1 2020-01-31 14 / 32

slide-15
SLIDE 15

Welcome Arch vs µarch Microcode Lab 1 Overview

Microcode

CS152 Section 1 2020-01-31 15 / 32

slide-16
SLIDE 16

Welcome Arch vs µarch Microcode Lab 1 Overview

Microprogramming

  • Separation of datapath (arithmetic, data movement) from control (sequencing of
  • perations on datapath)
  • Microcode program is essentially a description of a finite state machine
  • Implements an “interpreter” for a software-visible ISA (e.g., RISC-V)
  • Each microinstruction corresponds to one “state”
  • Microinstruction specifies outputs for given state and the next state

CS152 Section 1 2020-01-31 16 / 32

slide-17
SLIDE 17

Welcome Arch vs µarch Microcode Lab 1 Overview

Single-Bus Datapath

IR A B RegWr enReg MemWr enMem MA

addr addr data data

rs2 rs1 1 rd 32(PC) 1(RA)

RegSel busy? zero? ALUOp Opcode ldIR ldA ldB ldMA IntRq Memory 32 GPRs + PC

(32-bit registers)

ALU enALU

Immed Select

enImm ImmSel Bus

CS152 Section 1 2020-01-31 17 / 32

slide-18
SLIDE 18

Welcome Arch vs µarch Microcode Lab 1 Overview

Microcoded vs Pipelined

Q: How does a microcoded implementation differ from a classical RISC pipeline? Consider how the various instruction execution phases are implemented:

  • Instruction fetch
  • Instruction decode
  • Register read
  • ALU operations
  • Optional memory operations
  • Optional register writeback
  • Next instruction address (PC) calculation

Q: Why does microcoding generally facilitate a simpler microarchitecture?

CS152 Section 1 2020-01-31 18 / 32

slide-19
SLIDE 19

Welcome Arch vs µarch Microcode Lab 1 Overview

Historical Context

Q: Why did microcoding make sense historically?

  • ROM was cheaper and faster than logic
  • Simplified control complexity (helps verification)
  • CISC yielded better code density

(Do these still hold true today?)

CS152 Section 1 2020-01-31 19 / 32

slide-20
SLIDE 20

Welcome Arch vs µarch Microcode Lab 1 Overview

Historical Context

Recurring theme in architecture:

  • Design choices are influenced by the limitations of available circuit technology
  • Re-evaluation becomes necessary as technology changes

Avoid repeating past mistakes. . . but also know when old lessons may not apply

CS152 Section 1 2020-01-31 20 / 32

slide-21
SLIDE 21

Welcome Arch vs µarch Microcode Lab 1 Overview

Preemptive Clarification

Note: MemEn and RegEn are treated differently in the lecture and handout

Lecture Handout

Main Memory PC Registers 32 (PC) rd rs1 rs2 Register RAM Address In Data Out

  • Mem. Address

RegEn MemEn MemW RegW MALd RegSel Busy? Register RAM Main Memory RegEn RegW RegSel rs1 rs2 rd 32(PC) 1 (ra) MA MemEn MALd Busy? MemW

CS152 Section 1 2020-01-31 21 / 32

slide-22
SLIDE 22

Welcome Arch vs µarch Microcode Lab 1 Overview

Preemptive Clarification

RAM Array

Write/Read we ChipEnable addr dout din bus (internal details from handout)

MemEn and RegEn semantics

Lecture : Enable for tri-state buffer only Handout : General “chip enable” (CE)

  • Must also be asserted for writes,

not only reads

  • Nothing happens with memory

if de-asserted (logical 0)

CS152 Section 1 2020-01-31 22 / 32

slide-23
SLIDE 23

Welcome Arch vs µarch Microcode Lab 1 Overview

Preemptive Clarification

Tri-state buffers versus multiplexors

encoder

Bus using N tri-state buffers Bus using N:1 mux tree

  • Microcoded implementation in Lab 1 (Sodor) uses a mux tree instead of tri-state

buffers to drive the bus

  • Functionally equivalent; friendlier to logic synthesis
  • Easier mapping to ASIC standard cells and FPGA CLBs
  • Design simplicity is worth the marginal area overhead

CS152 Section 1 2020-01-31 23 / 32

slide-24
SLIDE 24

Welcome Arch vs µarch Microcode Lab 1 Overview

Preemptive Clarification

Takeaways

  • We will adhere to the lecture’s convention for convenience
  • Handout will be eventually updated to match
  • Will be clarified in exam questions
  • Many approaches are valid depending on implementation style
  • Be aware that old exam/quiz solutions may use differing conventions
  • When in doubt, state your assumptions clearly in answers

CS152 Section 1 2020-01-31 24 / 32

slide-25
SLIDE 25

Welcome Arch vs µarch Microcode Lab 1 Overview

Lab 1 Overview

CS152 Section 1 2020-01-31 25 / 32

slide-26
SLIDE 26

Welcome Arch vs µarch Microcode Lab 1 Overview

Lab Logistics

  • CS152 is partitioned into 5 modules
  • 1 problem set per module (∼ 1.5 weeks to complete)
  • 1 lab per module (∼ 2.5 weeks to complete)
  • Labs are “take-home” assignments
  • No dedicated lab sessions
  • Lab infrastructure pre-installed on instructional Linux servers
  • Log in remotely through ssh
  • Request an EECS instructional user account:

(Log into WebAcct service with CalNet ID) https://acropolis.cs.berkeley.edu/~account/webacct/

CS152 Section 1 2020-01-31 26 / 32

slide-27
SLIDE 27

Welcome Arch vs µarch Microcode Lab 1 Overview

Lab Reports

Lab reports must be typed in readable English – no raw dumps!

  • Directed portion
  • Must be completed individually
  • Submit one report per person on Gradescope
  • Open-ended portion
  • Pick one problem to do
  • Feel free to collaborate in groups of 2 or 3
  • Submit one report per group on Gradescope (limit 6 pages)
  • Feedback
  • Write as much or as little as desired – marked down only if completely omitted
  • Please answer team feedback questions
  • Append feedback to individual report

CS152 Section 1 2020-01-31 27 / 32

slide-28
SLIDE 28

Welcome Arch vs µarch Microcode Lab 1 Overview

Lab 1

Due on Feb 19 – start early!

  • Gentler introduction to simulation flow and software toolchain
  • Given source code for processor design descriptions
  • Build cycle-accurate simulators
  • Run benchmarks in behavioral RTL-level simulation; gather data
  • CPI
  • Instruction mix
  • Analyze; make recommendations; propose new designs

CS152 Section 1 2020-01-31 28 / 32

slide-29
SLIDE 29

Welcome Arch vs µarch Microcode Lab 1 Overview

Lab Framework

  • CS152 labs are built on current research infrastructure (designs, tools, flows)
  • Developed from scratch at UC Berkeley over past 10 years
  • We will strive to use real hardware implementations wherever possible
  • More interesting than a contrived pure-software model
  • Enables more realistic experiments
  • Actual systems sometimes exhibit counter-intuitive behavior

CS152 Section 1 2020-01-31 29 / 32

slide-30
SLIDE 30

Welcome Arch vs µarch Microcode Lab 1 Overview

Chisel

  • New hardware description language from

UC Berkeley

  • Embedded in Scala
  • A Chisel design is a legal Scala program that

produces a digital logical circuit as a graph data structure (FIRRTL)

  • Elaborates into synthesizable Verilog RTL
  • Leverage object-oriented/functional

programming paradigms to write highly parameterized generators

  • Industry adoption: SiFive, Google, others

https://www.chisel-lang.org/

Chisel language frontend FIRRTL passes Chisel design (*.scala) GDSII layout + netlist manipulation + dead code elimination + statistics collection Verilog for SW sim Verilog for FPGA Verilog for ASIC Verilator compilation FPGA syn/ place/route VLSI syn/ place/route Hardware compiler framework FPGA bitstream Cycle-accurate C++ model CS152 Section 1 2020-01-31 30 / 32

slide-31
SLIDE 31

Welcome Arch vs µarch Microcode Lab 1 Overview

Chisel

NOTE: Students will NOT be required to implement hardware in Chisel!

  • Complete processor designs in Chisel will be

provided to you in labs

  • But will need to know how to configure

parameters to generate different designs

  • Can choose to write Chisel RTL for some
  • pen-ended problems

Chisel language frontend FIRRTL passes Chisel design (*.scala) GDSII layout + netlist manipulation + dead code elimination + statistics collection Verilog for SW sim Verilog for FPGA Verilog for ASIC Verilator compilation FPGA syn/ place/route VLSI syn/ place/route Hardware compiler framework FPGA bitstream Cycle-accurate C++ model CS152 Section 1 2020-01-31 31 / 32

slide-32
SLIDE 32

Welcome Arch vs µarch Microcode Lab 1 Overview

Sodor

  • Collection of basic RV32I processors

implemented in Chisel

  • 1-stage pipeline
  • 2-stage pipeline
  • 3-stage pipeline
  • 5-stage pipeline
  • Fully bypassed
  • Interlocked (all hazards resolved

by stalling)

  • Microcoded
  • Educational: Favors clarity and

simplicity over PPA optimizations (power/performance/area)

Top Tile

Core CtlPath DatPath 3-ported Main Memory Debug Module Debug Module Interface

Test Harness

CS152 Section 1 2020-01-31 32 / 32