Machine language, the binary representation for ...
Lecture 7
?
?
Machine language, the binary representation for instructions.
¡ª I-type, immediates
¡ª J-type, surprise
¡ª Encoding
Strlen example?
1
R-type format
? Register-to-register arithmetic instructions use the R-type format.
op
rs
rt
rd
shamt
func
6 bits
5 bits
5 bits
5 bits
5 bits
6 bits
? This format includes six different fields.
¡ª op is an operation code or opcode that selects a specific operation.
¡ª rs and rt are the first and second source registers.
¡ª rd is the destination register.
¡ª shamt is only used for shift instructions.
¡ª func is used together with op to select an arithmetic instruction.
? The green card in the textbook lists opcodes and function codes for all of
the MIPS instructions.
2
About the registers
? We have to encode register names as 5-bit numbers from 00000 to 11111.
¡ª For example, $t8 is register $24, which is represented as 11000.
¡ª The complete mapping is given on page B-24 in the book.
? The number of registers available affects the instruction length.
¡ª Each R-type instruction references 3 registers, which requires a total
of 15 bits in the instruction word.
¡ª We can¡¯t add more registers without either making instructions longer
than 32 bits, or shortening other fields like op and possibly reducing
the number of available operations.
op
rs
rt
rd
shamt
func
6 bits
5 bits
5 bits
5 bits
5 bits
6 bits
3
I-type format
? Load, store, branch, and immediate instructions all use the I-type format.
op
rs
rt
address
6 bits
5 bits
5 bits
16 bits
? For uniformity, op, rs and rt are in the same positions as in the R-format.
? The meaning of the register fields depends on the exact instruction.
¡ª rs is a source register¡ªan address for loads and stores, or an operand
for branch and immediate arithmetic instructions.
¡ª rt is a source register for branches and stores, but a destination
register for the other I-type instructions.
? The address is a 16-bit signed two¡¯s-complement value.
¡ª It can range from -32,768 to +32,767.
¡ª But that¡¯s not always enough!
4
Two¡¯s complement (reminder)
? Easy to do in HW
¡ª Most significant bit tells sign (sign bit)
¡ª Addition can be done without anything special
? How?
¡ª Invert all bits and add one
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- binary decimal hexadecimal ascii character conversion chart
- machine language the binary representation for
- ascii binary character table
- ascii conversion chart university of delaware
- binary and hexadecimal conversions
- decimal binary and hexadecimal
- binary numbers cleveland institute of electronics
- chapter 1 binary octal and hexadecimal numbers
- conversion of binary octal and hexadecimal numbers
- midi basics carleton college
Related searches
- legal representation for mentally ill
- the binary game
- binary code for beginners
- binary representation of decimal number java
- what is the best plan for savings for retirement
- language and literacy activity for toddlers
- determine the theoretical yield for the reaction
- binary coding for kids
- binary lessons for kids
- language and literacy activity for preschool
- 3 1 what are the hexadecimal bytes for the following instructions a inc dptr
- 3 1 what are the hexadecimal bytes for the following instructions