Download presentation
Presentation is loading. Please wait.
Published byMolly Bridges Modified over 8 years ago
1
Pirouz Bazargan SabetDecember 2003 Effective Implementation of a 32-bit RISC Processor Pirouz Bazargan Sabet University of Paris 6 - LIP6 - ASIM Pirouz.Bazargan-Sabet@lip6.fr
2
Pirouz Bazargan SabetDecember 2003 Outline Architecture of a RISC Processor Implementation
3
Pirouz Bazargan SabetDecember 2003 Introduction Architecture ? All aspects visible from the USER’s (programmer) point of view External view Specifications of the processor What the processor is supposed to do
4
Pirouz Bazargan SabetDecember 2003 Introduction Implementation ? All aspects visible from the DESIGNER’s point of view Internal view How much time does it take to perform some operation ? Which hardware may be used and how it should be organized to make the specifications feasable
5
Pirouz Bazargan SabetDecember 2003 Software visible registers The instruction set Architecture Memory Addressing The exception / reset mechanism
6
Pirouz Bazargan SabetDecember 2003 Architecture Architecture of the MIPS processor Mips ? A 32-bit processor One of the two first RISC architectures Defined in 1981 by the Architecture Research Group at the Stanford University (John Hennessy)
7
Pirouz Bazargan SabetDecember 2003 Architecture Simplified Mips-R3000 architecture No floating point operations No virtual memory management
8
Pirouz Bazargan SabetDecember 2003 Software visible registers The instruction set Architecture Memory Addressing The exception / reset mechanism
9
Pirouz Bazargan SabetDecember 2003 Architecture Software visible registers Registers that can be manipulated (written and read) in the assembly language
10
Pirouz Bazargan SabetDecember 2003 Software Visible Registers 32 common 32-bit registers Integer Registers R 0 …. R 31 Addressed from their number
11
Pirouz Bazargan SabetDecember 2003 Software Visible Registers R 0 : The Trash Register R 0 contains always 0 A value written into R 0 is lost R 31 : The Link Register When a subroutine is called, the return address is saved into R 31
12
Pirouz Bazargan SabetDecember 2003 Software Visible Registers Two 32-bit registers : HI and LO Used by multiply and divide instructions Multiply 32 most significant bits 32 least significant bits HI LO Divide Result Remainder HI LO
13
Pirouz Bazargan SabetDecember 2003 Software Visible Registers Four 32-bit special registers : Coprocessor Registers Needed to implement an operating system SRStatus Register CAUSECause Register (cause of exceptions) EPCException Program Counter (return address in case of exception) BAR Bad Address Register (illegal memory address)
14
Pirouz Bazargan SabetDecember 2003 Software visible registers The instruction set Architecture Memory Addressing The exception / reset mechanism
15
Pirouz Bazargan SabetDecember 2003 Memory Addressing 32-bit address 4 Gbytes of memory space Read / Write operations 3 types of data : Half-word (2 bytes) Word (4 bytes) Byte
16
Pirouz Bazargan SabetDecember 2003 Memory Addressing The processor can operate under 2 modes User / Kernel 1 1 : user 0 : kernel The current mode is defined by the Status Register Status Register
17
Pirouz Bazargan SabetDecember 2003 Memory Addressing The memory space is divided into 2 parts In User mode the processor can only access the addresses ranged from 0000 0000 to 7FFF FFF 0000 7FFF FFFF 8000 0000 FFFF USER
18
Pirouz Bazargan SabetDecember 2003 Memory Addressing 0000 7FFF FFFF 8000 0000 FFFF The OS protects the hardware against an error in a User program USER O S The frontier protects the OS
19
Pirouz Bazargan SabetDecember 2003 Memory Addressing lsbMsb memory register Data alignment rule
20
Pirouz Bazargan SabetDecember 2003 Memory Addressing lsbMsb memory register Bytes’ order : Little Endian 0000 FFFF
21
Pirouz Bazargan SabetDecember 2003 Memory Addressing Address alignment rule The address of an object of N bytes must be multiple of N Address of a Word multiple of 4 Address of a Half-Word multiple of 2 Address of a Byte multiple of 1
22
Pirouz Bazargan SabetDecember 2003 Software visible registers The instruction set Architecture Memory Addressing The exception / reset mechanism
23
Pirouz Bazargan SabetDecember 2003 Instruction Set RISC Architecture Only simple instructions All instructions have the same size (32 bits) 3-operand instructions (2 read, 1 write) No operation involving operands in memory - Only load and store operations
24
Pirouz Bazargan SabetDecember 2003 Instruction Set 3 instruction formats Register-register instructionsR Immediate instructionsI Jump instructionsJ
25
Pirouz Bazargan SabetDecember 2003 Instruction Set R format opcodOperation code funcFunction (opcod extension) rs# of source register rt# of source register rd# of destination register shamShift amount (# of bit the opr. is shifted) 6 opcod 5 rs 5 rt 5 rd 5 sham 6 func
26
Pirouz Bazargan SabetDecember 2003 Instruction Set I format opcodOperation code rs# of source register rt / rd# of source or destination register imdImmediate value 6 opcod 5 rs 5 rt/rd 16 imd
27
Pirouz Bazargan SabetDecember 2003 Instruction Set J format opcodOperation code imdImmediate value 6 opcod 26 imd
28
Pirouz Bazargan SabetDecember 2003 Instruction Set Arithmetic and logic instructions Control instructions Memory access instructions System instructions
29
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format Add Rd, Rs, RtRs+Rt Rd Overflow exc. add opcodrsrtrdfunc R format
30
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrdimd I format Addi Rd, Rs, ImdRs+Imd Rd add immediate Overflow exc. Imd is sign extended Rs Rd Imd
31
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc Addu Rd, Rs, RtRs+Rt Rd No overflow add unsigned R format
32
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrdimd I format Addiu Rd, Rs, ImdRs+Imd Rd add immediate unsigned No overflow Imd is sign extended Rs Rd Imd
33
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Sub Rd, Rs, Rt Rs – Rt Rd Overflow exc. subtract
34
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Subu Rd, Rs, Rt Rs – Rt Rd No overflow Subtract unsigned
35
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Or Rd, Rs, RtRs or Rt Rd bitwise logic OR
36
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrdimd I format Ori Rd, Rs, ImdRs or Imd Rd bitwise logic OR immediate Imd is zero extended Rs Rd 0 0 Imd
37
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format And Rd, Rs, RtRs and Rt Rd bitwise logic AND
38
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrdimd I format Andi Rd, Rs, ImdRs and Imd Rd bitwise logic AND immediate Imd is zero extended Rs Rd Imd 0 0
39
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Xor Rd, Rs, RtRs xor Rt Rd bitwise logic XOR
40
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrdimd I format Xori Rd, Rs, ImdRs xor Imd Rd bitwise logic XOR immediate Imd is zero extended Rs Rd Imd 0 0
41
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Nor Rd, Rs, RtRs nor Rt Rd bitwise logic NOR
42
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodshamrtrdfunc R format Sll Rd, Rt, ShamRt << Sham Rd Shift left logic 0 Sham Rt Rd
43
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Sllv Rd, Rt, RsRt << Rs Rd Shift left logic variable 0 Rt Rd Rs Only the 5 lsb of Rs are meaningful
44
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodshamrtrdfunc R format Srl Rd, Rt, ShamRt >> Sham Rd Shift right logic 0 Sham Rt Rd
45
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Srlv Rd, Rt, RsRt >> Rs Rd Shift right logic variable Rs Only the 5 lsb of Rs are meaningful 0 Rt Rd
46
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodshamrtrdfunc R format Sra Rd, Rt, ShamRt >> Sham Rd Shift right arithmetic Sham Rt Rd
47
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Srav Rd, Rt, RsRt >> Rs Rd Shift right arithmetic variable Rs Only the 5 lsb of Rs are meaningful Rt Rd
48
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Slt Rd, Rs, RtRs < Rt ? Set if less than 0 Rd 1 Rd Yes : No : Operands are signed
49
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format Slti Rd, Rs, ImdRs < Imd ? Set if less than immediate 0 Rd 1 Rd Yes : No : Operands are signed Imd is sign extended opcodrsrdimd I format
50
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrsrtrdfunc R format Sltu Rd, Rs, RtRs < Rt ? Set if less than unsigned 0 Rd 1 Rd Yes : No : Operands are unsigned
51
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format Sltiu Rd, Rs, ImdRs < Imd ? Set if less than immediate, unsigned 0 Rd 1 Rd Yes : No : Operands are unsigned Imd is zero extended opcodrsrdimd I format
52
Pirouz Bazargan SabetDecember 2003 Arithmetic and logic Assembly language Action Format opcodrdimd I format Lui Rd, ImdImd << 16 Rd load upper immediate 0 0 Rd
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.