实例介绍
【实例截图】
【核心代码】
Contents Preface i 1 Introduction 1 1.1 RISC-V Hardware Platform Terminology . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 RISC-V Software Execution Environments and Harts . . . . . . . . . . . . . . . . . . 3 1.3 RISC-V ISA Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.5 Base Instruction-Length Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.6 Exceptions, Traps, and Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.7 UNSPECIFIED Behaviors and Values . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 RV32I Base Integer Instruction Set, Version 2.1 13 2.1 Programmers’ Model for Base Integer ISA . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2 Base Instruction Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3 Immediate Encoding Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.4 Integer Computational Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.5 Control Transfer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.6 Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.7 Memory Ordering Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.8 Environment Call and Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.9 HINT Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 ix x Volume I: RISC-V Unprivileged ISA V20191214-draft 3 “Zifencei” Instruction-Fetch Fence, Version 2.0 31 4 RV32E Base Integer Instruction Set, Version 1.9 33 4.1 RV32E Programmers’ Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.2 RV32E Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5 RV64I Base Integer Instruction Set, Version 2.1 35 5.1 Register State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.2 Integer Computational Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.3 Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.4 HINT Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6 RV128I Base Integer Instruction Set, Version 1.7 41 7 “M” Standard Extension for Integer Multiplication and Division, Version 2.0 43 7.1 Multiplication Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 7.2 Division Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 8 “A” Standard Extension for Atomic Instructions, Version 2.1 47 8.1 Specifying Ordering of Atomic Instructions . . . . . . . . . . . . . . . . . . . . . . . 47 8.2 Load-Reserved/Store-Conditional Instructions . . . . . . . . . . . . . . . . . . . . . . 48 8.3 Eventual Success of Store-Conditional Instructions . . . . . . . . . . . . . . . . . . . 51 8.4 Atomic Memory Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 9 “Zicsr”, Control and Status Register (CSR) Instructions, Version 2.0 55 9.1 CSR Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 10 Counters 59 10.1 Base Counters and Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 10.2 Hardware Performance Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 11 “F” Standard Extension for Single-Precision Floating-Point, Version 2.2 63 Volume I: RISC-V Unprivileged ISA V20191214-draft xi 11.1 F Register State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 11.2 Floating-Point Control and Status Register . . . . . . . . . . . . . . . . . . . . . . . 65 11.3 NaN Generation and Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 11.4 Subnormal Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 11.5 Single-Precision Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . 67 11.6 Single-Precision Floating-Point Computational Instructions . . . . . . . . . . . . . . 67 11.7 Single-Precision Floating-Point Conversion and Move Instructions . . . . . . . . . . 69 11.8 Single-Precision Floating-Point Compare Instructions . . . . . . . . . . . . . . . . . . 71 11.9 Single-Precision Floating-Point Classify Instruction . . . . . . . . . . . . . . . . . . . 72 12 “D” Standard Extension for Double-Precision Floating-Point, Version 2.2 73 12.1 D Register State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 12.2 NaN Boxing of Narrower Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 12.3 Double-Precision Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . 74 12.4 Double-Precision Floating-Point Computational Instructions . . . . . . . . . . . . . . 75 12.5 Double-Precision Floating-Point Conversion and Move Instructions . . . . . . . . . . 75 12.6 Double-Precision Floating-Point Compare Instructions . . . . . . . . . . . . . . . . . 77 12.7 Double-Precision Floating-Point Classify Instruction . . . . . . . . . . . . . . . . . . 77 13 “Q” Standard Extension for Quad-Precision Floating-Point, Version 2.2 79 13.1 Quad-Precision Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . 79 13.2 Quad-Precision Computational Instructions . . . . . . . . . . . . . . . . . . . . . . . 80 13.3 Quad-Precision Convert and Move Instructions . . . . . . . . . . . . . . . . . . . . . 80 13.4 Quad-Precision Floating-Point Compare Instructions . . . . . . . . . . . . . . . . . . 81 13.5 Quad-Precision Floating-Point Classify Instruction . . . . . . . . . . . . . . . . . . . 82 14 RVWMO Memory Consistency Model, Version 2.0 83 14.1 Definition of the RVWMO Memory Model . . . . . . . . . . . . . . . . . . . . . . . . 84 14.2 CSR Dependency Tracking Granularity . . . . . . . . . . . . . . . . . . . . . . . . . 88 xii Volume I: RISC-V Unprivileged ISA V20191214-draft 14.3 Source and Destination Register Listings . . . . . . . . . . . . . . . . . . . . . . . . . 88 15 “L” Standard Extension for Decimal Floating-Point, Version 0.0 95 15.1 Decimal Floating-Point Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 16 “C” Standard Extension for Compressed Instructions, Version 2.0 97 16.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 16.2 Compressed Instruction Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 16.3 Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 16.4 Control Transfer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 16.5 Integer Computational Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 16.6 Usage of C Instructions in LR/SC Sequences . . . . . . . . . . . . . . . . . . . . . . 110 16.7 HINT Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 16.8 RVC Instruction Set Listings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 17 “B” Standard Extension for Bit Manipulation, Version 0.0 115 18 “J” Standard Extension for Dynamically Translated Languages, Version 0.0 117 19 “T” Standard Extension for Transactional Memory, Version 0.0 119 20 “P” Standard Extension for Packed-SIMD Instructions, Version 0.2 121 21 “V” Standard Extension for Vector Operations, Version 0.7 123 22 “Zam” Standard Extension for Misaligned Atomics, v0.1 125 23 “Ztso” Standard Extension for Total Store Ordering, v0.1 127 24 RV32/64G Instruction Set Listings 129 25 RISC-V Assembly Programmer’s Handbook 137 26 Extending RISC-V 141 Volume I: RISC-V Unprivileged ISA V20191214-draft xiii 26.1 Extension Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 26.2 RISC-V Extension Design Philosophy . . . . . . . . . . . . . . . . . . . . . . . . . . 144 26.3 Extensions within fixed-width 32-bit instruction format . . . . . . . . . . . . . . . . 144 26.4 Adding aligned 64-bit instruction extensions . . . . . . . . . . . . . . . . . . . . . . . 146 26.5 Supporting VLIW encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 27 ISA Extension Naming Conventions 149 27.1 Case Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 27.2 Base Integer ISA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 27.3 Instruction-Set Extension Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 27.4 Version Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 27.5 Underscores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 27.6 Additional Standard Extension Names . . . . . . . . . . . . . . . . . . . . . . . . . . 150 27.7 Supervisor-level Instruction-Set Extensions . . . . . . . . . . . . . . . . . . . . . . . 151 27.8 Hypervisor-level Instruction-Set Extensions . . . . . . . . . . . . . . . . . . . . . . . 151 27.9 Machine-level Instruction-Set Extensions . . . . . . . . . . . . . . . . . . . . . . . . . 151 27.10Non-Standard Extension Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 27.11Subset Naming Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 28 History and Acknowledgments 153 28.1 “Why Develop a new ISA?” Rationale from Berkeley Group . . . . . . . . . . . . . . 153 28.2 History from Revision 1.0 of ISA manual . . . . . . . . . . . . . . . . . . . . . . . . . 155 28.3 History from Revision 2.0 of ISA manual . . . . . . . . . . . . . . . . . . . . . . . . . 156 28.4 History from Revision 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 28.5 History from Revision 2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 28.6 History for Revision 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 28.7 Funding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 A RVWMO Explanatory Material, Version 0.1 161 xiv Volume I: RISC-V Unprivileged ISA V20191214-draft A.1 Why RVWMO? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 A.2 Litmus Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 A.3 Explaining the RVWMO Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 A.3.1 Preserved Program Order and Global Memory Order . . . . . . . . . . . . . . 163 A.3.2 Load Value Axiom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 A.3.3 Atomicity Axiom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 A.3.4 Progress Axiom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 A.3.5 Overlapping-Address Orderings (Rules 1–3) . . . . . . . . . . . . . . . . . . . 168 A.3.6 Fences (Rule 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 A.3.7 Explicit Synchronization (Rules 5–8) . . . . . . . . . . . . . . . . . . . . . . . 171 A.3.8 Syntactic Dependencies (Rules 9–11) . . . . . . . . . . . . . . . . . . . . . . . 173 A.3.9 Pipeline Dependencies (Rules 12–13) . . . . . . . . . . . . . . . . . . . . . . . 176 A.4 Beyond Main Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 A.4.1 Coherence and Cacheability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 A.4.2 I/O Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 A.5 Code Porting and Mapping Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . 180 A.6 Implementation Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 A.6.1 Possible Future Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 A.7 Known Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 A.7.1 Mixed-size RSW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 B Formal Memory Model Specifications, Version 0.1 191 B.1 Formal Axiomatic Specification in Alloy . . . . . . . . . . . . . . . . . . . . . . . . . 192 B.2 Formal Axiomatic Specification in Herd . . . . . . . . . . . . . . . . . . . . . . . . . 197 B.3 An Operational Memory Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 B.3.1 Intra-instruction Pseudocode Execution . . . . . . . . . . . . . . . . . . . . . 204 B.3.2 Instruction Instance State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 B.3.3 Hart State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Volume I: RISC-V Unprivileged ISA V20191214-draft xv B.3.4 Shared Memory State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 B.3.5 Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 B.3.6 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
标签: 手册
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论