Basic Functions of CPU:
CPU process instructions. Instructions
are taken in process of decoding various data from programs. CPU has to
implement 4 basic functions during instruction cycle: fetch, decode, execute,
store.
1. Fetch: All the instructions are stored in
memory. Each instruction has is address. The processor takes this address
number from the program counter. Program counter is responsible for tracking
what instructions CPU should execute next. So fetching basically means taking
the instruction from the memory.
2. Decode: CPU understands instructions, that are
written in Assembly programming language. All the programs, that must be
executed, are translated to Assembly instructions. Different CPUs understand
different instructions, so Assembly code must be decoded into binary
instructions which are understandable to your CPU. This step is called
decoding.
3. Execute:During the procedure of instruction
execution, tree things can be done. Firstly, CPU can do some calculations. To
execute calculations ALU is used. Secondly, CPU can move data from one memory
location to another. And thirdly, CPU can jump to different address if it is
needed. So basically, one of those three options is executed during this step.
4. Store: CPU must give some feedback after
executing the instruction. The output data is written to the memory. In this
phase program counter is incremented.

No comments:
Post a Comment