COM

[전산] 레지스터 (register)

Weistern 2006. 3. 13. 21:02
레지스터 (register)
컴퓨터의 CPU에 들어 있는 소규모 데이터 기억장치이다.

이 때 내부 Bus가 연산장치와 레지스터를 연결해준다.

컴퓨터의 중앙처리장치 속에는 쓰임새에 따라 몇 종류의 레지스터가 들어 있다.
가령, Program Counter, Instruction Register, Data Register, Address Register, Accumulator(누산기), Stack Pointer, Flag Register, Shift Register, Index Register, Base Register 등이 있다.

레지스터의 회로는 주로 플립플롭 회로를 많이 연결한 형태를 하고 있는데, 이것은 데이터를 쉽고 빠르게 읽고 쓸 수 있기 때문이다. 예를 들어 레지스터의 데이터로 데이터를 저장하는 데 걸리는 시간은 보통 수십ns 이하로, Main Memory(=Random Access Memory)에 비하여 훨씬 빠르다.

이중에 특히, 인스트럭션 레지스터와 데이타 레지스터를 좀더 알아보자.

Instruction Register
To perform a single instruction, the CPU must fetch the instruction from main memory, put it in its instruction register, interpre it, and perform it.

Then, that instruction is replaced by the next instruction in the instruction register.

Since only a copy of each instruction is written to the instruction register, the original is not destroyed, it is still in main memory, but it is no longer visible to the CPU.

The CPU can see only one instruction in the instruction register at a time. this is very important to you as you program. Humans can see the "big picture" but commuters cannot.


Data Register
The CPU has a few (perhaps 4 to 16, depending on the CPU ) other registers called data registers.

These store the data that the CPU uses in arithmetic or logical operations.
There are only a few of these registers, so data must continuously be moved in and out of them.


이제, CPU가 인스트럭션 레지스터와 데이타 레지스터로 어떻게 덧셈을 수행하는지 살펴보자.


1. Fetch the first instruction and put it in the CPU's instruction register.
2. That instruction directs the CPU to fetch the value from location 6016 and put it in a data register.
3. Fetch the second instruction and put it in the CPU's instruction register, replacing the first one.
4. That instruction directs the CPU to add the contents of location 6015 to the contents of the data register.
5. Fetch the third instruction and put it in the CPU's instruction register, replacing the second one.
6. That instruction directs the CPU to move the contents of the data register to location 6017, replacing the value there.