CSE 230 - Study Guide - Exam 1
CSE 230 - Study Guide - Exam 1 CSE 230
Popular in Computer Org/Assemb Lang Prog
Popular in Computer Science and Engineering
This 16 page Study Guide was uploaded by RianMartins on Friday September 25, 2015. The Study Guide belongs to CSE 230 at Arizona State University taught by Nakamura in Fall 2015. Since its upload, it has received 214 views. For similar materials see Computer Org/Assemb Lang Prog in Computer Science and Engineering at Arizona State University.
Reviews for CSE 230 - Study Guide - Exam 1
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/25/15
CSE 230 STUDY GUIDE EXAM 1 CHAPTER 1 0 Classic Components of Computer I Datapath Manipulates the data coming through the processor It also provides a small amount of temporary data storage I Control Generates control signals that direct the operation of memory and the datapath I Memory Holds instructions and most of the data for currently executing programs I Input External devices such as keyboard mice disks and networks that provide input to the processor I Output External devices such as display printers disks and networks that receive data from the processor CHAPTER 2 0 Number conversion Binary Decimal and Hex representation I To convert numbers to different bases we need to look at each number separately I xyz gt xbase2 ybase1 zbase0 I Converting Binary base 2 0 Binary Decimal o 1101gt12312202112 840113 I Hex System base 16 O From 0 9 the hex system is the same as the decimal system but after 9 we have 0 A 10 O B 11 O C 12 O D 13 O E 14 O F 15 0 Ex Converting 4002AC to binary with 24 bytes 39 4 0100 0 0000 0 0000 2 0010 A 1010 C 1100 39 4002AChex 0100 000 0000 0010 1010 1100two 0 Ex Converting 4002AC to decimal 39 44000022A10C12 I 4002AChex 4105 0104 0103 2102 10101 1210o 400312 0 See some more examples below Obs If you are not familiar with number conversions check the back of your green sheet 9 M0111 193quot 515 6105 quot DGC W OX Nomi GB 2 37 quot ESQCUS ilol en leo A quo Buo Numbers 2 0 lxz x1 DJ 1x1 thgt i o 13 6x 39 43gi 5 i t5gtlt39 O Registers O Registers can be numbered or named zero Used to represent zero v0 v1 Used in return values in functions and also to print and receive data a0 a3 Used to parse arguments to functions t0 t7 Temporary registers 50 57 Saved registers correspond to variables in C program t8 t9 Temporary registers sp Stack Pointer Sra Return Address MIPS Assembly Instructions add Description Adds two registers and stores the result in a register Operation Syntax Encoding Descriptio Operation Syntax Encoding d s t advancepc 4 add dst 0000 0088 ssst tttt dddd 1000 0010 0000 sub 11 Subtracts two registers and stores the result in a register d s t advancepc 4 sub d s t 0000 0088 ssst tttt 01010101 01000 0010 0010 I addi Adds a register and a sign extended immediate value and D Z O escnp on stores the result in a register Operation t s imm advancepc 4 Syntax addi t s imm Encoding 0010 0088 ssst tttt 1111 1111 1111 1111 I lw Description A word is loaded into a register from the specified address Operation t MEMs offset advancepc 4 Syntax lw t offsets Encoding 1000 1188 ssst tttt 1111 1111 1111 1111 39 SW Description The contents of t is stored at the specified address Operation MEMs offset t advancepc 4 Syntax sw t offsets Encoding 1010 1188 ssst tttt 1111 1111 1111 1111 I and Description Bitwise ands two registers and stores the result in a register Operation d s amp t advancepc 4 Syntax and d s t Encoding 0000 0088 ssst tttt 01010101 01000 0010 0100 I or Bitwise logical ors two registers and stores the result in a Description register Operation d s t advancepc 4 Syntax or d s t Encoding 0000 0088 ssst tttt 01010101 01000 0010 0101 39 nor Bitwise logical not ors two registers and stores the result in Description a register Operation d s t advancepc 4 Syntax or d s t Encoding 0000 0088 ssst tttt oldolol d000 0010 0101 I andi Description Bitwise ands a register and an immediate value and stores the result in a register Operation t s amp imm advancepc 4 Syntax andi t s imm Encoding 0011 0088 ssst tttt 1111 1111 1111 1111 I ori Description Bitwise ors a register and an immediate value and stores the result in a register Operation t s imm advancepc 4 Syntax ori t s imm Encoding 0011 0188 ssst tttt iiii iiii iiii iiii I sll Shifts a register value left by the shift amount listed in the instruction and Descnp on places the result in a third register Zeroes are shifted in Operation d t ltlt h advancepc 4 Syntax sll d t h Encoding 0000 0033 ssst tttt dddd dhhh 111100 0000 I srl Shifts a register value right by the shift amount shamt and places the value Descnp on in the destination register Zeroes are shifted in Operation d t gtgt h advancepc 4 Syntax srl d t h Encoding 0000 00 t tttt dddd dhhh 111100 0010 I bne Description Branches if the two registers are not equal Operation if s t advancepc offset ltlt 2 else advancepc 4 Syntax bne s t offset Encoding 0001 0188 ssst tttt 1111 1111 1111 1111 I beq Description Branches if the two registers are equal Operation if s t advancepc offset ltlt 2 else advancepc 4 Syntax beq s t offset Encoding 0001 0088 ssst tttt 1111 1111 1111 1111 I slt Description If s is less than t d is set to one It gets zero otherwise Operation if s lt t d l advancepc 4 else d O advancepc 4 Syntax slt d s t Encoding 0000 0088 ssst tttt 01010101 01000 0010 1010 I slti Description If s is less than immediate t is set to one It gets zero otherwise Operation if s lt imm t l advancepc 4 else t O advancepc 4 Syntax slti t s imm Encoding 0010 1088 ssst tttt 1111 1111 1111 1111 39 i Description Jumps to the calculated address Operation PC nPC nPC PC amp OxfOOOOOOO target ltlt 2 Syntax j target Encoding 0000 1011 1111 1111 1111 1111 1111 1111 I jal Description Jumps to the calculated address and stores the return address in 31 Operation 31 PC 8 or nPC 4 PC nPC nPC PC amp OxfOOOOOOO target ltlt 2 Syntax jal target Encoding 0000 1111 1111 1111 1111 1111 1111 1111 l jr Description Jump to the address contained in register s Operation PC nPC nPC s Syntax jrs Encoding 0000 0088 8880 0000 0000 0000 0000 1000 I mult Description Multiplies s by t and stores the result in LO Operation LO s t advancepc 4 Syntax mult s t Encoding 0000 0088 ssst tttt 0000 0000 0001 1000 I div Description DiVides s by t and stores the quotient in LO and the remainder in HI Operation LO s t HI s t advancepc 4 Syntax diV s t Encoding 0000 0088 ssst tttt 0000 0000 0001 1010 I mflo Description The contents of register LO are moved to the specified register Operation d LO advancepc 4 Syntax m o d Encoding 0000 0000 0000 0000 01010101 01000 0001 0010 I mfhi lDescription lThe contents of register HI are moved to the specified register lOperation ld HI advancepc 4 lSyntaX lm ii d lEncoding 0000 0000 0000 0000 01010101 01000 0001 0000 I Now Let s see some examples and notes for those commands o Encoding and Decoding Machine Language gtDecoma Mac iune chch MEL i SJ TUC llon is a a A 539 g 0 I a a 00 U f kw Oil H H O oto o o Jf c 3 al39n Q J m or 9 J IS 1639 0 gt90er Ts 20W Ti 4 S WJC Jam 11133 opCoAE LS 0 um be R 5499 4149 5931 0 1 5 t 9 A 0 Conditions Statements and Loops I For IFELSE in MIPS we use bne Branch of Not Equal or beq Branch of Equals I Loops must be written using thej jump to defined labels gt Onraj D 61550n Making 6999 368 LOJ Suki LOJDGQ 7 i fb 3 L105 ii 1an 9 quotI D bne site Sh M562 4 1 0 ii w i riox quad 83 b Cl 1 if 2 33 MIP55 lane 35o 34 LoJoGJZ h t A id MA 353 no 354 Law 39 o Arithmetic Operations amp Use of array of integers I Check quiz 3 solution 0 Spilling Register CHAPTER3 o Two s Complement I To convert back to decimal number we need to do the same procedure 1 Complement each bit 2 Add 1 3 Convert to decimal 0 Ex Convert the binary 1011 in two s complement to the equivalent decimal number 1 0100 complement each bit 2 0101 add 1 3 0101 5 convert to decimal and get the magnitude So we can affirm that 1011 represent negative 5 5
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'