1/86
Flashcards to help review the lecture notes on computer architecture concepts.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
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.
What is the power wall?
A limitation on computing systems' performance due to the heat generated when speeding up and empowering them.
What is the multicore crisis?
The splitting of the CPU into multiple smaller cores to alleviate power wall issues by reducing heat generation.
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.
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
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.
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
What are some of the variable declarations in C?
Int x = a, Int *y = &x, Char[] = āhelloā
What is meant by dereference?
give us the value at memory address pointed to
what does & mean in C?
address, give us the literal memory address being pointed to
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
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
What are the three files/streams created when any program is run?
stdin, stdout, stderr
What is the purpose of stdin?
It is used for taking text as an input.
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.
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.
Write the syntax for fopen
Fopen(filename, āmodeā)
What modes can be used when opening a file?
r or w, respectively
How do you define a string?
Must always contain a terminator byte '\0'
Is Char s[] = āhelloā mutable?
can be changed, accessing s[2] is valid
Is Char *t = āhelloā mutable?
immutable, canāt be changed bc is a pointer to a string
Is Char u[] = {'h', 'e', 'l', 'l', 'o'} a string?
not a string since no null terminator
What strings library function compares s2 to s1 and returns 0 if they are the same?
Strcmp(s1, s2)
What strings library function copies s2 into s1?
Strcpy(s1, s2)
What are three locations that objects can be created in?
Static/globals, stack, heap
When are global objects created and destroyed?
created when the program starts and are not destroyed
When are stack objects created and destroyed?
created when function begins and destroyed when it ends
When are heap objects created and destroyed?
created by malloc and must be freed at the end of the program
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)); }
How to convert decimal to binary?
continuously divide by 2 and mark remainder, put remainders together in reverse order
What is Endianness?
The direction data is read in
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
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
What does a '1' and '0' represent if the leftmost bit is the Sign Magnitude?
0 for positive and 1 for negative
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
How to find the two's complement?
To make a negative number, complement all the bits and then add one
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
What are the three parts of the single precision IEEE floating point format?
a sign bit, an exponent, and a significand
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
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
What are nomral values in single precisions format?
when exponent is not a special value
what are the conditions for subnormal values?
when the exponent is all zeroes
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
What are the sizes for data in x86 architecture?
Byte 8 bits, Word 16 bits, Double Word 32 bits, Quad Word 64 bits
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
What does opcode[size] operand, operand⦠mean
opcode = which operation, size = size of data being used, operands = operation parameters
What is an immediate value addressing mode?
$100
What is a register addressing mode?
%eax
What is an absolute address addressing mode?
100
What is an indirect reference addressing mode?
2(%eax) = indirect reference (register contains an address in memory where we want to read from)
What is an index mode addressing mode?
4(%eax, %ebx) = index mode
What is a scaled index addressing mode?
8(%eax, %ebx, 4) = scaled index mode
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
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
What happens during a push command?
subtracts 4 from ESP and puts that value into a register, effectively saving it
What happens during a pop command?
saves that register in memory and then adds four to ESP
What does the call command do?
Call [label] pushes a return address onto the stack and jumps to that label
What does the ret command do?
Ret pops the return address off the stack and jumps to that address
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
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
What are Caller-save registers?
eax, ecx, edx are used to hold temporary quantities that don't be preserved across function calls
What are Callee-save registers?
ebx, esi, edi are used to hold long-lived values that should be preserved across calls
where are arguments passed in?
the caller frame, above the return address
where the return values found after a function call?
eax is the register where by convention the return value is found
What is the most that is needed to maintain an array in assembly?
usually two registers are needed to maintain an array
What are structs in memory?
a region of memory containing members of different data types/lengths
Why do we align data?
to make memory accesses more efficient and streamlined
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
What is the one universal gate?
NAND
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
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
What is included in a minterm?
For every possible combination of inputs
What are latches and flip flops?
state elements that store one bit of state information
What do Latches and flip-flops depend on?
prior values and current states
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
What is a stable circuit?
A stable circuit is constantly in one state
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
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)
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
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
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)
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
What is the formula to find the Cache size?
Cache size = block size * number of sets * blocks per set
Addresses are read from to _ (little endian)
right, left
Address (A) = _ + + _
tag, set index, block offset
The valid bit
tells us if the data in our block is valid
Adding a dirty bit what is signified?
signify if the block has been changed (dirty if yes, clean if no)