Module 5: Basic Processing Unit: 1.some Fundamental Concepts
Module 5: Basic Processing Unit: 1.some Fundamental Concepts
Module 5: Basic Processing Unit: 1.some Fundamental Concepts
CONTROL-SIGNALS OF MDR
• The MDR register has 4 control-signals (Figure 7.4):
1) MDRin & MDRout control the connection to the internal processor data bus &
2) MDRinE & MDRoutE control the connection to the memory Data bus.
• MAR register has 2 control-signals.
1) MARin controls the connection to the internal processor address bus &
2) MARout controls the connection to the memory address bus.
4.HARDWIRED CONTROL
• Hardwired control is a method of control unit design (Figure 7.11).
• The control-signals are generated by using logic circuits such as gates, flip-flops, decoders etc.
• Decoder/Encoder Block is a combinational-circuit that generates required control-outputs
depending on state of all its inputs.
• Instruction Decoder
➢ It decodes the instruction loaded in the IR.
➢ If IR is an 8 bit register, then instruction decoder generates 2 8(256 lines); one for each
instruction.
➢ It consists of a separate output-lines INS1 through INSm for each machine instruction.
➢ According to code in the IR, one of the output-lines INS1 through INSm is set to 1, and
all other lines are set to 0.
• Step-Decoder provides a separate signal line for each step in the control sequence.
Note:
To execute instructions, the processor must have some means of generating the control-signals.
There are two approaches for this purpose:
1) Hardwired control and 2) Microprogrammed control.
5.MICROPROGRAMMED CONTROL
• Microprogramming is a method of control unit design (Figure 7.16).
• Control-signals are generated by a program similar to machine language programs.
• Control Word(CW) is a word whose individual bits represent various control-signals (like Add,
PCin).
• Each of the control-steps in control sequence of an instruction defines a unique combination
of 1s & 0s in CW.
• Individual control-words in microroutine are referred to as microinstructions (Figure 7.15).
• A sequence of CWs corresponding to control-sequence of a machine instruction constitutes the
microroutine.
• The microroutines for all instructions in the instruction-set of a computer are stored in a
special memory called the Control Store (CS).
• Control-unit generates control-signals for any instruction by sequentially reading CWs of
corresponding microroutine from CS.
• µPC is used to read CWs sequentially from CS. (µPC→ Microprogram Counter).
• Every time new instruction is loaded into IR, o/p of Starting Address Generator is loaded into
µPC.
• Then, µPC is automatically incremented by clock;
causing successive microinstructions to be read from CS.
Hence, control-signals are delivered to various parts of processor in correct sequence.
5.1 MICROINSTRUCTIONS
• A simple way to structure microinstructions is to assign one bit position to each control-signal
required in the CPU.
• There are 42 signals and hence each microinstruction will have 42 bits.
• Drawbacks of microprogrammed control:
1) Assigning individual bits to each control-signal results in long microinstructions
because the number of required signals is usually large.
2) Available bit-space is poorly used because
only a few bits are set to 1 in any given microinstruction.
• Solution: Signals can be grouped because
1) Most signals are not needed simultaneously.
2) Many signals are mutually exclusive. E.g. only 1 function of ALU can be activated at a
time. For ex: Gating signals: IN and OUT signals (Figure 7.19).
Control-signals: Read, Write.
ALU signals: Add, Sub, Mul, Div, Mod.
• Grouping control-signals into fields requires a little more hardware because
decoding-circuits must be used to decode bit patterns of each field into individual control-signals.
5.2MICROPROGRAM SEQUENCING
• The task of microprogram sequencing is done by microprogram sequencer.
• Two important factors must be considered while designing the microprogram sequencer:
1) The size of the microinstruction &
2) The address generation time.
• The size of the microinstruction should be minimum so that the size of control memory
required to store microinstructions is also less.
• This reduces the cost of control memory.
• With less address generation time, microinstruction can be executed in less time resulting
better throughout.
• During execution of a microprogram the address of the next microinstruction to be executed
has 3 sources:
1) Determined by instruction register.
2) Next sequential address &
3) Branch.
• Microinstructions can be shared using microinstruction branching.
• Disadvantage of microprogrammed branching:
1) Having a separate microroutine for each machine instruction results in a large total
number of microinstructions and a large control-store.
2) Execution time is longer because it takes more time to carry out the required branches.
• Consider the instruction Add src,Rdst ;which adds the source-operand to the contents of Rdst
and places the sum in Rdst.
• Let source-operand can be specified in following addressing modes (Figure 7.20):
a) Indexed
b) Autoincrement
c) Autodecrement
d) Register indirect &
e) Register direct
• Each box in the chart corresponds to a microinstruction that controls the transfers and
operations indicated within the box.
• The microinstruction is located at the address indicated by the octal number (001,002).
microinstruction.
• Eg: If the current address is 170 and branch address is 171 then the branch address can be
generated by ORing 01(bit 1), with the current address.
• Consider the point labeled in the figure. At this point, it is
• The next-address bits are fed through the OR gate to the μAR, so that the address can be modified
on the basis of the data in the IR, external inputs and condition-codes.
• Non-volatile ROM is used to store the program required to implement the desired
actions. So, the program will not be lost when the power is turned off (Figure
10.1).
• Most important requirement: The microcontroller must have sufficient I/O capability.
Parallel I/O Ports are used for dealing with the external I/O signals.
Basic I/O Interfaces are used to connect to the rest of the system.
• Processor Core may be a basic version of a commercially available microprocessor (Figure 10.3).
• Well-known popular microprocessor architecture must be chosen. This is because, design of
new products is facilitated by
→ numerous CAD tools
→ good examples &
→ large amount of knowledge/experience.
• Memory-Unit must be included on the microcontroller-chip.
• The memory-size must be sufficient to satisfy the memory-requirements found in small applications.
• Some memory should be of RAM type to hold the data that change during
computations. Some memory should be of Read-Only type to hold the
software.
This is because an embedded system usually does not include a magnetic-disk.
• A field-programmable type of ROM storage must be provided to allow cost-
effective use. For example: EEPROM and Flash memory.
• I/O ports are provided for both parallel and serial interfaces.
• Parallel and Serial Interfaces allow easy implementation of standard I/O connections.
• Timer Circuit can be used
→ to generate control-signals at programmable time intervals &
→ for event-counting purposes.
• An embedded system may include some analog devices.
• Each parallel port has an associated 8-bit DDR (Data Direction Register) (Figure 10.4).
• DDR can be used to configure individual data lines as either input or output.
• If the data direction flip-flop contains a 0, then Port pin PAi is treated as an input (Figure
10.5). If the data direction flip-flop contains a 1, then Port pin PAi is treated as an
output.
• Activation of control-signal Read_Port, places the logic value on the port-pin onto the data line
Di. Activation of control-signal Write_Port, places value loaded into output data flip-flop onto
port-pin.
• Addressable Registers are (Figure 10.6):
1) Input registers (PAIN for port A, PBIN for port B)
2) Output registers (PAOUT for port A, PBOUT for port B)
3) Direction registers (PADIR for port A, PBDIR for port B)
4) Status-register (PSTAT) &
5) Control register (PCONT).
8.3 COUNTER/TIMER
• A 32-bit down-counter-circuit is provided for use as either a counter or a timer.
• Basic operation of the circuit involves
→ loading a starting value into the counter and
→ then decrementing the counter-contents using either
i) Internal system clock or
ii) External clock signal.
• The circuit can be programmed to raise an interrupt when the counter-contents reach 0.
• Counter/Timer Register (CNTM) can be loaded with an initial value (Figure 10.9).
• The initial value is then transferred into the counter-circuit.
• The current contents of the counter can be read by accessing memory-address FFFFFFD4.
• Control Register (CTCON) is used to specify the operating mode of the counter/timer circuit.
• The control register provides a mechanism for
→ starting & stopping the counting-process &
→ enabling interrupts when the counter-contents are decremented to 0.
• Status Register (CTSTAT) reflects the state of the circuit.
• There are 2 modes: 1) Counter mode 2) Timer mode.
Counter Mode
• CTCON7 = 0 → When the counter mode is selected.
PPP