CSC 230 MIPS
C. 1024
" How many bytes are in a kilobyte? A. 8 B. 1000 C. 1024 D. 4068"
D. emulator
"10. What type of program uses software to imitate the hardware operation of a particular type of processor? A. imitator B. assembler C. translator D. Emulator"
A. a part of the processor that performs an operation.
"7. What is a register? A. a part of the processor that performs an operation. B. a part of the processor that keeps a log of operations. C. the part of the operating system that oversees what programs are selected for execution. D. a part of the processor that holds a bit pattern."
D. 0x2A
"7. What is the name for the bit pattern 101010? A. 0xA2 B. 0x222 C. This pattern can not be named. D. 0x2A"
A. No. Machine language is an engineering decision that is unique to each processor family.
"8. Do all processor chips use the same machine language? A. No. Machine language is an engineering decision that is unique to each processor family. B. No. Each individual processor chip has its own unique machine language. C. Yes. Machine language is a fundamental characteristic of all processors. D. Yes. An International Committee designed the machine language that all processors now use (after the year 2000)."
B. binary file
"9. Assemblers and compilers usually translate a source program into machine instructions contained in what type of file? A. include file B. binary file C. object module D. hidden file"
D. Yes — just read out loud into a microphone.
"Can English writing be represented with analog signals? A. No—only binary signals can represent symbolic data. B. No — it is not symbolic. C. No — analog signals don't represent anything. D. Yes — just read out loud into a microphone."
D. Yes — since it is symbolic, and anything symbolic can be represented.
"Can Japanese writing be represented in a computer? A. No — only English and English-like languages can be represented. B. No — only languages with an alphabet can be represented. C. Yes — but a special processor chip is needed. D. Yes — since it is symbolic, and anything symbolic can be represented."
B. 4
"How many bits are in a nibble? A. 2 B. 4 C. 8 D. 16"
C. 32
"How many bits are in the addresses of the MIPS 32 chip, the processor that is the subject of this course? A. 16 B. 24 C. 32 D. 64"
A. 2^32
"How many memory addresses are there with a 32-bit bus? A. 2^32 B. 32 C. 32^2 D. This depends on how much memory has been installed in the computer."
C. 2^N
"How many patterns can be formed from N bits? A. N B. N^2 C. 2^N D. 2*N"
B. 2
"How many patterns can be formed with a single bit? A. 1 B. 2 C. 4 D. 8"
C. 8
"How many patterns can be formed with three bits? A. 1 B. 3 C. 8 D. 12"
A. No — the exact value of the bits can be determined, as long as the noise is not too great.
"If a binary signal picks up some noise, has information been lost? A. No — the exact value of the bits can be determined, as long as the noise is not too great. B. No — binary signals can't pick up any noise. C. Yes — the exact value of the bits cannot be determined. D. Yes — the signal will have extra bits in it because of the noise."
D. Yes — the noise hides the exact values of the original signal.
"If an analog signal picks up some noise, has information been lost? A. No — electronics can just ignore the noise. B. No — information has been added to the signal. C. Maybe — it depends on how loud the noise is. D. Yes — the noise hides the exact values of the original signal."
B. Byte
"In most modern processors, what is the smallest addressable unit of memory? A. bit B. byte C. 32 bits D. 64 bits"
C. floppy disk, hard drive, main memory
"In which of the following lists are devices arranged in order of slowest to fastest for data movement into and out of the processor? A. main memory, hard drive, floppy disk B. floppy disk, main memory, hard drive C. floppy disk, hard drive, main memory D. hard drive, main memory, floppy disk"
A. virtual memory
"On a modern computer, the processor ""sees"" the full address space even though there is less installed memory than that. What is this full address space called? A. virtual memory B. apparent memory C. RAM D. physical memory"
B. ...a convention used in written documentation of the computer.
"Say that you read that a particular computer ""uses hexadecimal"". What is being described? A. ...the fundamental hardware of the processor chip. B. ...a convention used in written documentation of the computer. C. ...the type of arithmetic carried out by the computer. D. ...the type of signals used on the computer's bus."
A. fetch, increment, execute
"What are the three steps in the machine cycle? A. fetch, increment, execute B. increment, fetch, execute C. load, compile, run D. wash, rinse, spin dry"
B. Binary means "having only two states."
"What does the word binary mean? A. Binary means ""containing a computer."" B. Binary means ""having only two states."" C. Binary means ""having a discrete number of values."" D. Binary means ""using electronics to do arithmetic."""
C. 2^7
"What is 2^4 * 2^3? A. 8^2 B. 2^6 C. 2^7 D. 2^12"
A. A bit is a single binary value.
"What is a bit? A. A bit is a single binary value. B. A bit is a collection of several bytes. C. A bit is a single character stored in main memory. D. A bit is a small unit of computer time."
A. a pattern of bits that corresponds to one unit of data.
"What is a machine instruction? A. a pattern of bits that corresponds to one unit of data. B. a signal sent across the system bus that controls the operation of the computer. C. a pattern of bits that asks for one fundamental operation of the processor. D. a signal sent by the system clock that starts one machine cycle."
D. a description of the basic components of a processor chip and of its basic operations.
"What is the architecture of a processor? A. the style and colors for the case and monitor. B. the type of operating system and software that the computer runs. C. the shape of the chip and the layout of its connector pins. D. a description of the basic components of a processor chip and of its basic operations."
C. A machine cycle is the process through which one machine instruction is executed.
"What is the machine cycle? A. One machine cycle consists of all the steps taken in executing a program. B. A machine cycle is how a cold computer is booted into running an operating system. C. A machine cycle is the process through which one machine instruction is executed. D. A machine cycle is the steps through which a byte is fetched from memory."
B. There is no difference. All memory does is hold bit patterns. It is up to the rest of the computer system to determine what those patterns mean.
"What is the main difference between the section of memory that holds instructions and the section of memory that holds data? A. Data memory is arranged into bytes with addresses; instruction memory holds words without addresses. B. There is no difference. All memory does is hold bit patterns. It is up to the rest of the computer system to determine what those patterns mean. C. Data memory is connected to the data bus. Instruction memory is connected to the instruction bus. D. Data uses virtual memory; instructions use physical memory."
B. Bus
"What is the name for a group of parallel conductors on the main circuit board over which data and signals flow? A. PCB B. bus C. system cable D. device controller"
D. device controller
"What is the name for an electronic module that responds to requests from the central processor, by sending device-specific control signals to an I/O device? A. bus handler B. I/O module C. virtual device D. device controller"
B. 0x02
"What is the name for the bit pattern 0000 0010 ? A. 0x0002 B. 0x02 C. 0xA0 D. 0x201"
D. Octal
"What is the name for the convention where bits are named in groups of three? A. Trinary B. Sextuple C. Tridecimal D. Octal"
D. An analog signal is usually continuously changing in value.
"What is true of an analog signal? A. An analog signal has a discrete number of states. B. An analog signal is the only way that music can be recorded. C. An analog signal can never be converted into a binary signal. D. An analog signal is usually continuously changing in value."
A. assembly language
"What language allows the programmer to program the processor at the architectural level? A. assembly language B. Java C. FORTRAN D. C"
C. The program counter.
"What part of the processor indicates which machine instruction is next in line for execution? A. The address bus. B. The memory address register. C. The program counter. D. The system clock."
C. Binary devices are much faster than decimal devices.
"Which of the following is NOT an advantage of building computers out of binary devices? A. Binary devices are simple and easy to build. B. Binary signals are unambiguous. C. Binary devices are much faster than decimal devices. D. Patterns of bits can be used to represent anything symbolic."
A. The state of binary signals is measured only at specific instants in time.
"Why does a computer have a clock? A. The state of binary signals is measured only at specific instants in time. B. A clock is needed to check how fast signals are changing. C. A clock is needed to check that voltage levels are correct. D. A clock is used only with application programs that need to know the current time."
D. All of the above.
"Why is it important that unlimited perfect copies can be made of data represented in binary? A. Transmitting data over the Internet involves making many copies of the data. B. Application programs such as wordprocessors and computer games must be perfect copies of the original in order to run. C. Because data are copied back and forth between parts of a computer system many times per second. D. All of the above."
Convert 59 59 / 16 = 3.6875 0.6875 * 16 = 11 = B (LSB) 3 / 16 = 0.1875 0.1875 * 16 = 3 59 = 3B Convert 0.03125 0.03125 * 16 = 0.5 = 0 0.5 * 16 = 8.0 = 8 0.03125 = 0.08 3B.08
Convert Decimal to Hexadecimal: 59.03125
(1011.0101)₂ = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) + (0 × 2⁻¹) + (1 × 2⁻²) + (0 × 2⁻³) + (1 × 2⁻⁴) = (11.3125)₁₀
Convert binary to decimal: 1011.0101
(11.1011)₂ = (1 × 2¹) + (1 × 2⁰) + (1 × 2⁻¹) + (0 × 2⁻²) + (1 × 2⁻³) + (1 × 2⁻⁴) = (3.6875)₁₀
Convert binary to decimal: 11.1011
Direct conversion can be accomplished by evaluating sections of 4-bits or one byte. 1010 1101 ► (1010) (1101) ► (A) (D) ► AD
Convert binary to hexadecimal: 1010 1101
-10111 or 2's complement 101001
Convert decimal to binary: -23
Convert 36 36 / 2 = 18 with remainder so 0 (LSB) 18 / 2 = 9 with remainder so 0 9 / 2 = 4.5 with remainder so 1 4 / 2 = 2 with remainder so 0 2 / 2 = 1 with remainder so 0 1 / 2 = .5 with remainder so 1 (MSB) 36 = 100100 Convert 0.1875 0.1875 * 2 = 0 with remainder 0.375 0.375 * 2 = 0 with remainder 0.75 0.75 * 2 = 1 with remainder 0.5 0.5 * 2 = 1 with remainder 0 0.1875 = 0.0011 100100.0011
Convert decimal to binary: 36.1875
Each Hex value represents 4-bits or one byte. So we can convert each digit as a set of 4-bits. (C) (2) . (1) ► (12) (2) . (1) ► (1100) (0010) . (0001) 11000010.0001
Convert hexadecimal to binary: 0x C2.1
The magnitude of each numbers place is 16 to the power of its magnitude minus 1 (A's magnitude is 16³⁻¹ or simply 16²). We then multiply the this value by the value of the number at that place. (A)(6)(B) ► (10)(6)(11) ► (10*(16²))(6*(16¹))(11*16⁰) ► (2560)+(96)+(11) = 2,667
Convert hexadecimal to decimal: 0x A6B
Each Hex value represents 4-bits or one byte. So we can convert each digit as a set of 4-bits. (F) (2) (5) ► (15) (2) (5) ► (1111) (0010) (0101) Note: In the example above we converted top decimal before converting to binary. While this is easier or some, this step is optional.
Convert to hexadecimal to binary: 0x F25
These tell the assembler to set aside space for variables, include additional source files, or establish the start address for your program. In MIPS these directives begin with a '.' (IE .ascii)
Define Assembler Directives
The most significant byte (the "big end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.
Define Big Endian byte order
The least significant byte (the "little end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.
Define Little Endian byte order
These are compiler-defined instructions of common operations that are defined to execute a combination of assembler instructions to simplify code.
Define Pseudo instructions
a programming language with strong abstraction from the details of the computer.
Define high-level language
Any low-level programming language in which there is a very strong correspondence between the instructions in the language and the architecture's machine code instructions
Define: Assembly Language
A right arithmetic shift by n is equivalent to dividing by 2^n and rounding toward 0. note: right arithmetic shift of a two's complement value is equivalent to dividing by 2^n and rounding toward negative infinity.
Division with arithmetic bit shifting
Defined by a word followed by a colon. (ex. thing: ) It is simply a string used to name a location in memory.
How are MIPS labels defined syntactically? What do they actually represent?
The result of multiplication is stored in the LO register. If the product exceeds 32 bytes, overflow is placed in HI and will represent the MSB of the product. The LO and HI value can be accessed with the 'mfhi' and 'mflo' instructions.
How are registers used for Multiplication in MIPS
Negative numbers always have a leading zero. The most significant bit (MSB) indicates sign.
How can you differentiate a binary 2's complement number from negative or positive?
Multiply the decimal by 2 keeping notice of the resulting integer and fractional part. Continue multiplying by 2 until you get a resulting fractional part equal to zero. Example: Convert 3/8 or 0.375 0.375 * 2 = 0 with remainder 0.75 0.75 * 2 = 1 with remainder 0.5 0.5 * 2 = 1 with remainder 0 0.375 = 0.011
How do you convert base-ten decimal fractions to binary (IE 3/8 = .011 )?
(bitValue + PreviousResult) / 2 = Result OR (1/2^n) + PreviousResult = Result See Below for more detailed description... Start from the right with the total of 0. Take your current total, add the next bit and divide the result by 2. Continue until there are no more digits left. Example: Convert 0.1011 (1 + 0) / 2 = 0.5 (1 + 0.5) / 2 = 0.75 (0 + 0.75) / 2 = 0.375 (1 + 0.375) / 2 = 0.6875 OR Perform summation of the magnitude of each bit, skipping 0's. Begin from the left with magnitude equal to 1/2^n Example: Convert 0.1011 (1/2^1) + 0 = 0.5 (1/2^3) + 0.5 = 0.625 (1/2^4) 0.625 = 0.6875
How do you convert fractional binary numbers to base-ten decimal numbers (IE Convert 0.0101 to 5/16)?
This type of storage is dynamic and grows UP, with its address increasing.
How does Data segment storage behave or grow?
This type of storage is dynamic and grows DOWN, with its address decreasing.
How does Stack storage behave or grow?
Text segment is static memory (size does not change) located below data segment.
How does Text segment storage behave or grow?
Base addressing: The address of the operand is the sum of the immediate and the value in a register (rs) (I-type) Immediate addressing: The operand is embedded inside the encoded instruction (I-type) Register addressing: Operands are in a register (R-type) PC-relative addressing (Program Counter): the value in the immediate field is interpreted as an offset of the next instruction (PC+4 of current instruction) (I-type) (B.I.R.P.)
List and define available MIPS addressing modes
op (6 bits), rs (5 bits), rt (5 bits), immediate (16 bits)
List the Basic Instruction format fields for an I-type instruction? (Extra: how many bits are devoted to each field)
op (6 bits), address (26 bits)
List the Basic Instruction format fields for an J-type instruction? (Extra: how many bits are devoted to each field)
op (6 bits), rs (5 bits) - 1st source register, rt (5 bits) - 2nd source register, rd (5 bits) - destination register, shamt (5 bits) - shift amount, funct (6 bits)
List the Basic Instruction format fields for an R-type instruction? (Extra: how many bits are devoted to each field)
A left arithmetic shift by n performs multiplication and is equivalent to multiplying by 2^n
Multiplication with arithmetic bit shifting
1010 0111 = 0101 1001
Perform the 2's complement operation on 1010 0111?
Literals represent all numbers (e.g. 5), characters enclosed in single quotes (e.g. 'g') and strings enclosed in double quotes (e.g. "Deadpool").
What are literals?
Registers used for arguments to functions - not preserved by subprograms
What are the $a0 - $a3 registers used for?
These are the saved registers and are preserved by subprograms
What are the $s0 - $s7 registers used for?
Registers used for temporary data, not preserved by subprograms
What are the $t0 - $t7 registers used for?
Registers return values from functions
What are the $v0, $v1 registers used for?
R-type = Arithmetic Instruction Format I-type = Transfer, Branch, Immediate J-type = Jump Instruction
What are the 3 MIPS Instruction Formats and what is their purpose.
Input, Output, Memory, and Datapath and Control. Note: (Datapath and Control is generally referred to as the CPU) (MC DIO)
What are the Five Classic Components of the Computer
.byte .ascii .double .word .halfword .asciiz .float (BAD WHAF)
What are the available data types in MIPS? (hint: 7-types)
"Load address" and "Store address". Basic instructions that Load or Store selected address to a register.
What does 'la' and 'sa' mean in MIPS?
"Load Word" and "Store Word". Basic instructions that Load or Store contents to a register.
What does 'lw' and 'sw' mean in MIPS?
Least Significant Bit, right-most bit, lowest magnitude generally representing the value 0 or 1
What does LSB stand for?
Most Significant Bit, left-most bit, highest magnitude or sign representation
What does MSB stand for?
Align next data item on specified byte boundary (0=byte, 1=half, 2=word, 3=double) Used to manage and properly store different byte length data segments onto the proper boundaries.
What does the ".align" assembler directive do in MIPS? Why is it important?
This is where MIPS variable names, to be used in the program, are declared. note: storage for these are allocated in main memory (RAM).
What does the ".data" assembler directive in MIPS do.
This directive declares the listed label(s) as global to enable referencing from other files.
What does the ".globl" assembler directive in MIPS do
This is where MIPS program code and instructions are written.
What does the ".text" assembler directive in MIPS do
A model for modern computer organization where; 1) Both data & instructions are stored in the same place (shared memory) 2) Units that store information are different from units that process information. (the processor operates fetching and execution cycles serially)
What is Von Neumann architecture?
The bits that are shifted out of either end are discarded. In a left arithmetic shift, zeros are shifted in on the right; in a right arithmetic shift, the sign bit (the MSB in two's complement) is shifted in on the left, thus preserving the sign of the operand.
What is an arithmetic bit-shift?
Allows the representation of fractional numbers in binary. Represents numbers as two sequences of bits, one sequence for the digits in the number and the other for the exponent.
What is floating point
Short-circuit evaluation means that when evaluating Boolean expressions you can stop as soon as you find the first condition which satisfies or negates the expression. (1 && 1) || (1 && 0) Because (1 && 1) evaluates to 1 or True the second condition is never evaluated.
What is short-circuit evaluation?
The $zero register is Hard-wired to the value 0.
What is special about $0
Register reserved for pseudo-instructions
What is the $at register used for?
This register is used for storage of the return address. Only accessible indirectly though the use of JAL or JR commands.
What is the $ra register used for?
The weight or value of a binary bit. Evaluated by powers of 2. (IE. 2^(position) = magnitude)
What is the Magnitude of a binary bit?
The sign represents the positive or negative representation of a number. In binary it is generally represented as the MSB.
What is the Sign of a binary bit?
These registers provide overflow for multiplication and division numbers.
What is the function of the HI and LO registers in MIPS?
First perform the 1's complement operation to invert all binary bits, then add one. Example: 1011 ► 0100 ► 0101 1000 ► 0111 ► 1_1000 (note the range for 2's complement is [−2^(N−1), 2^(N−1) − 1 ] so for 4-bits would be [-8,7] ) We can also perform this by simply inverting all bits, stopping at the last one in the number Example 0100 1100 ► 1011 0100 Notice the last three bits, starting from the last ' 1 ', remain unchanged.
What is the operation for 2's compliment?
AND evaluates 1 only on 1&1 comparison. 1 & 1 = 1 1 & 0 = 0 0 & 1 = 0 0 & 0 = 0
What is the truth table for AND?
NOR is the inversion of OR. Evaluate OR and invert all bits 1 || 1 = 1 NOT = 0 1 || 0 = 1 NOT = 0 0 || 1 = 1 NOT = 0 0 || 0 = 0 NOT = 1
What is the truth table for NOR?
NOT accepts only one input and inverts the bit NOT 1 = 0 NOT 0 = 1
What is the truth table for NOT?
OR evaluates 1 on 1&1, 1&0 , or 0&1 comparison. 1 || 1 = 1 1 || 0 = 1 0 || 1 = 1 0 || 0 = 0
What is the truth table for OR?
XOR only evaluates to 1 if the bits being compared and opposites (1-0 or 0-1) 1 ⊕ 1 = 0 1 ⊕ 0 = 1 0 ⊕ 1 = 1 0 ⊕ 0 = 0
What is the truth table for XOR?