Computer Architecture Flashcards

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

1/86

flashcard set

Earn XP

Description and Tags

Flashcards to help review the lecture notes on computer architecture concepts.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

87 Terms

1
New cards

What is Moore's Law?

The observation that the number of transistors in a chip has increased exponentially over time, leading to a doubling of processor speed every few years.

2
New cards

What is the power wall?

A limitation on computing systems' performance due to the heat generated when speeding up and empowering them.

3
New cards

What is the multicore crisis?

The splitting of the CPU into multiple smaller cores to alleviate power wall issues by reducing heat generation.

4
New cards

What is the CPU memory speed gap?

The disparity in performance improvement rates between CPU speed and memory speed, with CPU speeds improving much faster.

5
New cards

What is the Von Neumann model?

A computer model that splits a computer into the CPU and memory, where the CPU fetches instructions AND data from memory so that the CPU can work faster

6
New cards

Why are registers and caches used in the context of the Von Neumann model?

Registers and caches are used to capitalize on the faster processing speed of the CPU compared to memory, providing extra internal workspaces and layers between the CPU and memory.

7
New cards

Why might a switch statement be used over an if statement?

Switch cases have the chance of being compiled in a constant time operation in assembly code, whereas if statements may require a lot of jumping

8
New cards

What are some of the variable declarations in C?

Int x = a, Int *y = &x, Char[] = ā€œhelloā€

9
New cards

What is meant by dereference?

give us the value at memory address pointed to

10
New cards

what does & mean in C?

address, give us the literal memory address being pointed to

11
New cards

Why is it necessary to use sizeof() to find the number of bytes used to represent a data type?

The amount of bytes varies across systems

12
New cards

What is the main function in C?

necessary to have in any program where we get argv, our arguments, from and must return exit status

13
New cards

What are the three files/streams created when any program is run?

stdin, stdout, stderr

14
New cards

What is the purpose of stdin?

It is used for taking text as an input.

15
New cards

What is the purpose of stdout?

It is used for text output of any command you type in the terminal, and then that output is stored in the stdout stream.

16
New cards

What is the purpose of stderr?

It is invoked whenever a command faces an error, then that error message gets stored in this data stream.

17
New cards

Write the syntax for fopen

Fopen(filename, ā€œmodeā€)

18
New cards

What modes can be used when opening a file?

r or w, respectively

19
New cards

How do you define a string?

Must always contain a terminator byte '\0'

20
New cards

Is Char s[] = ā€œhelloā€ mutable?

can be changed, accessing s[2] is valid

21
New cards

Is Char *t = ā€œhelloā€ mutable?

immutable, can’t be changed bc is a pointer to a string

22
New cards

Is Char u[] = {'h', 'e', 'l', 'l', 'o'} a string?

not a string since no null terminator

23
New cards

What strings library function compares s2 to s1 and returns 0 if they are the same?

Strcmp(s1, s2)

24
New cards

What strings library function copies s2 into s1?

Strcpy(s1, s2)

25
New cards

What are three locations that objects can be created in?

Static/globals, stack, heap

26
New cards

When are global objects created and destroyed?

created when the program starts and are not destroyed

27
New cards

When are stack objects created and destroyed?

created when function begins and destroyed when it ends

28
New cards

When are heap objects created and destroyed?

created by malloc and must be freed at the end of the program

29
New cards

How to allocate and access a 2D array?

Int **array = (type **)malloc(rows * sizeof(type*)); for (int I= 0; I < rows; i++){ array[i] = (type *) malloc (columns * sizeof(type)); }

30
New cards

How to convert decimal to binary?

continuously divide by 2 and mark remainder, put remainders together in reverse order

31
New cards

What is Endianness?

The direction data is read in

32
New cards

How does the little-endian read direction compare to how a number is represented?

Little-endian reads from right to left, which is how base n numbers are represented, where the leftmost place is the place of highest value

33
New cards

What is the result of an arithmetic calculation that produces data larger than the allocated bits?

report as an error, reduce the number to the highest representable value, returning a congruent number by dropping the high order bits

34
New cards

What does a '1' and '0' represent if the leftmost bit is the Sign Magnitude?

0 for positive and 1 for negative

35
New cards

How to find the ones complement?

Flip every bit of a positive number to make its negative counterpart and Add 1 if there is overflow during addition

36
New cards

How to find the two's complement?

To make a negative number, complement all the bits and then add one

37
New cards

How to perfrom Sign extension for signed integers?

Fill with 1's if the leftmost bit is a 1, fill with 0's if the leftmost bit is a 0

38
New cards

What are the three parts of the single precision IEEE floating point format?

a sign bit, an exponent, and a significand

39
New cards

Explain how to compute the exponent in the IEEE floating point format?

Found by writing the number in binary and moving over until the number is 1.xxxxx, our exponent is how many places we moved over, 2^places

40
New cards

How to compute the bias in the IEEE floating point format?

Computed by 2^(e-1) -1, where e is our bits for the exponent

41
New cards

What are nomral values in single precisions format?

when exponent is not a special value

42
New cards

what are the conditions for subnormal values?

when the exponent is all zeroes

43
New cards

What are ISA, CISC, and RISC?

ISA is the instruction set architecture, or the set of instructions a CPU can execute, CISC architecture favors complex instructions in the CPU that can reduce code size, RISC architecture favors simple instructions in the CPU that can increase code size but make the CPU perform faster

44
New cards

What are the sizes for data in x86 architecture?

Byte 8 bits, Word 16 bits, Double Word 32 bits, Quad Word 64 bits

45
New cards

Describe some of the x86 register names.

Data registers (EAX, EBX, ECX, EDX) hold operands, pointer/index registers (EBP, ESP, EIP…) hold references to addresses and indices

46
New cards

What does opcode[size] operand, operand… mean

opcode = which operation, size = size of data being used, operands = operation parameters

47
New cards

What is an immediate value addressing mode?

$100

48
New cards

What is a register addressing mode?

%eax

49
New cards

What is an absolute address addressing mode?

100

50
New cards

What is an indirect reference addressing mode?

2(%eax) = indirect reference (register contains an address in memory where we want to read from)

51
New cards

What is an index mode addressing mode?

4(%eax, %ebx) = index mode

52
New cards

What is a scaled index addressing mode?

8(%eax, %ebx, 4) = scaled index mode

53
New cards

What are the condition codes?

Represent a state depending on the most recent operation;
CF; carry flag
ZF; zero flag
SF; sign flag
OF; overflow flag

54
New cards

What does the mov command do?

MOV [source, destination]
Source can be registers, location in memory denoted by a literal, or a label
Destination can be a register or location in memory
Used to copy data from one place to another

55
New cards

What happens during a push command?

subtracts 4 from ESP and puts that value into a register, effectively saving it

56
New cards

What happens during a pop command?

saves that register in memory and then adds four to ESP

57
New cards

What does the call command do?

Call [label] pushes a return address onto the stack and jumps to that label

58
New cards

What does the ret command do?

Ret pops the return address off the stack and jumps to that address

59
New cards

What does the Leal command do?

Lea [(source) , destination %register] >>> destination = source
Source must be in address mode expression, aka an indirect reference
Sets destination to be the address specified by the source

60
New cards

What does the Cmp command do?

Cmp [source1, source2] >>> source2 - source1 = ?
Compares the first source operand with the second source operand and sets condition codes according to the results
the comparison is performed by subtracting the second operand from the first operand and then setting codes

61
New cards

What are Caller-save registers?

eax, ecx, edx are used to hold temporary quantities that don't be preserved across function calls

62
New cards

What are Callee-save registers?

ebx, esi, edi are used to hold long-lived values that should be preserved across calls

63
New cards

where are arguments passed in?

the caller frame, above the return address

64
New cards

where the return values found after a function call?

eax is the register where by convention the return value is found

65
New cards

What is the most that is needed to maintain an array in assembly?

usually two registers are needed to maintain an array

66
New cards

What are structs in memory?

a region of memory containing members of different data types/lengths

67
New cards

Why do we align data?

to make memory accesses more efficient and streamlined

68
New cards

What is the largest data type?

our K, so overall our block of memory must be a multiple of K, and different data items should be aligned at multiples of K

69
New cards

What is the one universal gate?

NAND

70
New cards

What is a decoder?

takes an input of N bits to encode an integer, and only one output out of 2^N outputs will be true depending on the input

71
New cards

What is a multiplexer?

Takes in N-selector bits and 2^N inputs, and puts out a single output, based on the values of the selectors, the value of the output will be equal to one of the inputs

72
New cards

What is included in a minterm?

For every possible combination of inputs

73
New cards

What are latches and flip flops?

state elements that store one bit of state information

74
New cards

What do Latches and flip-flops depend on?

prior values and current states

75
New cards

The difference between latches, flip-flops and d-flipflops.

A latch changes its output whenever its input changes, a flip-flop only changes its output at specific moments, d-flipflops make it so that the state can only change the moment the clock cycle hits 1, and not again until the next iteration

76
New cards

What is a stable circuit?

A stable circuit is constantly in one state

77
New cards

What is a bistable circuit

A bistable circuit swaps between two states, with no inputs and 2 outputs where the output feeds back into the circuit infinitely

78
New cards

Finite State Machines

A combination of state registers (who store and load the next state on the clock edge) and combinational logic (computes the next state and the current output)

79
New cards

What is the memory hierarchy?

Registers >> L1 cache >> L2 cache >> main memory >> local secondary storage, each layer can be considered as a cache for the layer below, in a manner of speaking

80
New cards

What are spatial and temporal locality?

assumption that recently accessed locations will be accessed again sometime soon and assumption that locations accessed recently will probably want to access nearby areas as well

81
New cards

What is a cold miss?

our cache is initially empty, so the first request will always be a miss (and then we begin loading our cache)

82
New cards

Block size vs cache size vs associativity/lines per set

Cache size (C) = size of the overall cache, Sets (S) = number of sets present in the cache, Block size (B) = size of a cache block in bytes, Associativity (A) = number of blocks allowed in a set

83
New cards

What is the formula to find the Cache size?

Cache size = block size * number of sets * blocks per set

84
New cards

Addresses are read from to _ (little endian)

right, left

85
New cards

Address (A) = _ + + _

tag, set index, block offset

86
New cards

The valid bit

tells us if the data in our block is valid

87
New cards

Adding a dirty bit what is signified?

signify if the block has been changed (dirty if yes, clean if no)