CSC 311 Lecture Material
CSC 311 Lecture Material
❖ Course Outline
Introduction to microprocessor architecture-systems operations and interfacing, Encoders, decoders and
multiplexers. Registers and counters. Arithmetic circuits: binary adders-parallel and serial adders; full and
half adders, binary substractors - full and half subtractors, At least 16 or 32-bit microprocessor (Architecture
and instruction set). Microcomputer interfacing, microcomputer-based A-D and D-A converters. Design,
construction, programming and testing of microprocessors control systems.
1.0 Microprocessor
A microprocessor is a computer processor where the data processing logic and control is included on a single
integrated circuit (IC), or a small number of ICs. The microprocessor contains the arithmetic, logic, and
control circuitry required to perform the functions of a computer's central processing unit (CPU). The
microprocessor is a multipurpose, clock- driven, register-based, digital integrated circuit that accepts binary
data as input, processes it according to instructions stored in its memory, and provides results (also in binary
form) as output. Microprocessors contain both combinational logic and sequential digital logic, and operate
on numbers and symbols represented in the binary number system.
Register Unit: This area of the microprocessor consists of various registers. The register is used primarily
to store data temporarily during the executing of a program. Some of the registers are accessible to the user
through instructions.
Control Unit: The control unit provides the necessary timing and control signals to all the operations in the
microcomputer. It controls the flow of data between the microprocessor and peripherals (including memory).
In figure 1.0 is the basic diagram of a microprocessor comprises of the input, microprocessor (ALU, register
& control unit), memory and the output.
Fig 1.0 Block Diagram of a Basic Microcomputer
2.1 Coprocessor
A coprocessor is a specially designed microprocessor, which can handle its particular function many times
faster than the ordinary microprocessor.
For example − Math Coprocessor.
Some Intel math-coprocessors are −
• 8087-used with 8086
• 80287-used with 80286
• 80387-used with 80386
2.3 However, based on size of data bus, microprocessors are grouped as follows:
I. 4-bit microprocessor
II. 8-bit microprocessor
III. 16-bit microprocessor
IV. 32-bit microprocessor
In figure 2.0, the interfaces have been broken into four basic categories: operational overhead, user-
interaction, sensory, and control.
Operational overhead interfaces: are those interface components necessary to make a processor function on
the most basic level. This class includes data and address bus drivers, bus receivers, and the clock circuit surrounding
the microprocessor. Larger interface items such as those for memory and data storage devices would also fall into this
category.
User-interaction interfaces: are those circuits required to send and receive user specified data to and
from a processing system. This interface class includes computer terminal interfaces, keyboard
interfaces, graphic-device interfaces, and voice recognition and synthesis interfaces.
Sensor interface: When dealing with strict scientific computing or business data processing, a central
processing unit, operational overhead interfaces (including memory and disk interfaces), and a few user-
interaction interfaces for computer terminals and line printers are usually sufficient to accomplish the
task. Control systems are a different matter, however. Events in the real world must be monitored.
Sensory interfaces are those circuits required to monitor events in the real world and send the results to
a microprocessor system. Pressure sensor, thermal sensor, flow-rate indicator, and tachometer interfaces
are but a few of the interfaces that fall into this class.
Fig. 2.0 Typical Microprocessor and its interfaces
Control interface: Once the sensor provides the status and the microcomputer decides what action is to be
taken, a control interface is usually needed to carry out the action. Control interfaces take a microcomputer's
milliampere-level data signals and convert them to the proper voltage and current levels to control real-
world devices. The circuitry needed to drive a stepping motor on a machine tool, to activate a solenoid-
controlled valve, control signal, or to illuminate a bank of stoplights falls into this interface category.
8086 Microprocessor is an enhanced version of 8085Microprocessor that was designed by Intel in 1976. It
is a 16-bit Microprocessor having 20 address lines and16 data lines that provides up to 1MB storage, see
figure 2.2. It consists of powerful instruction set, which provides operations like multiplication and division
easily.
0 0 No operation
S0, S1, S2
These are the status signals that provide the status of operation, which is used by the Bus Controller 8288 to
generate memory & I/O control signals. These are available at pin 26, 27, and 28. Following is the table
below, showing their status −
S2 S1 S0 Status
0 0 0 Interrupt acknowledgement
0 0 1 I/O Read
0 1 0 I/O Write
0 1 1 Halt
1 0 0 Opcode fetch
1 0 1 Memory read
1 1 0 Memory write
1 1 1 Passive
LOCK
When this signal is active, it indicates to the other processors not to ask the CPU to leave the system bus. It
is activated using the LOCK prefix on any instruction and is available at pin 29.
RQ/GT1 and RQ/GT0
These are the Request/Grant signals used by the other processors requesting the CPU to release the system
bus. When the signal is received by CPU, then it sends acknowledgment. RQ/GT0 has a higher priority than
RQ/GT1.
Interrupt Instructions
These instructions are used to call the interrupt during program execution.
• INT − Used to interrupt the program during execution and calling service specified.
• INTO − Used to interrupt the program during execution if OF = 1
• IRET − Used to return from interrupt service to the main program
Advantages
• Having more than one processor results in increased efficiency.
• Each of the processors have their own local bus to access the local memory/I/O devices. This
makes it easy to achieve parallel processing.
• The system structure is flexible, i.e. the failure of one module doesn’t affect the whole system
failure; faulty module can be replaced later.
Microcontroller Microprocessor
Microcontrollers are used to execute a single task Microprocessors are used for big
within an application. applications.
Its designing and hardware cost is low. Its designing and hardware cost is high.
It is built with CMOS technology, which requires Its power consumption is high because it
less power to operate. has to control the entire system.
It consists of CPU, RAM, ROM, I/O ports. It doesn’t consist of RAM, ROM, I/O
ports. It uses its pins to interface to
peripheral devices.
A processor register is a quickly accessible location available to a computer processor. Registers usually
consist of a small amount of fast storage, although some registers have specific hardware functions and may
be read-only or write-only. In computer architecture, registers are typically addressed by mechanisms other
than main memory but may in some cases be assigned a memory address.
Processor registers are normally at the top of the memory hierarchy, and provide the fastest way to access
data. The term normally refers only to the group of registers that are directly encoded as part of an instruction
as defined by the instruction set. However, modern high- performance CPUs often have duplicates of these
architecture registers in order to improve performance via register renaming, allowing parallel and speculative
execution.
A processor often contains several kinds of registers which can be classified according to the types of values
they can store or instructions that operates on them:
There are several more registers in microprocessor such as floating-point register, general purpose register,
vector register and address registers.
6.1 Counters
Counters are essential to design advanced circuits which are found in digital computers. Counters are
employed to keep track of a sequence of events. Counters are particularly common in the control and
arithmetic units of processor.
Counters can count in two ways: up count it may count from (0, 1, 2 …….N). Example can be seen in
electronic voting machine and in shopping mail counting machine. The second is down count where it starts
from downward direction that may starts from (N, N-1….. 1, 0). Example are found in space related
application such as missile rocket launcher where they will start counting from a point downwards until it gets
to zero and they start launching.
Counters may count in binary or in non-binary fashion. The basic operational characteristics of a counter are
sequential, for every present state there is a well-defined next state. The design of a counter involves
designing combinational logic that decodes the present state and enables entry into the next state of the
counting sequence. Each state frequency (SF) is given as:
6.2 Counters are generally classified into two groups: synchronous and asynchronous
The flip-flop delay time and possibility of glitches are overcome by the use of a synchronous or parallel
counter. Every flip-flop is triggered in synchronism with the clock.
Synchronous counter is faster than the asynchronous counter.
From the timing diagram, the frequency of Q4 pulse is the 1 /16 th of the frequency of input clock pulse.
An encoder is a digital circuit that performs the reverse operation of a decoder. An encoder has 2 n input
lines and n output lines and the output lines produce binary code corresponding to the input value. An encoder
is a device, algorithm, that is a software program that converts the information from one format (code) to
another. The main purpose of the encoder is security, speed ,standardization or saving space by shrinking
size. They can be accepted one or more inputs and generates a multibit output code. Here this article gives
the application of encoder to better understand this topic.
The encoder is also a combinational logic circuit; it converts information, such as a decimal number or an
alphabetic character, into some coded form such as binary or Binary Code Decimal (BCD) or it performs
inverse operation of a decoder.
The octal-to-binary encoder consists of eight inputs, one for each of the eight digits, and three outputs that
generate the corresponding binary number, see figure 7.1. It is constructed with OR gates whose inputs can
be determined from the truth table given in table 2.1. The lower order output bit Z is 1 if the input octal digit
is odd. Output X is 1 for octal digits 4, 5, 6 or 7. Note that D 0 is not connected to any OR gate, the binary
inputs are all 0's.
An example of an encoder is the octal-to-binary encoder whose truth table is given in following table 7.0. It
has eight (23 ) inputs (one for each of the octal digits) and three outputs that generate the corresponding their
binary number. It is assumed that only one input has a value of 1 at a times.
The encoder can be applied with OR gates whose inputs are determined directly from the truth table. These
conditions can be expressed by the following Boolean output functions:
Limitation to encoder
The limit of the encoder shown in the table is that only one input can be active at any given time. If two
inputs are simultaneously activated the output produces an undefined combination. For example, if D3 and
D6 are 1 together, the output of the encoder will be 111 because all three outputs are equal 1 and Output 111
does not represent either binary 3 or binary 6. To resolve this ambiguity, the encoder circuit has to be installed
. It has an input priority to ensure that only one input is encoded. If we set a higher priority to an input with
a higher subscript number, and if both D3 and D6 are 1 at the same time, the output will be 110 because D6
has a higher priority than D3. Another ambiguity in octal-to-binary encoders is that an output with all 0s is
produced when all inputs are 0; But this output is the same when D0 equals 1. The discrepancy can be
resolved by providing another output to indicate whether at least one of the inputs is equal to 1.
Uses of encoder :-
• Encoders are a very common electronic circuit used in all digital systems.
• Encoder is used to translate decimal values into binary so that binary functions like addition,
subtraction, multiplication etc. can be performed.
• Other applications may include interrupt detection in microprocessor applications,
specifically for priority encoders.
• It is used in automatic health monitoring systems and RF-based home automation system.
• it is metal detector with robotics vehicle.
• War field flying robot with a using night-vision flying camera.
• Speed can be synchronized of multiple motors in industries.
• Encoder can be used for CNC machines and the medical industry most common for breast
cancer treatment in the world.
A decoder is a combinational circuit that converts coded information, such as binary, into a
recognizable form, such as decimal.
A decoder has a combinational circuit that converts binary information from n input lines to a maximum of
2n output lines. If the n -bit coded information has unused combinations, the decoder may have fewer than
2n outputs. Each combination of inputs will assert a unique output. The name decoder is also used with other
code converters, such as the BCD-to-seven segment decoder. At a particular tie one output line is active.
The input to a decoder is parallel binary number and it is used to detect the presence of a specific binary
number at the input. The output indicates the presence or absence of specific number at the decoder input.
Figure below shows a 2-to-4 line decoder circuit. The two inputs are decoded into four outputs, each output
representing one of the minterms of the 2-input variables. The two inverters provide the complement of the
input, each one of the minterms. However, a 2-to-4 line decoder can be used for decoding any 2-bit code to
provide four outputs, one of each element at the code.
Fig. 7.3 Logic circuit of 2 to 4 lines decoder
The operation of the decoder may be further classified from its input-output relationships, listed in table 2
observe that one output variable are mutually exclusive because only one output can be equal to 1 at one
time. The operation of the encoder is shown table 1
Enabling line: In figure 2.1 shows the block diagram of a typical decoder with enabling line, which has
n input lines, and m output lines, where m is equal to 2n. The decoder is called n-to- m decoder. Apart
from this, there is also a single line connected to the decoder called enable line.
General decoders have the “enable” input .The enable input performs no logical operation, but is only
responsible for making the decoder ACTIVE or INACTIVE.
• is zero, then all outputs are zero regardless of the input values.
• is one, then the decoder performs its normal operation.
Example of decoder with enable
• It is used for code conversion. i.e analog to digital conversion in the analog decoder and also
used for data distribution.
• Decoder can be used to minimize the effect of system decoding for high performance memory
system and it is used as address deoders in CPU memory location identification…
• Decoders are mainly used in logical circuits, data transfer and They can also be used to create
simple other digital logics like half adders and full adders .
• Microprocessor can be selected different I/O devices.
• It is decoding to binary input to activate the LED segments so that the decimal number can be
displayed.
• Microprocessor memory system an be selected different banks of memory.
• The decoder can be used as sequencing or a timing signals to turn the device on or off at
specific times because when the decoder inputs come from a counter that is being continually
pulsed, the decoder output will be activated sequentially.
• It is used whenever an output or a group of output is to be activated only on the occurrence of
a specific combination of input signals.
• It can be the application of switching function often with the fewer integrated circuit.
As mentioned above encoder and decoder are exact different from each other in terms of functioning. The
given table summarizes the difference between the encoder and decoder in detail.
Maps a smaller
Maps multiple inputs to a
Purpose representation back to the
smaller representation
original inputs
Number of
Input lines are 2^n, Input lines are n, Output
inputs and
Output lines are n lines are 2^n
outputs:
High, compact
Depends on the
representation of data
Efficiency implementation, may
reduces transmission
have a higher overhead
time
Limited, output
High, can be designed to
representation is
Flexibilty handle different input
determined by the input
codes
combination
Implementation of an encoder and decoder in digital signal processing typically involves the following steps:
Encoder Implementation
• Sampling: The analog signal is sampled at regular intervals to obtain a series of discrete values.
• Quantization: The discrete values are quantized, or mapped to a finite set of numerical values, to
reduce the number of bits required to represent the signal.
• Compression: The quantized values are compressed to reduce the size of the data for efficient
transmission or storage. This can be achieved using lossless or lossy compression algorithms,
depending on the desired level of compression and the acceptable level of data loss.
Decoder Implementation
• Dequantization: The quantized values are dequantized to obtain an approximation of the original
discrete values.
• Reconstruction: The discrete values are reconstructed to obtain an approximation of the original
analog signal.
It's worth noting that the exact implementation details of an encoder and decoder in digital signal processing
will vary depending on the specific signal and application. Different encoding and decoding algorithms may
use different techniques for sampling, quantization, compression, and reconstruction, tailored to the specific
requirements of the signal and the system.
Encoder and decoder are widely used in many applications in digital circuits and systems, including:
• Computer Memory: Encoders are used to encode addresses in computer memory, allowing for
efficient access to specific memory locations. Decoders are used to decode the encoded addresses
and access the corresponding memory locations.
• Digital Communication Systems: Encoder and Decoder are used in the Digital Communication
Systems for the interconversion of signals so that they can be transferred from one place to another.
• Computer Peripherals: Encoders are used in computer peripherals, such as keyboards and mice, to
encode user inputs and transmit them to the computer. Decoders are used to decode the encoded
inputs and interpret them in the computer.
• Robotics and Automation: Encoders are used in robotics and automation systems to encode and
decode positional information, allowing for precise control of motors and actuators.
• Data Compression: Encoders are used in data compression algorithms to reduce the size of data for
efficient transmission or storage. Decoders are used to decompress the compressed data and
reconstruct the original data.
• Digital Signal Processing: Encoders are used in digital signal processing to quantize and compress
signals, allowing for efficient processing and analysis. Decoders are used to dequantize and
decompress the signals and reconstruct the original data.
• Display Technology: Encoder and Decoder are used in display technology, such as televisions and
computer monitors, to encode and decode video signals.
7.7 Summary
Encoder and decoder are fundamental building blocks in digital circuits and play a crucial role in converting
digital signals from one format to another. An encoder is a digital circuit that converts information from
multiple inputs into a coded format that can be transmitted or stored more efficiently. Encoders are commonly
used in applications such as data compression, error correction, and digital-to-analog conversion.
A decoder, on the other hand, is a digital circuit that performs the reverse operation of an encoder, converting
coded information into multiple outputs. Decoders are used in applications such as memory address
decoding, data demultiplexing, and digital-to-analog conversion. In memory address decoding, a decoder is
used to convert binary addresses into specific memory locations, allowing the processor to access specific
data stored in the memory. In data demultiplexing, a decoder is used to distribute one data input to multiple
outputs, based on the input signal.
Encoder and decoder can be implemented using different digital logic circuits such as AND gates, OR gates,
NOT gates, and NAND gates. The choice of encoder or decoder size and type depends on the specific
requirements of the application. Encoder and decoder are widely used in a variety of digital systems such as
computers, communication systems, and digital control systems.
Encoder and decoder play a crucial role in converting digital signals from one format to another, allowing
for efficient data storage and transmission. Their applications range from simple data compression to
complex memory address decoding, and they are widely used in a variety of digital systems.
8.0 Multiplexer
A multiplexer (sometimes spelled multiplexor and also known as a MUX) is defined as a combinational
circuit that selects one of several data inputs and forwards it to the output. The inputs to a multiplexer can
be analog or digital. Multiplexers are also known as data selectors.
A multiplexer is useful for transmitting a large amount of data over the network within a certain amount
of time and bandwidth.
Multiplexers that are built from transistors and relays are termed as analog multiplexers which are used in
analog applications and Multiplexers that are built from logic gate termed as digital multiplexers which
are used in digital applications. The inverse of a multiplexer is known as a demultiplexer.
A multiplexer is a digital circuit that selects one of the n data inputs and forwards it to the output. The
selection of one of the n inputs is done by the select inputs. To select one of several inputs, we need m
select lines such that 2m=n.
Depending on the digital code applied at the select inputs, one of the n data inputs is selected and
transmitted to the single output. Hence, a multiplexer has maximum 2 n data input lines, ‘m’ selects lines,
and one output line.
The block diagram of an n-to-1 multiplexer and its equivalent circuit is shown in the figure below.
How Does a Multiplexer Work?
The multiplexer works like a multiple-input and single-output switch. The output gets connected to only
one of the n data inputs at a given instant of time. Therefore, the multiplexer is ‘many into one’ and it
works as the digital equivalent of an analog selector switch.
8.1.1 2 to 1 Multiplexer
2 to 1 Multiplexer Circuit
A 2-to-1 multiplexer is the digital multiplexer circuit that has two data inputs D 0 and D1, one selects line
S and one output Y. To implement a 2-to-1 multiplexer circuit we need 2 AND gates, an OR gate, and a
NOT gate.
The block diagram, logic symbol and switching circuit analogy of 2-to-1 multiplexer is shown in the
figure below.
As shown, D0 is an applied input to one of the AND gate and D1 is an applied input to the other AND gate.
Select input S is applied to the second AND gate as a second input and an inverted input S is applied to
the first AND gate as a second input. The output of both the AND gates is applied as inputs to the OR
gate.2 to 1 Multiplexer Circuit
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
Here, the 2-input multiplexer connects one of two 1-bit sources to a common output, hence it produces a 2-
to-1 multiplexer.
In simple notation
S Y
0 D0
1 D1
As shown in the above table that when select input S=0 then output Y=D0 and when S=1 then Y=D1. We can
increase the number of data inputs to be selected further and larger multiplexer circuits can be implemented
using smaller 2-to-1 multiplexer.
We can also implement all the multiplexers by using the NAND gate. Note that NAND and NOR gates are
a universal gate and we can implement any digital circuits by using NAND and NOR gates.
• A multiplexer reduces the number of wires used. Hence it reduces the circuit complexity and
overall cost.
• A multiplexer improves the reliability of the digital systems because it reduces the number of
external wired connections.
• We can implement many combinational circuits using MUX.
• Multiplexer simplifies the logic design.
• Multiplexer does not need the k-maps (Karnaugh map) and simplification.
Communication Systems
•Multiplexers are used as a data selector to select one out of many data inputs in communication
systems to transmit the various types of data (audio, video, etc.) at the same instant. Hence it
increases the efficiency of the communication system by allowing various types of data into
single transmission lines.
Telephone Networks
•
In a telephone network, multiplexers can be used to transmit multiple audio signals into a
single channel.
Computer Memory
• In computer memory, multiplexers are used to implement a large amount of data, at the same
instant reduces the number of copper wires required to connect memory to other parts in the
computer.
Transmission from the computer system to a satellites
• Multiplexers are also used to transmit the data from the computer system of a spacecraft or
satellite to the earth by utilizing “GPS” (Global Positioning System) and “GSM” (Global
System for Mobile Communication).
Some other applications include:
• Multiplexers can be used to implement the combinational logic circuit like time-multiplexing
systems and frequency multiplexing systems, A/D and D/A converter.
• Multiplexers can be used to implement Boolean functions of multiple variables.
• Multiplexers are used in data acquisition systems.
9.0 Arithmetic circuits
In this session you will study digital arithmetic. Digital arithmetic is, used in the internal calculations
performed in many modem computer systems. An arithmetic circuit is a set of gates with a separate set of
inputs for each number that has to be processed. The gates are connected so as to carry out an arithmetic
action and the outputs of the gate circuit are the digits of the result.
Addition is one of the most basic operations performed by different electronic devices like computers,
calculators, etc. The electronic circuit that performs the addition of two or more numbers, more specifically
binary numbers, is called as adder. As we know, the logic circuits use binary number system to perform the
operations, hence the adder is referred to as binary adder.
Depending on the number of binary digits that a circuit can add, adders (or binary adders) are of two types
• Half Adder
• Full Adder
Inputs Outputs
A B S (Sum) C (Carry)
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Carry, C=A⋅B
In this tutorial, we will discuss the Full Adder, its definition, circuit diagram, truth table, k-map,
characteristic equations, and applications.
What is a Full Adder?
A combinational logic circuit that can add two binary digits (bits) and a carry bit, and produces a sum bit
and a carry bit as output is known as a full-adder.
In other words, a combinational circuit which is designed to add three binary digits and produces two outputs
(sum and carry) is known as a full adder. Thus, a full adder circuit adds three binary digits, where two are
the inputs and one is the carry forwarded from the previous addition. The block diagram and circuit diagram
of the full adder are shown in Figure 9.2.
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Hence, from the truth table, it is clear that the sum output of the full adder is equal to 1 when only 1 input is
equal to 1 or when all the inputs are equal to 1. While the carry output has a carry of 1 if two or three inputs are
equal to 1.
S=A⨁B⨁C C = AB+AC+BC
9.2.3 Advantages and Disadvantages of Full Adder in Digital Logic
Advantages of Full Adder in Digital Logic
Flexibility: A full snake can add three information bits, making it more flexible than a half viper. It can likewise
be utilized to add multi-bit numbers by binding different full adders together.
Carry Info: The full viper has a convey input, which permits it to perform expansion of multi-bit numbers and
to chain different adders together.
Speed: The full snake works at an extremely fast, making it reasonable for use in rapid computerized circuits.
Similar to the binary addition, binary subtraction also, has four possible basic operations. They are:
• 0–0=0
• 0 – 1 = (Borrow)1
• 1–0=1
• 1–1=0
In figure 10 shows the four possible rules or elementary operations of the binary subtractions. In all the
operations, each subtrahend bit is deducted from the minuend bit. But in the second rule, minuend bit is smaller
than the subtrahend bit, hence 1 is borrowed to perform the subtraction. Similar to the adder circuits, basic
subtraction circuits are also of two types:
• Half Substractor
• Full Substractor
Thus, the Half Subtraction is also performed by the Ex-OR gate with an AND gate with one inverted input
and one normal input, requiring to perform the Borrow operation. In table 5 shows the truth table of a half
substractor
Table 10 Truth table for half substractor
The figure 10.1 below shows the complete diagram for the half substractor
This circuit is similar to that of the Half Adder with only difference being the minuend input i.e., A is
complemented before applied at the AND gate to implement the borrow output.
In case of multi-digit subtraction, subtraction between the two digits must be performed along with borrow
of the previous digit subtraction, and hence a subtractor needs to have three inputs, which is not possible
with a Half Subtractor. Therefore, a half subtractor has limited set of applications and strictly speaking, it is
not used in practice.
So, a Full Subtractor has three inputs, in which two inputs corresponding to the two bits to be subtracted
(minuend A and subtrahend B), and a borrow bit, usually represented as BIN, corresponding to the borrow
operation. There are two outputs, one corresponds to the difference D output and the other Borrow output
BO
Table 10.1 shows the truth table for a Full Subtractor. In the table it can be stated as:
• 'A' and' B' are the input variables. These variables represent the two significant bits that are going to be
subtracted.
• 'Borrowin' is the third input which represents borrow.
• The 'Diff' and 'Borrow' are the output variables that define the output values.
• The eight rows under the input variable designate all possible combinations of 0 and 1 that can occur in
these variables.
By deriving the Boolean expression for the full subtractor from above truth table, we get the expression that
tells that a full subtractor can be implemented with half subtractors with OR gate as shown in figure 10.3.
By comparing the adder and subtractor circuits and truth tables, we can observe that the output D in the full
subtractor is exactly same as the output S of the full adder (see figure 9.2). And the only difference is that
input variable A is complemented in the full subtractor.
The following image in figure 10.2 shows the block diagram of a full subtractor.
Therefore, it is possible to convert the full adder circuit into full subtractor by simply complementing the
input A before it is applied to the gates to produce the final borrow bit output B0.
10.2.1 K-Map for Full Subtractor
We can use the K-Map (or Karnaugh Map), a method for simplifying Boolean algebra, to determine equations
of the difference bit (d) and the output borrow bit (b).
Disadvantages
• In case of half subtractor, there is no provision for accepting Borrow as input from
the previous stage.
• The speed of the subtractor is limited by the longest delay through the circuit.
Advantages
• It is simple to design and implement.
• Power deduction in Digital Signal Processing.
• Computational tasks can be carried out at high speed.
Any voltage falling in the range 0 to 0.8 V is given the digital value 0, and any voltage in the range 2 to 5 V
is assigned the digital value 1. The digital circuits respond accordingly to all voltage values within a given
range.
Most physical variables are analog in nature and can take on any value within a continuous range of values.
Examples include temperature, pressure, light intensity, audio signals, position, rotational speed, and flow
rate. Digital systems perform all of their internal operations using digital circuitry and digital operations. Any
information that has to be inputted to a digital system must first be put into digital form. Similarly, the outputs
from a digital system are always in digital form.
11.2 Transducer
The physical variable is normally a nonelectrical quantity. A transducer is a device that converts the physical
variable to an electrical variable, see figure 11. Some common transducers include thermistors, photocells,
photodiodes, flow meters, pressure transducers, and tachometers. The electrical output of the transducer is
an analog current or voltage that is proportional to the physical variable it is monitoring. For example, the
physical variable could be the temperature of water. Let’s say that the water temperature varies from 80 to
1500 F and that a thermistor and its associated circuitry convert this water temperature to a voltage ranging
from 800 to 1500mV. Note that the transducer’s output is directly proportional to temperature; such that each
10 F produces a 10mV output. Analog-to digital converter (ADC) and digital-to-converter (DAC) are used
to interface a computer to the analog world so that the computer can monitor and control a physical variable
Fig. 11 Interfacing with the analog world using Analog-to-Digital Converter (ADC) and Digital-
to- Analog Converter (DAC).
11.3 Actuator
The analog signal from the DAC is often connected to some device or circuit that serves as an actuator to
control the physical variable. For our water temperature example, the actuator might be an electrically
controlled valve that regulates the flow of hot water into the tank in accordance with the analog voltage from
the DAC. The flow rate would vary in proportion to this analog voltage, with 0 V producing no flow and
10 V producing the maximum flow rate.
Thus we see that ADCs and DACs function as interfaces between a completely digital system, like a
computer, and the analog world.
The digital inputs D, C, B, and A are usually derived from the output register of a digital system. The 24 =
16 different binary numbers represented by these 4 bits for each input number, the D/A converter output
voltage is a unique value. In fact, for this case, the analog output voltage Vout is equal in volts to the binary
number.
In general,
where K is the proportionality factor and it is constant value for a given DAC. The analog output can of
course be a voltage or current. When it is a voltage, K will be in voltage units, and when the output is current,
K will be in current units. For the DAC of K=1 V, so that
We can use this to calculate VOUT for any value of digital input. For example, with a digital input of 11002 =
1210, we obtain
VOUT = 1V × 12 = 12V
Problem 1: A 5-bit DAC has a current output. For a digital input of 101000, an output current of 10mA is
produced. What will IOUT be for a digital input of 11101?
Solution: The digital input 101002 is equal to decimal 20. Since IOUT = 10 mA for this case, the
proportionality factor as 0.5 mA. Thus, we can find for a digital input such as 11101 2 = 2910 as
follows:
IOUT = (0.5mA) × 29
= 14.5 mA
Remember, the proportionality factor, K, will vary from one DAC to another.
Problem 2. What is the largest value of output voltage from an 8-bit DAC that produces 1.0V for a
digital input of 00110010?
Thus, A, which is the LSB, has a weight of 1V, B has a weight of 2V, C has a weight of 4 V, and D, the MSB,
has the largest weight 8V. The weights are successively doubled for each bit, beginning with the LSB. Thus,
we can consider VOUT to be the weighted sum of the digital inputs. For instance, to find VOUT for the digital
input 0111 we can add the weights of the C, B, and A bits to obtain 4 V + 2V + 1V=7V.
Problem 3. A 5-bit D/A converter produces VOUT = 0.2 V for a digital input of 0001. Find the value of
Vout for an input of 11111.
Solution: Obviously, 0.2 V is the weight of the LSB. Thus, the weights of the other bits must be
0.4 V, 0.8 V, 1.6 V, and 3.2 V respectively. For a digital input of 11111, then, the value of VOUT will be
3.2 V + 1.6 V+ 0.8V + 0.4V + 0.2 V = 6.2V.
11.6 Resolution
Resolution of a D/A converter is defined as the smallest change that can occur in an analog output as a result
of a change in the digital input. We can see that the resolution is 1V, since VOUT can change by no less than
1 V when the digital input value is changed. The resolution is always equal to the weight of the LSB and is
also referred to as the step size. As the counter is being continually cycled through its 16 states by the clock
signal, the DAC output is a staircase waveform that goes up 1 V per step. When the counter is at 1111, the
DAC output is at its maximum value of 15 V; this is its full-scale output. When the counter recycles to 0000,
the DAC output returns to 0V. The resolution or step size of the jumps in the staircase waveform; in this
Note that the staircase has 16 levels corresponding to the 16 input states, but there are only 15 steps or jumps
between the 0-V level and full-scale, In general, for an N-bit DAC the number of different levels will be 2 N,
and the number of steps will be 2N - 1.
You may have already figured out the resolution (step size) is the same as the proportionality factor in the
DAC input/output relationship:
A new interpretation of this expression would be that the digital input is equal to the number of the step, K
is the amount of voltage (or current) per step, and the analog output is the product of the two.
Problem 4: For the DAC of Example 3 determine V OUT for a digital input of 10001.
Solution: The step size is 0.2 V, which is the proportionality factor K. The digital input is 10001
= 1710. Thus we have:
VOUT = (0.2 V) × 17
= 3.4V
𝑠𝑡𝑒𝑝 𝑠𝑖𝑧𝑒
% 𝑟𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 = 𝑥 100%
𝑓𝑢𝑙𝑙 𝑠𝑐𝑎𝑙𝑒 (𝐹𝑆)
1𝑣
= 15𝑣 𝑥 100% = 6.67%
Problem 5: A 10-bit DAC has a step size of 10 mV. Determine the full-scale output voltage and the
percentage resolution.
Solution
With 10 bits, there will be 210 - 1 = 1023 steps of 10mV each. The fullscale output will therefore be
10mV × 1023 = 10.23 V and
10𝑚𝑉
% 𝑟𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 = 𝑋 100 % ≈ 0.1
10.23𝑉
Problem 4 helps to illustrate the fact that the percentage resolution becomes smaller as the number of input
bits is increased. In fact, the percentage resolution can also be calculated from.
1
% resolution = 𝑡𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑠𝑡𝑒𝑝𝑠 𝑥 100 %
For an N-bit binary input code the total number of steps is 2N-1. Thus, for the previous example,
1
% resolution = 𝑥 100 % ≈ 0.1 %
210 −1
This means that it is only the number of bits which determines the percentage resolution. Increase of the
number of bits increases the number of steps to reach full scale.
As previous said the aim of D/A converter is to convert a binary word to a proportional current or voltage.
The binary weighted resistors produce binary-weighted current which are summed up by the op-amp to
produce proportional output voltage. The binary word applied to the switches produces a proportional output
voltage. Several different binary codes such as straight binary, BCD and offset binary are commonly used as
inputs to D/A converters.
Fig. 11.2 DAC circuitry using op-amp with binary weighted resistors.
Figure 11.2 shows the basic circuit of 4-bit DAC. The inputs A,B,C, and D are binary inputs which are
assumed to have values of either 0 V or 5 V. The operational amplifier is employed as a summing amplifier,
which produces the weighted sum of these input voltages. the summing amplifier multiplies each input
voltage by the ratio of the feedback resistor RF to the corresponding input resistor RIN. In this circuit RF
RIN 1kΩ and the input resistors range from 1 to 8 kΩ . The D input has RIN = 1KΩ, so the summing amplifier
passes the voltage at D with no attenuation. The C input has RIN = 2 kΩ, so that it will be attenuated by 1/2.
Similarly, the B input will be attenuated by 1/4 and the A input by 1 /8. The amplifier output can thus be
expressed as
VOUT = - (VD +1 /2 VC + ¼ VB + 1 /8 VA)
The negative sign is present because the summing amplifier is a polarity inverting amplifier, but it will but
concern us here.
Clearly, the summing amplifier output is an analog voltage which represents a weighted sum of the digital
inputs. The output is evaluated for any input condition by setting the appropriate inputs to either 0 V or 5 V.
For example, if the digital input is 1010, then VD = VB = 5V and VC = VA = 0V. Thus, using equation
VOUT = - (5V +OV + ¼ × 5V + OV)
= - 6.25V
The resolution of this D/A converter is equal to the weighting of the lSB, which is 1 /8 × 5V = 0.625 V.
The analog output increases by 0.625 V as the binary input number advances one step.
Problem 6: Assume VREF = 10 V and R = R = 10 kΩ. Determine the resolution and fullscale output for
this DAC. Assume that RL is much smaller than R.
Solution
I0 = VREE/R = 1 mA. This is the weight of the MSB. The other three currents will be 0.5, 0.25, and 0.125
mA. The LSB is 0.125 mA, which is also the resolution.
The full-scale output will occur when the binary inputs are all HIGH so that each current switch is closed
and
IOUT = 1 + 0.5 + 0.25 + 0.125 = 1.875 mA
Note that the output current is proportional to VREF. If VREF is increased or decreased, the resolution and
full-scale output will change proportionally.
where B is the value of the binary input, which can range from 000 (0) to 1111 (15).
Fig. 9.1 R/2R ladder DAC
Accuracy
There are several ways of specifying accuracy. The two most common are called full-scale error and
linearity error which are normally expressed as a percentage of the converter’s full-scale output (%F.S.)
Full-scale error is the maximum deviation of the DAC’s output from its expected (ideal) value, expressed
as a percentage of full scale. For example, assume that the DCA has an accuracy of ± 0.01% F.S. Since this
converter has a full-scale output of 9.375 V, this percentage converts to
This means that the output of this DAC can, at any time, be off by as much as 0.9375mV from its expected
value.
Linearity error is the maximum deviation in step size from the ideal step size. For example, the DAC has
an expected step size of 0.625 V. If this converter has a linearity error of ± 0.01F.S,, this would mean that
the actual step size could be off by as much as 0.9375 mV.
Problem 7 A certain 8-bit DAC has a full-scale output of 2mA and a full-scale error of ± 0.5% F.S. What is
the range of possible outputs for an input of 10000000?
Solution: The step size is 2mA/255 = 7.84 µA. Since 10000000 = 12810, the ideal output should be 128 ×
7.84 µA. The error can be as much as
± 0.5% × 2mA = ± 10µA
Thus, the actual output can deviate by this amount from the ideal 1004µA , so the actual output can be
anywhere from 994 to 1014 µA.
Offset Error
Ideally, the output of a DAC will be zero volts when the binary input is all 0’s. In practice, however, there
will be a very small output voltage for this situation; this is called offset error. This offset error, if not
corrected, will be added to the expected DAC output for all input cases. Offset error can be negative as well
as positive.
Many DACs will have an external offset adjustment that allows you to zero the offset. This is usually
accomplished by applying all 0s to the DAC input and monitoring the output while an offset adjustment
potentiometer is adjusted until the output is as close to 0 V as required.
Settling Time
The operating speed of a DAC is usually specified by giving its settling time, which is the time required for
the DAC output to go from zero to full scale as the binary input is changed from all 0’s to all 1’s. Typical
values for settling time range from 50 ns to 10 μs.
Monotonicity
A DAC is monotonic if its output increases as the binary input is incremented from one value to the next.
Another way to describe this is that the staircase output will have no downward steps as the binary input is
incremented from zero to full scale.
DAC Applications
DACs are used whenever the output of a digital circuit has to provide an analog voltage or current to drive
an analog device. Some of the most common applications are described in the following paragraphs.
Control
The digital output from a computer can be converted to an analog control signal to adjust the speed of a
motor or the temperature of a furnace, to control almost any physical variable.
Automatic Testing
Computers can be programmed to generate the analog signals (through a DAC) needed to test analog
circuitry. The test circuit’s analog output response will normally be converted to a digital value by an ADC
and fed into the computer to be stored, displayed, and sometimes analyzed.
Signal Reconstruction
In many applications, an analog signal is digitized, meaning that successive points on the signal are converted
to their digital equivalent and stored in memory. This conversion is performed by an analog-to-digital
converter (ADC). A DAC can then be used to convert the stored digitized data back to analog-one point at a
time-thereby reconstructing the original signal. This combination of digitizing and reconstruction is used in
digital storage oscilloscopes, audio compact disk systems, and digital audio and video recording.
Exercise
Multiple choice questions
a) Resolution of DAC is equal to the weight of
i) LSB
ii) MSB
iii) full scale output
iv) 1 volt.
b) When the binary input is all 0.s, ideally the output of a DAC will be?
i) Zero volt
ii) Full scale output voltage
iii) 1 volt
iv) One step voltage.
Questions for short answers
a) Define full scale error and offset error.
b) What is the advantage of R/2R ladder DAC over the DAC that
uses binary weighted resistors?
c) An 8-bit DAC has an output of 3.92 mA for an input of 01100010.
What are the DAC’s resolution and full-scale output?
d) What is the percentage resolution of an 8-bit DAC?
e) How many different output voltages can a 12-bit DAC produce?
f) Define full-scale error.
g) What is settling time?
h) Describe offset error and its effect on a DAC output.
Analytical questions
a) Describe the operation of a DAC.
b) What is the advantage of R/2R ladder DACs over those that use binary weighted resistors?
c) Discuss some of the DAC applications.
Several important types of ADC utilize a DAC as part of their circuitry. Figure 12.0 is a general block
diagram for this class of ADC. The timing for the operation is provided by the input clock signal. The control
unit contains the logic circuitry for generating the proper sequence of operations. The START COMMAND,
initiates the conversion process. The op-amp compactor has two analog inputs and a digital output that
switches states, depending on which analog input is greater.
The basic operation of ADCs of this type consists of the following steps:
1. The START COMMAND pulse initiates the operation.
2. At a rate determined by the clock, the control unit continually modifies the binary number that is
stored in the register.
3. The binary number in the register is converted to an analog voltage, VAX, by the DAC.
4. The comparator compares VAX with the analog input VA. As long as VAX < VA1 the comparator output
stays HIGH. When VAX exceeds VA by at least an amount = VT (threshold voltage), the comparator output
goes LOW and stops the process of modifying the register number. At this point, V AX is a close
approximation to VA. The digital number in the register, which is the digital equivalent of V AX, is also
the approximate digital equivalent of VA1 within the resolution and
accuracy of the system.
5. The control logic activates the end-of-conversion signal, EOC, when the conversion is complete.
1. A START pulse is applied to reset the counter to zero. The HIGH at START also inhibits clock pulse
form passing through the AND gate into the counter.
2. With all 0’s at its input, the DAC’s output will be VAX = 0V.
3. Since VA > VAX, the comparator output, EOC, will be HIGH.
4. When START returns LOW, the AND gate is enabled and clock pulses get through to the counter.
5. As the counter advances, the DAC output, VAX, increases one step at a time as shown in Fig. 12.1
6. This continues unit VAX reaches a step that exceeds VA by an amount equal to or greater than VT
(typically 10 to 100 μV). At this point, EOC will go LOW and inhibit the flow of pulses into the counter
and the counter will stop counting.
7. The conversion process is now complete as signaled by the HIGH-to-LOW transition at EOC, and the
contents of the counter are the digital representation of VA.
8. The counter will hold the digital value until the next START pulse initiates a new conversion
Problem 8: Assume the following values for the ADC clock frequency = 1 MHz; V T = 0.1 mV; DAC has
F.S. output = 10.23 V and a 10-bit input. Determine the following values.
a. The digital equivalent obtained for VA = 3.728 V.
b. The conversion time.
c. The resolution of this converter.
Solution:
a. The DAC has a 10-bit input and a 10.23-V F.S. output. Thus, the number of total possible steps is 210
- 1 = 1023, and so the step size is;
10.23𝑉
= 10𝑚𝑉
1023
This means that VAX increases in steps of 10 mV as the counter counts up from zero. Since V A = 3.728 V
and VT = 0.1 mV, VAX has to reach 3.7281 V or more before the comparator switches LOW. This will
require.
3 7281V
= 372 81 = 373 steps
10𝑚𝑉
At the end of the conversion, then, the counter will hold the binary equivalent of 373, which is 0101110101.
This is the desired digital equivalent of VA = 3.728 V, as produced by this ADC.
b. Three hundred seventy-three steps (373) were required to complete the conversion. Thus, 373 clock
pulses occurred at the rate of one per microsecond. This gives a total conversion time of 373 μs.
c. The resolution of this converter is equal to step size of the DAC, which is 10mV. In percent it is;
1
𝑥 100 ≈ 0.1%
1023
Problem 9
For the same ADC of problem 8 determine the approximate range of analog input voltages that will produce
the same digital result of 01011101012 = 37310.
Solution
Table 12 shows the ideal DAC output voltage, VAX, for several of the steps on and around the 373rd. If VA is
slightly smaller than 3.72 V (by an amount < VT),
Then EOC won’t go LOW when VAX reaches the 3.72-V step, but will go LOW on the 3.73-V step. If VA is
slightly smaller than 3.73 V (by an amount < VT), then EOC won’t go LOW until VAX reaches the 3.74-V
step. Thus, as long as VA is between approximately 3.72 V and 3.73-V, EOC won’t go LOW until VAX
reaches the 3.73-V step. The exact range of VA values is;
3.72 V - VT to 3.73 V – VT
but since VT is so small, we can simply say that the range is approximately 3.72 V to 3.73 V - a range equal
to 10 mV, the DAC’s resolution.
Problem 10
A certain 8-bit ADC has a full-scale input of 2.55 V (i.e., VA = 2.55 V produces a digital output of 11111111).
It has a specified error of 0.1% F.S. Determine the maximum amount by which the VAX output can differ
from the analog input.
Solution
The step size is 2.55 V/ (28 - 1), which is exactly 10 mV. This means that even if the DAC has no inaccuracies,
the VAX output could be off by as much as 10 mV because VAX. can change only in 10-mV steps; this is
the quantization error. The specified error of 0.1% F.S. is 0.1% × 2.55 V =
2.55 mV. This means that the VAX value can be off by as much as 2.55 mV because of component
inaccuracies. Thus, the total possible error could be as much as 10 mV + 2.55 mV =
12.55 mV.
The maximum conversion time will occur when V A is just below full scale so that VAX has to go to the last
step to activate EOC. For an N-bit converter this will be
Sometimes, average conversion time is specified; it is half of the maximum conversion time.
𝑡𝑐(𝑚𝑎𝑥)
𝑡𝑐 ≈ 2𝑁−1 𝐶𝐿𝑂𝐶𝐾 𝐶𝑌𝐶𝐿𝐸𝑆
2
The major disadvantage of the digital-ramp method is that conversion time essentially doubles
for each bit that is added to the counter, so that resolution can be improved only at the cost of a longer tc.
Applications, however, the relative simplicity of the digital-ramp converter is an advantage over the more
complex, higher-speed ADCs.
12.4 Applications
Almost any measurable quantity present as a voltage can be digitized by an A/D converter and displayed.
A/D converters are the heart of digital voltmeters and digital MultiMate’s. Analog voice signals are converted
to digital form for transmission over long distances. At their destination they are reconverted to analog. In
digital audio record- the analog audio signal produced by a microphone is digitized (using an ADC), then
stored on some medium such as magnetic tape, magnetic disk or optical disk. Later the stored data are played
back by sending them to a DAC to reconstruct the analog signal, which is fed to the amplifier and speaker
system to produce the recorded sound.
13.1.1 Lay out the basic arithmetic operations you want your chip to have:
• Addition/Subtraction
• Multiplication
• Division
• Shifting and Rotating
• Logical Operations: AND, OR, XOR, NOR, NOT,
etc.
This decision, more than any other, is going to have the largest effect on your final design. Do not proceed
in the design process until you have made this decision. Once you have your ALU architecture, you create
your memory element (stack or register file), and you can lay out your ALU.
• The early RISC years focused on making instruction sets that ran a few benchmark programs in C,
when compiled with relatively primitive compilers, really, really fast -- "cycles per instruction", and
later "instructions per cycle" was recognized as an important part of achieving low "time to run the
benchmark".
• The rise of multitasking operating systems (and shared-memory parallel processors) lead to the
discovery of non-blocking synchronization and the instructions necessary to support it.
• CPUs dedicated to a single application (ASICs or FPGAs) led to the idea of customizing the CPU
for one particular application
• The rise of viruses and other malware led to the recognition of the Popek and Goldberg virtualization
requirements.
•
Bottom-Up Method is a system design approach where the parts of a system are defined in details. Once
these parts are designed and developed, then these parts or components are linked together to prepare a bigger
component. This technique is repeated until the complete system is built. The advantage of Bottom-Up
technique is in making decisions at very low level and to decide the re-usability of components.
Top-Down Method is a system design approach where the design starts from the system as a whole. The
complete system is then divided into smaller sub-applications with more details.
Each part again goes through the top-down approach till the complete system is designed with all the minute
details. Top-Down approach is also termed as breaking a bigger problem into smaller problems and solving
them individually in recursive manner.
13.5 Difference between Bottom-Up Model and Top-Down Method
The following are the important differences between Bottom-Up Method and Top-Down Method
The focus is on identifying and resolving The focus is on breaking the bigger
Focus smallest problems and then integrating problem into smaller one and then
them together to solve the bigger problem. repeats the process with each problem.
Have high interactivity between various Has tight coupling issues and low
Interaction
modules. interactivity between various modules.
However, software based self-testing (SBST) approaches can be grouped together under the term software-
based self-testing (SBST) and various SBST techniques has seen as effective alternative to hardware self-
test for embedded processors. SBST has a nonintrusive nature since it utilizes existing processor resources
and instructions to perform self-testing. Therefore, SBST can potentially provide sufficient testing quality
without impact on performance, area, or power consumption during normal operation.
Self-test routines and data are downloaded into instruction and data memories, respectively, from a low-
speed, low-cost external mechanism. Subsequently, these self-test routines are executed at the processor
actual speed (at-speed testing) and test responses are stored back in the on-chip RAM. These test responses
may be in a compacted (self-test signatures) or uncompact form and can be unloaded by the low-cost external
ATE during manufacturing testing. Since today’s microprocessors have a reasonable amount of on-chip
cache, execution from the on-chip cache is considered a further improvement when targeting low-cost testers,
provided that a cache-loader mechanism exists to load the test program and unload the test response. As an
alternative, self-test routines may be executed from an on-chip ROM dedicated to this task when periodic
online testing is performed for the device.
Exercise
Multiple choice question
a) The number of total steps of a 9-bit ADC is,
i) 255
ii) 256
iii) 511
iv) 512.
Questions for short answers
a) What do you know about quantization error?
b) Define conversion time.
c) What is the major disadvantage of the digital ramp type ADC?
d) What is the function of the comparator in the ADC?
e) Where is the approximate digital equivalent of VA when the
conversion is complete?
g) What is the function of the EOC signal?
Analytical question
a) Draw digital ramp ADC and write down its operation.
Applications
b) A 10-bit DAC has a step size of 10 mV. Determine the full-scale output voltage and the percentage
resolution.