CENG304 – Computer Architecture
Izmir Katip Celebi University
Spring 2023-2024
Lecture 05
H. Burak Akyol, Ph.D.
Main Components of Computers
IKCU - CENG304 2
Single-Cycle Processor
◼ Single-cycle processors are a type of CPU design where each
instruction executes in a single clock cycle.
◼ Regardless of the complexity of the instruction, each
instruction takes the same amount of time to be executed.
◼ Simplifies the design while potentially limiting performance
compared to more complex architectures.
IKCU - CENG304 3
Single-Cycle Processor
◼ add x2, x3, x4
◼ sw x5, 8(x6)
◼ Each instruction has different latencies. Therefore, cycle time is
determined based on the slowest instruction (the instruction with
the maximum latency). IKCU - CENG304 4
Processor Designing Stages
1- Instruction set architecture specification
2- Determination of the requirements of the ISA
3- Datapath design
a- Identification of datapath components that meet the requirements
b- Integration of the datapath components
4- Control unit design
a- Identification of control points
b- Designing the unit that controls
IKCU - CENG304 5
Instruction Set Architecture Specification
ISA: Subset of RV32I
Instr. Operands Description
add rd, rs1, rs2 Adds the values in registers rs1 and rs2 and stores the result in register rd.
sub rd, rs1, rs2 Subtracts the value in register rs2 from the value in register rs1 and stores the result in register rd.
addi rd, rs1, imm12 Adds the value of immediate (imm) to the value in register rs1 and stores the result in register rd.
and rd, rs1, rs2 Performs a bitwise AND operation between the values in registers rs1 and rs2 and stores the result in register rd.
xor rd, rs1, rs2 Performs a bitwise XOR operation between the values in registers rs1 and rs2 and stores the result in register rd.
Loads a word from memory at the address formed by adding the immediate (imm) value to the value in register rs1
lw rd, imm12 (rs1)
and stores it in register rd.
Stores the value from register rs2 into memory at the address formed by adding the immediate (imm) value to the
sw rs2, imm12 (rs1)
value in register rs1.
beq rs1, rs2, imm12 Branches to the target address (PC + imm) if the values in registers rs1 and rs2 are equal.
jal rd, imm20 Jumps to the target address (PC + imm) and stores the address of the instruction following the jump in register rd.
IKCU - CENG304 6
Determination of ISA Requirements
How many registers in register file?
32
How many bits wide are the registers?
32
How many registers can be read simultaneously?
2
Which operations must be possible?
Arithmetic: sum (add, addi, lw, sw, jal), subtract (sub, beq)
Logic: and, xor
IKCU - CENG304 7
Datapath Design
The units used to store data or perform operations on data within the processor are called
datapath units. The processor's datapath is comprised of these units.
Which units do we need for the subset of RV32I;
◼ Program Counter
◼ Instruction Memory
(Harvard Architecture)
◼ Data Memory
◼ Register File
◼ Arithmetic Logic Unit
◼ Immediate Generator (Extender)
IKCU - CENG304 8
Program Counter & Instruction Memory
◼ Instruction memory stores program
instructions and outputs the
instruction corresponding to the
given instruction address.
◼ Program counter (PC) holds the
address of the next instruction.
Since instructions are 32 bits wide
and byte addressing is used, the PC
increments by 4 after each clock
cycle.
IKCU - CENG304 9
Register File
◼ Register file outputs the data from
the source registers specified by
register numbers or writes the given
data to the destination register
specified by the register number.
IKCU - CENG304 10
Arithmetic & Logic Unit (ALU)
◼ It is the unit where arithmetic and
logic operations are performed.
◼ For the given example;
◼ sum
◼ sub
◼ and
◼ xor
IKCU - CENG304 11
Immediate Generator
◼ According to ISA, immediate values
of different instructions can have
different bit lengths, and ALU
operates with 32-bit data. Hence,
the immediate values need to be
extended.
◼ The immediate generation unit
decodes the instruction, selects the
immediate value, and then extends
it (preserves the sign).
IKCU - CENG304 12
Data Memory
◼ The data memory stores the data of
running programs and serves as the
unit that enables access to these
addresses.
◼ It can perform read or write
operations to the given address.
IKCU - CENG304 13
Multiplexer (Mux)
◼ Multiplexer (mux) is a fundamental
component used to select one of
several input signals and pass it
through to the output based on a
selection signal.
◼ It essentially acts as a data selector.
IKCU - CENG304 14
Branching Datapath
IKCU - CENG304 15
Arithmetic and Logic Datapath
IKCU - CENG304 16
Memory Datapath
IKCU - CENG304 17
Entire Datapath
IKCU - CENG304 18
Entire Datapath
◼ add & sub
IKCU - CENG304 19
Entire Datapath
◼ addi
IKCU - CENG304 20
Entire Datapath
◼ and & xor
IKCU - CENG304 21
Entire Datapath
◼ lw
IKCU - CENG304 22
Entire Datapath
◼ sw
IKCU - CENG304 23
Entire Datapath
◼ beq
IKCU - CENG304 24
Entire Datapath
◼ jal
IKCU - CENG304 25