Podcast
Questions and Answers
Which factor most directly influences the number of operations an algorithm requires?
Which factor most directly influences the number of operations an algorithm requires?
- The speed of the processor.
- The efficiency of the chosen algorithm. (correct)
- The system's input/output capabilities.
- The programming language used.
How does the control component of a computer system manage data flow?
How does the control component of a computer system manage data flow?
- By providing the physical pathways for data transfer.
- By executing arithmetic operations.
- By directing signals to orchestrate operations in the datapath, memory, and I/O. (correct)
- By storing data for later retrieval.
Why is abstraction considered a valuable tool in computer design?
Why is abstraction considered a valuable tool in computer design?
- It enhances the speed of processors.
- It reduces the need for memory.
- It simplifies design by hiding lower-level details. (correct)
- It increases the complexity of algorithms.
In the context of RISC-V architecture, what does the 'ra' register primarily store?
In the context of RISC-V architecture, what does the 'ra' register primarily store?
What is the primary role of the opcode in the RISC-V instruction format?
What is the primary role of the opcode in the RISC-V instruction format?
Which addressing mode involves the operand being located at a memory address calculated by summing a register's value and a constant?
Which addressing mode involves the operand being located at a memory address calculated by summing a register's value and a constant?
When calling a procedure in RISC-V, what is the typical first step?
When calling a procedure in RISC-V, what is the typical first step?
Why might a compiler need to spill registers to memory?
Why might a compiler need to spill registers to memory?
What is the role of the Frame Pointer (fp) in RISC-V memory layout?
What is the role of the Frame Pointer (fp) in RISC-V memory layout?
Under what condition will the sc.w
instruction fail in an atomic exchange operation?
Under what condition will the sc.w
instruction fail in an atomic exchange operation?
What is the primary function of a compiler?
What is the primary function of a compiler?
What is the purpose of a Linker/Link Editor?
What is the purpose of a Linker/Link Editor?
How do Dynamically Linked Libraries (DLLs) contribute to program execution?
How do Dynamically Linked Libraries (DLLs) contribute to program execution?
What is the role of the Java Virtual Machine (JVM) in executing Java bytecode?
What is the role of the Java Virtual Machine (JVM) in executing Java bytecode?
In binary representation, what does the term '2's complement' refer to?
In binary representation, what does the term '2's complement' refer to?
During the shift and add multiplication algorithm, what operation is performed when the last bit of the multiplier is 1?
During the shift and add multiplication algorithm, what operation is performed when the last bit of the multiplier is 1?
In Booth's algorithm, what action is taken for a sequence of 1s in the multiplier?
In Booth's algorithm, what action is taken for a sequence of 1s in the multiplier?
During the restoring division algorithm, what is done if the remainder is negative after subtracting the divisor?
During the restoring division algorithm, what is done if the remainder is negative after subtracting the divisor?
When does overflow occur in addition/subtraction operations?
When does overflow occur in addition/subtraction operations?
In floating-point representation, what is the purpose of the exponent?
In floating-point representation, what is the purpose of the exponent?
Flashcards
Algorithm
Algorithm
Affects the number of operations required to solve a problem.
Programming Language, Compiler, Architecture
Programming Language, Compiler, Architecture
Impacts machine instructions per operation.
Processor & Memory System
Processor & Memory System
Affects the speed of execution.
Input/Output (I/O) System
Input/Output (I/O) System
Signup and view all the flashcards
Little Endian
Little Endian
Signup and view all the flashcards
Big Endian
Big Endian
Signup and view all the flashcards
Opcode
Opcode
Signup and view all the flashcards
Immediate addressing
Immediate addressing
Signup and view all the flashcards
Register addressing
Register addressing
Signup and view all the flashcards
Base or displacement addressing
Base or displacement addressing
Signup and view all the flashcards
PC-relative addressing
PC-relative addressing
Signup and view all the flashcards
Compiler
Compiler
Signup and view all the flashcards
Assembler
Assembler
Signup and view all the flashcards
Linker/Link Editor
Linker/Link Editor
Signup and view all the flashcards
Dynamically Linked Libraries (DLLs)
Dynamically Linked Libraries (DLLs)
Signup and view all the flashcards
Loader
Loader
Signup and view all the flashcards
Java Virtual Machine (JVM)
Java Virtual Machine (JVM)
Signup and view all the flashcards
Just-In-Time compiler (JIT)
Just-In-Time compiler (JIT)
Signup and view all the flashcards
Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU)
Signup and view all the flashcards
Multiplicand
Multiplicand
Signup and view all the flashcards
Divisor
Divisor
Signup and view all the flashcards
Quotient
Quotient
Signup and view all the flashcards
Remainder
Remainder
Signup and view all the flashcards
Study Notes
- Assemblers Notes provides information on equations, RISC-V operations, and registers covered in Chapters 1 and 2.
Chapter 1: Equations
- MIPS = IC / (t x 10^6)
- t = (IC x CPI) / CR
- CC = CPI x IC
- Power = (1/2)(capacitive load)(voltage)^2(frequency switch)
- timproved = (toriginal) / (improvement factor) + tunaffected
- speedup = (toriginal) / (timproved)
- cost/die = cost/wafer / (dies/wafer) x yield
- dies/wafer = wafer area / die area
- yield = (1 + (defects density x die area) / 2)^-1
- SPECratio = treference / ttarget
Chapter 1: Definitions
- CC (Clock Cycles): The number of clock cycles
- CPI (Cycles Per Instruction): The number of cycles per instruction, a whole number.
- IC (Instruction Count): Number of instructions
- MIPS (Millions of Instructions Per Second): Measures computer performance
- CR (Clock Rate): Measured in GHz (1 GHz = 1 x 10^9 Hz), frequency.
- Power: Measured in Watts (1 MW = 1 x 10^6 W)
- SPECratio: A higher ratio is better, compute geometric mean to find overall ratio
- Capacitive Load: Measured in farads (F)
CPU Performance Factors
- Algorithm: Affects the number of operations
- Programming Language, Compiler, Architecture: Affects the number of machine instructions per operation.
- Processor & Memory System: Affects the speed of operation execution involving data movement between the CPU and memory
- Input/Output (I/O) System (includes OS): How fast I/O operations are executed by peripheral systems like monitors or printers.
- Hardware: Includes the processor, memory, and I/O controllers as five main components.
- Input: mechanism writes data to memory, examples include Touchscreens (resistive and capacitive types, capacitive allows multiple touches simultaneously, is used more, and is more durable)
- Output: mechanism conveys computation results, examples include Liquid Crystal Display (LCD) screen made up of pixels (picture elements)
- Memory: Used by the Central Processor Unit (CPU) to get instructions and data
- Datapath: Performs computations as the path data takes
- Control: Sends signals determining data path operations, memory usage, and input/output, managing data flow and memory access.
- Integrated Circuit (IC): Combines dozens to millions of transistors
Seven Great Ideas In Computer Architecture
- Use abstraction to simplify design by hiding lower-level details for a simpler model.
- Make the common case fast to optimize performance.
- Use parallelism to divide tasks into smaller chunks executed on different processors, increasing step speed.
- Use pipelining as a type of parallelism to execute multiple instructions/steps simultaneously, eliminating the waiting period for the first step to complete.
- Use prediction, guess on conditional statements (if/else) and begin the steps with your prediction and if correct, it will already be started when true/false is determined.
- Use hierarchy of memories for efficient data storage and retrieval.
- Use dependability via redundancy to ensure system reliability.
Chapter 2 - RISC-V ISA
- Little Endian: Least significant byte stored in lowest address, used by RISC-V.
- Big Endian: Most significant byte stored in lowest address, used by MIPS.
RISC-V Registers and Purposes
Register Name | Number | Use | Preserved on Call? |
---|---|---|---|
zero | x0 | The constant value 0 | N/A |
ra | x1 | Return address (link register) | Yes |
sp | x2 | Stack pointer | Yes |
gp | x3 | Global pointer | Yes |
tp | x4 | Thread pointer | Yes |
t0-t2 | x5-x7 | Temporaries | No |
s0-s1 | x8-x9 | Saved registers and local variables for a given procedure | Yes |
a0-a7 | x10-x17 | Arguments/results | No |
s2-s11 | x18-x27 | Saved registers | Yes |
t3-t6 | x28-x31 | Temporaries | No |
RISC-V Instruction Types
- opcode: 7 bits; combined with funct7 (7 bits) and funct3 (3 bits) specifies instruction format/type.
- rs: 5-bit source register.
- rd: 5-bit destination register
- immediate: a 12-bit constant value
Instruction Types
Name | Field | Description |
---|---|---|
R-type | funct7, rs2, rs1, funct3, rd, opcode | Arithmetic instruction format |
I-type | immediate [11:0], rs1, funct3, rd, opcode | Loads & immediate arithmetic |
S-type | immed[11:5], rs2, rs1, funct3 immed[4:0], opcode | Stores |
SB-type | immed[12,10:5], rs2, rs1, funct3 immed[4:1,11], opcode | Conditional branch format |
UJ-type | immediate [20,10:1, 11, 19:12], rd, opcode | Unconditional jump format |
U-type | immediate[31:12], rd, opcode | Upper immediate format |
- R-Type: register-based arithmetic and logical operations such as add, sub, sll, slt, sltu, xor, srl, sra, or, and.
- I-Type: loads and immediate versions of arithmetic functions such as addi, slti, sltiu, xori, ori, andi, lb, lh, lw, lbu, lhu, jalr, alli, srli, srai.
- J-Type/UJ-Format: unconditional jump format (jal), similar to U-type and has a 20-bit immediate
- U-Type: upper immediate format (lui), has a 20-bit immediate.
- S-Type: stores data (sb, sh, sw).
- B-Type: conditional branch format (beq, bne, blt, bge, bltu, bgeu), similar to S-Type, immediate number is multiplied by two and target address is immediate * 2 + PC.
Addressing Modes
- Immediate addressing: operand is constant within instruction (e.g., addi).
- Register addressing: operand is a register (e.g., add).
- Base or displacement addressing: operand's memory location is the sum of a register and a constant (e.g., lw).
- PC-relative addressing: branch address is the sum of the PC and a constant (e.g., beq or jal).
Procedures - Calls and Returns, Stack Operations
- Procedure: subroutine performing task based on parameters.
Calling Convention
- Load parameters into registers (a2-a7 in x12-x17).
- Transfer control to procedure/call (jal zero, ProcedureLabel).
- Acquire storage (move data to memory on the stack).
- Spilling Registers to Memory: Compiler needs more registers, involves decrementing sp, loading return address/parameters, and remembering to restore them.
- Perform procedure instructions.
- Place result in register (a0, a1 in x10, x11).
- Return to place of call (jalr zero, O(ra)).
RISC-V Memory Layout
- Frame Pointer: (stored in x8 or as fp) denotes saved registers/local variables location.
- Stack Pointer: denotes the most recently allocated address in a stack that shows where registers should be spilled or where old register values can be found (x2 or sp in RISC-V)
- Global Pointer: register pointing to the static area (static/outside procedure variables)
- Heap: dynamic data structures, grows upwards in memory
Synchronization (Atomic Exchange)
- Data Race: different threads accessing same memory location.
- Atomic Exchange/Swap: interchanges a register's value with a memory value.
- Ir.w and sc.w are used to atomically load and conditionally write a word, ensuring synchronization.
Translation from HLL to Machine Code
- Compiler: transforms a high-level language program into assembly language.
- Compiler Optimization: improves code performance and efficiency.
- Assembly Language: symbolic language translated into binary machine language by assembler.
- Assembler: converts assembly language instructions into machine code.
- Linker/Link Editor: Combines separately assembled object modules, resolves undefined labels, creates executable file.
- Object Module: header, text segment, data segment, relocation information, symbol table, debugging information.
- Executable File: complete program format with all references resolved for execution.
- Symbol Table: maps label names to their corresponding memory addresses.
- Dynamically Linked Libraries (DLLs): library routines linked during execution.
- Loader: systems program places object program into main memory for execution.
- Basic Block: sequence of instructions without branches.
Java Translation
- Java bytecode: Instructions read by the JVM to run Java programs on any platform
- Java Virtual Machine (JVM): Runs Java bytecode.
- Just-In-Time compiler (JIT): compiles bytecode into native code during runtime for faster execution.
RISC-V Coding
- Translation of if-and-else branches, while/for loops
- Procedures calls/returns, and stack operations
- Analyzing and writing RISC-V code (4-10 lines)
- Loading 32-bit immediate values into RISC-V registers, including using lui and addi instructions.
Chapter 2 - Numeric and Data Representation
- Includes unsigned numbers, binary/decimal/hexadecimal conversions.
Numeric Concepts
- Binary to decimal conversion: mod 2, divide by two, work bottom to top.
- Binary to hex conversion: each set of 4 bits is one hex digit.
- 2's complement: switch bits and add one to convert from negative to positive or vice versa.
- Overflow problem: Addresses when results exceed representation limits.
- Characters and strings, using the ASCII table
- Strings: arrays of characters, length tracked by null or length
- Bit-Extension: extend with zeros (unsigned)
Chapter 3: Multiplication
- multiplicand: the first number
- multiplier: the second number
Shift and add multiplication
- Adds the multiplicand to the product.
- Shifts the multiplicand left.
- Shifts the multiplier right.
- signed multiplication: converting to unsigned, then converting its sign at the end.
- Optimized multiplication: stores product register on the left, multiplier on the right
Booth's Algorithm
- Handles consecutive ones in the multiplier efficiently.
- Involves shift right arithmetic (sra) that handles the sign extension upon shifting right.
Action Table
- Employs rewriting sequences of 1s to optimize multiplication.
Division
- Division algorithm: dividend, divisor, quotient, remainder
- Restoring division: after subtracting divisor if remainder permits.
- Optimized division: initialized to the right for the dividend.
- Signed division involves unsigned division then restoring the sign at the end.
- Floating-point representation: balancing range and precision.
- Normalized Scientific Notation: Includes significand and exponent
Floating points
- S: significand (one non-zero digit/bit and the fraction/bit fraction)
- 1.0 <= significand < 2.0
- B: base 10 or 2
- E: exponent
- add bias number to actual exponent to make it unsigned
- Single Precision (32 bit) - float
- S Exponent Fraction (8 bits) (23 bits)
- bias = 127
- exponent range: -126 to 127
- total range: 12^-126 to 22^127 o decimal precision: 6 digits past the decimal
- S Exponent Fraction (8 bits) (23 bits)
- Double Precision (64 bit) - double
- S Exponent Fraction (11 bits) (52 bits) o bias = 1023 o exponent range: -1022 to 1023
- total range: 12^-1022 to 22^1023
- o decimal precision: 16 digits past the decimal
- Half Precision
- S Exponent Fraction1 (5 bits) (10 bits)
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.