Professional Documents
Culture Documents
1 Frequency Counters
A frequency counter, being a digital instrument, is limited in its frequency range by the
speed of its logic circuitry. Today the state of the art in high-speed logic allows the
construction of counters with a frequency range of around 500 MHz. Continuing advances
in IC technology should extend this range beyond 1 GHz in the not-too-distant future.
The designer of an automatic counter must look to some form of down-conversion in order to
extend frequency measurement beyond 500 MHz. Four techniques are available today
to provide this down-conversion:
• Prescaling, with a range of 1.5 GHz;
• Heterodyne Converter. Frequency measurements as high as 20 GHz are fairly common.
• Transfer Oscillator, used in counters with ranges to 23 GHz;
• Harmonic Heterodyne Converter, a new technique which can provide
measurements
to 40 GHz.
Prescaling involves a simple division of the input frequency, resulting in a lower frequency
signal which can be counted in digital circuitry. The frequency measured by the counter
section is related to the input simply by the integer N. A display of the correct frequency
is accomplished either by multiplying the counter’s contents by N or by increasing the
counter’s gate time by a factor of N. Typically, N ranges from 2 to 16. Modern frequency
counters using this technique are capable of measuring up to 1.3 GHz. Recent
developments in solid-state technology might extend this range into the low microwave
range within a few years.
Heterodyne Converter
Heterodyne down-conversion centers about a mixer which beats the incoming microwave fre-
quency against a high-stability local oscillator signal, resulting in a difference frequency
which is within the conventional counter’s 500-MHz bandwidth.
Figure 7.1 is the block diagram of an automatic microwave counter using the heterodyne
down-
conversion technique. The down-converter section is enclosed by the dotted line.
Outside the
dotted line is the block diagram of a conventional counter, with the addition of a new
block called
the processor. The decision-making capability of a processor is necessary here in order
to lead the counter through its measurement algorithm. The high stability local oscillator
of Figure 7.2 is
generated by first multiplying the frequency of the instrument’s time base to a
convenient funda-
mental frequency (designated fin), typically 100 to 500 MHz. This fin is directed to a
harmonic
generator which produces a “comb line” of frequencies spaced at fin extending to the full
fre-
quency range of the counter. One line of this comb, designated Kfin, is then selected by
the micro-
wave filter and directed to the mixer. Emerging from the mixer is a video frequency equal
to
fx - Kfin. This video frequency is amplified and sent to the counter. The display shows the
sum of
the video frequency and Kfin, which is provided by the processor. (The processor stores
the value
of K, since it is in control of the microwave filter.)
The signal detector block in Figure 7.1 is necessary for determining the correct K value.
In practice, the processor will begin with K =1 and will “walk” the value of K through the
comb line until the signal detector determines that a video frequency is present. At this
point the acquisition routine is terminated and measurement can begin.
The remaining block in Figure 7.1 which has not been discussed is the automatic gain control
(AGC) circuit. This circuit provides a degree of noise immunity by desensitizing the video
amplifier such that only the strongest frequency components of the video signal will enter
the Schmitt
trigger and be counted.
- Kf
fvideo fx in Schmitt Main Counting
Mixer Video Amp Trigger Gate Register
− Kf
Unknown Input (fx) fx in
Kfin dc
Amp
YIG/PIN Display
Switch Filter AGC
Amp Main Gate
FF
Signal
fin Detector
Harmonic Multiplier
Generator
Filter Processor
Control
Transfer Oscillator
The transfer oscillator uses the technique of phase locking a low frequency oscillator
to the microwave input signal. The low frequency oscillator can then be measured in a
conventional counter, and all that remains to be accomplished is to determine the
harmonic relationship between that frequency and the input.
Figure 7.2 is the block diagram of an automated transfer oscillator. Once again, the
down conversion circuitry is contained within the dotted line.
The lower sampler and portion of the converter section is used for determination of N.
By offsetting F1 by a known frequency, F0, the output of VCO 2 is given by
F2 = F 1 − F0 (7.2)
This signal is used to drive the lower sampler whose output frequency, Fif2, is given by
Fif2 = NF 2 - fx (7.3)
Hence,
Fif2 = Fif1 − NF0 (7.4)
This output from the lower sampler at Fif2 is mixed with Fif1 to generate NF0. N is then deter-
mined in a ratio counter with NF0 and F0 as inputs. Once determined, N is then used to
extend the time base while F1 is being measured. By offsetting the display by Fif1,
equation (7.1) is solved and the unknown frequency fx displayed.
Amp
Power
fx Divider Quadrature
Detector
VCO 2 F0
fx F2 Fif2 Fif REF
NF0
Sampler Video
Amp 2 Mixer
Schmitt
Trigger Main Counting
Gate Register
Figure 36 shows the input fx being directed to a sampler, with the resulting down-
converted video signal fif = fx - Nfs amplified and sent to the counter. The sampling
frequency fs is created by a processor-controlled synthesizer.
The acquisition routine for this down-converter consists of tuning the synthesizer fs until
the signal
detector finds a video signal fif of the appropriate frequency range (defined by the
bandpass filter).
Next, the harmonic number N must be determined, as in the transfer oscillator. One
method of
finding N is to use a second sampler loop, as with the transfer oscillator (Figure 7.2) or
similar
technique. A second method is to step the synthesizer back and forth between two
closely-spaced
frequencies and observe the differences in counter readings; it is then a simple task for
the proces-
sor to calculate N.
fif Schmitt
fx Sampler Video Amp Trigger
Time Base
Oscillator
Processor
The performance criteria to be used for the comparison include the following:
• Measurement speed
• Accuracy
• Sensitivity and Dynamic Range
• Signal-to-Noise Ratio
• FM tolerance
• AM tolerance
• Amplitude Discrimination
Measurement Speed
The time required for a microwave counter to perform a measurement may be divided
into two
parts:
• Acquisition Time — The time necessary for the counter to detect the
microwave signal
and prepare to make a measurement: and
• Gate Time — The duration of the counter’s gate required to measure to a given resolution.
Accuracy
For a gate time of one second, the transfer osciIlator is limited to about 1 • 10-8
resolution (for 100-MHz clock). The heterodyne and harmonic heterodyne converters are
limited to about
1 • 10-9, at which point the short-term instabilities of common crystal oscillators
become the limiting factor. With the higher stability of an oven oscillator, these two
converters are capable of resolving 1 • 10-10 at microwave frequencies.
As shown in Figure 7.4, there is little difference in sensitivity specifications among the
three downconversion techniques. A good microwave counter will have sensitivity of
about -25 dBm for most measurements.
Input Level
+20 dBm
0 dBm
Figure 7.4. Available microwave counter sensitivity specifications. Maximum measured input (regardless
of
down-conversion technique) is typically +7 dBm, although some counters allow measurements to +20
dBm.
Signal-to-Noise Ratio
All modern microwave counters are capable of measuring today’s microwave sources
with their inherent incidental frequency modulation. In general, although the transfer
oscillator is capable of measuring microwave frequencies with all common forms of FM
modulation, the heterodyne and harmonic heterodyne have an advantage in the area of
FM tolerance.
AM Tolerance
Amplitude Discrimination
All modern microwave counters incorporate amplitude discrimination in their designs. This
capability is one of the key features of the transfer oscillator and harmonic heterodyne
converter.
These counters are typically capable of always finding the most prominent component of
the
spectrum, provided that it is at least 2 dB above nearby signals and at least 10 dB above
signals at
the far end of the counter’s frequency range. Figure 7.5 illustrates these measurement
capabilities.
Figure 7.5. Amplitude discrimination capabilities of the transfer oscillator and harmonic heterodyne
converter.
Each drawing indicates the required level separation in order for the counter to distinguish the greater
signal.
Harmonic
Characteristic Heterodyne Converter Transfer Oscillator Heterodyne Converter
Accuracy Time base limited Time base limited Time base limited
Sensitivity/ -30 dBm/35-50 dB -35 dBm/40 dB -30 dBm/35-50 dB
Dynamic Range
Signal-to-Noise Ratio 40 dB 20 dB 20 dB
FM Tolerance 30-40 MHz peak-peak 1-10 MHz peak-peak 10-50 MHz peak-peak
AM Tolerance Less than 50% Greater than 90% Greater than 90%
Amplitude 4-30 dB 2 -10 dB 2 -10 dB
Discrimination
Figure 7.6. Summary of the performance of the three principal microwave counter down-conversion techniques.
7.2 Analog-to-digital converter
Typically, an ADC is an electronic device that converts an input analog voltage (or
current) to a digital number proportional to the magnitude of the voltage or current.
However, some non-electronic or only partially electronic devices, such as rotary
encoders, can also be considered ADCs. The digital output may use different coding
schemes, such as binary, Gray code or two's complement binary.
7.2a Resolution
The resolution of the converter indicates the number of discrete values it can produce
over the range of analog values. The values are usually stored electronically in binary
form, so the resolution is usually expressed in bits. In consequence, the number of
discrete values available, or "levels", is usually a power of two. For example, an ADC
with a resolution of 8 bits can encode an analog input to one in 256 different levels,
8
since 2 = 256. The values can represent the ranges from 0 to 255 (i.e. unsigned
integer) or from -128 to 127 (i.e. signed integer), depending on the application.
Resolution can also be defined electrically, and expressed in volts. The voltage
resolution of an ADC is equal to its overall voltage measurement range divided by the
number of discrete intervals as in the formula:
Where:
• Example 1
o Full scale measurement range = 0 to 10 volts
o ADC resolution is 12 bits: 212 = 4096 quantization levels (codes)
o ADC voltage resolution is: (10V - 0V) / 4096 codes = 10V / 4096 codes
0.00244 volts/code 2.44 mV/code
• Example 2
o Full scale measurement range = -10 to +10 volts
o ADC resolution is 14 bits: 214 = 16384 quantization levels (codes)
o ADC voltage resolution is: (10V - (-10V)) / 16384 codes = 20V / 16384
codes 0.00122 volts/code 1.22 mV/code
• Example 3
o Full scale measurement range = 0 to 8 volts
o ADC resolution is 3 bits: 23 = 8 quantization levels (codes)
o ADC voltage resolution is: (8 V − 0 V)/8 codes = 8 V/8 codes = 1
volts/code = 1000 mV/code
In practice, the smallest output code ("0" in an unsigned system) represents a voltage
range which is 0.5X of the ADC voltage resolution (Q)(meaning half-wide of the ADC
voltage Q ) while the largest output code represents a voltage range which is 1.5X of
the ADC voltage resolution (meaning 50% wider than the ADC voltage resolution). The
other N − 2 codes are all equal in width and represent the ADC voltage resolution (Q)
calculated above. Doing this centers the code on an input voltage that represents the
Mth division of the input voltage range. For example, in Example 3, with the 3-bit ADC
spanning an 8 V range, each of the N divisions would represent 1 V, except the 1st ("0"
code) which is 0.5 V wide, and the last ("7" code) which is 1.5 V wide. Doing this the "1"
code spans a voltage range from 0.5 to 1.5 V, the "2" code spans a voltage range from
1.5 to 2.5 V, etc. Thus, if the input signal is at 3/8ths of the full-scale voltage, then the
ADC outputs the "3" code, and will do so as long as the voltage stays within the range of
2.5/8ths and 3.5/8ths. This practice is called "Mid-Tread" operation. This type of ADC
can be modeled mathematically as:
The exception to this convention seems to be the Microchip PIC processor, where all M
steps are equal width. This practice is called "Mid-Rise with Offset" operation.
Linear ADCs
Most ADCs are of a type known as linear[1] The term linear as used here means that
the range of the input values that map to each output value has a linear relationship
with the output value, i.e., that the output value k is used for the range of input values
from
m(k + b)
to
m(k + 1 + b),
where m and b are constants. Here b is typically 0 or −0.5. When b = 0, the ADC is
referred to as mid-rise, and when b = −0.5 it is referred to as mid-tread.
Non-linear ADCs
If the probability density function of a signal being digitized is uniform, then the signal-
to-noise ratio relative to the quantization noise is the best possible. Because this is
often not the case, it is usual to pass the signal through its cumulative distribution
function (CDF) before the quantization. This is good because the regions that are more
important get quantized with a better resolution. In the dequantization process, the
inverse CDF is needed.
This is the same principle behind the companders used in some tape-recorders and
other communication systems, and is related to entropy maximization.
For example, a voice signal has a Laplacian distribution. This means that the region
around the lowest levels, near 0, carries more information than the regions with higher
amplitudes. Because of this, logarithmic ADCs are very common in voice
communication systems to increase the dynamic range of the representable values
while retaining fine-granular fidelity in the low-amplitude region.
An eight-bit A-law or the μ-law logarithmic ADC covers the wide dynamic range and has
a high resolution in the critical low-amplitude region, that would otherwise require a 12-
bit linear ADC.
7.2c Accuracy
An ADC has several sources of errors. Quantization error and (assuming the ADC is
intended to be linear) non-linearity is intrinsic to any analog-to-digital conversion. There
is also a so-called aperture error which is due to a clock jitter and is revealed when
digitizing a time-variant signal (not a constant value).
These errors are measured in a unit called the LSB, which is an abbreviation for least
significant bit. In the above example of an eight-bit ADC, an error of one LSB is 1/256 of
the full signal range, or about 0.4%.
7.2d Quantization error
Quantization error is due to the finite resolution of the ADC, and is an unavoidable
imperfection in all types of ADC. The magnitude of the quantization error at the
sampling instant is between zero and half of one LSB.
In the general case, the original signal is much larger than one LSB. When this happens,
the quantization error is not correlated with the signal, and has a uniform distribution.
Its RMS value is the standard deviation of this distribution, given by
In the eight-bit ADC example, this represents 0.113% of the full signal range.
At lower levels the quantizing error becomes dependent of the input signal, resulting in
distortion. This distortion is created after the anti-aliasing filter, and if these distortions
are above 1/2 the sample rate they will alias back into the audio band. In order to make
the quantizing error independent of the input signal, noise with an amplitude of 1
quantization step is added to the signal. This slightly reduces signal to noise ratio, but
completely eliminates the distortion. It is known as dither.
Non-linearity
All ADCs suffer from non-linearity errors caused by their physical imperfections,
resulting in their output to deviate from a linear function (or some other function, in the
case of a deliberately non-linear ADC) of their input. These errors can sometimes be
mitigated by calibration, or prevented by testing.
Important parameters for linearity are integral non-linearity (INL) and differential non-
linearity (DNL). These non-linearities reduce the dynamic range of the signals that can
be digitized by the ADC, also reducing the effective resolution of the ADC.
Aperture error
Imagine that we are digitizing a sine wavex(t) = Asin(2πf0t). Provided that the
actual sampling time uncertainty due to the clock jitter is Δt, the error caused by this
One can see that the error is relatively small at low frequencies, but can become
significant at high frequencies.This effect can be ignored if it is relatively small as
compared with quantizing error. Jitter requirements can be calculated using the
32 74.1 ps – – – – – –
This table shows, for example, that it is not worth using a precise 24-bit ADC for sound
recording if there is not an ultra low jitter clock. One should consider taking this
phenomenon into account before choosing an ADC.
A continuously varying bandlimited signal can be sampled (that is, the signal values at
intervals of time T, the sampling time, are measured and stored) and then the original
signal can be exactly reproduced from the discrete-time values by an interpolation
formula. The accuracy is limited by quantization error. However, this faithful
reproduction is only possible if the sampling rate is higher than twice the highest
frequency of the signal. This is essentially what is embodied in the Shannon-Nyquist
sampling theorem.
Since a practical ADC cannot make an instantaneous conversion, the input value must
necessarily be held constant during the time that the converter performs a conversion
(called the conversion time). An input circuit called a sample and hold performs this
task—in most cases by using a capacitor to store the analog voltage at the input, and
using an electronic switch or gate to disconnect the capacitor from the input. Many ADC
integrated circuits include the sample and hold subsystem internally.
7.2f Aliasing
All ADCs work by sampling their input at discrete intervals of time. Their output is
therefore an incomplete picture of the behaviour of the input. There is no way of
knowing, by looking at the output, what the input was doing between one sampling
instant and the next. If the input is known to be changing slowly compared to the
sampling rate, then it can be assumed that the value of the signal between two sample
instants was somewhere between the two sampled values. If, however, the input signal
is changing rapidly compared to the sample rate, then this assumption is not valid.
If the digital values produced by the ADC are, at some later stage in the system,
converted back to analog values by a digital to analog converter or DAC, it is desirable
that the output of the DAC be a faithful representation of the original signal. If the input
signal is changing much faster than the sample rate, then this will not be the case, and
spurious signals called aliases will be produced at the output of the DAC. The frequency
of the aliased signal is the difference between the signal frequency and the sampling
rate. For example, a 2 kHz sine wave being sampled at 1.5 kHz would be reconstructed
as a 500 Hz sine wave. This problem is called aliasing.
To avoid aliasing, the input to an ADC must be low-pass filtered to remove frequencies
above half the sampling rate. This filter is called an anti-aliasing filter, and is essential
for a practical ADC system that is applied to analog signals with higher frequency
content.
Although aliasing in most systems is unwanted, it should also be noted that it can be
exploited to provide simultaneous down-mixing of a band-limited high frequency signal
(see undersampling and frequency mixer).
7.2g Dither
In A to D converters, performance can usually be improved using dither. This is a very
small amount of random noise (white noise) which is added to the input before
conversion. Its amplitude is set to be about half of the least significant bit. Its effect is to
cause the state of the LSB to randomly oscillate between 0 and 1 in the presence of
very low levels of input, rather than sticking at a fixed value. Rather than the signal
simply getting cut off altogether at this low level (which is only being quantized to a
resolution of 1 bit), it extends the effective range of signals that the A to D converter
can convert, at the expense of a slight increase in noise - effectively the quantization
error is diffused across a series of noise values which is far less objectionable than a
hard cutoff. The result is an accurate representation of the signal over time. A suitable
filter at the output of the system can thus recover this small signal variation.
An audio signal of very low level (with respect to the bit depth of the ADC) sampled
without dither sounds extremely distorted and unpleasant. Without dither the low level
always yields a '1' from the A to D. With dithering, the true level of the audio is still
recorded as a series of values over time, rather than a series of separate bits at one
instant in time.
A virtually identical process, also called dither or dithering, is often used when
quantizing photographic images to a fewer number of bits per pixel—the image
becomes noisier but to the eye looks far more realistic than the quantized image, which
otherwise becomes banded. This analogous process may help to visualize the effect of
dither on an analogue audio signal that is converted to digital.
Dithering is also used in integrating systems such as electricity meters. Since the values
are added together, the dithering produces results that are more exact than the LSB of
the analog-to-digital converter.
Note that dither can only increase the resolution of a sampler, it cannot improve the
linearity, and thus accuracy does not necessarily improve.
7.2h Oversampling
Usually, signals are sampled at the minimum rate required, for economy, with the result
that the quantization noise introduced is white noise spread over the whole pass band
of the converter. If a signal is sampled at a rate much higher than the Nyquist
frequency and then digitally filtered to limit it to the signal bandwidth then there are 3
main advantages:
• digital filters can have better properties (sharper rolloff, phase) than analogue
filters, so a sharper anti-aliasing filter can be realised and then the signal can be
downsampled giving a better result
• a 20 bit ADC can be made to act as a 24 bit ADC with 256× oversampling
• the signal-to-noise ratio due to quantization noise will be higher than if the
whole available band had been used. With this technique, it is possible to obtain
an effective resolution larger than that provided by the converter alone
There is, as expected, somewhat of a trade off between speed and precision. Flash
ADCs have drifts and uncertainties associated with the comparator levels, which lead to
poor uniformity in channel width. Flash ADCs have a resulting poor linearity. For
successive approximation ADCs, poor linearity is also apparent, but less so than for
flash ADCs. Here, non-linearity arises from accumulating errors from the subtraction
processes. Wilkinson ADCs are the best of the three. These have the best differential
non-linearity. The other types require channel smoothing in order to achieve the level of
the Wilkinson.
• A direct conversion ADC or flash ADC has a bank of comparators sampling the
input signal in parallel, each firing for their decoded voltage range. The
comparator bank feeds a logic circuit that generates a code for each voltage
range. Direct conversion is very fast, capable of gigahertz sampling rates, but
usually has only 8 bits of resolution or fewer, since the number of comparators
needed, 2N - 1, doubles with each additional bit, requiring a large expensive
circuit. ADCs of this type have a large die size, a high input capacitance, high
power dissipation, and are prone to produce glitches on the output (by
outputting an out-of-sequence code). Scaling to newer submicrometre
technologies does not help as the device mismatch is the dominant design
limitation. They are often used for video, wideband communications or other fast
signals in optical storage.
• A successive-approximation ADC uses a comparator to reject ranges of voltages,
eventually settling on a final voltage range. Successive approximation works by
constantly comparing the input voltage to the output of an internal digital to
analog converter (DAC, fed by the current value of the approximation) until the
best approximation is achieved. At each step in this process, a binary value of
the approximation is stored in a successive approximation register (SAR). The
SAR uses a reference voltage (which is the largest signal the ADC is to convert)
for comparisons. For example if the input voltage is 60 V and the reference
voltage is 100 V, in the 1st clock cycle, 60 V is compared to 50 V (the reference,
divided by two. This is the voltage at the output of the internal DAC when the
input is a '1' followed by zeros), and the voltage from the comparator is positive
(or '1') (because 60 V is greater than 50 V). At this point the first binary digit
(MSB) is set to a '1'. In the 2nd clock cycle the input voltage is compared to 75 V
(being halfway between 100 and 50 V: This is the output of the internal DAC
when its input is '11' followed by zeros) because 60 V is less than 75 V, the
comparator output is now negative (or '0'). The second binary digit is therefore
set to a '0'. In the 3rd clock cycle, the input voltage is compared with 62.5 V
(halfway between 50 V and 75 V: This is the output of the internal DAC when its
input is '101' followed by zeros). The output of the comparator is negative or '0'
(because 60 V is less than 62.5 V) so the third binary digit is set to a 0. The
fourth clock cycle similarly results in the fourth digit being a '1' (60 V is greater
than 56.25 V, the DAC output for '1001' followed by zeros). The result of this
would be in the binary form 1001. This is also called bit-weighting conversion,
and is similar to a binary search. The analogue value is rounded to the nearest
binary value below, meaning this converter type is mid-rise (see above).
Because the approximations are successive (not simultaneous), the conversion
takes one clock-cycle for each bit of resolution desired. The clock frequency
must be equal to the sampling frequency multiplied by the number of bits of
resolution desired. For example, to sample audio at 44.1 kHz with 32 bit
resolution, a clock frequency of over 1.4 MHz would be required. ADCs of this
type have good resolutions and quite wide ranges. They are more complex than
some other designs.
• A ramp-compare ADC produces a saw-tooth signal that ramps up, then quickly
falls to zero. When the ramp starts, a timer starts counting. When the ramp
voltage matches the input, a comparator fires, and the timer's value is recorded.
Timed ramp converters require the least number of transistors. The ramp time is
sensitive to temperature because the circuit generating the ramp is often just
some simple oscillator. There are two solutions: use a clocked counter driving a
DAC and then use the comparator to preserve the counter's value, or calibrate
the timed ramp. A special advantage of the ramp-compare system is that
comparing a second signal just requires another comparator, and another
register to store the voltage value. A very simple (non-linear) ramp-converter
can be implemented with a microcontroller and one resistor and capacitor [2].
Vice versa a filled capacitor can be taken from an integrator, time-to-amplitude
converter, phase detector, sample and hold circuit, or peak and hold circuit and
discharged. This has the advantage that a slow comparator cannot be disturbed
by fast input changes.
• The Wilkinson ADC was designed by D. H. Wilkinson in 1950. The Wilkinson ADC
is based on the comparison of an input voltage with that produced by a charging
capacitor. The capacitor is allowed to charge until its voltage is equal to the
amplitude of the input pulse. (A comparator determines when this condition has
been reached.) Then, the capacitor is allowed to discharge linearly, which
produces a ramp voltage. At the point when the capacitor begins to discharge, a
gate pulse is initiated. The gate pulse remains on until the capacitor is
completely discharged. Thus the duration of the gate pulse is directly
proportional to the amplitude of the input pulse. This gate pulse operates a
linear gate which receives pulses from a high-frequency oscillator clock. While
the gate is open, a discrete number of clock pulses pass through the linear gate
and are counted by the address register. The time the linear gate is open is
proportional to the amplitude of the input pulse, thus the number of clock pulses
recorded in the address register is proportional also. Alternatively, the charging
of the capacitor could be monitored, rather than the discharge. [3][4]
• An integrating ADC (also dual-slope or multi-slope ADC) applies the unknown
input voltage to the input of an integrator and allows the voltage to ramp for a
fixed time period (the run-up period). Then a known reference voltage of
opposite polarity is applied to the integrator and is allowed to ramp until the
integrator output returns to zero (the run-down period). The input voltage is
computed as a function of the reference voltage, the constant run-up time
period, and the measured run-down time period. The run-down time
measurement is usually made in units of the converter's clock, so longer
integration times allow for higher resolutions. Likewise, the speed of the
converter can be improved by sacrificing resolution. Converters of this type (or
variations on the concept) are used in most digital voltmeters for their linearity
and flexibility.
• A delta-encoded ADC or Counter-ramp has an up-down counter that feeds a
digital to analog converter (DAC). The input signal and the DAC both go to a
comparator. The comparator controls the counter. The circuit uses negative
feedback from the comparator to adjust the counter until the DAC's output is
close enough to the input signal. The number is read from the counter. Delta
converters have very wide ranges, and high resolution, but the conversion time
is dependent on the input signal level, though it will always have a guaranteed
worst-case. Delta converters are often very good choices to read real-world
signals. Most signals from physical systems do not change abruptly. Some
converters combine the delta and successive approximation approaches; this
works especially well when high frequencies are known to be small in
magnitude.
• A pipeline ADC (also called subranging quantizer) uses two or more steps of
subranging. First, a coarse conversion is done. In a second step, the difference
to the input signal is determined with a digital to analog converter (DAC). This
difference is then converted finer, and the results are combined in a last step.
This can be considered a refinement of the successive approximation ADC
wherein the feedback reference signal consists of the interim conversion of a
whole range of bits (for example, four bits) rather than just the next-most-
significant bit. By combining the merits of the successive approximation and
flash ADCs this type is fast, has a high resolution, and only requires a small die
size.
• A Sigma-Delta ADC (also known as a Delta-Sigma ADC) oversamples the desired
signal by a large factor and filters the desired signal band. Generally a smaller
number of bits than required are converted using a Flash ADC after the Filter.
The resulting signal, along with the error generated by the discrete levels of the
Flash, is fed back and subtracted from the input to the filter. This negative
feedback has the effect of noise shaping the error due to the Flash so that it
does not appear in the desired signal frequencies. A digital filter (decimation
filter) follows the ADC which reduces the sampling rate, filters off unwanted
noise signal and increases the resolution of the output. (sigma-delta modulation,
also called delta-sigma modulation)
• A Time Interleaved ADC uses M parallel ADCs where each ADC sample data
every M:th cycle of the effective sample clock. This result in that the sample rate
is increased M times compared to what each individual ADC can manage. In
practice the individual differences between the M ADCs degrade the overall
performance reducing the SFDR. However, technologies exist to correct for
these time-interleaving mismatch errors.
• There can be other ADCs that use a combination of electronics and other
technologies:
• A Time-stretch analog-to-digital converter (TS-ADC) digitizes a very wide
bandwidth analog signal, that cannot be digitized by a conventional electronic
ADC, by time-stretching the signal prior to digitization. It commonly uses a
photonic preprocessor frontend to time-stretch the signal, which effectively
slows the signal down in time and compresses its bandwidth. As a result, an
electronic backend ADC, that would have been too slow to capture the original
signal, can now capture this slowed down signal. For continuous capture of the
signal, the frontend also divides the signal into multiple segments in addition to
time-stretching. Each segment is individually digitized by a separate electronic
ADC. Finally, a digital signal processor rearranges the samples and removes any
distortions added by the frontend to yield the binary data that is the digital
representation of the original analog signal.
7.2k Commercial analog-to-digital converters
These are usually integrated circuits.
Most converters sample with 6 to 24 bits of resolution, and produce fewer than 1
megasample per second. Thermal noise generated by passive components such as
resistors masks the measurement when higher resolution is desired. For audio
applications and in room temperatures, such noise is usually a little less than 1 μV
(microvolt) of white noise. If the Most Significant Bit corresponds to a standard 2 volts of
output signal, this translates to a noise-limited performance that is less than 20~21
bits, and obviates the need for any dithering. Mega- and gigasample per second
converters are available, though (Feb 2002). Megasample converters are required in
digital video cameras, video capture cards, and TV tuner cards to convert full-speed
analog video to digital video files. Commercial converters usually have ±0.5 to ±1.5
LSB error in their output.
In many cases the most expensive part of an integrated circuit is the pins, because they
make the package larger, and each pin has to be connected to the integrated circuit's
silicon. To save pins, it's common for slow ADCs to send their data one bit at a time over
a serial interface to the computer, with the next bit coming out when a clock signal
changes state, say from zero to 5V. This saves quite a few pins on the ADC package,
and in many cases, does not make the overall design any more complex. (Even
microprocessors which use memory-mapped IO only need a few bits of a port to
implement a serial bus to an ADC.)
Commercial ADCs often have several inputs that feed the same converter, usually
through an analog multiplexer. Different models of ADC may include sample and hold
circuits, instrumentation amplifiers or differential inputs, where the quantity measured
is the difference between two voltages.
Applications
Application to music recording
ADCs are integral to current music reproduction technology. Since much music
production is done on computers, when an analog recording is used, an ADC is needed
to create the PCM data stream that goes onto a compact disc or digital music file.
The current crop of AD converters utilized in music can sample at rates up to 192
kilohertz. Many people[citation needed] in the business consider this an overkill and
pure marketing hype, due to the Nyquist-Shannon sampling theorem. Simply put, they
say[citation needed] the analog waveform does not have enough information in it to
necessitate such high sampling rates, and typical recording techniques for high-fidelity
audio are usually sampled at either 44.1 kHz (the standard for CD) or 48 kHz
(commonly used for radio/TV broadcast applications). However, this kind of bandwidth
headroom allows the use of cheaper or faster anti-aliasing filters of less severe filtering
slopes. The proponents of oversampling assert that such shallower anti-aliasing filters
produce less deleterious effects on sound quality, exactly because of their gentler
slopes. Others prefer entirely filterless AD conversion, arguing that aliasing is less
detrimental to sound perception than pre-conversion brickwall filtering. Considerable
literature exists on these matters, but commercial considerations often play a
significant role. Most[citation needed] high-profile recording studios record in 24-
bit/192-176.4 kHz PCM or in DSD formats, and then downsample or decimate the signal
for Red-Book CD production.
Other applications
AD converters are used virtually everywhere where an analog signal has to be
processed, stored, or transported in digital form. Fast video ADCs are used, for example,
in TV tuner cards. Slow on-chip 8, 10, 12, or 16 bit ADCs are common in
microcontrollers. Very fast ADCs are needed in digital oscilloscopes, and are crucial for
new applications like software defined radio.
Electrical Symbol
8-channel digital-to-analog converter Cirrus Logic CS4382 placed on Sound Blaster X-Fi
Fatal1ty
7.3c1 Audio
7.3c2 Video
Video signals from a digital source, such as a computer, must be converted to analog
form if they are to be displayed on an analog monitor. As of 2007, analog inputs are
more commonly used than digital, but this may change as flat panel displays with DVI
and/or HDMI connections become more widespread. A video DAC is, however,
incorporated in any Digital Video Player with analog outputs. The DAC is usually
integrated with some memory (RAM), which contains conversion tables for gamma
correction, contrast and brightness, to make a device called a RAMDAC.
A device that is distantly related to the DAC is the digitally controlled potentiometer,
used to control an analog signal digitally.
• Static performance:
o DNL (Differential Non-Linearity) shows how much two adjacent code
analog values deviate from the ideal 1LSB step [1]
o INL (Integral Non-Linearity) shows how much the DAC transfer
characteristic deviates from an ideal one. That is, the ideal characteristic
is usually a straight line; INL shows how much the actual voltage at a
given code value differs from that line, in LSBs (1LSB steps).
o Gain
o Offset
o Noise is ultimately limited by the thermal noise generated by passive
components such as resistors. For audio applications and in room
temperatures, such noise is usually a little less than 1 μV (microvolt) of
white noise. This limits performance to less than 20~21 bits even in 24-
bit DACs, and cannot be corrected unless one resorts to extremely low
temperatures to create superconductivity: clearly an impractical
proposition.
• Frequency domain performance
o SFDR (Spurious Free Dynamic Range) indicates in dB the ratio between
the powers of the converted main signal and the greatest undesired spur
o SNDR (Signal to Noise and Distortion Ratio) indicates in dB the ratio
between the powers of the converted main signal and the sum of the
noise and the generated harmonic spurs
o HDi (i-th Harmonic Distortion) indicates the power of the i-th harmonic of
the converted main signal
o THD (Total harmonic distortion) is the sum of the powers of all HDi
o if the maximum DNL error is lessthan 1 LSB,then D/A converter is
guaranteed to be monotonic.
However many monotonic converters may have a maximum DNL greater than 1 LSB.
Two digital voltmeters. Note the 40 microvolt difference between the two
measurements, an offset of 34 parts per million.
The first digital voltmeter was invented and produced by Andrew Kay of Non-Linear
Systems (and later founder of Kaypro) in 1954.
Digital voltmeters necessarily have input amplifiers, and, like vacuum tube voltmeters,
generally have a constant input resistance of 10 megohms regardless of set
measurement range.
Digital Voltmeters (DVMs) are a special case of A/Ds. DVMs are voltmeters - i.e. they
measure voltage - and are general purpose instruments commonly used to measure
voltages in labs and in the field. DVMs display the measured voltage using LCDs or
LEDs to display the result in a floating point format. They are an instrument of choice
for voltage measurements in all kinds of situations.
Obviously, if voltage measurements are taken and the results are displayed
digitally with LED or LCD displays, the instrument has to contain an A/D converter.
Digital voltmeters have some characteristics that you might need to understand.
• Digital voltmeters usually have scales that are 0-0.3v, 0-3v, 0-30v, 0-300v, etc.
It is not clear why those ranges were chosen but they are commonplace. Now, consider
some of the implications of these facts.
Example
E1 Consider a voltmeter built around a 10 bit A/D converter. We will assume the
following.
• The range of the voltmeter is from 0-3v, and it does DC voltage measurements.
It does not measure negative voltages.
If you wanted to measure voltages on a 0-30v scale, you would probably use a voltage
divider or some other way to reduce the voltage by a factor of (exactly) 10 (i.e., multiply
it by exactly 0.1) and then use the same converter as on the 0-3v scale.
If there are 4096 intervals over a range of 3v, each interval will be 3/4096 = .000732v.
That would make the range 0-3.072v - just as it was in the case of the 10 bit converter,
That produces the same advantages as you had with the 10 bit converter.
If you wanted to measure negative voltages and have the range be from -3v to +3v,
you would have intervals of .0015v, and the meter would measure from -3.072v to
+3.072v.
In the example you saw a few typical voltmeter possibilities. For some reason
voltmeters have had scales like 0-3v, 0-30v, etc. for a long time. You might have
expected 0-1v and 0-10v, etc. to be more common. However, that's not the way it is,
and it probably won't change any time soon. That situation has led to some interesting
ways to specify voltmeters.
If you had a voltmeter that had a 0-1v range, and it had ten bits, it would probably
be designed to have a range from 0-1.024v, and it would measure voltages in steps of .
001v. Then, the measurement results would be things like 0.314v or 0.582v, things like
that. Displayed values would all have exactly three decimal places, and the instrument
would be referred to as a 3 digit meter. If you use the same converter on a 0-10v scale
(and put the voltage through a 0.1x voltage divider!), then the results would be things
like 3.14v or 5.82v. You would get exactly the same number of significant figures, and
you would still refer to the meter as a 3 digit meter.
If you have a voltmeter with a 0-1v scale that can read increments of .001v the meter is
a 3 digit meter.
If you have a voltmeter with a 0-1v scale that can read increments of .0001v the meter
is a 4 digit meter.
If you have a voltmeter with a 0-10v scale that can read increments of .001v the meter
is a 4 digit meter.
If you have a voltmeter with a 0-100v scale that can read increments of .001v the meter
is a 5 digit meter.
Now, what if you have a meter that has a 0-3v scale that can read increments of .001v?
How many digits is that meter?
You need to be able to answer the question in the last section. When you buy a
meter it may tell you the number of digits and you need to know what that means,
especially when the scales are 0-3v, etc. Here is the story.
A meter that reads in increments of .001v and has a 0-1v range is a 3 digit meter.
A meter that reads in increments of .001v and has a 0-10v range is a 4 digit meter.
A meter that reads in increments of .001v and has a 0-100v range is a 5 digit meter.
Digits
Range (v)
(for .001v)
0-1 3
0-10 4
0-100 5
If the high limit of the scale is 3, that's almost halfway between 1 and 10 on a
logarithmic scale. (The mid point is really at the square root of ten.) A meter that has a
range of 0-3v is said to be a 3 1/2 digit meter when it has intervals of .001v. That's
halfway between 3 and 4 digits.
There is another way to look at the question of digits. If you have a meter that has
a 0-10v scale that reads in increments of .01v that's a 3 bit meter. That meter has
1000 steps, and 1000=103. Let's repeat the table from above, but include the log10 of
the number of steps.
Digits
Range #Steps log10(#Steps)
(for .001v)
0-1v 3 1000 3
0-10v 4 10,000 4
0-30v 4.5? 30,000 4.47
0-100v 5 100,000 5
We included an extra row for a 0-30v meter. We also included the number of
steps and a suggestion for the number of digits we can claim for the meter. It looks
reasonable to call a 0-30v meter with 30,000 steps a 4.5 digit meter, and that's the way
they are sold.
That's it for digits in a voltmeter. That's the way that they are specified, and that's
what you pay for when you buy a DVM. The number of digits is determined by the
number of bits in the A/D, and we need to look at that idea just a little bit more.
Stand-alone units are self-contained devices that include everything from the user
interface to define the patterns that should be generated to the electronic that actually
generates the output signal.
Some test equipment manufacturers propose pattern generators as add-on modules for
logic analyzers (see for example the PG3A module for Tektronix' TLA7000 series of logic
analyzers). In this case, the pattern generator is the 'generation counterpart' to the
analysis functionality offered by logic analyzers.
7.5b Features
Digital pattern generators are primarily characterized by a number of digital channels, a
maximum rate and the supported voltage standards.
• The number of digital channels defines the maximum width of any pattern
generated - typically, 8-bits, 16-bits, 32 bits pattern generator. A 16-bits pattern
generator is able to generate arbitrary digital samples on from 1 to 16 bits.
• The maximum rate defines the minimum time interval between 2 successive
patterns. For instance, a 50 MHz (50 MSample/s) digital pattern generator is able
to output a new pattern every 20 nanoseconds.
• The supported voltage standards ultimately define the set of electronic devices
a digital pattern generator can be used with. Concretely, the voltages and the
transition characteristics of the signal at the output of the digital pattern
generator will be compliant to these voltage standards. Examples of supported
voltage standards: TTL, LVTTL, LVCMOS, LVDS.
Most digital pattern generator add features such as the ability to generate a repetitive
sequence or a digital clock signal at a specified frequency, the ability to use an external
clock input and triggering options, to start pattern generation upon the reception of an
event from an external input.
The B&K Precision model 4078 Dual Channel Arbitrary Waveform Generator uses Direct
Digital Synthesis to generate waveforms up to 400,000 points
Unlike function generators, AWGs can generate any arbitrarily defined waveshape as
their output. The waveform is usually defined as a series of "waypoints" (specific
voltage targets occurring at specific times along the waveform) and the AWG can either
jump to those levels or use any of several methods to interpolate between those levels.
For example, a 50% duty cycle square wave is easily obtained by defining just two
points: At t0, set the output voltage to 100% and at t50%, set the output voltage back
to 0. Set the AWG to jump (not interpolate) between these values and the result is the
desired square wave. By comparison, a triangle wave could be produced from the same
data simply by setting the AWG to linearly interpolate between these two points.
Because AWGs synthesize the waveforms using digital signal processing techniques,
their maximum frequency is usually limited to no more than a few gigahertz[1]. The
output connector from the device is usually a BNC connector and requires a 50 or 75
ohm termination.
AWGs, like most signal generators, may also contain an attenuator, various means of
modulating the output waveform, and often contain the ability to automatically and
repetitively "sweep" the frequency of the output waveform (by means of a voltage-
controlled oscillator) between two operator-determined limits. This capability makes it
very easy to evaluate the frequency response of a given electronic circuit.
Some AWGs also operate as conventional function generators. These would include
standard waveforms such as sine, square, ramp, triangle, noise and pulse. Some units
include additional built-in waveforms such as exponential rise and fall times, sinx/x,
cardiac. Some AWG's allow users to retrieve waveforms from a number of digital and
mixed-signal oscilloscopes. Some AWG's may display a graph of the waveform on their
screen - a graph mode. Some AWG's have the ability to generate a pattern of words
from multiple bit output connector to simulate data transmission, combining the
properties of both AWG's and Digital Pattern Generator's.
AWGs may also be contained within musical synthesizers.
Simple pulse generators usually allow control of the pulse repetition rate (frequency),
pulse width, delay with respect to an internal or external trigger and the high- and low-
voltage levels of the pulses. More-sophisticated pulse generators may allow control over
the rise time and fall time of the pulses. Pulse generators may use digital techniques,
analog techniques, or a combination of both techniques to form the output pulses. For
example, the pulse repetition rate and duration may be digitally controlled but the pulse
amplitude and rise and fall times may be determined by analog circuitry in the output
stage of the pulse generator. With correct adjustment, pulse generators can also
produce a 50% duty cycle square wave. Pulse generators are generally single-channel
providing one frequency, delay, width and output. To produce multiple pulses, these
simple pulse generators would have to be ganged in series or in parallel.
A new class of pulse generator offers both multiple input trigger connections and
multiple output connections. Multiple input triggers allows experimenters to synchronize
both trigger events and data acquisition events using the same timing controller.
Pulse generators are available for generating output pulses having widths (durations)
ranging from minutes down to under 1 picosecond. In general, generators for pulses
with widths over a few microseconds employ digital counters for timing these pulses,
while widths between approximately 1 nanosecond and several microseconds are
typically generated by analog techniques such as RC (resistor-capacitor) networks or
switched delay lines. Pulse generators capable of generating pulses with widths under
approximately 100 picoseconds are often termed "microwave pulsers", and typically
generate these ultra-short pulses using Step recovery diode (SRD) or Nonlinear
Transmission Line (NLTL) methods (see, for example, [1]). Step Recovery Diode pulse
generators are inexpensive but typically require several volts of input drive level and
have a moderately high level of random jitter (usually undesirable variation in the time
at which successive pulses occur). NLTL-based pulse generators generally have lower
jitter, but are more complex to manufacture, and are not suited for integration in low-
cost monolithic ICs. A new class of microwave pulse generation architecture, the RACE
(Rapid Automatic Cascode Exchange) pulse generation circuit [2],[3], is implemented
using low-cost monolithic IC technology and can produce pulses as short as 1
picosecond, and with a repetition rates exceeding 30 billion pulses per second. These
pulsers are typically used in military communications applications, and low-power
microwave transceiver ICs. Such pulsers, if driven by a continuous frequency clock, will
as microwave comb generators, having output freqency components at integer
multiples of the pulse repetition rate, and extending to well over 100 gigahertz (see, for
example,[4]).
Pulse generators are generally voltage sources, with true current pulse generators
being available only from a few suppliers. Light pulse generators are the optical
equivalent to electrical pulse generators with rep rate, delay, width and amplitude
control. The output in this case is light typically from a LED or laser diode.
These pulses can then be injected into a device under test and used as a stimulus or
clock signal or analyzed as they progress through the device, confirming the proper
operation of the device or pinpointing a fault in the device. Pulse generators are also
used to drive devices such as switches, lasers and optical components, modulators,
intensifiers as well as resistive loads.The output of a pulse generator may also be used
as the modulation signal for a signal generator. Non-electronic applications include
those in material science, medical, physices and chemistry.
There are many different types of signal generators, with different purposes and
applications (and at varying levels of expense); in general, no device is suitable for all
possible applications.
Traditionally, signal generators have been embedded hardware units, but since the age
of multimedia-PCs, flexible, programmable software tone generators have also been
available.
7.5.3a General purpose signal generators
Function generators
Function generators are typically used in simple electronics repair and design; where
they are used to stimulate a circuit under test. A device such as an oscilloscope is then
used to measure the circuit's output. Function generators vary in the number of outputs
they feature, frequency range, frequency accuracy and stability, and several other
parameters.
In addition to the above general-purpose devices, there are several classes of signal
generators designed for specific applications.
7.6c History
Although frequency as the inverse of a wave period is a relatively recent idea[4], the
origins of frequency synthesis can be found in the much older concept of angular
velocity.[4] The wheel trains of timekeeping devices have gear ratio relationships that
were well-studied at least as far back as the time of Christian Huygens, who died in
1695.[4]
Prior to widespread use of synthesizers, radio and television receivers relied on manual
tuning of a local oscillator. Some might remember the classic turret tuner commonly
used in television receivers prior to the 1980s. Variations in temperature and aging of
components caused frequency drift. Automatic frequency control (AFC) solves some of
the drift problem, but manual retuning was often necessary. Since transmitter
frequencies are well known and very stable, an accurate means of generating fixed,
stable frequencies would solve the problem.
A simple and effective solution employs the use of many stable resonators or
oscillators, one for each tuning frequency. Quartz crystals offer good stability and are
often used for this purpose. This "brute force" technique is practical when only a
handful of frequencies are required, but quickly becomes costly and impractical in many
applications. For example, the FM radio band in many countries supports 100 individual
frequencies from about 88 MHz to 108 MHz. Cable television can support even more
frequencies or channels over a much wider band. A large number of crystals increases
cost and requires greater space.
Many coherent and incoherent techniques have been devised over the years. Some
approaches include phase locked loops, double mix, triple mix, harmonic, double mix
divide, and direct digital synthesis (DDS). The choice of approach depends on several
factors, such as cost, complexity, frequency step size, switching rate, phase noise, and
spurious output.
This began to change with the works of Floyd M. Gardner (his 1966 Phaselock
techniques) and Venceslav F. Kroupa (his 1973 Frequency Synthesis)[4].
Mannassewitsch calls this the Brute-force approach.[10] Techniques and formulae have
been provided by Dean Banerjee [11].
Gearbox approach
Surprisingly sophisticated mathematical techniques analogous to mechanical gear ratio
relationships can be employed in frequency synthesis when the frequency synthesis
factor is composed of multiplicative integers in the numerator and denominator. [4] This
method allows for effective planning of distribution and suppression of spectral spurs.
Modulo-N approach
Variable frequency synthesizers including DDS are routinely designed using this
method.
The key to the ability of a frequency synthesizer to generate multiple frequencies is the
divider placed between the output and the feedback input. This is usually in the form of
a digital counter, with the output signal acting as a clock signal. The counter is preset to
some initial count value, and counts down at each cycle of the clock signal. When it
reaches zero, the counter output changes state and the count value is reloaded. This
circuit is straightforward to implement using flip-flops, and because it is digital in
nature, is very easy to interface to other digital components or a microprocessor. This
allows the frequency output by the synthesizer to be easily controlled by a digital
system.
Example
Suppose the reference signal is 100 kHz, and the divider can be preset to any value
between 1 and 100. The error signal produced by the comparator will only be zero when
the output of the divider is also 100 kHz. For this to be the case, the VCO must run at a
frequency which is 100 kHz x the divider count value. Thus it will produce an output of
100 kHz for a count of 1, 200 kHz for a count of 2, 1 MHz for a count of 10 and so on.
Note that only whole multiples of the reference frequency can be obtained with the
simplest integer N dividers. Fractional N dividers are readily available [11].
Many radio applications require frequencies that are higher than can be directly input to
the digital counter. To overcome this, the entire counter could be constructed using
high-speed logic such as ECL, or more commonly, using a fast initial division stage
called a prescaler which reduces the frequency to a manageable level. Since the
prescaler is part of the overall division ratio, a fixed prescaler can cause problems
designing a system with narrow channel spacings - typically encountered in radio
applications. This can be overcome using a dual-modulus prescaler.[11]
Further practical aspects concern the amount of time the system can switch from
channel to channel, time to lock when first switched on, and how much noise there is in
the output. All of these are a function of the loop filter of the system, which is a low-pass
filter placed between the output of the frequency comparator and the input of the VCO.
Usually the output of a frequency comparator is in the form of short error pulses, but
the input of the VCO must be a smooth noise-free DC voltage. (Any noise on this signal
naturally causes frequency modulation of the VCO.). Heavy filtering will make the VCO
slow to respond to changes, causing drift and slow response time, but light filtering will
produce noise and other problems with harmonics. Thus the design of the filter is
critical to the performance of the system and in fact the main area that a designer will
concentrate on when building a synthesiser system
An Arithmetic and Logic Unit (ALU) is a combinational circuit that performs logic and
arithmetic micro-operations on a pair of n-bit operands (ex. A[3:0] and B[3:0]). The
operations performed by an ALU are controlled by a set of function-select inputs. In this
lab you will design a 4-bit ALU with 3 function-select inputs: Mode M, Select S1 and S0
inputs. The mode input M selects between a Logic (M=0) and Arithmetic (M=1)
operation. The functions performed by the ALU are specified in Table I.
When doing arithmetic, you need to decide how to represent negative numbers. As is
commonly done in digital systems, negative numbers are represented in two’s
complement. This has a number of advantages over the sign and magnitude
representation such as easy addition or subtraction of mixed positive and negative
numbers. Also, the number zero has a unique representation in two’s complement. The
two’s complement of a n-bit number N is defined as,
2n - N = (2n - 1 - N) + 1
The last representation gives us an easy way to find two’s complement: take the bit wise
complement of the number and add 1 to it. As an example, to represent the number -5,
we take two’s complement of 5 (=0101) as follows,
5 0 1 0 1 --> 1 0 1 0 (bit wise complement)
+ 1
1 0 1 1 (two’s complement)
Numbers represented in two’s complement lie within the range -(2n-1) to +(2n-1 - 1). For a
4-bit number this means that the number is in the range -8 to +7. There is a potential
problem we still need to be aware of when working with two's complement, i.e. over- and
underflow as is illustrated in the example below,
0 1 0 0 (=carry Ci)
+5 0 1 0 1
+4 + 0 1 0 0
+9 0 1 0 0 1 = -7!
also,
1 0 0 0 (=carry Ci)
-7 1 0 0 1
-2 + 1 1 1 0
-9 1 0 1 1 1 = +7!
Both calculations give the wrong results (-7 instead of +9 or +7 instead of -9) which is
caused by the fact that the result +9 or -9 is out of the allowable range for a 4-bit two’s
complement number. Whenever the result is larger than +7 or smaller than -8 there is an
overflow or underflow and the result of the addition or subtraction is wrong. Overflow
and underflow can be easily detected when the carry out of the most significant stage (i.e.
C4 ) is different from the carry out of the previous stage (i.e. C3).
You can assume that the inputs A and B are in two’s complement when they are
presented to the input of the ALU.
b. Design strategies
When designing the ALU we will follow the principle "Divide and Conquer" in order to
use a modular design that consists of smaller, more manageable blocks, some of which
can be re-used. Instead of designing the 4-bit ALU as one circuit we will first design a
one-bit ALU, also called a bit-slice. These bit-slices can then be put together to make a 4-
bit ALU.
There are different ways to design a bit-slice of the ALU. One method consists of writing
the truth table for the one-bit ALU. This table has 6 inputs (M, S1, S0, C0, Ai and Bi) and
two outputs Fi and Ci+1. This can be done but may be tedious when it has to be done by
hand.
An alternative way is to split the ALU into two modules, one Logic and one Arithmetic
module. Designing each module separately will be easier than designing a bit-slice as one
unit. A possible block diagram of the ALU is shown in Figure 7.8. It consists of three
modules: 2:1 MUX, a Logic unit and an Arithmetic unit.
In order the easily see the output of the ALU you will display the results on the seven-
segment displays and the LEDs (LD).
1. 1.The result of the logic operation can be displayed on the LEDs (LD). Use also
one of these LEDs to display the overflow flag V.
2. 2.Since you are working with a 4-bit representation for 2's complement numbers,
the maximum positive number is +7 and the most negative number is –8. Thus a
single seven-segment display can be used to show the magnitude of the number.
Use another seven-segment display for the “-“ sign (e.g. use segment “g”).
3. 3.There is one complication when using more than one of the seven-segment
displays on the Digilab board, as can be seens from the connections of the LED
segments of the displays. You will notice that the four seven-segment displays
share the same cathodes A, B, ..., G). This implies that one cannot directly
connect the signals for the segments of the magnitude and sign to these terminals,
since that would short the outputs of the gates which would damage the FPGA!.
How could you solve this problem? Sketch a possible solution in your lab
notebook. (Hint: You can alternate the signals applied to the cathodes between
those of the Magnitude and Sign displays. If you do this faster than 30 times per
second the eye will not notice the flickering. You will also need to alternate the
anode signals). What type of circuit will be needed to accomplish this? You can
make use of an on-chip clock, called OSC4 that provides clock signals of 8MHz,
500KHz, 590Hz and 15Hz.
4. 4.Figure 3 shows a schematic of the overall system, consisting of the ALU,
Decoder and Switching circuit, and Displays on the Digilab board.
Figure 7.9: Overall system, including the 4-bit ALU and display units.
d. Tasks:
Do the following tasks prior to coming to the lab. Write the answers to all questions in
your lab notebook prior to coming to the lab. There is no on-line submission for the pre-
lab. Ask the TA to sign pre-lab section in your lab notebook at the start of the lab
session. You will also need to include answer to the pre-lab questions in your lab report.
1. Design the MUX. You can choose to design the MUX with gates or by writing
HDL (VHDL) code. Choose one of the two methods and write the design down in
your lab notebook.
2. Design of the Logic unit. Here you also have several choices to design this unit:
a. Write truth table, derive the K-map and give the minimum gate implementation
b. Use a 4:1 MUX and gates
As part of the pre-lab, you can choose any of the three methods. Briefly justify why you
chose a particular design method. Explain the design procedure and give the logic
diagram or the HDL file. In case you use a MUX, you need also to give the schematic or
the HDL file for the MUX.
3. Design the arithmetic unit. Again, here you have different choices to design and
implement the arithmetic unit. A particularly attractive method is one that makes
use of previously designed modules, such as your Full Adder. The arithmetic unit
performs basically additions on a set of inputs. By choosing the proper inputs, one
can perform a range of operations. This approach is shown in Figure 7.10 The
only blocks that need to be designed are the A Logic and B Logic circuits. You
can make use of your previously designed full adder (MYFA).
Xi Yi
S1 S0 Ai (A S1 S0 Bi (B
Logic) Logic)
0 0 0 . 0 0 0 .
0 0 1 . 0 0 1 .
0 1 0 . 0 1 0 .
0 1 1 . 0 1 1 .
1 0 0 . 1 0 0 .
1 0 1 . 1 0 1 .
1 1 0 . 1 1 0 .
1 1 1 . 1 1 1 .
Table II: Truth tables for the A and B logic circuits.
b. Give the K-map for Xi and Yi functions. Find the minimum realization for
Xi and Yi.
c. Draw the logic diagram for Xi and Yi.
d. Design the circuit that detects over- or underflow.
3. 4.Design the decoder for the seven-segment displays. Remember that the
segments of the display are active-low. The decoders should be designed in such a
way that when the Logic Mode (M=0) is selected, only the LEDs are active and
when the Arithmetic Mode (M=1) is selected only the seven-segment displays are
active.
4. 5.Design the switching circuit that is needed to use the two seven-segment
displays (see section c3 above).