CS 120 Lecture Notes - Lecture 15: Opcode, Assembly Language, Machine Code

73 views2 pages

Document Summary

There are 2 types of assembly instructions used in the classwork: register-type and immediate-type. Immediate is another term for a constant, like 32 or -7 lw, addi, sw instructions are i-type. lw and addi use rt as a destination, while sw uses rt as another source. All machine code in mips is 32-bit, which means that all machine code will be eight digits long in hexadecimal. Example: given the machine code 00000010110101110100000000100000, take groups of four bits and translate them into hex. To denote that a piece of code is in hexadecimal, use the prefix 0x before the number, like the example above. First, we must split the code into its operands and opcode: Seeing that the first 6 bits are the opcode for an arithmetic operation, we know that it is an r-type, so we can split it completely: The options bits at the end signify that it is addition. The assembly code is: add , , .

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