FIT1008 Lecture Notes - Lecture 1: Call Stack, Instruction Register, Opcode

140 views3 pages
In#computer#architecture
GPRs
Memory (from#bottom)
OS,#stack#segment,#heap,#static#data,#text#segment,#OS
CU#(Control#Unit)
Tells#ALU#and#registers#what#to#do,#based#on#opcode#and#operands#in#
IR
ALU#(Arithmetic#Logic#Unit)
Register-register#archi
Integer#and#bitwise#arithmetic
Registers.(GPRs.-General.Purpose.Registers)
Prefixed#with#$,#32#in#total,#given#names#based#on#usage#conventions
Each#GPR#is#4B#in#size#(32#bits)#(1#word)
Fast#but#expensive
Physically#located#on#CPU#chip
$0
Zero
Constant#zero,#read-only,#no#change
$2,#$3
$v0,#$v1
Function#return#values#&#syscall#numbers
$4-$7
$a0-$a3
Function#and#syscall#arguments
$8-$15
$t0-$t7
Temporary#storage#(caller-saved)
$24,$25
$t8,#$t9
Temporary#storage#(caller-saved)
$16-$23
$s0-$s7
Temporary#storage#(callee-saved)
$29
$sp
Top-of-stack#pointer
$30
$fp
Stack#frame#pointer
$31
$ra
Function#return#address
Special#purpose#registers:
PC (Program#Counter)
Acts#as#bookmark,#telling#computer#where#it#has#stopped
§
Stores#memory#address#of#(i.e.#points#to)#next#instruction#to#be#
executed#in#the#text#segment
§
Instruction#address#increments#by#4(PC#=#PC#+#4)
§
HI, LO ("high",#"low")
Used#for#multiplication#and#division
§
Multiplying#2#32-bit#numbers#might#require#64#bits#to#fit
§
Integer#division#might#be#used
HI#contains#quotient,#LO#contains#remainder
§
IR (Instruction#Register)
Stores#instruction#currently#being#executed#
§
MAR/MRR/MWR#(Memory#Address/Read/Write#Register)
To#work#on#data,#we#load#data#into#a#register#to#work#on#it,#then#store#the#data#
back#into#memory#when#done.
Loading#from#memory#to#register:#lw (load#word)
Address#to#be#loaded#goes#to#MAR,#telling#memory#controller#to#read#it
Data#at#address#goes#to#MRR,#which#is#copied#to#destination#GPR#specified#
instruction
Loading#from#register#to#memory:#sw (store#word)
Contents#of#GPR#specified#in#instruction#copied#to#MWR#and#written#to#
memory
Address#to#be#stored#goes#into#MAR#memory#controller#is#told#to#write
Memory
For#memory#addresses#lower#than#text#segments Reserved#for#
OS
Executable#code#goes#here#(in#machine#code)
Starts#at#0x00400000#(4194304#in#dec)
OS#puts#code#here#("loading")#when#you#tell#it#to#run#a#program
Text#segment
Starts#at#0x10000000
Contains#program's:
Global#variables
String#constants
Static#data
Contains#programs'#dynamically#allocated#memory
Shrinks#when#memory#is#de-allocated,#either#by#garbage#collector#
or#programmer
Empty#at#start#of#program#execution
Grows.downwards as#more#memory#is#allocated#during#runtime
Heap#segment
Grows.upwards during#runtime
Starts#at#7FFFFFFC
Contains#system#stack:
Function#local#vars,#args,#return#addresses
Saved#registers
Frame#pointer
Stack#segment
Week$1:$memory$+$registers
Wednesday,# 13#June#2018
14:29
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Os, stack segment, heap, static data, text segment, os. Tells alu and registers what to do, based on opcode and operands in. Performs computations mainly on register values, not main memory. Prefixed with $, 32 in total, given names based on usage conventions. Each gpr is 4b in size (32 bits) (1 word) , function return values & syscall numbers. Acts as bookmark, telling computer where it has stopped. Stores memory address of (i. e. points to) next instruction to be executed in the text segment. Instruction address increments by 4(pc = pc + 4) Multiplying 2 32-bit numbers might require 64 bits to fit. To work on data, we load data into a register to work on it, then store the data back into memory when done. Loading from memory to register: lw (load word) Address to be loaded goes to mar, telling memory controller to read it.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents