32
RISC V - Architecture and Interfaces The RocketChip Moritz Nöltner-Augustin Institut für Technische Informatik Lehrstuhl für Rechnerarchitektur Universität Heidelberg February 6, 2017

RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

RISC V - Architecture and InterfacesThe RocketChip

Moritz Nöltner-Augustin

Institut für Technische InformatikLehrstuhl für Rechnerarchitektur

Universität Heidelberg

February 6, 2017

Page 2: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Table of Contents

1 Introduction

2 Structure

3 Interfaces

4 Conclusion

Moritz Nöltner-Augustin 2 / 26

Page 3: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Table of Contents

1 Introduction

2 Structure

3 Interfaces

4 Conclusion

Moritz Nöltner-Augustin 3 / 26

Page 4: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

What is RISCV?

Source: https://riscv.org

Open-source Instruction SetArchitecture (ISA)One ISA to cover allcomputer devices3 ISAs (32-128 bits)Meant for implementation

ModularExtensibleActively developedA good investment?

Moritz Nöltner-Augustin 4 / 26

Page 5: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Why should I care?

lowRISC aims to create the processor pendantof linux

SiFive and Open-V create custom silicon

ETH Zurich and Università di Bologna createa state of the art microcontroller

NVIDIA replacesFalcon processor

IIT Madrascreates aprocessor

UC Berkeley usesit for reasearch

Sources: [1]

Moritz Nöltner-Augustin 5 / 26

Page 6: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Table of Contents

1 Introduction

2 Structure

3 Interfaces

4 Conclusion

Moritz Nöltner-Augustin 6 / 26

Page 7: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

What is RocketChip?

Tile1

BOOM L1I$

L1D$

RoCCAccel.

FPU

L1toL2 Network

Tile2

Rocket L1I$

L1D$

RoCCAccel.FPU

L2toIO Network

L2$ Bank

TileLink/AXI4Bridge

AXI4 Crossbar

DRAMController

High-Speed

IO DeviceAHB & APBPeripherals

A

B

C

D

E

F

TIleLink

Core

Cache

RoCC

TIle

Periph.

Source: [2]

Moritz Nöltner-Augustin 7 / 26

Page 8: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

How can I ”use” RocketChip?

git clone https://github.com/ucb-bar/rocket-chip.gitcd rocket-chip#git checkout boomgit submodule update --init --recursive# Now the repo is about 3GBcd riscv-toolsexport RISCV=/path/to/toolchain/installexport PATH="${PATH}:$RISCV/bin"./build.sh # Takes about 45 min# The toolchain is another 800MBcd ../emulatormake run CONFIG=BOOMConfigmake run CONFIG=ExampleSmallConfigcd ../vsimmake -jN CONFIG=ExampleSmallConfig # about 20 min

Source: Collected from [3] and [4]

Moritz Nöltner-Augustin 8 / 26

Page 9: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

What can be configured?

A selection from$(ROCKET-CHIP)/src/main/scala/coreplex/Configs.scala:

Tile (RC || Boom): Caches: Uncore:

Instruction widthIFetch widthUse debug#Breakpoints#Perf. CountersFPU keyMult. div. keyUse atomics

#Sets#Ways#TLB-Entries#row bits#id bitssplit metadataECC codeReplacementpolicy

TileLink configL1toL2 configBroadcast configBanked L2 configBootrom#Tiles$block #bytesBuild Core?

Moritz Nöltner-Augustin 9 / 26

Page 10: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

How to configure RocketChip? /1

$(RC)/src/main/scala/coreplex/Configs.scala:case CacheBlockBytes => 64case CacheName("L1D") => CacheConfig(nSets = 64,nWays = 4,rowBits = site(L1toL2Config).beatBytes*8,nTLBEntries = 8,cacheIdBits = 0,splitMetadata = false)

...class WithL1ICacheSets(sets:Int) extends Config((site,here,up)=>{case CacheName("L1I")=>up(CacheName("L1I"), site).copy(nSets=sets)}) // Likewise for nWaysclass WithCacheBlockBytes(linesize:Int)

extends Config((site,here,up)=>{case CacheBlockBytes => linesize})

Moritz Nöltner-Augustin 10 / 26

Page 11: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

How to configure RocketChip? /2

$(ROCKET-CHIP)/src/main/scala/rocketchip/Configs.scalaclass DualCoreConfig2way extends Config(

new WithNCores(2) ++ new WithL1ICacheWays(2)++ new WithL1ICacheSets(32) ++ new WithCacheBlockBytes(64)++ new WithL2Cache ++ new BaseConfig)

class DualCoreConfig4way extends Config(new WithNCores(2) ++ new WithL1ICacheWays(4)++ new WithL1ICacheSets(64) ++ new WithCacheBlockBytes(32)++ new WithL2Cache ++ new BaseConfig)

...cd rocket-chip/vsimmake -j5 CONFIG=DualCoreConfig2way...make -j5 CONFIG=DualCoreConfig4way

Moritz Nöltner-Augustin 11 / 26

Page 12: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

How to configure RocketChip? /2

$(ROCKET-CHIP)/src/main/scala/rocketchip/Configs.scalaclass DualCoreConfig2way extends Config(

new WithNCores(2) ++ new WithL1ICacheWays(2)++ new WithL1ICacheSets(32) ++ new WithCacheBlockBytes(64)++ new WithL2Cache ++ new BaseConfig)

class DualCoreConfig4way extends Config(new WithNCores(2) ++ new WithL1ICacheWays(4)++ new WithL1ICacheSets(64) ++ new WithCacheBlockBytes(32)++ new WithL2Cache ++ new BaseConfig)

...cd rocket-chip/vsimmake -j5 CONFIG=DualCoreConfig2way...make -j5 CONFIG=DualCoreConfig4way

Moritz Nöltner-Augustin 11 / 26

Page 13: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Cache Example, 2-Way

Main Memory

𝑖𝑡ℎ lineMem-block

𝑖𝑡ℎ lineMem-block

𝑖𝑡ℎ lineMem-block

index i

Cache

Set 0

Cache-block 32sets

Set 1

Cache-block 32sets

64bytes

Address Logic

Address

tag[

20:0

]in

dex[

4:0]

orhit

TagMem 1

=

TagMem 0

=

Moritz Nöltner-Augustin 12 / 26

Page 14: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Cache Example, 4-Way

Main Memory

𝑖𝑡ℎ lineMem-block

𝑖𝑡ℎ lineMem-block

𝑖𝑡ℎ lineMem-block

index i

Cache

Set 0

Cache-block 64sets

Set 1

Cache-block 64sets

Set 2

Cache-block 64sets

Set 3

Cache-block 64sets

32bytes

Address Logic

Address

tag[

20:0

]in

dex[

5:0]

orhit

TagMem 3

=

TagMem 2

=

TagMem 1

=

TagMem 0

=

Moritz Nöltner-Augustin 13 / 26

Page 15: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Results: Module ICache_icache (2 ways, 32 sets, 64 bytes)module tag_array( // x1

input [4:0] RW0_addr,input RW0_en,input RW0_clk,input RW0_wmode,input [20:0] RW0_wdata_0,input [20:0] RW0_wdata_1,output [20:0] RW0_rdata_0,output [20:0] RW0_rdata_1,input RW0_wmask_0,input RW0_wmask_1

);reg [41:0] ram [31:0];

module _T_772( // x2input [7:0] RW0_addr,input RW0_en,input RW0_clk,input RW0_wmode,input [63:0] RW0_wdata,output [63:0] RW0_rdata

);reg [63:0] ram [255:0];

Moritz Nöltner-Augustin 14 / 26

Page 16: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Results: Module ICache_icache (4 ways, 64 sets, 32 bytes)module tag_array( // x1

input [5:0] RW0_addr,input RW0_en,input RW0_clk,input RW0_wmode,input [20:0] RW0_wdata_0,input [20:0] RW0_wdata_1,input [20:0] RW0_wdata_2,input [20:0] RW0_wdata_3,output [20:0] RW0_rdata_0,output [20:0] RW0_rdata_1,output [20:0] RW0_rdata_2,output [20:0] RW0_rdata_3,input RW0_wmask_0,input RW0_wmask_1,input RW0_wmask_2,input RW0_wmask_3

);reg [83:0] ram [63:0];

module _T_850( // x4input [7:0] RW0_addr,input RW0_en,input RW0_clk,input RW0_wmode,input [63:0] RW0_wdata,output [63:0] RW0_rdata

);reg [63:0] ram [255:0];

Moritz Nöltner-Augustin 15 / 26

Page 17: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Table of Contents

1 Introduction

2 Structure

3 Interfaces

4 Conclusion

Moritz Nöltner-Augustin 16 / 26

Page 18: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

RocketChip Interfaces

ExampleRocketTop

clockreset

io_interrupt_0_0io_interrupt_0_1

io_mem_axi4_0io_mio_axi4_0

TileLinkTileLink

451 signals per TileLink

TileLink: Data + Opcode

282 signals per AXI interface

io_l2_axi4_0 optional

Signal Bundle PrefixWrite Address Channel …_aw_…Write Data Channel …_w_…Write Response …_b_…Read Address Channel …_ar_…Read Data Channel …_r_…(Low Power Interface) …_c_…

Moritz Nöltner-Augustin 17 / 26

Page 19: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

RocketChip Interfaces

ExampleRocketTop

clockreset

io_interrupt_0_0io_interrupt_0_1

io_mem_axi4_0io_mio_axi4_0

TileLinkTileLink

451 signals per TileLink

TileLink: Data + Opcode

282 signals per AXI interface

io_l2_axi4_0 optional

Signal Bundle PrefixWrite Address Channel …_aw_…Write Data Channel …_w_…Write Response …_b_…Read Address Channel …_ar_…Read Data Channel …_r_…(Low Power Interface) …_c_…

Moritz Nöltner-Augustin 17 / 26

Page 20: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

AXI Read

Source: Taken from [5]

Moritz Nöltner-Augustin 18 / 26

Page 21: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

AXI Write

Source: Taken from [5]

Moritz Nöltner-Augustin 19 / 26

Page 22: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

AXI Features

Burst up to 256 transfersMemory attributesTransaction bufferingPrivileged, secure,instruction bits

Transaction IDsExclusive AccessAtomicy sizeQuality of Service signals

Moritz Nöltner-Augustin 20 / 26

Page 23: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

TileLink: Inter-tile cache coherence network

AgentsClient Request/hold $ block

Manager Oversee permission and data flowChannels

Aquire Start read/write uncachedProbe Check if client has $-block/revoke permissions

Release Free data/write backGrant Provide data/permissionsFinish Final acknowledgement from requestor

Refer to the specification for definitions of the exactoperations

Moritz Nöltner-Augustin 21 / 26

Page 24: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

TileLink: Operations

Memory

Manager

Client0

Client1

Client2

Manager Don’t accept transactions for in-flight blocksClient Don’t release block with outstanding voluntary write-back

Moritz Nöltner-Augustin 22 / 26

Page 25: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

TileLink: Operations

Memory

Manager

Client0

Client1

Client2

A

P R

A G

G F

Request

Manager Don’t accept transactions for in-flight blocksClient Don’t release block with outstanding voluntary write-back

Moritz Nöltner-Augustin 22 / 26

Page 26: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

TileLink: Operations

Memory

Manager

Client0

Client1

Client2

A

P R

A G

G F

Request

R

R G

G

Release

Manager Don’t accept transactions for in-flight blocksClient Don’t release block with outstanding voluntary write-back

Moritz Nöltner-Augustin 22 / 26

Page 27: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

TileLink: Operations

Memory

Manager

Client0

Client1

Client2

A

P R

A G

G F

Request

R

R G

G

Release

Manager Don’t accept transactions for in-flight blocksClient Don’t release block with outstanding voluntary write-back

Moritz Nöltner-Augustin 22 / 26

Page 28: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

RocketChip Interfaces

Source: Clipped from [6]

Moritz Nöltner-Augustin 23 / 26

Page 29: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Table of Contents

1 Introduction

2 Structure

3 Interfaces

4 Conclusion

Moritz Nöltner-Augustin 24 / 26

Page 30: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

Conclusion

RISC-V is here to stayRocketChip generates SoCCan use Rocket or BoomLots of configuration options

Chisel is hard to readGenerated Verilog is worseRocketChip exposes AXIMany standard AXI IP

Moritz Nöltner-Augustin 25 / 26

Page 31: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

ReferencesSome users of the RISC-V ISAlowRISC: http://www.lowrisc.org/; SiFive: https://www.sifive.com/Open-V: https://www.crowdsupply.com/onchip/open-v Pulp: http://www.pulp-platform.org;IID Madras: http://rise.cse.iitm.ac.in/shakti.htmlNvidia: https://riscv.org/wp-content/uploads/2016/07/Tue1100_Nvidia_RISCV_Story_V2.pdfUC Berkeley: https://www.youtube.com/watch?v=WJndUQssFBg&t=1539s

Asanović, Krste/Avizienis, Rimas/Bachrach, Jonathan et at. (2016)The Rocket Chip Generator.Technical Report No. UCB/EECS-2016-17, EECS Department, University of California, Berkeley.http://www2.eecs.berkeley.edu/Pubs/TechRpts/2016/EECS-2016-17.html

The RocketChip github pageshttps://github.com/ucb-bar/rocket-chiphttps://github.com/ucb-bar/project-template

The Berkeley Out Of Order Machine github pagehttps://github.com/ucb-bar/riscv-boom

AXI Reference Guide, Xilinx 2011http://www.xilinx.com/support/documentation/ip_documentation/ug761_axi_reference_guide.pdf

Xuan Guo, Nathanael Davison, Profir-Petru Partachi, Alistair Fisher (2016)Technical report from the lowRISC Summer Internship 2016http://www.lowrisc.org/docs/internship-2016/report

AMBA® AXI™ and ACE™ Protocol Specification, ARM Limited 2011http://infocenter.arm.com/help/topic/com.arm.doc.ihi0022d/index.htmlhttp://www.gstitt.ece.ufl.edu/courses/fall15/eel4720_5721/labs/refs/AXI4_specification.pdf

The TileLink Specification, Version 0.3.3https://docs.google.com/document/d/1Iczcjigc-LUi8QmDPwnAu1kH4Rrt6Kqi1_EUaCrfrk8/pub

Moritz Nöltner-Augustin 26 / 26

Page 32: RISC V - Architecture and Interfaces - The RocketChip · RISCV-ArchitectureandInterfaces TheRocketChip MoritzNöltner-Augustin InstitutfürTechnischeInformatik LehrstuhlfürRechnerarchitektur

Introduction Structure Interfaces Conclusion

End

Time for your questions

Moritz Nöltner-Augustin 26 / 26