728x90
반응형
경희대학교 김정욱 교수님의 컴퓨터구조 강의를 기반으로 정리한 글입니다.
Processor
- 컴퓨터를 실행하는 연산을 수행하는 integrated electronic circuit

Datapath of the Processor
- Fetch stage, Decode stage, Execute stage로 나뉨 → stage들은 반복됨

- Data memory: lw, sw를 통해 데이터를 꺼내오고 저장하는 메모리
- Instruction memory: 인스터럭션 값이 저장되어 있는 메모리
Fetch stage
- Fetch: 꺼내다
- 현재 PC가 가리키는 메모리 주소에서 인스트럭션을 꺼내오는 단계
- Fetch가 끝나면 PC는 다음 인스트럭션을 가리킴(PC + 4)

Decode stage
- 레지스터에 있는 인코딩된 인스트럭션은 디코더에 의해 해석됨

Execute stage
- 인스트럭션의에 목적에 따라 실행
- e.g., 레지스터로부터 값 읽기, ALU 연산, 레지스터에 값 쓰기

- Branch Instruction: PC를 PC+4가 아니라 branch로 변경
- R format Instruction: 레지스터에서 나온 두 값을 피연산자로 인식 → ALU에서 연산한 값을 data로 저장
- I format Instruction: 레지스터 3개를 한 번에 const로 인식 → ALU에서 base address와 const의 연산 결과를 data memory에 전달 → data memory는 해당 주소에 저장된 데이터를 다시 레지스터에 전달(lw) 또는 저장(sw)
Problem
Two different sources can meet → Multiplexor(Controller)

Logic Design Basics
- Datapath는 두 가지 타입의 logic elements를 가짐
Combinational element
- AND gate, Adder, Multiplexer, ALU, etc.
- 현재의 input에 의해서만 output 결정 → 입력이 주어지면 바로 아웃풋이 나옴
State element
- Instruction memory, Data memory, etc.
- 데이터를 저장하기 위해 사용
- input들과 internal state의 contents에 의해 output 결정

→ 클락 시그널이 라이징 엣지(0 → 1)일 때 D 값에 따라 Q가 결정
Clocking Methodology
- Clocking Methodology: 언제 신호를 읽고 쓸 수 있을지 결정
- Edge-triggered clocking: clock이 0에서 1로(rising edge) 바뀔 때 update

→ State element가 값을 주자마자 처리하고 기다림 → 다시 State element가 0에서 1로 바뀌면 값을 전달
Building Datapath
Datapath elements
- Instruction memory: 인스트럭션 어드레스가 주어지면, 프로그램의 인스트럭션을 저장하고 제공하는 역할
- Program Counter(PC): 현재 인스트럭션 주소를 가리키는 레지스터
- Adder

Instruction Fetch
- 인스트럭션을 꺼내고 PC를 증가 시키는 역할

R-format
Register file
- Input: 2 read ports, 1 write ports, 1 data
- Output: read register에 따른 32bits contents 레지스터
- Regwrite: clock edge에서 데이터를 write(edge-triggered)

ALU
- Input: 2 32bits input
- Output: 1-bit signal → if result is 0, 레지스터의 write data(32bits)
- ALU operation(4-bits): 16 operations

I-format
Load/Store (Data memory)
- Input: 주소, Write data
- Output: 주소에 있는 Read Data
- Read and Write controls는 별개
- 레지스터 파일과 달리 data memory는 read signal 필요 → 유효하지 않은 주소의 reading value는 문제를 일으킬 수 있음


- MemWrite/MemRead는 1인 경우 Write/Read Data를 유효하게 받아들임
Sign extension unit
- ALU가 16bits 인풋(signed offset)과 32bit-base register를 더하기 위해서 필요

- MSB의 값을 앞에 연장하여 32bit로 변환(ex. 1111 → 0000 1111(X) → 1111 1111(O)

Branch(beq)

- ALU: branch condition을 평가하기 위해 사용
- Adder: target으로 branch하는데 사용
- Branch 변위: (PC + 4) + 32bits(16bits에서 sign extension된 상태) + sll 2-bits

728x90
반응형
'Computer Science > Computer Architecture' 카테고리의 다른 글
| [컴퓨터구조] Lecture 14: The Processor - Part3 (0) | 2026.02.12 |
|---|---|
| [컴퓨터구조] Lecture 13: The Processor - Part2 (0) | 2026.02.12 |
| [컴퓨터구조] Lecture 10: Arithmetic for Computers - Part2 (0) | 2026.02.08 |
| [컴퓨터구조] Lecture 09: Arithmetic for Computers - Part1 (0) | 2026.02.08 |
| [컴퓨터구조] Lecture 08: Instructions - Language of the Computer - Part5 (0) | 2026.02.08 |