Skip to content

Latest commit

ย 

History

History
63 lines (44 loc) ยท 2.2 KB

File metadata and controls

63 lines (44 loc) ยท 2.2 KB

Program Counter

PC : Program Counter
PC ๋Š” ๋ ˆ์ง€์Šคํ„ฐ์˜ ์ผ์ข…์œผ๋กœ์จ CPU ๊ฐ€ ๋‹ค์Œ์— ์‹คํ–‰์‹œ์ผœ์•ผ ํ•  ๋ช…๋ น์˜ ์ฃผ์†Œ๋ฅผ ๋‹ด๊ณ  ์žˆ๋‹ค.

  • IP (Instrcuton Pointer) ๋˜๋Š” IAR (Instruction Address Register) ๋ผ ๋ถˆ๋ฆฌ๊ธฐ๋„ ํ•œ๋‹ค.

diagram of processor Image credit : thinglink.com

Table of Contents

Register

๋ช…๋ น์–ด๋“ค์€ Main Memory ์— ์ €์žฅ๋˜์–ด ์žˆ๋‹ค.
PC ๋Š” Main Memory ๊ฐ€ ๋‹ค์Œ์œผ๋กœ ์‹คํ–‰ํ•ด์•ผ ํ•˜๋Š” ๋ช…๋ น์–ด์˜ ์ฃผ์†Œ๋ฅผ ํฌ์ธํ„ฐ๋กœ ๊ฐ€๋ฆฌํ‚จ๋‹ค.

  • ์ฒซ ๋ฒˆ์งธ ๋ช…๋ น์–ด์˜ ์ฃผ์†Œ๋Š” ๋Š˜ 0 ๋ฒˆ์ง€๋ถ€ํ„ฐ ์‹œ์ž‘ํ•œ๋‹ค.

Return to TOC

Stack

LIFO(Last In First Out) ์˜ ํŠน์„ฑ์„ ์ง€๋‹Œ Stack ์— ์ฃผ์†Œ๋ฅผ ์ฐจ๊ณก ์ฐจ๊ณก ์Œ“์•„๋‘”๋‹ค.

Fetch Instruction ๋ช…๋ น์–ด ์ฝ์–ด์˜ค๊ธฐ

ํ˜„์žฌ์˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰์‹œํ‚จ CPU ๋Š” ํฌ์ธํ„ฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ฃผ์†Œ๋กœ ์ฐพ์•„๊ฐ€ ๋‹ค์Œ์— ์ง„ํ–‰ ์‹œ์ผœ์•ผํ•˜๋Š” ๋ช…๋ น๋“ค์„ ์ˆœ์ฐจ์ ์œผ๋กœ ์‹คํ–‰์‹œ์ผœ๋‚˜๊ฐ„๋‹ค.

ํ•˜๋‚˜์˜ instruction์„ ์‹คํ–‰ ์‹œํ‚จ ์ดํ›„์— PC ๊ฐ’์ด ์ฆ๊ฐ€๋œ๋‹ค.

Return to TOC

32 bits

PC ๋Š” 32 bits ์˜ ๊ธธ์ด๋ฅผ ๊ฐ€์ง„๋‹ค.
32 bits == 4 bytes.

๋ชจ๋“  ๋ช…๋ น์€ 32 ๋น„ํŠธ์ด๋‹ค. ์ด๋Š” ALU๊ฐ€ 32 ๋น„ํŠธ ์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
32 ๋น„ํŠธ ๊ธธ์ด๋กœ ๊ทœ๊ฒฉํ™” ํ•ด ๋†“์Œ์œผ๋กœ์จ fetch ๋ฐ decode ํ•˜๊ธฐ๊ฐ€ ์ˆ˜์›”ํ•ด ์ง„๋‹ค.

  • ALU (Arithmetic and Logic Unit) ์—ฐ์‚ฐ์žฅ์น˜ : CPU์˜ ๋ช…๋ น์— ๋”ฐ๋ผ ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ์žฅ์น˜.
    • ์—ฐ์‚ฐ์˜ ์ข…๋ฅ˜๋Š” ์‚ฐ์ˆ ์—ฐ์‚ฐ, ๋…ผ๋ฆฌ ์—ฐ์‚ฐ, ๊ด€๊ณ„ ์—ฐ์‚ฐ, ์ด๋™(Shift) ๋“ฑ์ด ์žˆ๋‹ค.

3 Fields

32 ๋น„ํŠธ๋Š” 3๊ฐœ์˜ ํ•„๋“œ๋กœ ๋‚˜๋‰œ๋‹ค.

  • 1 operation code (8 bits)
  • 2 operands (8 bits + 16 bits)

program counter

Return to TOC

Control Signals

PC ๋Š” ์„ธ ๊ฐœ์˜ ์ปจํŠธ๋กค ์‹œ๊ทธ๋„์„ ๊ฐ€์ง„๋‹ค.

  • CE
    Program Counter Enable
  • CO
    Program Counter Output Enable
  • J
    Program counter Jump

Return to TOC