OSU CSE 3430 Midterm 1 Key Points

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

16. What is the range of values which can be encoded by a B2T number of n bits?

-2^(n-1) through 2^(n-1)-1

18. What bit value is used as the first carry to add two B2U numbers?

0

13. What is the range of values which can be encoded by a B2U number of n bits?

0 through 2n- 1

26. How does IEEE 754 single-precision encoding of floating-point numbers work? How many bits, and which bit(s) is/are used for the sign? How many bits are used for the exponent? How is the exponent encoded (with a bias of 127)? How is the mantissa encoded?

1 bit for the sign number, 8 bits to represent a signed exponent to a base of 2, 23 significant bits in the form 1.XX...X. Value represented is 1.XX...X * 2exp. There is an implied 1 before the binary point. 8 bits to encode the exponent. Mantissa is 23 Significant bits.

78. How many registers does Y86-64 have?

15

6. How many different values can be encoded by a bit string with n bits?

2n - 1 unique values

23. Which method of encoding signed integers is used universally in all hardware being built today? Why is it always used instead of the other two methods of encoding signed integers which we discussed?

2s complement

80. How many condition codes (or What do the 4 data movement instructions flags) does Y86 have, and what are they?

3 flags: ZF, SF, and OF.

37. What is the size of an address (how many bits)?

32-bit string.

84. What size are addresses in Y86?

8 bytes (64 bits).

90. What is an immediate operand in Y86?

A constant value; always stored in the encoded bit string for the instruction.

100. What is the portion of the stack that each subroutine (function/procedure/method) is given to use called?

A frame.

67. Be able to explain how a device (for example, a disk drive) can raise an interrupt, and how the interrupt is sent to the CPU. What does the CPU do when it receives an interrupt?

A part of the hardware system (such as UART) raises an interrupt and sets interrupt signal line to one. Signal is sent to interrupt controller which notifies the CPU that interrupt has occurred. CPU then calls code in OS which handles interrupt.

59. How is a subroutine call different from a branch?

A return address must be saved.

22. When we added numbers encoded in B2O, we said the hardware has to do the addition differently if the two operands have a certain combination of signs (one negative and one non-negative). How did we say the hardware must do the addition differently in these cases?

A second addition is required, to add the last carry bit back to the result to get a final result.

8. What is a word of memory? How large is a word (how many bits)?

A string of 64 bits.

50. When can the address in the PC register be incremented to the address of the next instruction?

After the address has been sent to memory, so that the instruction can be read/fetched from memory.

38. What is the difference between word-aligned access and unaligned access of data in memory?

Aligned means the memory has to be evenly divisible by the certain amount of bytes (ex. 8). Aligned data is more efficient.

10. What is a byte?

Always a string of 8 bits.

63. What kind of subroutine is involved with an interrupt?

An Interrupt Service Routine, or ISR; this is a subroutine in the Operating System.

3. What is a bit string?

An ordered sequence of 1 or more bits

36. How is memory organized?

As an array of bytes; addresses are indexes into that array, starting at index/address 0

68. When does the CPU check for interrupts?

As part of executing each instruction.

72. How many instructions in assembly language correspond to a single machine language instruction?

Assembly has one instruction per machine language instruction.

34. How can parity and the msb of a one-byte ASCII character code sent over a network by a sender be used by the receiver to detect possible errors in the byte received?

At the receiver's end, the most significant bit of the byte is checked along with the parity bit to detect errors in the transmission. If the most significant bit is set to 1, it indicates that the byte received is an error. The receiver then checks the parity bit to confirm the error. If the parity bit does not match the expected parity, then an error is detected in the transmission.

14. What are the three ways of encoding signed integers which were discussed (B2S, B2T, B2O)?

B2S (Binary to sign and magnitude): Left-most bit is sign value. 0 is used for non-negative, and 1 for negative. Everything else is normal. B2T (2's complement): Positive numbers start with 0, and negative starts with 1. To make a positive number negative, invert all the bits (0 turns to 1, visversa), then add 1. B2O (1's complement): Negate by inverting all bits. When adding 2 negative values use carry of 1. When adding two non-negative numbers use carry of 0.

85. What is the difference in the way multi-byte data is stored in memory in a big-endian versus a little-endian system?

Big-endian: Most significant Bit is stored at lowest address and least significant bit is stored at the highest numbered address. Little-Endian: LSB is stored first and MSB is last.

12. What is the way of encoding unsigned integers which was discussed in class (B2U)? Is this method universally used for unsigned integers?

Binary has place values going (in position notation) from 2n,...,64,32,16,8,4,2,1. B2U is universal, but only for unsigned integers.

2. What is the smallest unit of memory in a computer system?

Bit

51. Which kinds of instructions in the CPU are used to execute if or else (or loop) statements in a high-level language?

Branch instructions.

71. How can the Operating System (which executes the ISR code) make sure the ISR is not interrupted while handling the interrupt?

By disabling interrupts while the ISR code is executing.

66. How can a UART be programmed to do I/O without interrupts?

By using busy-waiting.

58. How is a subroutine called?

Caller subroutine puts parameters for callee in frame of callee. When called, address of next instruction after call will be pushed onto stack.

41. What 4 types of instructions can all CPUs perform?

Data movement instructions (transfer data from memory to cpu or cpu to memory/between registers), arithmetic and logic operations on data (ALU), program sequencing and control instructions (branches), input/output transfers.

28. What kind of value is encoded by an IEEE 754 number if the true exponent is negative?

Decimal value

4. What kinds of data/information are stored as bit strings in a computer?

Everything in the computer

89. Is a destination operand read, written or both in Y86?

For ALU instructions, both read and written; for other types of instructions, only written.

52. What is the Processor Status Register (or PSR)?

Four flags that are used by the processor to store information about the result of executing an ALU instruction.

30. Why are many IEEE 754 encoded values only approximations to real number values? Which kinds of real values can be encoded precisely in IEEE 754 assuming we have a sufficient, but finite, number of bits?

Fractional values like ⅕ cannot be stored precisely because it goes ½,¼,⅛,etc. So some fractions can only be approximated with a finite number of bits. Approximation is very good but is still just an approximation, not perfect precision.

27. Be sure you understand the four steps which must be done to convert an IEEE 75 single-precision encoded floating-point number to the corresponding decimal value (assume the value is a normalized number, and not a denormalized number or a special infinite/error value).

Get the sign bit. Get the encoded exponent and subtract it by 127. Write the number in standard form. Multiply 1.XX...X * 2true exponent. Decimals go (½)^x,(¼)^x,(⅛)^x,...

29. What is the trade-off that must be made to get the much greater range of values that can be represented by 32 bit IEEE 754 encoded numbers?

Greater range is traded for less precision.

24. How does the CPU compare the last two carries to determine if there is overflow for two's complement (B2T) operations? Be sure you understand which kind of gate is used to compare the last two carries, and how it does this.

If the last 2 digits of the carry are the same, no overflow, if they are different, there is overflow. exclusive gate (XOR) is used to compare the last two carries.

17. Be able to add two B2U encoded (unsigned) numbers of and determine if there is overflow. How is overflow determined by the CPU for B2U (unsigned) addition?

If the most significant bit of the carry is 1 that means there is overflow.

19. Be able to add two B2T encoded (signed) numbers and determine if there is overflow. How is overflow determined by the CPU for B2T (signed) addition? Can the same method be used for B2O addition?

If the two msb carries in B2T are equal, no overflow.. For B2O, addition can be done but it is very difficult, and for multiplication the hardware is very complicated.

79. Why is the number of registers in Y86 unlike a real CPU?

In real CPUs, the number of registers is always equal to a power of 2.

44. Which register in the CPU holds the instruction being executed (the bit string with the encoded instruction)?

Instruction register (IR).

75. Which real CPU architecture is the Y86-64 simulated CPU based on?

Intel X86-64.

47. Which type of CPU (RISC or CISC) are Intels? Which type are ARMs (or the Mac M1)?

Intel is CISC. ARM and M1 is RISC

7. How is memory organized in a computer?

Into a sequence of words (an array of words or bytes)

21. How is an integer negated in B2O (One's complement)?

Invert all bits.

20. How is an integer negated in B2T (Two's complement)?

Invert all the bits and add one to result.

25. How can subtraction be done in two's complement by using inversion of one operand and a first carry of 1? Be sure that you can subtract one number encoded in two's complement from another using this method.

Invert the bits in the second operand and change the carry used for the first pair of bits from 0 to 1. It is the same as adding 1 to the complemented second operand.

95. Be sure you understand the conditional jump instructions in Y86, and how the flags must be set for the jump to be taken for each type of unconditional jump: je, jne, jl, jle, jg, jge.

Je: if ZF = 1. Jne: if ZF = 0. jl: if SF =1 and ZF = 0. Jle: SF = 1 or ZF = 1. Jg: SF = 0 and ZF = 0. Jge: SF = 0 or ZF = 1.

31. What kinds of characters can be encoded in ASCII? How many bits are used to encode each character? What is the most significant bit in the ASCII code for any character?

Latin alphabet and related characters and decimal digits (0-9). Most significant bit is always 0.

86. Is Y86 (and Intel) big-endian or little-endian?

Little-endian.

1. What are the main components of a computer?

Memory: Main memory (Random Access Memory)(volatile), Secondary memory (disks, flash drives)(non-volatile), Cache (Improves performance)(volatile) Processor/CPU: Arithmetic/logic, timing/control, registers and cache memory Input: KBM, camera, etc Output: printers, speakers, etc

74. How many assembly language instructions does a high-level language statement (Jave, C++, C, etc.) correspond to?

Multiple assembly instructions.

49. How many assembly language instructions typically correspond to a single statement in a high-level language (such as Java, C++, or C)?

Multiple assembly language instructions almost always.

73. Does every type of CPU (Intel, ARM, Mac M1, SPARC, PowerPC, MIPS etc.) use the same assembly language?

No

39. Do all systems require word-aligned access?

No, Intel does not use it.

32. Be sure you understand the fundamentals of UTF-8 character encoding. Is each character in UTF-8 encoded using the same number of bytes? How many bytes are used to encode each character in UTF-8?

No, each character is encoded by one to four 8-bit bytes. Variable byte length enociding. Up to 4 bytes can be used.

35. Can the hardware (the CPU) tell, by looking at a bit string, what kind of data is encoded by the bit string?

No, it has to know more (the coding scheme) to interpret the data.

9. Are words the same size in every system (in other words, is the definition of a word universal)?

No, there is no universal definition about the size of a word (could be 32,16,8)

55. Do labels occupy any space in memory? Why or why not?

No, they are not data, just symbolic markers.

56. Which built-in data structures does the CPU recognize?

None! There are NO built-in data structures that the CPU recognizes!

83. What sizes of operands can the Y86 simulated CPU work on? How is this different from real CPUs?

Only 8 bytes (64 bits). Real CPUs can work on data of different sizes: 1 byte, 2 bytes, 4 bytes, or 8 bytes.

88. Is a source operand read, written, or both in Y86?

Only read.

62. Besides being used to save a return address, what other kinds of data related to a subroutine call can a stack be used for?

Parameters and return value.

99. What two things does the ret instruction in Y86 do (Be sure to pay attention to the order)?

Pop the return address from the stack and then write it to the PC.

98. What two things does the call instruction in Y86 do (Be sure to pay attention to the order in which these two things are done)?

Pushes the return address onto the stack and then writes the address of the label called to the PC, so the label's function's code will execute next.

77. What are the two major types of ISAs today?

RISC and CISC.

48. Which of the two types of processor architectures is called load/store?

RISC because the only CPU instructions that can access memory are load and store.

42. Be able to explain how a read from memory is performed. How are writes to memory performed?

Read Instruction: Memory retrieves contents at address given by CPU, value in memory is not changed. Write instruction: Memory overwrites contents at address given by CPU with data given by CPU. Value overwritten is lost unless preserved somewhere else before.

65. What two registers does a UART have, and what are they used for?

Receiver Value (Rvalue), which contains the value received and can be read from that location. Second is Reciever Status (Rstatus), which will have 1 in it if Rvalue contains a new value that has not yet been read by CPU.

46. Know the fundamental differences between RISC and CISC processors on slide 8.

Risc processors are one word instructions. Cisc processors can be 1 or more words (variable instruction length). Cisc is more complex.

87. What do the 4 data movement instructions rrmovq, irmovq, rmmovq and mrmovq do in Y86?

Rrmovq: moves value of register to another register. Irmovq: Moves immediate value to register. Rmmovq: moves value of register to memory. Mrmovq: Moves value from memory to register.

81. How are the condition codes/flags in Y86 set by the processor?

Set by the arithmetic or logical instructions by processor.

53. What four flags does the PSR have which were covered in class and the class slides?

Sign Flag (set to 1 if result of last ALU was negative), Zero Flag (Set to 1 if result was 0), Carry flag (Set to 1 if result of last instruction generated a carry of 1 from msb), OF (Set to 1 if the result of the last instruction generated a carry from the addition of the most significant pair of operand bits different from the carry from adding the second most significant pair of bits aka if last two carries are different)

82. What kinds of operands can the Y86 simulated CPU work on?

Signed operands.

60. In what two ways can the return address be saved?

Single link register or stack.

61. Which way of saving a return address has a limitation on the number of subroutine calls which can be made before returning to the original calling subroutine?

Stack, since its size is fixed so it can reach its limit.

97. What are labels in Y86?

Strings that mark addresses in memory. The assembler coverts the label to the corresponding address, so the CPU does not see the label; it only sees addresses.

70. How does the ISR know where to return to the program that was executing when the interrupt occurred?

The CPU saves the PC, which is the return address, in memory before calling the ISR.

91. Be sure you understand address expressions for memory operands in Y86: DISP(BASE), where DISP is an optional constant displacement of the base address, and BASE is a named register (one of the 15 Y86 registers).

The address expression DISP(BASE) is used to compute the effective memory address for a memory operand. The effective address is calculated by adding the value of the base register (BASE) to the displacement (DISP). The result is the memory address where the operand is stored or fetched.

45. What kind of program converts assembly language to machine language?

The assembler.

76. What is Instruction Set Architecture (ISA)?

The human programmer visible machine interface.

96. What does it mean to say a jump (or branch) is taken in Y86? [The next instruction is the instruction at the address of the target label.] What does it mean to say that a jump (or branch) is not taken?

The next instruction executed will be the instruction immediately after the jump (or branch) instruction.

43. Which register in the CPU is used to hold the address of the instruction being executed?

The program counter.

92. Be sure you understand how the 4 ALU instructions in Y86 work.

They all use two register operands: addq, subq, andq, xorq. Value is stored in destination register (the second register listed in the instruction).

33. We said that not all of the bits in a UTF-8 character code are used to identify the character (not all of the bits are significant). What are the other bits used for?

They are the format of the code, not the actual character.

69. Why can't the CPU check for interrupts after executing each instruction (in between instructions)?

This wastes half the clock cycles just to check for interrupts.

101. Why does each subroutine (other than main) save the calling subroutine's rbp (base/frame pointer) before it sets its own base/frame pointer?

To ensure that the calling subroutine's base/frame pointer can be restored before returning to the calling subroutine.

64. What does UART stand for?

Universal Asynchronous Reciever/Transmitter

54. What are labels used for in assembly language?

Used to mark addresses where 1) data is stored 2) where a branch target is located.

5. Are instructions stored as bit strings also?

Yes

11. Is the definition of byte universal?

Yes, always string of 8 bits.

93. Be sure you understand how Y86 ALU instructions set the 3 flags (And that other types of instructions besides ALU instructions in Y86 do not affect the flags).

Zero flag: Set if the result of the last ALU operation is 0. Sign Flag: Set if the result of the last ALU operation resulted in the sign bit being set equal to 1. Overflow Flag: set if the result of last ALU resulted in signed overflow.

57. What is a subroutine (function/procedure/method)?

block of code within a program that performs a specific task. Implement task in one block on instructions. Will return to the instruction where the call was made.

94. Be sure you understand the unconditional jump instruction in Y86: jmp.

jmp Jumps regardless of flag settings

40. What are the sub-parts of the CPU?

registers, ALU, control


Ensembles d'études connexes

SHRM Functional Area #9 - EE and Labor Relations

View Set

General Biology: Chapter 20 Study Questions

View Set

Davis Q&A NCLEX "Gastrointestinal Disorders"

View Set

Small Business Management Module 3

View Set

MULTIPLICATIONS FLASH CARDS 12,s

View Set

POB 5.05 Analyze cost/profit relationships to guide business decision making.

View Set

Reciprocating Engines - Powerplant Written

View Set