The Instruction Set Architecture
-
Upload
quintin-hollis -
Category
Documents
-
view
37 -
download
1
description
Transcript of The Instruction Set Architecture
![Page 1: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/1.jpg)
11
The Instruction Set The Instruction Set ArchitectureArchitecture
September 27September 27thth, 2007, 2007
By: Corbin JohnsonBy: Corbin Johnson
CS 146CS 146
![Page 2: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/2.jpg)
22
What is the Instruction Set What is the Instruction Set Architecture?Architecture?
It contains instructions to use and manipulate It contains instructions to use and manipulate programmer-accessible hardware in a computer.programmer-accessible hardware in a computer.
in terms of in terms of
place in a place in a
computercomputer
![Page 3: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/3.jpg)
33
What is the relationship between What is the relationship between the Instruction Set Architecture and the Instruction Set Architecture and
Assembly / Machine language?Assembly / Machine language?An assembly / machine program is made An assembly / machine program is made
up of the instructions in the ISA and up of the instructions in the ISA and makes use of registries in the ISA.makes use of registries in the ISA.
![Page 4: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/4.jpg)
44
Here’s how it worksHere’s how it works
Higher level languages (Java, C++, etc…) Higher level languages (Java, C++, etc…) are translated into assembly / machine are translated into assembly / machine language by compilers.language by compilers.
When a user calls the program, the When a user calls the program, the compiled program is loaded into RAM.compiled program is loaded into RAM.
The program then executes, line by line, The program then executes, line by line, until the Operating System takes back until the Operating System takes back control of the computer.control of the computer.
![Page 5: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/5.jpg)
55
A Sample Computer: ARCA Sample Computer: ARC
The ARC has an ISA that is a subset of The ARC has an ISA that is a subset of the ISA of the SPARC, or Scalable the ISA of the SPARC, or Scalable Processor Architecture processor Processor Architecture processor developed by Sun in the mid 80’s.developed by Sun in the mid 80’s.
Has most important features of SPARC Has most important features of SPARC but has left out most complex portions.but has left out most complex portions.
ARC is considered a RISC or “Reduced ARC is considered a RISC or “Reduced Instruction Set Computer.”Instruction Set Computer.”
![Page 6: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/6.jpg)
66
Goal: Program the ARCGoal: Program the ARC
A program can be written for the ARC A program can be written for the ARC using the ISA of the ARC.using the ISA of the ARC.
Discuss three main parts of ARC:Discuss three main parts of ARC:RAMRAMProcessor (CPU)Processor (CPU) Instruction SetInstruction Set
![Page 7: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/7.jpg)
77
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
32 bit memory32 bit memoryByte AddressableByte AddressableMemory-mapped I/OMemory-mapped I/O
![Page 8: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/8.jpg)
88
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The OSThe OS221111 bits of memory bits of memoryOnly OS uses this Only OS uses this
areaarea
![Page 9: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/9.jpg)
99
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The User SpaceThe User SpaceUndefined amountUndefined amountUser’s program fillsUser’s program fills
Into unused space Into unused space Designed to work well Designed to work well
If stack small and If stack small and
Program large or Program large or
Vice versa. Vice versa.
![Page 10: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/10.jpg)
1010
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The System StackThe System StackUndefined amountUndefined amountProgram’s executionProgram’s execution
Uses stack for storage Uses stack for storage Grows towards lowerGrows towards lower
Memory as user’s Memory as user’s
Space grows towardsSpace grows towards
Higher memory. Higher memory.
![Page 11: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/11.jpg)
1111
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
Memory-Mapped I/OMemory-Mapped I/OStatic slotsStatic slotsData talks with inputData talks with input
And output devices And output devices
![Page 12: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/12.jpg)
1212
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The CPUThe CPUExecutes programsExecutes programs
In main memoryIn main memory Contains RegistriesContains Registries
Holding dataHolding dataFour-Step cycle toFour-Step cycle to
Execute programExecute program
![Page 13: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/13.jpg)
1313
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The Four Step The Four Step
CycleCycle1)1) Fetch next instructionFetch next instruction
2)2) Decode the instructionDecode the instruction
3)3) Read operand in main Read operand in main memory if anymemory if any
4)4) Execute instruction and store Execute instruction and store results, if any.results, if any.
![Page 14: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/14.jpg)
1414
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The registersThe registers Positions in CPU that Positions in CPU that
hold data during hold data during calculationcalculation
Special Registries: Special Registries: %r0, %sp, %link, %psr, %r0, %sp, %link, %psr, % pc% pc
![Page 15: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/15.jpg)
1515
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
The Arithmetic and The Arithmetic and Logic UnitLogic Unit
Takes care of Takes care of calculations that need calculations that need to be executedto be executed
Fed instructions by the Fed instructions by the Control UnitControl Unit
![Page 16: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/16.jpg)
1616
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
Some Features of the ISA:Some Features of the ISA: All of the instructions in the Instruction Set are All of the instructions in the Instruction Set are
32 bit32 bit ARC is load-store: all operands must be either ARC is load-store: all operands must be either
loaded to use or stored in memory to be storedloaded to use or stored in memory to be stored ARC is two’s compliment ARC is two’s compliment
![Page 17: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/17.jpg)
1717
Discuss three main parts of ARC:Discuss three main parts of ARC: RAMRAM Processor (CPU)Processor (CPU) Instruction SetInstruction Set
Three different classes of instructions:Three different classes of instructions: Arithmetic and LogicArithmetic and Logic Memory AccessMemory Access Transfer of ControlTransfer of Control
![Page 18: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/18.jpg)
1818
Three different classes of instructions:Three different classes of instructions: Arithmetic and LogicArithmetic and Logic Memory AccessMemory Access Transfer of ControlTransfer of Control
Arithmetic and LogicArithmetic and LogicIncludes Includes instructions like Add instructions like Add and Subtractand SubtractAlso includes Also includes instructions like AND, instructions like AND, OR and NOT.OR and NOT.
![Page 19: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/19.jpg)
1919
Three different classes of instructions:Three different classes of instructions: Arithmetic and LogicArithmetic and Logic Memory AccessMemory Access Transfer of ControlTransfer of Control
Memory AccessMemory AccessIncludes Includes instructions load and instructions load and storestoreLoads into registers Loads into registers and stores into and stores into memory slots in RAMmemory slots in RAM
![Page 20: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/20.jpg)
2020
Three different classes of instructions:Three different classes of instructions: Arithmetic and LogicArithmetic and Logic Memory AccessMemory Access Transfer of ControlTransfer of Control
Transfer of ControlTransfer of ControlInstructions help get Instructions help get to different places in to different places in programprogramPlace in ISA where Place in ISA where conditionals first are conditionals first are seen (if statement, seen (if statement, loops, etc…)loops, etc…)Essentially changes Essentially changes program counter program counter registerregister
![Page 21: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/21.jpg)
2121
The Syntax of the ARC Assembly The Syntax of the ARC Assembly LanguageLanguage
The The MnemonicMnemonic is a way for the programmer is a way for the programmer to remember the instruction’s name.to remember the instruction’s name.
A A CompilerCompiler will take a written assembly will take a written assembly language code and convert it to machine language code and convert it to machine code.code.
![Page 22: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/22.jpg)
2222
What’s that cc after addcc?What’s that cc after addcc?
CC stands for Condition Code and they are set in the CC stands for Condition Code and they are set in the PSR (it is a 32 bit registry)PSR (it is a 32 bit registry)
There are 4: There are 4:
Z: if the result of the instruction is zero, this flag is set.Z: if the result of the instruction is zero, this flag is set.
N: if the most significant bit is 1, this bit is setN: if the most significant bit is 1, this bit is set
C: if there is a carry out of the MSB or a borrow into it, C: if there is a carry out of the MSB or a borrow into it, this flag is set.this flag is set.
V: Overflow. The result cannot be represented in 32 V: Overflow. The result cannot be represented in 32 bits.bits.
![Page 23: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/23.jpg)
2323
THE PSR THE PSR (Processor Status Register)(Processor Status Register)
![Page 24: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/24.jpg)
2424
More on The Syntax of the ARC More on The Syntax of the ARC Assembly LanguageAssembly Language
Brackets Brackets [ ] around an operand means to load [ ] around an operand means to load (or store) from (or in) the memory which is (or store) from (or in) the memory which is addressed by the operand within the brackets.addressed by the operand within the brackets.
![Page 25: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/25.jpg)
2525
A few of the 35 instructionsA few of the 35 instructions
The ARC ISA has more than 35 The ARC ISA has more than 35 instructions.instructions.
Memory: ld [%r5 + 2064] , %r1Memory: ld [%r5 + 2064] , %r1Arithmetic: addcc %r1, 129, %r1Arithmetic: addcc %r1, 129, %r1Control: call sub_rControl: call sub_r
![Page 26: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/26.jpg)
2626
From Assembly Language to From Assembly Language to Machine CodeMachine Code
Each Assembly Each Assembly Language Language instruction is instruction is translated one translated one line for one line line for one line (one to one).(one to one).
rd: destination registryrd: destination registry
Cond: based on the PSR, this Cond: based on the PSR, this executes differentlyexecutes differently
Simm13: a user defined Simm13: a user defined constant in 2’s compliment constant in 2’s compliment in 13 bits.in 13 bits.
Rs1: registry 1 in the CPURs1: registry 1 in the CPU
Disp30/Disp 22: 30/22 bit number is Disp30/Disp 22: 30/22 bit number is shifted to the left to achieve 32 bit shifted to the left to achieve 32 bit destination of it’s function.destination of it’s function.
![Page 27: The Instruction Set Architecture](https://reader034.fdocuments.us/reader034/viewer/2022051416/5681354f550346895d9cad22/html5/thumbnails/27.jpg)
2727
SummarySummary
Although not explicitly shown, this method Although not explicitly shown, this method will take an upper level program and will take an upper level program and convert it into actual things the computer convert it into actual things the computer can do.can do.
Involves translation from the higher level Involves translation from the higher level into assembly language into machine code into assembly language into machine code using the ARC ISA.using the ARC ISA.