Datapath
Encyclopedia
A datapath is a collection of functional units, such as arithmetic logic unit
Arithmetic logic unit
In computing, an arithmetic logic unit is a digital circuit that performs arithmetic and logical operations.The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers...

s or multipliers, that perform data processing
Data processing
Computer data processing is any process that a computer program does to enter data and summarise, analyse or otherwise convert data into usable information. The process may be automated and run on a computer. It involves recording, analysing, sorting, summarising, calculating, disseminating and...

 operations. Most central processing unit
Central processing unit
The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...

s consist of a datapath and a control unit
Control unit
A control unit in general is a central part of the machinery that controls its operation, provided that a piece of machinery is complex and organized enough to contain any such unit. One domain in which the term is specifically used is the area of computer design...

, with a large part of the control unit dedicated to regulating the interaction between the datapath and main memory.

The purpose of datapaths is to provide routes for data to travel between functional units.These datapaths can be joined together to make bigger datapaths using multiplexers. A Sign extension
Sign extension
Sign extension is the operation, in computer arithmetic, of increasing the number of bits of a binary number while preserving the number's sign and value...

 unit can also be used in conjunction when bigger sized words are needed.

Recently there have been research efforts into reconfigurable datapaths. These datapaths can be imprinted onto fabrics and can be changed at runtime. This concept could revolutionize CPU design and allow for more efficient processing.

Functional blocks of a datapath

The important functional blocks inside the processor can be listed as:-
  • Instruction register
    Instruction register
    In computing, an instruction register is the part of a CPU's control unit that stores the instruction currently being executed or decoded. In simple processors each instruction to be executed is loaded into the instruction register which holds it while it is decoded, prepared and ultimately...

    (IR)
  • Program Counter
    Program counter
    The program counter , commonly called the instruction pointer in Intel x86 microprocessors, and sometimes called the instruction address register, or just part of the instruction sequencer in some computers, is a processor register that indicates where the computer is in its instruction sequence...

    (PC)
  • General purpose registers
There are also 2 registers inherent in the processor that facilitate the communication of the processor with the memory,or basically help in the memory operations of the register.They are:-
  • Memory address register
    Memory address register
    The Memory Address Register is a CPU register that either stores the memory address from which data will be fetched to the CPU or the address to which data will be sent and stored....

    (MAR)
  • Memory data register
    Memory data register
    The Memory Data Register is the register of a computer's control unit that contains the data to be stored in the computer storage , or the data after a fetch from the computer storage...

    (MDR).

Single bus organization of datapath

The first and foremost important interconnecting medium for all the registers inside the processor is the System bus
System bus
A system bus is a single computer bus that connects the major components of a computer system. The technique was developed to reduce costs and improve modularity....

. This bus is the processor bus and is not to be confused with the external bus that connects different memory chips and I/O devices to the processor.
This external bus is connected to the internal System bus via the
MAR and the MDR registers.The data lines of the external bus are connected to MDR and the address lines of the external bus are connected to the MAR.The MDR is a bidirectional register implying that it can receive and send data to and from any one of the two internal or external buses.The MAR is a unidirectional register.It receives it's input from the internal bus and gives it's output to the external bus.
The number of general purpose registers can vary from one processor to another.Every processor has some special purpose registers.These are are used as a temporary storage medium by the processor.
The Arithmetic logic unit
Arithmetic logic unit
In computing, an arithmetic logic unit is a digital circuit that performs arithmetic and logical operations.The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers...

(ALU) is used for performing arithmetic and logic operations on the data
contained in different registers.It is the heart of the microprocessor.The multiplexer
Multiplexer
In electronics, a multiplexer is a device that selects one of several analog or digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the output...

 is provided for selecting either the constant value 4 or the register X. The constant value 4 is selected when one instruction is completed and The Program Counter is to be incremented.{As told before :- (PC ← (PC)+4)}. The "instruction decoder and control logic" block decodes and carries out the instruction present in the IR register.
The processor uses all these blocks together to carry out different primary operations such as :-
  1. Inter Register data transfers
  2. Arithmetic or Logical operations
  3. Retrieving data from Memory
  4. Writing data into the Memory

Examples

Let us consider addition as an Arithmetic operation and Retrieving data from memory in detail.

Example 1) Arithmetic addition :-contents of register reg1 and reg2 are added and the result is stored in reg3
Sequence of operations:-
  1. reg1out,Xin
  2. reg2out,choose X,ADDITION,Yin
  3. Yout,reg3in

The control signals written in one line are executed in the same clock cycle.
all other signals remain untouched.So, in the first step the contents of register1
are written into the register X through the bus.In the second stage the content
of register2 is placed onto the bus and the Multiplexer
Multiplexer
In electronics, a multiplexer is a device that selects one of several analog or digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the output...

 is made to choose input X as the contents of reg1 are stored in register X.The ALU then adds the contents in the register X and reg1 and stores the result of the addition in the special temporary register Y.In the final step the result strored in Y is sent over to the register reg3 over the internal processor bus.Only one register can output its data onto bus in one step.[Hence steps 2 and 3 cannot be combined].
Example 2) Retrieving data from memory
To retrieve data from memory, the processor has to provide the address of the memory location where the required data is saved. The data stored at a particular required memory location can be either an instruction of a program or the operand of a particular executable instruction.
The sequence of operations for the above operation is as follows:-
  1. reg1out,MARin,,READM
  2. MDRinEX,WMC
  3. MDRout,reg2in,


A new control signal WMC has been introduced here. WMC stands for Wait for Memory operation to Complete. Generally the addressed device on the memory bus is slower than the microprocessor.Therefore,the microprocessor has to wait for the
addressed device to complete its operation.This indication that the memory operation has been completed is given to the processor by the control signal WMC.
Also, as described above, the MDR is a bidirectional register i.e. it is connected to both the internal and external buses.Therefore the signal MDR has subscript inEX . The EX stands for the external bus.The signal implies that data
is moved from the external memory bus into the MDR register.The remaining control signals are self-explanatory and can be understood easily as in Example 1 where MDR is the bidirectional Memory data register and MAR is the unidirectional
Memory Address Register.

An entire instruction is executed

Now,let us put together the primary operations to see how a complete instruction is executed.
Consider for example the instruction

ADD (reg3),reg1.

This instruction adds the data stored at the location pointed to by the register3
to the contents of register 1.The sequence of control signals for the aforementioned complete instruction are as follows:-
  1. PCountout,MARin,READM,Choose4,ADDITION,Yin
  2. Yout,PCin,Yin,WMC
  3. MDRout,IRegin
  4. reg3out,MARin,READM
  5. reg1out,Xin,WMC
  6. MDRout,ChooseX,ADDITION,Yin
  7. Yout,reg1in,HALT


The first 3 steps written above are common to all the instructions of a microprocessor
Microprocessor
A microprocessor incorporates the functions of a computer's central processing unit on a single integrated circuit, or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and...

.These constitute the "Fetching of Instruction" Phase mentioned earlier.After the execution of the first three steps the instruction is loaded into
the instruction register.the "instruction decoding and control circuitry" then decode the instruction and switch on all the control signals needed for steps 4 through 7.The steps 4 through 7 constitute the "Execution based on fetch instruction phase".
The content of register 3 is copied into the MAR register in step 4,which gives the address of the desired memory location and the READM instruction is executed.The contents of the other register 1 are transferred over the bus to the register X.As soon as the READM operation is completed the data at the desired memory location is made available in the MDR.The multiplexer is made to choose X over 4 .The contents of the two register are added in step 6 using the ADDITION instruction.The result of the addition is stored in the special register Y. Finally the value stored in Y is transferred to register1 over the bus in step 7.
The contents of the updated program counter are copied into the register X in step 2.Although there is no need to do this in the above program,the updated value of PC is generally stored in the register X in case of Branched Instructions to calculate the 'branch target address'

Multi-Bus Organizations of datapath

The Internal Organization of Processor discussed above was a single bus organization.It was discussed to get the basic idea.Practically,however,such single bus microprocessors are not feasible.They result in lengthy control signal sequences.Therefore,to cut down on the number of steps needed to execute an instruction a multi-bus organization is used.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK