• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/51

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

51 Cards in this Set

  • Front
  • Back

Instruction Set

The vocabulary of commands understood by a given architecture

MIPS:


How many registers are there?


How many bytes per register?



32 Registers with 32 bits per register

Translate to MIPS:


int t0 = 5


int t1 = 3


int v0 = t0 + t1

addi $t0, $0, 5 (or li $t0, 5)


addi $t1, $0, 3 (or li $t1, 3)


add $v0, $t0, $t1

The size of a register in the MIPS architecture is 32 bits; groups of 32 bits occur so frequently that they are given the name _______ in the MIPS architecture

word

What registers should we use that correspond to variables in C

$s0,$s1...

What registers should we use that are used temporarily to compile program into MIPS instruction?

$t0,$t1...


f = (g + h) – (i + j); f,g,h,i and j correspond to $s0,$s1... $s4 respectively. What is the compiled MIPS code?

add $t0, $s1, $s2 #g+h


add $t1, $s3,$s4 #i+j


sub $s0, $t0,$t1 #f = g+h - (i+j)





data transfer instruction

A command that moves data between memory and registers.

address

A value used todelineate the location ofa 
specific data elementwithin a memory array.

A value used todelineate the location ofa


specific data elementwithin a memory array.



What is the data transfer instruction that copies data from memory to a register called?

load (ex. load word (lw), load byte (lb)..etc )



g = h + A[8]; g and h with $s1 and $s2


A or A[0] is $s3


Assuming A has 100 words


What is the compiled MIPS code?



lw $t0, 32($s3)


#$t0 = A[8] each word is 4bytes so 4*8 = 32


add $s1, $s2, $t0 #g = h + A[8]

What is the base register and offset for an array in MIPS, give example.

The base register is the register associated with the first location in the array given to a register.


ex. A[0] or B[0] $s0 = A[0] and $s1 = B[0]


both are base registers


--------------------------------------------------------------------


The offset is the number in which you use to


access any part of the array.


ex. access A[5]. if $s0 = A[0] then


lw $s1, 20($s0) # $s1 = A[5], offset = 4 * 5 = 20





If the computer can only use 32 registers, how can a computer be able to hold large arrays?

The registers only store the address for the location of these arrays in the memory.

How many bits and bytes in a MIPS word?

32 bits and 4 bytes

what is big-endian?

stores the Most Significant Bit in the first address and then moves to the right to store the rest

What is little-endian?

stores the Least Significant Bit in the first address and then moves to the left to store the rest

Does MIPS use Big-Endian or Little-Endian?

Big-Endian

What is the data transfer instruction that copies data from the register to the memory called?

Store (ex. sw(store word), sb(store byte)...etc)



Why is it when you purchase memory it is always in binary sizes like 1024 (1GB) , 2048 (2GB)


memory.

The reason is that loads and stores are in binary.

A[12] = h + A[8]


$s0 is base address of A


$s1 is h


What is the compiled MIPS code?

lw $t0, 32($s0) #t0 = A[8]


add $t0, $t0, $s1 #t0 = A[8] + h


sw $t0, 48($s0) #A[12] = A[8] + h





What is the meaning of the term 'spilling registers'?

Computers use many more variables then there are registers, so the compiler uses most frequently used variables in registers and stores the rest in memory.

Which is faster to access; registers or memory?

Registers!

What is an assembly language?

a symbolic language that can be translated into binary machine language.

What do you call a simplification of many instructions that can be accessed with one 'instruction' ?

peseudoinstruction

what is the instructions for the pseudo instruction blt.

slt rd, rs, ra


bneq rd, $0, loop




loop:

what is the cost of using a pseudo instruction?

The only cost is reservingone register, $at, for use by the assembler.

There are 6 distinct pieces to producing an object module which provide information for building a complete program from the pieces. What are these pieces?

object file header - describes the size and position of the other pieces of the object file


text segment - contains the machine language code


static data segment - contains data allocated for the life of the program.


Relocation information - identifies instructions and data words that depend on absolute addresses when the program is loaded into memory


symbol table - contains the remaining labels that are not defined, such as external references.


debugging information - contains a concise description of how the modules were compiled so that a debugger can associate machine instructions with C source files and make data structures readable.



a Link editor or linker takes all independently assembled machine language program and 'stitches' them together. What are the three steps for the linker?

1. Place code and data modules symbolically in memory. (merges segments)


2. Determine the addresses of the data and instruction labels.


3. patch both the internal and external references.

A system's program that places an object program in main memory so that it is ready to execute.

a Loader

The _________ follows these steps in UNIX systems.




1. Reads the executable file header to determine size of the text and datasegments.


2. Creates an address space large enough for the text and data.


3. Copies the instructions and data from the executable file into memory.


4. Copies the parameters (if any) to the main program onto the stack.


5. Initializes the machine registers and sets the stack pointer to the first freelocation.


6. Jumps to a start-up routine that copies the parameters into the argumentregisters and calls the main routine of the program. When the main routinereturns, the start-up routine terminates the program with an exit systemcall.





Loader

what is 1101.011 in decimal form?

13.375

what is A59.FCE in binary

101001011001.11111100111

convert 166.34 into binary

10100110.010101...

Signed Magnitude: n=4


convert 1110 to decimal



-6

Signed Magnitude: n=4


convert 0111 to decimal

7

Signed Magnitude:


what is -10 in binary in n=5

11010

1's Compliment: n = 6


101101 in decimal

-18

1's Compliment: n = 7


find 32 and -32 in binary



0100000 = 32


1011111 = -32

2's Compliment: n=7


find 32 and -32 in binary

0100000 = 32


1100000 = -32

2's Compliment: n=7


1001001

0110111 = 55


1001001 = -55

for 1's compliment what would be 0000 and 1111 in decimal, if n=4.

Both are 0

what is the largest number that can be represented in 32 bits unsigned.

2^32 - 1.

what is the number range that can be represented in 32 bits with 2's compliment?

-2^(n-1) to 2^(n-1) -1

How is MIPS R format represented?

How is MIPS I format represented?

Find the MIPS binary code for


add $t0, $s1, $s2

Find the MIPS binary code for


lw $t0, 32($s3)

whats 1111001101


+1


----------------------------

1111001110

What are the three kinds of negative number representations?

Signed Magnitude, 1's compliment and 2's compliment

Whats the difference between sign magnitude, 1's compliment, and 2's compliment?

Sign magnitude uses the MSB to dictate the sign of the number, 1 being negative, 0 being positive. To find a negative number with 1's compliment you simply find the positive number normally then you find it's compliment. To find 2's compliment its the same as 1's compliment, except you add 1.

When you want to branch to an address larger than 16bit how do you code it in MIPS?

if it was a beq $t1, $t2, exit


then it will turn into


bneq $t1, $t2, other


j exit