Architectures Flashcards
Difference between von Neumann architecture and Harvard architecture?
Harvard has two separate memory spaces for programs and data, and therefore two separate buses
vN only has one memory space for both, with only one bus (this is the litmus test for vN)
What are accumulators?
General purpose registers for holding data, interim and final results of calculations, holding data ready to be transferred between I/O and main memory or between different memory locations
What is the Program Counter?
Holds the address of the next instruction to be executed
What is the Instruction Register?
Holds the actual instruction being executed
What are flags?
1 bit registers used to keep track of special conditions, such as:arithmetic carry, overflow, power failure, internal computer error
They are grouped together in one or more Status Registers
What is the Memory Address Register?
Register that holds the address of a memory location to be accessed, connected to the memory with a one-way bus
What is the Memory Buffer/Data Register?
Register that holds the data being stored in/retrieved from memory location specified in the MAR, connected to the memory with a two-way bus
What is a bus?
A physical connection (group of electrical conductors) from one part of the system to another, used for transferring data. They are used to transfer data inside the CPU, between CPU and RAM, and between CPU and components
What are the four categories of buses?
Data, Address, Control, Power
Point-to-point buses carry the signal from a specific source to a specific destination
Broadcast buses carry the signal from a specific source to multiple destinations
Three types of MIPS instructions
R-type: register operands
I-type: immediate operand
J-type: for jumping
R-type instruction format
Human format: Opcode, Dest, Source1, Source2, ShiftAmount, Function
e.g. add, $s0, $s1, $s2
Internal format: Opcode, Source1, Source2, Dest, ShiftAmount, Function
6, 5, 5, 5, 5, 6
e.g. 0, 17, 18, 16, 0, 32
opcode is always 0 for R-type instructions
add, sub, etc. are different functions for R-type
I-type instruction format
Human format: Opcode, Dest, Source, Argument
Example: addi $s0, $s1, 5
Internal format: Opcode, Source, Dest, Argument
6, 5, 5, 16
Example: 8, 17, 16, 5
J-type instruction format
Opcode, Address
6, 26
Jumps to the address specified in the 26-bit address operand
What are the four parts of the 4GB MIPS address space?
Text, global data, dynamic data, reserved
Text segment
Stores the program in memory, maximum capacity 256 MB, first four significant bits of any address in this area are 0000
Global data segment
Stores global variables, capacity of 64 KB
Global variables are accessed using the pointer $gp
Dynamic data segment
The dynamic data segment stores datat hat are dynamically allocated and deallocated throughout the execution of the program.
Data in this segment are stored in a stack and a heap.
Register only addressing
Uses registers for all source and destination operands
R-type instructions use Register Only adddressing
Immediate addressing
Uses registers and a 16-bit immediate
Some of the I-type instructions use this
Base addressing
The base address in the register rs is added to the contents of the immediate
Used in memory access instructions (subset of I-type instructions)
Memory access instructions
lw destRegister offset source = load word
lb = load byte
sw sourceRegsiter offset dest = store word
sb = store byte
word = 32 bits = 4 bytes
Example: sw $s3, 4($0) means write $s3 to Word 1
PC-relative addressing
0x40 loop: __________
…
0x54 bne $t1, $0, loop
0x58 _____________
…
bne is an I-type instruction. To calculate the imm, subtract the target address from the PC value immediately after the branching instruction and divide by 4. (0x58 - 0x40)/4 = -6
Therefore imm = -6 = 1111 1111 1111 1010
Pseudo-direct addressing
This is used to calculate the new value of the Program Counter from a J-type instruction
2 least significant bits and 4 most significant bits are left to 0
j 0x004000A0 = j 0000 0000 0100 0000 0000 0000 1010 0000 = j 0000 0100 0000 0000 0000 1010 00