Professional Documents
Culture Documents
INTRODUCTION
1.1 OVERVIEW
Degradation Restoration
F(x,y ) + F′(x ,y)
Function, H Filters
3
themselves. For example sensor temperature, light levels are major factors affect
the amount of noise in the resulting image. Images are corrupted during
transmission principally due to interference in the channel used for transmission.
For example; due to lightning effect or other atmospheric disturbance image
transmitted by wireless network is corrupted. Images acquired by optical, electro-
optical or electronic means are mostly degraded by the sensing environment. The
degradations may be in the form of sensor noise.
1. Impulsive Noise
Impulse noise shown in figure is characterized by a noise spike replacing
the actual pixel value. Impulse noise is further divided into two classes. Random
valued impulse noise (RVIN) and salt and pepper noise (SPN). In RVIN, the
impulse value at a particular pixel may be a random value between particular
intervals. But in SPN the impulses are either the minimum value or the maximum
value allowed in the intensity values. For example 0 and 255 in the case of 8-bit
image.
Pa ………. When..z= a
P(z)= Pb ………..When..z= b
0 ………… otherwise
pb ……………
P (z)
pa ……
a b z
4
2. Uniform Noise
It is another common noise model shown in figure. In this case the noise
can take on values in an interval [a, b] with uniform probability. The PDF of
uniform noise is given by,
1
……when …a ≤ z ≤ b
𝑏−𝑎
P (Z) =
0 ………. otherwise
P(z)
1/(b-a) …………..
a b z
3. Gaussian noise
Due to mathematical tractability in both the spatial and frequency domains
Gaussian noise models are used in frequent in practice. The PDF of Gaussian
random values z is given by,
2 /2𝜎 2
p(z) = 1/√2𝜋𝜎(𝑒 −(𝑧−𝜇) )
5
Figure 1.1.3 PDF of Gaussian noise
6
The different classes of filtering techniques exist in spatial domain filtering.
• Mean Filters
• Order-Statistics Filters
• Adaptive Filters
Sharpening Filters
Mean Filter
Mean filters in this method the middle pixel value of the filter window is
replaced with the arithmetic mean or geometric mean or harmonic or contra-
harmonic mean of all the pixel values within the filter window. A mean filter
simply smoothes local variations in an image. Noise is reduced as a result of this
smoothening, but edges within the image get blurred.
Examples: - Arithmetic Mean Filter, Geometric Mean Filter, Contra
harmonic Mean Filter Order statistics filter Median Filter comes under the class of
order-statistics filters.
Order Statistic Filters
7
Adaptive Filters
What is noise? Noise is any undesirable signal. Noise is everywhere and thus
we have to learn to live with it. Noise gets introduced into the data via any
8
electrical system used for storage, transmission, and/or processing. In addition,
nature will always plays a "noisy" trick or two with the data under observation.
When encountering an image corrupted with noise you will want to improve
its appearance for a specific application. The techniques applied are application-
oriented. Also, the different procedures are related to the types of noise introduced
to the image. Some examples of noise are: Gaussian or White, Rayleigh, Shot or
Impulse, periodic, sinusoidal or coherent, uncorrelated, and granular.
This class of filter belongs to the class of edge preserving smoothing filters
which are non-linear filters. These filters smooth the data while keeping the small
and sharp details.
Shown below are the original image and the same image after it has been
corrupted by shot noise at 10%. This means that 10% of its pixels were replaced by
full white pixels. Also shown are the median filtering results using 3x3 and 5x5
windows; three (3) iterations of 3x3 median filter applied to the noisy image; and
finally for comparison, the result when applying a 5x5 mean filter to the noisy
image
9
1.3 MEDIAN FILTER
Like the mean filter, the median filter considers each pixel in the image in
turn and looks at its nearby neighbours to decide whether or not it is representative
of its surroundings. Instead of simply replacing the pixel value with the mean of
neighbouring pixel values, it replaces it with the median of those values. The
median is calculated by first sorting all the pixel values from the surrounding
neighbourhood into numerical order and then replacing the pixel being considered
with the middle pixel value. (If the neighbourhood under consideration contains an
even number of pixels, the average of the two middle pixel values is used.) Figure
1 illustrates an example calculation.
The idea of mean filtering is simply to replace each pixel value in an image
with the mean (`average') value of its neighbours, including itself. This has the
effect of eliminating pixel values which are unrepresentative of their surroundings.
Mean filtering is usually thought of as a convolution filter. Like other convolutions
it is based around a kernel, which represents the shape and size of the
neighbourhood to be sampled when calculating the mean. Often a 3×3 square
kernel is used, as shown in Figure 1, although larger kernels (e.g. 5×5 squares) can
be used for more severe smoothing. (Note that a small kernel can be applied more
than once in order to produce a similar - but not identical - effect as a single pass
with a large kernel.)
11
Figure 1.4 3×3 averaging kernel often used in mean filtering
12
8 nearest neighbours and, based upon the relative values, increments or decrements
the value of the pixel in question such that it becomes more representative of its
surroundings. The noisy pixel alteration (and detection) procedure used by
Crimmins is more complicated than the ranking procedure used by the non-linear
median filter. It involves a series of pair wise operations in which the value of the
`middle' pixel within each neighbourhood window is compared, in turn, with each
set of neighbours (N-S, E-W, NW-SE, NE-SW) in a search for intensity spikes.
The operation of the algorithm is illustrated in Figure 1 and described in more
detail below.
For each iteration and for each pair of pixel neighbours, the entire image is
sent to a Pepper Filter and Salt Filter as shown above. In the example case, the
Pepper Filter is first called to determine whether the each image pixel is
darker_than - i.e. by more than 2 intensity levels - its northern neighbours.
Comparisons where this condition proves true cause the intensity value of the pixel
under examination to be incremented twice lightened, otherwise no change is
effected. Once these changes have been recorded, the entire image is passed
through the Pepper Filter again and the same series of comparisons are made
between the current pixel and its southern neighbour. This sequence is repeated by
the Salt Filter, where the conditions lighter_than and darken are, again, instantiated
using 2 intensity levels.
Note that, over several iterations, the effects of smoothing in this way
propagate out from the intensity spike to infect neighbouring pixels. In other
words, the algorithm smoothes by reducing the magnitude of a locally inconsistent
pixel, as well as increasing the magnitude of pixels in the neighbourhood
surrounding the spike. It is important to notice that a spike is defined here as a
pixel whose value is more than 2 intensity levels different from its surroundings.
13
CHAPTER 2
LITERATURE REVIEW
2.1 R.-D. Chen, P.-Y. Chen, and C.-H. Yeh, “Design of an area-efficient one
dimensional median filter,” IEEE Trans. Circuits Syst. II, Exp. Briefs, vol.
60, no. 10, pp. 662–666, Oct. 2013.
It consists of N cascaded blocks, one for each window rank. Each cell block
ci is composed of a data register (Ri), an m-bit (m = log2 N) age register (Pi), and a
control unit for data transfer. Register Ri stores the value of the sample in cell ci,
and register Pi keeps the age of this sample, i.e., the number of clock cycles the
sample has experienced in the window. All cells are connected to a global input X,
through which they receive the new input sample. At each machine cycle,
depending on the value of the input sample, the data transfer control unit
determines if each cell will keep its original sample, receive the input sample from
the outside, or receive the sample from its adjoining cell on the left or right. The
14
window samples are stored in descending order from left to right, so that at any
time, the maximum sample is at the leftmost register (R1) and the minimum
sample is at the rightmost register (RN). The median value of the window will be
at the center cell (R(N+1)/2), assuming N is an odd number.
15
2.3 O.T.-C. Chen, S. Wang, and Y.-W. Wu, “Minimization of switching
activities of partial products for designing low-power multipliers,” IEEE
Trans. Very Large Scale Integr. (VLSI) Syst., vol. 11, no. 3, pp. 418–433 Jun.
2003.
16
various media processing to yield low-power consumption at limited hardware cost
or little slowing of speed.
The ever increasing demand for high image quality requires fast and efficient
methods for noise reduction. The best known order-statistics filter is the median
filter. A method is presented to calculate the median on a set of N W-bit integers in
W B time steps. Blocks containing B-bit slices are used to find B-bits of the
median; using a novel quantum-like representation allowing the median to be
computed in an accelerated manner compared to the best known method (W time
steps). The general method allows a variety of designs to be synthesised
systematically. A further novel architecture to calculate the median for a moving
set of N integers is also discussed. This method reduces by B the number of steps
to calculate the median on a set of N items compared to previously known
methods. We found parameters B and N for which circuit implementations also
make the method faster. This is ideal for real-time processing of images. The
method applies to non-negative or signed integers and also easily extends to the
case of rank filtering. Multiple architectures can be derived with different tradeoffs
between area and time in fully pipelined structures.
17
2.5 D. Prokin and M. Prokin, “Low hardware complexity pipelined rank
filter,” IEEE Trans. Circuits Syst. II, Exp. Briefs, vol. 57, no. 6, pp. 446–
450, Jun. 2010.
The major benefit of a disclosed low-hardware-complexity pipelined
rank filter is reduction in hardware complexity and increase in processing
speed, due to identical pipelined stages and the absence of mask bits. Field-
programmable-gate-array realization of this filter significantly reduces the
number of used logic elements and registers, in comparison with the best prior
art methods, and, at the same time, increases the maximum operating frequency.
18
CHAPTER 3
PROJECT DESCRIPTION
3.1 INTRODUCTION
The median filter replaces a sample with the middle-ranked value among all
the samples inside the sample window, centered around the sample in question.
Depending on the number of samples processed at the same cycle, there are two
types of architectures for hardware design, i.e., word-level architecture and bit-
level architecture. In the word-level architecture, the input samples are sequentially
19
processed word by word, and the bits of the sample are processed in parallel. On
the contrary, the bit-level architecture processes the samples in parallel and the bits
of the incoming samples are sequentially processed. In this brief, the word-level
architecture will be adopted in the design of a low-power median filter for practical
use. The median of a set of samples in the word-level sorting network is often
computed by first sorting the input samples and then selecting the middle value.
20
token ring in our architecture. Since the stored samples in the window are
immobile, our architecture is suitable for low-power applications.
21
The architecture is implemented as a two-stage pipeline, where the registers
in all the cells serve as the internal pipeline registers. All the registers in the
architecture are synchronized by the rising edge of a global clock. Each cell block
ci is composed of a rank generation (RankGen) module, a comparator module
“==,” and three registers: an m-bit (m = log2 N) rank register (Pi), a data register
(Ri), and a 1-bit token register (Ti). Register Ri stores the value of the sample in
cell ci, register Pi keeps the rank of this sample, and the enable signal (en) of Ri is
stored in register Ti. All the samples in the window are ranked according to their
values, regardless of their physical locations in the window. In our design, a cell
with a greater sample value will be associated with a greater rank. However, for
two cells ci and cj , whose sample values are equal, ci will be given a greater rank
if Ri is newer than Rj (or Rj is older than Ri); i.e., the sample in cj enters the
window earlier than the sample in ci. The rank is hence unique for each cell. For a
window with size N, the rank starts from 1 for a cell with the least sample value,
and ends with N for a cell with the greatest sample value.
The median of the window can then be obtained from the sample value Ri
of a cell ci whose rank Pi is equal to (N + 1)/2, assuming N is an odd number. In
the architecture, the input sample enters the window in a FIFO manner. After it is
queued, it will not be moved and is simply dequeued in place. A token, which is
represented as logic state 1 in the token register of some cell, is used to control the
dequeuing of old sample and queuing of new input sample at the same time. After
the token is used, it will be passed to the next cell at a new cycle. All the token
registers form a token ring with exactly one token. It serves as a state machine in
the circuit, where the location of the token defines the state of the machine.
Since the data in each register Ri is immobile, our architecture has the
potential for low-power applications. At the initial state of the architecture, to
22
make the first incoming sample be stored in the first cell c1, the token is assumed
to exist in the last cell cN, shown as the shadowed circle at the output of register
TN. Whenever an input sample enters the window at a new cycle, the rank of each
cell has to be updated. It may have to be recalculated, or may be the old rank
decremented by 1, incremented by 1, or kept unchanged.
The new rank of each cell, which is denoted by signal Qi in the cell, is
generated by the RankGen module. Each RankGen module receives signal A from
the RankCal module and signal B from the RankSel module. Signal A is the
recalculated rank of a cell ci that contains the token and signal B is the old rank of
ci. Moreover, signal Yi is the output of a comparator module “==,” which
compares the value of rank Pi with a constant value (N + 1)/2 so that Yi = 1 if Pi is
equal to (N + 1)/2, else Yi = 0. This signal is used to indicate if the corresponding
cell ci contains the median in Ri. Similar to the RankSel module, the MedianSel
module transfers the value of Ri to the output register Y if Yi = 1; i.e., if the median
is stored in Ri.
For the RankGen module in a cell ci, its implementation .Signal Fi is the
output of a comparator module “<=,” which compares the value of Ri with that of
the input sampleX so that Fi = 1if Ri is less than or equal toX (Ri <= X), else Fi = 0
(Ri > X). Signal Ai is the output of a logic AND gate so that Ai = 1 if Ti = 0 and Fi
= 1; i.e., if cell ci,does not contain the token and Ri is less than or equal toX, else Ai
= 0. The Ai signal of each cell is connected to the RankCal module, which
calculates the new rank of a cell that contains the token. As mentioned in Section
III-A, the new rank is calculated as K + 1, where K is the number of cells, which
does not contain the token and whose sample value is less than or equal toX; i.e.,K
is equal to the number of logic 1’s on the Ai signals of all the cells. The RankCal
23
module can be implemented by a multi-input adder that adds all the Ai signals and
then increments the sum by 1. If cell ci contains the token, the output A of the
RankCal module will be its new rank at the next cycle. On the contrary, if cell ci
does not contain the token, its new rank will be determined by the other signals.
Signal Gi is the output of a comparator module “>,” which compares the
value of rank Pi with that of signal B so that Gi = 1 if Pi is greater than B, else Gi =
0. Since the value of B is the rank Pj of another cell cj that contains the token, the
meaning of Gi can also be described as Gi = 1 if Pi is greater than Pj (Pi > Pj),
elseGi = 0(Pi <= Pj). Signal Ei is the output of a compactor module “==,” which
also compares the value of Pi with that of B so that Ei = 1 if Pi is equal to B, else
Ei = 0. Likewise, the meaning of Ei can be described as Ei = 1 if Pi is equal to Pj
(Pi = Pj), else Ei = 0. Combining these two signals Ei and Gi, for the three
relations between Pi and Pj (Pi > Pj , Pi = Pj , and Pi < Pj ), the corresponding
value of EiGi will be 01, 10, and 00, respectively.
24
by tristate buffers, the median will be valid only when there exists at least (N + 1)/2
samples in the window; otherwise, it will remain in a high impedance state.
This section explains how to determine the new rank for each cell. Two
types of cells will be separately discussed: a cell with the token and a cell without
the token.
For a cell ci with the token, its sample value Ri will be replaced by the
input sample X, and its rank Pi has to be recalculated. The new value of Pi can be
obtained by comparing X with the sample values of all the other N − 1 cells that
do not contain the token. For these cells, if K is the number of cells whose sample
value is less than or equal to X, the new value of Pi will be K + 1. At cycle t6 of
Fig. 2, for example, the new value of rank P1 will be calculated as 2 + 1 at the
next cycle t7.
For a cell ci without the token, its sample value Ri will not be affected when
an input sample X enters the window. However, its rank Pi may be affected by the
sample value Rj of another cell cj that contains the token. Since the value of Rj will
be replaced by X, the relation between Ri and Rj may change. However, the
sample value Rk of any other cell ck that does not contain the token will not affect
Pi since the value of Rk will not be changed. Depending on the relation between Pi
and Pj, and the relation between Ri and X, the new value of Pi may be
decremented by 1, incremented by 1, or kept unchanged when an input sample X is
25
inserted into the window. The change of rank Pi can be explained as the following
five cases, where cell ci does not contain the token, but cell cj does.
Case 1—(Decremented by 1)Pi > Pj andRi <= X: If rank Pi is greater than
rank Pj , Ri is greater than or equal to (but newer than) Rj at the current cycle. If Ri
is less than or equal to the input sample X, Ri will be less than or equal to (but
older than) the new value of Rj at the next cycle. In other words, Rj will change
from a value that is less than or equal to (but older than) Ri to a value that is
greater than or equal to (but newer than) Ri. Therefore, the number of cells whose
sample value is less than or equal to (but older than) Ri will be decremented by 1 at
the next cycle; i.e., Pi has to be decremented by 1. Take rank P4 at cycle t6 of Fig.
2, for example, its value will be decremented by 1 (from 3 to 2) at the next cycle
t7.
Case 2—(Incremented by 1) Pi<Pj and Ri>X: Similar to Case 1, if rank Pi
is less than rank Pj , Ri is less than or equal to (but older than) Rj at the current
cycle. If Ri is greater than the input sample X, Ri will be greater than the new value
of Rj at the next cycle. Therefore, the number of cells whose sample value is less
than or equal to (but older than) Ri will be incremented by 1 at the next cycle; i.e.,
Pi has to be incremented by 1.
Case 3—(Kept Unchanged) Pi < Pj and Ri <= X: If Pi is less than Pj , Ri is
less than or equal to (but older than) Rj at the current cycle. If Ri is less than or
equal to X, Ri will also be less than or equal to (but older than) the new value of Rj
at the next cycle. Therefore, the number of cells whose sample value is less than or
equal to (but older than) Ri at the current cycle will be equal to that at the next
cycle; i.e., Pi has to be kept unchanged. For example, at cycle t7 of Fig. 2, the
value of rank P3 has to be kept unchanged at one at the next cycle t8.
Case 4—(Kept Unchanged) Pi > Pj and Ri > X: Similar to Case 3, if Pi is
greater than Pj and Ri is greater than X, the number of cells whose sample value is
26
less than or equal to (but older than) Ri at the current cycle will also be equal to
that at the next cycle; i.e., Pi has to be kept unchanged.
Case 5—(Kept Unchanged) Pi = Pj : This case occurs when the window is
not yet fully occupied with valid data. At the initial state, the rank of each cell is
reset to be zero. After the window is fully occupied, each cell will be assigned a
nonzero and unique rank. If rank Pi is equal to rank Pj , the values of Pi and Pj are
both zero, and neither cell ci nor cell cj contains valid data. The new value of Pi at
the next cycle will still be zero since ci does not contain the token; i.e., Pi has to be
kept unchanged at zero. At cycle t2 of Fig. 3.2.1, for example, the value of rank P4
will still be zero at the next cycle t4.
It can be obtained from the above discussions that for a cell ci that contains
the token, its rank Pi has to be recalculated at a new cycle. If ci does not contain
the token, its rank Pi may be decremented by 1, incremented by 1, or kept
unchanged. Therefore, there are four sources for ci to update its rank.
27
Figure 3.6 Using AND/OR gates.
There exists exactly one Ti signal whose value is equal to 1, the value of B
will always be valid. The Median Sel module can also be implemented in a similar
way. It transfers the value of Ri to the output register Y if Ri is the median; i.e.,
when Yi = 1. However, if it is implemented by Tristate buffers, the median will be
valid only when there exists at least (N + 1)/2 samples in the window; otherwise, it
will remain in a high impedance state.
For the RankGen module in a cell ci, its implementation is given in Fig.
3.3.1. Signal Fi is the output of a comparator module “<=,” which compares the
value of Ri with that of the input sample X so that Fi = 1if Ri is less than or equal
to X (Ri <= X), else Fi = 0 (Ri > X). Signal Ai is the output of a logic AND gate so
that Ai = 1 if Ti = 0 and Fi = 1; i.e., if cell ci does not contain the token and Ri is
less than or equal to X, else Ai = 0.
28
Figure 3.6.2 Implementation of the Rank Generation module.
29
described as Gi = 1 if Pi is greater than Pj (Pi > Pj), else Gi = 0(Pi <= Pj). Signal
Ei is the output of a compactor module “==,” which also compares the value of Pi
with thatof B so that Ei = 1 if Pi is equal to B, else Ei = 0. Likewise, the meaning
of Ei can be described as Ei = 1 if Pi is equal to Pj (Pi = Pj), else Ei = 0.
Combining these two signals Eiand Gi, for the three relations between Pi and Pj
(Pi > Pj , Pi = Pj , and Pi < Pj ), the corresponding value of EiGi will be 01, 10,
and 00, respectively.
For a cell ci, since there are four possible sources to update its rank, a 4-to-1
multiplexer is used to select one of these sources for signal Qi in Fig. 3.3.2. Then,
the value of rank Pi will be updated by the value of Qi at each cycle. The
multiplexer is controlled by two selection signals S1 and S0; and these two signals,
which are generated by the Ctrl module, are determined by four signals Ti, Ei, Fi,
and Gi. If cell ci contains the token (Ti = 1), its new rank is obtained from the
output A of the RankCal module; i.e., the value of S1S0 should be 11 when Ti = 1.
If cell ci does not contain the token (Ti = 0),there are five cases for this, as
described in Section III-B. In Case 1 when Pi > Pj (EiGi = 01) and Ri <= X (Fi =
1), the rank of ci will be decremented by 1; i.e., the value of S1S0 should be 10
when EiFiGi = 011.
Similarly in Case 2, when Pi < Pj (EiGi = 00) and Ri > X (Fi = 0), the rank
of ci will be incremented by 1; i.e., the value of S1S0 should be 01 when EiFiGi =
000. Finally, when Pi < Pj (EiGi = 00) and Ri <= X (Fi = 1) in Case 3, Pi > Pj
(EiGi = 01) and Ri >X (Fi = 0) in Case 4, and Pi = Pj (EiGi = 10) in Case 5, the
rank of ci will be kept unchanged; i.e., when EiFiGi = 010, 001, or 1 − 0, the value
of S1S0 should be 00. Fig depicts a simple implementation of the Ctrl module.
30
CHAPTER 4
SOFTWARE DESCRIPTION
31
(digital) and continuous-time (analog) modeling exist, and HDLs targeted for each
are available.
32
process of writing the HDL description is highly dependent on the nature of the
circuit and the designer's preference for coding style. The HDL is merely the
'capture language'—often beginning with a high-level algorithmic description such
as MATLAB or a C++ mathematical model. Designers often use scripting
languages (such as Perl) to automatically generate repetitive circuit structures in
the HDL language. Special text editors offer features for automatic indentation,
syntax-dependent coloration, and macro-based expansion of entity architecture
signal declaration.
The HDL code then undergoes a code review, or auditing. In preparation for
synthesis, the HDL description is subject to an array of automated checkers. The
checkers report deviations from standardized code guidelines, identify potential
ambiguous code constructs before they can cause misinterpretation, and check for
common logical coding errors, such as dangling ports or shorted outputs. This
process aids in resolving errors before the code is synthesized.
In industry parlance, HDL design generally ends at the synthesis stage. Once
the synthesis tool has mapped the HDL description into a gate netlist , this netlist is
passed off to the back-end stage. Depending on the physical technology (FPGA,
ASIC gate array, ASIC standard cell), HDLs may or may not play a significant role
in the back-end flow. In general, as the design flow progresses toward a physically
realizable form, the design database becomes progressively more laden with
technology-specific information, which cannot be stored in a generic HDL
description. Finally, an integrated circuit is manufactured or programmed for use.
33
verification, an important milestone that validates the design's intended function
(specification) against the code implementation in the HDL description. It also
permits architectural exploration. The engineer can experiment with design choices
by writing multiple variations of a base design, then comparing their behavior in
simulation. Thus, simulation is critical for successful HDL design.
34
language. The majority of the initial test/debug cycle is conducted in the HDL
simulator environment, as the early stage of the design is subject to frequent and
major circuit changes. An HDL description can also be prototyped and tested in
hardware — programmable logic devices are often used for this purpose. Hardware
prototyping is comparatively more expensive than HDL simulation, but offers a
real-world view of the design. Prototyping is the best way to check interfacing
against other hardware devices and hardware prototypes. Even those running on
slow FPGAs offer much faster simulation times than pure HDL simulation.
The assertions do not model circuit activity, but capture and document the
"designer's intent" in the HDL code. In a simulation environment, the simulator
evaluates all specified assertions, reporting the location and severity of any
35
violations. In a synthesis environment, the synthesis tool usually operates with the
policy of halting synthesis upon any violation. Assertion-based verification is still
in its infancy, but is expected to become an integral part of the HDL design toolset.
On the other hand, a software compiler converts the source-code listing into
a microprocessor-specific object-code, for execution on the target microprocessor.
As HDLs and programming languages borrow concepts and features from each
other, the boundary between them is becoming less distinct. However, pure HDLs
are unsuitable for general purpose software application development, just as
general-purpose programming languages are undesirable for modeling hardware.
Yet as electronic systems grow increasingly complex, and reconfigurable systems
36
become increasingly mainstream, there is growing desire in the industry for a
single language that can perform some tasks of both hardware design and software
programming. SystemC is an example of such—embedded system hardware can be
modeled as non-detailed architectural blocks (blackboxes with modeled signal
inputs and output drivers). The target application is written in C/C++, and natively
compiled for the host-development system (as opposed to targeting the embedded
CPU, which requires host-simulation of the embedded CPU). The high level of
abstraction of SystemC models is well suited to early architecture exploration, as
architectural modifications can be easily evaluated with little concern for signal-
level implementation issues. However, the threading model used in SystemC and
its reliance on shared memory mean that it does not handle parallel execution or
lower level models well.
37
existing software engineers. There is more information on C to HDL and Flow to
HDL in their respective articles.
4.2 VERILOG
Verilog, standardized as IEEE 1364, is a hardware description language
(HDL) used to model electronic systems. It is most commonly used in the design
and verification of digital circuits at the register-transfer level of abstraction. It is
also used in the verification of analog circuits and mixed-signal circuits.
38
declarations, demarcation of procedural blocks (Verilog uses begin/end instead of
curly braces {}), and many other minor differences. Verilog requires that variables
be given a definite size. In C these sizes are assumed from the 'type' of the variable
(for instance an integer type may be 8 bits).
Verilog's concept of 'wire' consists of both signal values (4-state: "1, 0, floating,
undefined") and signal strengths (strong, weak, etc.). This system allows abstract
modeling of shared signal lines, where multiple sources drive a common net. When
a wire has multiple drivers, the wire's (readable) value is resolved by a function of
the source drivers and their strengths. A subset of statements in the Verilog
language are synthesizable. Verilog modules that conform to a synthesizable
coding style, known as RTL (register-transfer level), can be physically realized by
synthesis software. Synthesis software algorithmically transforms the (abstract)
Verilog source into a netlist, a logically equivalent description consisting only of
elementary logic primitives (AND, OR, NOT, flip-flops, etc.) that are available in
a specific FPGA or VLSI technology. Further manipulations to the netlist
ultimately lead to a circuit fabrication blueprint (such as a photo mask set for an
ASIC or a bit stream file for an FPGA).
39
Example:
modulemain;
initial
begin
$display("Hello world!");
$finish;
end
endmodule
Create a New Project Create a new ISE project which will target the FPGA
device on the Spartan-3 Startup Kit demo board.
To create a new project:
1. Select File > New Project... The New Project Wizard appears.
2. Type tutorial in the Project Name field.
3. Enter or browse to a location (directory path) for the new project. A
tutorial subdirectory is created automatically.
4. Verify that HDL is selected from the Top-Level Source Type list.
40
5. Click Next to move to the device properties page.
Fill in the properties in the table as shown below:
Leave the default values in the remaining fields. When the table is complete,
our project properties will look like the following:
Create the top-level Verilog source file for the project as follows:
1. Click New Source in the New Project dialog box.
2. Select Verilog Module as the source type in the New Source dialog box.
3. Type in the file name counter.
4. Verify that the Add to Project checkbox is selected.
5. Click Next.
6. Declare the ports for the counter design by filling in the port information
as shown below:
The source file containing the counter module displays in the Workspace,
and the counter displays in the Sources tab, as shown below:
42
Figure 4.3.1.1 Xilinx ISE window
43
4. With Simple Counter selected, select Edit → Use in File, or select the Use
Template in File toolbar button. This step copies the template into the counter
source file.
5. Close the Language Templates
4.3.3 Design Simulation
The test bench waveform is a graphical view of a test bench. Create the test
bench waveform as follows:
3. In the New Source Wizard, select Test Bench WaveForm as the source
type, and type counter in the File Name field.
4. Click Next.
5. The Associated Source page shows that you are associating the test bench
waveform with the source file counter. Click Next.
6. The Summary page shows that the source will be added to the project, and
it displays the source directory, type, and name. Click Finish.
7. You need to set the clock frequency, setup time and output delay times in
the Initialize Timing dialog box before the test bench waveform editing window
opens.
44
The requirements for this design are the following:
♦ Global Signals: GSR (FPGA) Note: When GSR (FPGA) is enabled, 100
ns is added to the Offset value automatically.
9. The blue shaded areas that precede the rising edge of the CLOCK correspond to
the Input Setup Time in the Initialize Timing dialog box.
45
Figure 4.3.3 Initial timing and clock wizard
Toggle the DIRECTION port to define the input stimulus for the counter design as
follows:
♦ Click on the blue cell at approximately the 300 ns to assert DIRECTION high so
that the counter will count up.
♦ Click on the blue cell at approximately the 900 ns to assert DIRECTION low so
that the counter will count down.
46
Fig 4.3.3.1 Clock pulse
47
CHAPTER 5
5.1 RESULT
A low-power architecture for the design of a 1-D median filter has been
proposed in this brief. The power saving is achieved by adopting a token ring in
our design, where the stored samples are kept immobile; only the rank of each
sample has to be updated at each new cycle. As can be seen from the experimental
results, the power consumption for median filters in practical use has been
successfully reduced at the expense of some area overhead.
48
Figure 5.1.1 Power Reduction window
5.2. CONCLUSION
A low power architecture for the design of a one dimensional median filter
has been proposed in this brief .The power saving is achieved by adopting a token
ring in our design, where the stored samples are kept immobile ;only the rank of
each sample has to be updated at each new cycle .As can be seen from the
experimental result ,the power consumption for median filters in practical use has
been successfully reduced at the expense of some area overhead.
49
REFERENCES
50
9. M. Mottaghi-Dastjerdi, A. Afzali-Kusha, and M. Pedram, “BZ-FAD: A low-
power low-area multiplier based on shift-and-add architecture,” IEEE Trans.
Very Large Scale Integr. (VLSI) Syst., vol. 17, no. 2, pp. 302–306, Feb. 2009.
10. D. Prokin and M. Prokin, “Low hardware complexity pipelined rank filter,”
IEEE Trans. Circuits Syst. II, Exp. Briefs, vol. 57, no. 6, pp. 446– 450, Jun.
2010.
11. D. S. Richards, “VLSI median filters,” IEEE Trans. Acoust., Speech, Signal
Process., vol. 38, no. 1, pp. 145–153, Jan. 1990.
12. Z. Vasicek and L. Sekanina, “Novel hardware implementation of adaptive
median filters,” in Proc. 11th IEEE Workshop DDECS, 2008, pp. 1–6.
51