새발블로그

[Computer Architecture] The Processor 본문

Computer Science/Computer Architectures

[Computer Architecture] The Processor

EUG 2024. 1. 11. 02:19

Load a instruction from memory (fetch)

User the opcode field to identify the instruction type(decode_

Arithmetic/logic : add, sub, and, or

  • read 2 operand values from register
  • perform calculation
  • write the result back into register
  • add 4 to pcMemory access : lw
  • read 1 word from the register (base address)
  • add the base address with the offset(Immediate field)
  • load word from data memory (Address : base address + offset)
  • write loaded word into the register
  • add 4 to PCMemory access : sw
  • read 1 word from the register file (base address)
  • add the base address with the offset (imm field)
  • read 1 word from the regiser : value to store
  • store the word to data memory (address : base address + offset)
  • add 4 to PCControl transfer : beq
  • read 2 words from the register
  • perfom comparison (using ALU): substraction
  • if *rs1 == *rs2 -> pc < pc+imm
    else pc <-pc +4

Instruction/ Data Memroy

CPU
instruction cache data cache
main memory

R-Format instructions

Read: Behaves like combinational logic
Read Register 1/2 : register IDs from the current instruction
Read Date 1/2 : The current value of the corresponding registers

Write : behaves like a sequential logic
if RegWrite is "1", writes the values to the target register
write happends when moving to the next cycle

Arithmetic Logic Unit(ALU)

ALU operation (4-bit input) selects actual function

load/store : add
branch : subtract
r-type : fun7, fun3 fields

 

ALU control bits

 

 

 

Data Memory

MemRead : gives the current memory value from the address

MemWrite: writes the data to the address

 

Branch Condition test