Computer Architecture Final

0.0(0)
studied byStudied by 4 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/202

flashcard set

Earn XP

Description and Tags

Exam questions, quizzes, and practice exams. Includes syllabus quiz cause Jesse might do crazy shit like that.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

203 Terms

1
New cards

What percent of your grade are midterms and the final?

60

2
New cards

How many classes can you miss before you have to provide formal documentation for why you miss class?

2

3
New cards

What are your chances of being selected to present a solution in class?

1-1 / number_students * number_questions

4
New cards

What do you get for a successful bug bounty call?

5 points on my lowest score group quiz or student presentation

5
New cards

Which of the following units is deemed harder, and requires two weeks instead of one?

Virtual Machine I

6
New cards

Midterm II includes material that was tested over on midterm I.

False

7
New cards

Where are office hours held for Johnson?

Interdisciplinary Science Building Room 406A

8
New cards

There is an assignment that is to be completed for January 21st.

True

9
New cards

Which of the following units will not be covered in class?

Operating Systems

10
New cards

How will I know if you've been abusing generative AI on the assignments?

You'll do poorly on the exams

11
New cards

What form does group work take?

Online quizzes done by a group

12
New cards

How much does the very good course textbook cost?

$36.14

13
New cards

How many unique inputs are possible in a boolean function that accepts n bits?

2^n

14
New cards

What is the correct notation for the logical operation xy

And

15
New cards

What is the correct notation for the logical operation x+y

Or

16
New cards

What is the correct notation for the logical operation (Bar over x)

_

x

Not

17
New cards

How many boolean functions can be attributed to n input bits?

2^(2^n)

18
New cards

What is the canonical representation of the function given on 3 input variables that results in 01010111? Assume labels for input variables are x (most significant bit), y, and z (least significant bit).

not(xy)z + not(x)yz + x not (yz) + xy not(z) + xyz

19
New cards

The boolean expression not(x)y+xnot(y) is equivalent to which of the following?

XOR(xy)

20
New cards

What is the decimal equivalent of the binary number 0101 1011? Do not use a calculator!

91

21
New cards

What is the sum of the binary numbers 1101 + 0111? Include any overflow bit or bits in your answer.

10100

22
New cards

Which is the correct output for a half-adder given inputs of 0 and 1?

sum = 1, carry = 0

23
New cards

Suppose you have a 16-bit input called 'b' for a chip you are building. The chip adds one to a value and is called Inc16. You'd like that input to always be (decimal) 1. Which of the following statements achieves that in HDL? In the array, the lowest index corresponds to the least significant bit.

b[0] = true, b[15] = false

24
New cards

To find the two's complement of a binary number, you should:

 

flip all the bits and then add one

25
New cards

Which of the following represents the integer -11 in two's compliment with 8 bits?

1111 0101

26
New cards

You are given the input of 4 and you need to flip the sign. What is the output to represent -4 in two’s complement?

1100

27
New cards

What is the result of adding the 8-bit signed binary numbers 11100101 and 01111010 in two's complement representation?

  • Consider the numbers to be in two's complement.

  • Include any overflow or carry-out bits if necessary.

01011111

28
New cards

In twos compliment, what is the value of not(0), irrespective of the number of bits?

-1

29
New cards

What is the result of taking the twos compliment representation of negative 1 AND x? Assume x is some 16 bit binary number in twos compliment form?

x

30
New cards

What is NOT(NOT(X)-1)? The + operator below is addition. - is subtraction.

x+1

31
New cards

The ALU has a zr flag to determine if the output is all zeros. Which of the following gates will be indispensable in finding zr?

Or16

32
New cards

The f bit of the ALU controls the operation performed on  the processed inputs x and y. The operation is either AND16 or binary addition, ADD16. Which of the following is the best strategy to completing the logic with basic gates?

Compute both AND16(x,y) as well as ADD16(x,y) and use a MUX16 to determine which advances to the next stage.

33
New cards

Time is the key to memory. For example, the data flip-flop (DFF) upholds the following relationship:

out(t+1) = in(t)

34
New cards

The all-important 'bit' (storage) is a multiplexor with a DFF. Its logic is: if load(t-1) then out(t) = in(X) else out(t) = Y(t-1). What are the correct values of X and Y in this logic?

 

X = t-1, Y= out

35
New cards

For a RAM that holds 256 kilobytes of 64 bit words, the load line has to be how many bits?

1

36
New cards

For a RAM that holds 256 kilowords of 64 bit words, the address line has to be how many bits?

18

37
New cards

Consider the RAM8 chip you need to write. The output should be the contents of the register specified by the address line. Select the best chip for doing that.

Mux8Way16

38
New cards

What does the following Hack machine language code block do?

code-2.png

If D=0 goto 100, else goto 150

39
New cards

Which of the following machine language commands sets y to be a value equal to the line number or address in the instruction code?

(y)

40
New cards

Which of the following machine language commands sets x to a value corresponding to the location of the next free memory cell?

@x

41
New cards

What is the appropriate form of addressing to Set register R1 to be the constant 12

Immediate Addressing

42
New cards

What is the appropriate form of addressing to Set register R2 to be the contents of memory cell 55?

Direct Addressing

43
New cards

What is the appropriate form of addressing to Set the value of R3 to be M[M[R1]], the memory address specified in R1?

Indirect Addressing

44
New cards

What is the appropriate form of addressing to AND registers 1 and 3?

Only addressing registers

45
New cards

What is the appropriate form of addressing to Set the value of R4 to M[sp], the value of the memory cell sp?

Direct addressing

46
New cards

What does this machine language instruction do?

M=D

Set the contents of memory cell M[A] to register D

47
New cards

What does the machine language instruction do?

D=A-1

Set register D to register A minus 1

48
New cards

What does the machine language instruction do?

A = M

Set register A to the memory cell M[A]

49
New cards

What does the machine language instruction do?

D = M-1

Set the contents of register D to the value of the memory cell M[A] minus 1

50
New cards

What does the machine language instruction do?

AM = @17

Set the value of register A and the memory cell M[A] to 17

51
New cards

The C-instruction has what format?

dest = comp; jump

52
New cards

Which parts of a C-instruction are optional?

dest, jump

53
New cards

A 16-bit instruction with the leftmost bit set to 0 (e.g. 0xxx xxxx xxxx xxxx) is what kind of instruction?

A-instruction

54
New cards
<p><span>What is the correct binary structure of a C-instruction?</span></p><p></p>

What is the correct binary structure of a C-instruction?

A

55
New cards

Which of the following is NOT part of the Hack computer?

Disk Storage

56
New cards

Suppose you want a screen pattern of alternating black and white pixels across each row. The first (left) pixel should be black. What unsigned 16-bit number should be written to the screen's memory locations? Use a binary-to-decimal converter. LSB is leftmost!

43690

57
New cards

Which of the following machine language commands will color the set of 16 pixels all black? SCREEN_COUNTER stores the memory-mapped address of the current screen word. " / " here is used to indicate new line.

 

@SCREEN_COUNTER / A = M / M = -1

58
New cards

Which of the following machine language commands will advance the screen pointer to the next position for writing to the screen. " / " is new line.

 

@SCREEN_COUNTER / M = M + 1

59
New cards

Which of the following is the address of the last 16 bit word in screen?

24575

60
New cards

Which of the following will jump to a line of code labeled "(BLACKEN)" if a key is pressed? In this problem " / " is new line.

 

@KBD / D=M / @BLACKEN / D;JNE

61
New cards

Which of the following lines of HDL will successfully identify an instruction as an A-instruction (true if A instruction)?

 

Not (in=instruction[15], out=aInst);

62
New cards

Which of the following lines of HDL will test to see if a ALU result is positive. Assume outputs from the ALU are aluZr and aluNg of zero and negative respectively. Also assume that a ' / ' indicates a new line.

Or (a=aluZr, b=aluNg, out=zrng) / Not (in=zrng, out=aluPos)

63
New cards

A difficulty arises in coding the HDL for the Memory chip. The keyboard address is 0x6000 = 0110 0000 0000 0000. To devise a test to see if a memory address is this value, one should:

 

See if bits 14 and 13 are 1, and check that bits 0..12 are 0

64
New cards

Another difficulty of creating the memory chip is determining if the memory address is specifying the screen. We know that the screen begins at 16,384 and ends at 24,575. What are their hex and binary equivalents?

0x4000 = 0100 0000 0000 0000, 0x5FFF = 0101 1111 1111 1111

65
New cards

The test to see if an address goes to the screen and not the keyboard or RAM should be based on address bits (remember, the right most bit is bit 0):

 

14 and 13

66
New cards

How many entries will be in the symbol table prior to reading the first line of code?

23

67
New cards

In the Chapter 6 notes, slide 56, the comp table contains only 18 rows. Why might you need more entries in the dictionary used to represent the comp table?

The 10 extra M vs. A instructions should be added, and reversible commands should be included to avoid parsing complications.

68
New cards

Which of the following python commands will remove all spaces from a line of text stored in the variable line?

 

line.replace(" ", "")

69
New cards

Which of the following Python data structures is most appropriate for managing a symbol table?

dictionary

70
New cards

Given that line is a string variable representing a "C-command" that has been stripped of spaces, which of the following is the best strategy to break it into dest, comp, jump portions?

use line.split(x) where x will be "=" or ";" to break the line into its parts. Get the output list, check it's length, and subdivide it if needed.

71
New cards

What type of operation is SUB?

Binary

72
New cards

What type of operation is LT

Binary

73
New cards

What type of operation is ADD

Binary

74
New cards

What type of operation is NEG

Unary

75
New cards

What type of operation is EQ

Binary

76
New cards

What type of operation is GT

Binary

77
New cards

What type of operation is AND

Binary

78
New cards

What type of operation is OR

Binary

79
New cards

What type of operation is NOT

Unary

80
New cards

From the options below, select the assembly language that will set the D register to true (D = -1), or false (D = 0) based on the value in the D register being greater than 0. Assume ' / ' means new line.

@TRUE / D;JGT / @FALSE / D=0;JMP / (TRUE) / D= -1 / (FALSE)

81
New cards

Which of the following sequence of assembly instructions would negatate the top of the stack? Assume that ' / ' means new line and that popToD() is the Python function that produces assembly to pop the top of the stack into the D register.

@SP / A = M - 1 / M = -M

82
New cards

Suppose the top of the stack is y and the next thing down is x. What do the assembly instructions

"@SP

A = M-1

A = A-1

D = M

A =A + 1

D = D - M

do?

Make the D register x - y and don't change the stack pointer.

83
New cards

When dealing with segments, the assembly produced will be different for push and pop operations. Suppose the appropriate segment has the name "seg". Identify the appropriate assembly code for push seg and pop seg, respectively. Assume the functions pushFromD() and popToD() are implemented.

@seg / D = M / pushFromD() : popToD() / @seg / M = D

84
New cards

Is pointer base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

fixed

85
New cards

Is local base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

pointer

86
New cards

Is this base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

pointer

87
New cards

Is argument base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

pointer

88
New cards

Is temp base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

fixed

89
New cards

Is that base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

pointer

90
New cards

Is constant base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

other

91
New cards

Is static base address is stored in another RAM cell (pointer), mapped directly to a fixed area of RAM (fixed), or mapped to a specific symbol (symbol).

symbol

92
New cards

If the VM encounters the line "push pointer 12", which of the following is the best explanation of what will happen?

push the contents of RAM[3+12] onto the stack

93
New cards

If the VM encounters the line "pop argument 3", which of the following is the best explanation of what will happen?

pop the top of the stack into RAM[RAM[2]+3]

94
New cards

Which of the following sequences of assembly instructions will place the memory address of 'argument 4' in the A register?

@ARG
D=M
@4
D=D+A
A=D

@ARG / D=M / @4 / D=D+A / A=D

95
New cards

Which of the following is a problem unique to writing assembly for VM commands of the type 'pop X index', where X is a pointer type segment?

both the address of "X index" and the thing being popped need to be stored in register D, hence a storage space must be used to prevent overwriting D.

96
New cards

The virtual machine language commands write machine language. In that machine language, when is ARG set after "call foo nArgs" is encountered in VM language? Chose the best answer.

After the calling frame (return address, LCL, ARG, THIS, and THAT) are all recorded.

97
New cards

When a function is called in the virtual machine by "call foo nArgs", what is the called function's ARG segment set to?

SP-nArgs-5

98
New cards

The virtual machine creates a functions with syntax "function foo nVars", where nVars is the number of local variables needed by the function "foo". When is this local segment initialized?

On entry to the called function.

99
New cards

The "calling frame" or set of things that the calling function records about itself before handing control over to the called functions consists of the following, in correct order.

return address, LCL, ARG, THIS, THAT

100
New cards

When the 'return' command in a virtual machine is encountered, what should be at the top of the stack? Where will the top of the stack be copied to as part of the implementation of "return"?

return value, ARG