High-Level Architecture Flashcards
A basic computer system consists of what? (6)
- CPU
- System Clock
- Primary Memory (RAM)
- Secondary Memory (SSD or HDD)
- Peripheral I/O Devices
- Bus
Computer System Elements Diagram
Check Notes
What does the CPU do?
- Executes instructions (i.e. a program)
- Controls the transfer of data across the bus
Where is the CPU contained?
On a single microprocessor chip
3 Main Parts of a CPU
- Control Unit (CU)
- Arithmetic Logic Unit (ALU)
- Registers
What does the CU do?
The CU directs the execution of instructions
- Loads an opcode from Primary Memory into Instruction Register (IR)
- Decodes the opcode to identify the operation
- If needed, transfers data between PM and Registers
What does the ALU do?
The ALU performs arithmetic and logical operations on data stored in registers
What are Registers?
They are binary storage units in the CPU
What may Registers contain?
- Data
- Addresses
- Instructions
- Status Information
What are General-purpose Registers used for?
To temporarily hold data and addresses
What does the Program Counter (PC) contain?
It contains the address in memory of the currently executing instruction
It is incremented to execute the next instruction
What does the Status Register (SR) contain?
It contains information (flags) about the result of a previous instruction (e.g. overflow or carry)
What does the System Clock do?
It generates a clock signal to synchronize the CPU and other clocked devices
- It is a square wave at a particular frequency
- Device coordinate on the rising or falling edges
Features of Primary Memory?
- RAM (any byte in memory can be accessed directly if you know its address)
- Can be written to and read from
- Is volatile (Data disappears when powered off)
- Is used to store program instructions and data (variables)
- Consists of a sequence of addressable memory locations (each location is typically one byte long)
Two architectures and features
- In a VON NEUMANN ARCHITECTURE, RAM contains both data and programs
- In a HARVARD ARCHITECTURE, it uses separate memories for data and programs
What is the Bus and what does it do?
The Bus is a set of parallel data/signal lines
It is used to transfer information between computer components
The bus is subdivided into what?
- Address Bus
- Data Bus
- Control Bus
What does the Address Bus do?
The Address Bus specifies memory location in RAM
or sometimes a memory-mapped I/O device
What is the Data Bus used for?
The Data Bus is used for bidirectional data transfer
What is the Control Bus used for?
The Control Bus is used to control or monitor devices connected to the Bus
e.g. read/write signal for RAM
Features of Secondary Memory?
Usage?
Volatility?
Embodied on?
- Is used to hold a computer’s file system (Stores files containing program or data)
- Is non-volatile read/write memory (Its contents persist through power cycle)
- Usually embodied on a HDD or SSD
What do Peripheral I/O Devices do?
They allow communication between the computer and the external environment
e.g. I/O devices are HDD, Modem
Basic CPU Architectures Diagram
Check Notes
Explaining the Basic CPU Architecture Diagram
- Operands for an instruction come from the Accumulator Register (ACC) and from a single location in RAM
- ALU results are always put into the ACC
- Only Load and Store instructions can access RAM
- Other instructions operate on Specified Registers in Register file, not on RAM (b/c registers are more quickly access than RAM, so faster)
What is a Typical Program Sequence?
- Load registers from memory
- Execute an instruction using 2 source registers, putting result into destination register
- Store the result back into memory
What does the RISC Architecture stand for?
RISC: Reduced Instruction Set Computer
RISC: Instruction Cycles?
Size of instructions - what does it allow for?
~ Uses only simple instruction that can be executed in one machine cycle
- Enables faster clock rates -> faster execution
- Makes Programs More larger
~ Machine instructions are always the same size
- Makes decoding simpler and faster
What size are ARMv8 Instructions
ARMv8 instructions are always 32 bits wide
What does CISC Architecture stand for?
CISC: Complex Instruction Set Computer
CISC: Instruction Cycles?
Size of instructions?
~ May have instructions that take many cycles to execute
- Provided for programmer convenience
- Slows down overall execution speed
~ Machine instructions vary in length and may be followed by “immediate” data
- Makes decoding difficult and slow
Another name for Instruction Cycle?
Fetch-execute or fetch-decode-execute cycle
Process of Instruction Cycle?
The CPU executes each instruction in a series of small steps
- Fetch the next instruction from memory into the IR
(PC has addresses) - Increments PC to point to next instruction
- Decodes instruction
- If instruction uses an operand in RAM, calculate its address
- Fetch the operand
(4/5 repeat)
- Execute instruction
- If instruction produces a result stored in RAM, calculate its address
(6/7 repeat)
- Store the result
ALP: What do Assembly Language Programs have?
Consist of a series of statements, each corresponding to a machine instruction
ALP: Each Statement has what?
An Opcode, and a variable number of Operands
add (opcode) x20, x20, x21 (operands)
ALP: How are instructions stored?
Seuqentially - each instruction statement has a unique address
ALP: What does a label do?
It can prefix a statement, and is a symbol whose value is the address of the machine instruction
Can be used as a target for a Branch Instruction
start: add x20, x20, x21
ALP: What are Pseudo-ops?
Pseudo-ops (assembler directives) do not generate machine instructions but give assembler extra information
e.g.
.global start
ALP: What do comments do?
May be appended to the end of a statment
e. g.
start: add x20, x20, x21 //add term
ALP: Format of line of code
label | | opcode | | operands | | comments |
What do Assemblers do?
Give a type
Assemblers translate assembly source code into machine code
GNU for this course
Code instructions to assemble ARMv8 source code?
gcc myprog.s -o myprog
gcc invokes the assembler as, then links the code, producing an executable called “myprog”
Assumes files ending with .s have assembly source code
What are Macro Processors?
What is Macro Expansion?
Many assemblers support macros
- Allow to define a piece of text with a macro name (Optionally, parameters can be specified)
- This text will be substituted inline wherever invoked (macro expansion)
- Provided as a convenience to help make code more readable?
gcc support for macros code
- We use m4 before invoking gcc which is a standard UNIX (Linux) Command to expand macros