Final document


Published on

Published in: Education, Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Final document

  1. 1. ABSTRACT <br />Many image processing operations such as scaling and rotation require re-sampling or convolution filtering for each pixel in the image. Convolutions on digital images are important since they represent operations that are more general than the operations that can be performed on analog images. Convolution has many applications which have great significance in discrete signal processing. It is usually difficult to deal with analog signals. Hence signals are converted to digital state. Filtering of signals is very important in order to determine which one to accept and which one to reject, and all of that is done by convolution.<br />This paper presents a direct method of reducing convolution processing time using hardware computing and implementations of discrete linear convolution of two finite length sequences (NXN). This implementation method is realized by simplifying the convolution building blocks. The purpose of this research is to prove the feasibility of an FPGA that performs a convolution on an acquired image in real time. <br />The proposed implementation uses a modified hierarchical design approach, which efficiently and accurately speeds up computation; reduces power, hardware resources, and area significantly. The efficiency of the proposed convolution circuit is tested by embedding it in a top level FPGA. In addition, the presented circuit uses less power consumption and delay from input to output. It also provides the necessary modularity, expandability, and regularity to form different convolutions for any number of bits. <br />CHAPTER 1<br />INTRODUCTION<br />INTRODUCTION <br />Convolution provides the mathematical framework for DSP. It is the single most important technique in Digital Signal Processing. Convolution is a mathematical way of combining two signals to form a third signal. Using the strategy of impulse decomposition, systems are described by a signal called the impulse response. In signal processing, the impulse response, or impulse response function (IRF), of a dynamic system is its output when presented with a brief input signal, called an impulse. More generally, an impulse response refers to the reaction of any dynamic system in response to some external change. It has applications that include statistics, computer vision, image and signal processing, electrical engineering, and differential equations.<br />INTRODUCTION TO CONVOLUTION <br /> One of the most important concepts in Fourier theory, and in crystallography, is that of a convolution. Convolutions arise in many guises, as will be shown below. Because of a mathematical property of the Fourier transform, referred to as the convolution theorem, it is convenient to carry out calculations involving convolutions. <br />Convolution Definition<br /> <br />The convolution of ƒ and g is written ƒ∗g, using an asterisk or star. It is defined as the integral of the product of the two functions after one is reversed and shifted. As such, it is a particular kind of integral transform:<br />      <br /> While the symbol t is used above, it need not represent the time domain. But in that context, the convolution formula can be described as a weighted average of the function ƒ(τ) at the moment t where the weighting is given by g(−τ) simply shifted by amount t. As t changes, the weighting function emphasizes different parts of the input function.<br />More generally, if f and g are complex-valued functions on Rd, then their convolution may be defined as the integral:<br /> TYPES OF CONVOLUTION <br /> There are two types of convolution. They are:<br /><ul><li>Linear convolution
  2. 2. Circular convolution
  3. 3. Linear convolution</li></ul>Convolution is an integral concatenation of two signals. It has many applications in numerous areas of signal processing. The convolution described above is nothing but linear convolution. The most popular application is the determination of the output signal of a linear time-invariant system by convolving the input signal with the impulse response of the system. Convolving two signals is equivalent to multiplying the Fourier transform of the two signals. <br /> Mathematical Formulae:<br />The linear convolution of two continuous time signals and is defined by, <br />For discrete time signals x(n) and h(n) , the integration is replaced by a summation <br /><ul><li>Circular Convolution</li></ul>The circular convolution of two aperiodic functions occurs when one of them is convolved in the normal way with a periodic summation of the other function. It occurs naturally in digital signal processing when DTFTs and inverse DTFTs are replaced by DFTs and inverse DFTs. Equivalently, the continuous frequency domain is replaced by a discrete one. (See Circular convolution theorem.)<br />The Circular convolution theorem states that :<br />For a periodic function xT(t) , with period T, the convolution with another function, h(t), is also periodic, and can be expressed in terms of integration over a finite interval as follows:<br />Where, to is an arbitrary parameter, and hT(t) is a periodic summation of h, defined by:<br />When xT(t) is expressed as the periodic summation of another function x, this convolution is sometimes referred to as circular convolution of functions h and x.<br /><ul><li> PROPERTIES OF CONVOLUTION
  4. 4. This section describes the properties of convolution. The properties of convolution are:
  5. 5. Commutative
  6. 6. Associative
  7. 7. Distributive
  8. 8. Commutative property:
  9. 9. The commutative property for convolution is expressed in mathematical form:</li></ul>a[n] * b[n] = b[n] * a[n]<br />In words, the order in which two signals are convolved makes no difference, the results are identical.<br /><ul><li>Associative property:</li></ul>The associative property describes the way to convolve more than two signals. Convolve two of the signals to produce an intermediate signal, then convolve the intermediate signal with the third signal. The associative property provides that the order of the convolutions doesn't matter. As an equation:<br />(a[n] * b[n] ) * c[n] = a[n] * ( b[n] * c[n] )<br />The associative property is used in system theory to describe how cascaded systems behave. Two or more systems are said to be in a cascade if the output of one system is used as the input for the next system. From the associative property, the order of the systems can be rearranged without changing the overall response of the cascade. Further, any number of cascaded systems can be replaced with a single system. The impulse response of the replacement system is found by convolving the impulse responses of all of the original systems.<br /><ul><li>Distributive property:</li></ul>In equation form, the distributive property is written as:<br /><ul><li>a[n] * b[n] + a[n] * c[n] = a[n] * (b[n] + c [n] )</li></ul>The distributive property describes the operation of parallel systems with added outputs. Two or more systems can share the same input, x[n] , and have their outputs added to produce y[n] . The distributive property allows this combination of systems to be replaced with a single system, having an impulse response equal to the sum of the impulse responses of the original systems.<br />APPLICATIONS OF CONVOLUTION<br /> Convolution and related operations are found in many applications of engineering and mathematics. The following are the areas where convolution is being applied :<br />In statistics, as noted above, a weighted moving average is a convolution. <br />In probability theory, the probability distribution of the sum of two independent random variables is the convolution of their individual distributions. <br />In optics, many kinds of "blur" are described by convolutions. A shadow (e.g. the shadow on the table when you hold your hand between the table and a light source) is the convolution of the shape of the light source that is casting the shadow and the object whose shadow is being cast. An out-of-focus photograph is the convolution of the sharp image with the shape of the iris diaphragm. The photographic term for this is “bokeh”. <br />Similarly, in digital image processing, convolutional filtering plays an important role in many important algorithms in edge detection and related processes. <br />In linear acoustics, an echo is the convolution of the original sound with a function representing the various objects that are reflecting it. <br />In artificial reverberation (digital signal processing, pro audio), convolution is used to map the impulse response of a real room on a digital audio signal (see previous and next point for additional information). <br />In electrical engineering and other disciplines, the output (response) of a (stationary, or time- or space-invariant) linear system is the convolution of the input (excitation) with the system's response to an impulse or Dirac delta function. See LTI system theory and digital signal processing. <br />In time-resolved fluorescence spectroscopy, the excitation signal can be treated as a chain of delta pulses, and the measured fluorescence is a sum of exponential decays from each delta pulse. <br />In physics, wherever there is a linear system with a "superposition principle", a convolution operation makes an appearance. <br />In digital signal processing, frequency filtering can be simplified by convolving two functions (data with a filter) in the time domain, which is analogous to multiplying the data with a filter in the frequency domain<br />CHAPTER 2<br />LITERATURE REVIEW<br />INTRODUCTION TO CONVOLUTION<br />The most important operation performed on signals is linear filtering, which can be performed by convolution. The reason that linear filtering is so important to signal processing is that it solves many problems and is relatively simple to describe mathematically. In this chapter we will be looking at convolution. Convolution helps to determine the effect a system has on an input signal. It can be shown that a linear, time-invariant system is completely characterized by its impulse response. Using the sampling property of the delta function for continuous time signals and the unit sample for discrete time signals we can decompose a signal into an infinite sum / integral of scaled and shifted impulses. By knowing how a system affects a single impulse, and by understanding the way a signal is comprised of scaled and summed impulses, it seems reasonable that it should be possible to scale and sum the impulse responses of a system in order to determine what output signal will results from a particular input. This is precisely what convolution does - convolution determines the system's output from knowledge of the input and the system's impulse response.<br /><ul><li>CONVOLUTION - DISCRETE TIME</li></ul>The idea of discrete-time convolution is exactly the same as that of continuous-time convolution. For this reason, it may be useful to look at both versions to help your understanding of this extremely important concept. Convolution is a very powerful tool in determining a system's output from knowledge of an arbitrary input and the system's impulse response.<br />We know that any discrete-time signal can be represented by a summation of scaled and shifted discrete-time impulses. Since we are assuming the system to be linear and time-invariant, it would seem to reason that an input signal comprised of the sum of scaled and shifted impulses would give rise to an output comprised of a sum of scaled and shifted impulse responses. This is exactly what occurs in convolution.<br />For discrete time signals and , the convolution equation is given by:<br />2.2.1 Graphical Interpretation:<br />Reflection of resulting in <br />Shifting of resulting in <br />Element-wise multiplication of the sequences and <br />Summation of the product sequence resulting in the convolution value for <br /><ul><li>Graphical illustration of convolution properties (Discrete - time):</li></ul>A quick graphical example may help in demonstrating why convolution works.<br />FIGURE 2.1: Impulse Response.<br /> A single impulse input yields the system's impulse response.<br />FIGURE 2.2: Scaled Response.<br />A scaled impulse input yields a scaled response, due to the scaling property of the systems linearity . <br /> <br />FIGURE 2.3: Time-invariance property.<br />We now use the time-invariance property of the system to show that a delayed input results in an output of the same shape, only delayed by the same amount as the input.<br />FIGURE 2.4: Additive portion of the Linearity property.<br />We now use the additively portion of the linearity property of the system to complete the picture. Since any discrete-time signal is just a sum of scaled and shifted discrete-time impulses, we can find the output from knowing the input and the impulse response.<br />CONVOLUTION – ANALOG<br />In this module we examine convolution for continuous time signals. This will result in the convolution integral and its properties. These concepts are very important in Engineering and will make any engineer's life a lot easier if the time is spent now to truly understand what is going on.<br /> <br />2.3.1 Derivation of the convolution integral<br /><ul><li>To begin this, it is necessary to state the assumptions we will be making. In this instance, the only constraints on our system are that it be linear and time-invariant.</li></ul> Brief Overview of Derivation Steps:<br />1. An impulse input leads to an impulse response output. <br />2. A shifted impulse input leads to a shifted impulse response output. This is due to the time-invariance of the system.<br />3. We now scale the impulse input to get a scaled impulse output. This is using the scalar multiplication property of linearity.<br />4. We can now "sum up" an infinite number of these scaled impulses to get a sum of an infinite number of scaled impulse responses. This is using the additively attribute of linearity.<br />5. Now we recognize that this infinite sum is nothing more than an integral, so we convert both sides into integrals.<br />6. Recognizing that the input is the function f(t), we also recognize that the output is exactly the convolution integral.<br />FIGURE 2.5: Impulse Response of the system.<br />We begin with a system defined by its impulse response, h(t).<br />FIGURE 2.6: Shifted version of the input impulse.<br />We then consider a shifted version of the input impulse. Due to the time invariance of the system, we obtain a shifted version of the output impulse response.<br />FIGURE 2.7: Scaling aspect of linearity of the system.<br />Now we use the scaling part of linearity by scaling the system by a value, f(τ), that is constant with respect to the system variable, t.<br />FIGURE 2.8: Additive aspect of linearity of the system.<br />We can now use the additively aspect of linearity to add an infinite number of these, one for each possible τ. Since an infinite sum is exactly an integral, we end up with the integration known as the Convolution Integral. Using the sampling property, we recognize the left-hand side simply as the input f(t).<br />Convolution Integral<br />As mentioned above, the convolution integral provides an easy mathematical way to express the output of an LTI system based on an arbitrary signal, x (t), and the system's impulse response, h(t) . The convolution integral is expressed as<br />Convolution is such an important tool that it is represented by the symbol *, and can be written as<br />y (t) = x(t) * h(t)<br />By making a simple change of variables into the convolution integral, τ = t−τ, we can easily show that convolution is commutative:<br />x (t) * h(t) = h(t) * x(t)<br />2.3.3 Implementation of Convolution<br />Taking a closer look at the convolution integral, we find that we are multiplying the input signal by the time-reversed impulse response and integrating. This will give us the value of the output at one given value of t. If we then shift the time-reversed impulse response by a small amount, we get the output for another value of t. Repeating this for every possible value of t, yields the total output function. While we would never actually do this computation by hand in this fashion, it does provide us with some insight into what is actually happening. We find that we are essentially reversing the impulse response function and sliding it across the input function, integrating as we go. This method, referred to as the graphical method, provides us with a much simpler way to solve for the output for simple (contrived) signals, while improving our intuition for the more complex cases where we rely on computers. In fact Texas Instruments develops Digital Signal Processors which have special instruction sets for computations such as convolution.<br /> <br /><ul><li>SYMMETRIC CONVOLUTION
  10. 10. In mathematics, symmetric convolution is a special subset of convolution operations in which the convolution kernel is symmetric across its zero point. Many common convolution-based processes such as Gaussian blur and taking the derivative of a signal in frequency-space are symmetric and this property can be exploited to make these convolutions easier to evaluate.
  11. 11. The convolution theorem states that a convolution in the real domain can be represented as a point-wise multiplication across the frequency domain of a Fourier transform. Since sine and cosine transforms are related transforms a modified version of the convolution theorem can be applied, in which the concept of circular convolution is replaced with symmetric convolution. Using these transforms to compute discrete symmetric convolutions is non-trivial since discrete sine transforms (DSTs) and discrete cosine transforms (DCTs) can be counter-intuitively incompatible for computing symmetric convolution, i.e. symmetric convolution can only be computed between a fixed set of compatible transforms.</li></ul>2.4.1 Advantages of symmetric convolutions<br />There are a number of advantages to computing symmetric convolutions in DSTs and DCTs in comparison with the more common circular convolution with the Fourier transform. Most notably the implicit symmetry of the transforms involved is such that only data unable to be inferred through symmetry is required. For instance using a DCT-II, a symmetric signal need only have the positive half DCT-II transformed, since the frequency domain will implicitly construct the mirrored data comprising the other half. This enables larger convolution kernels to be used with the same cost as smaller kernels circularly convolved on the DFT. <br />Also the boundary conditions implicit in DSTs and DCTs create edge effects that are often more in keeping with neighboring data than the periodic effects introduced by using the Fourier transform.<br />CHAPTER 3<br /> VHDL BASICS<br />3.1 DESIGN ENTITIES AND CONFIGURATIONS<br /> The design entity is the primary hardware abstraction in VHDL. It represents a portion of a hardware designthat has well-defined inputs and outputs and performs a well-defined function. A design entity may representan entire system, a subsystem, a board, a chip, a macro-cell, a logic gate, or any level of abstraction in between.A configuration can be used to describe how design entities are put together to form a complete design.<br /> A design entity may be described in terms of a hierarchy of blocks, each of which represents a portion of the whole design. The top-level block in such a hierarchy is the design entity itself; such a block is an external block that resides in a library and may be used as a component of other designs. Nested blocks in the hierarchy are internal blocks, defined by block statements<br />3.1.1 Entity declarations:<br /> An entity declaration defines the interface between a given design entity and the environment in which it issued. It may also specify declarations and statements that are part of the design entity. A given entity declaration may be shared by many design entities, each of which has a different architecture. Thus, an entity declaration can potentially represent a class of design entities, each with the same interface.<br /> entity_declaration ::=<br /> entity identifier is<br /> entity_header<br /> entity_declarative_part<br /> [ begin<br /> entity_statement_part ]<br /> end [ entity ] [ entity_simple_name ] ;<br /> Generics:<br /> Generics provide a channel for static information to be communicated to a block from its environment. The following applies to both external blocks defined by design entities and to internal blocks defined by block<br /> statements.<br /> generic_list ::= generic_interface_list<br /> The generics of a block are defined by a generic interface list. Each interface element in such a generic interface list declares a formal generic.<br /> Ports:<br />Ports provide channels for dynamic communication between a block and<br />its environment.<br /> port_list ::= port_interface_list<br />3. 2 Architecture bodies:<br /> An architecture body defines the body of a design entity. It specifies the relationships between the inputs and outputs of a design entity and may be expressed in terms of structure, dataflow, or behavior. Such specifications may be partial or complete.<br />architecture_body ::=<br />architecture identifier of entity_name is<br /> architecture_declarative_part<br />begin<br /> architecture_statement_part<br />end [ architecture ] [ architecture_simple_name ] ;<br />3.3 Subprograms And Packages:<br />3.3.1 Subprogram declarations:<br /> A subprogram declaration declares a procedure or a function, as indicated by the appropriate reserved word.<br />subprogram_declaration ::=<br />subprogram_specification ;<br /> subprogram_specification ::=<br />procedure designator [ ( formal_parameter_list ) ]<br /> | [ pure | impure ] function designator [ ( formal_parameter_list ) ]<br />return type_mark<br />The specification of a procedure specifies its designator and its formal parameters (if any). The specification of a function specifies its designator, its formal parameters (if any), the subtype of the returned value (the result subtype), and whether or not the function is pure. A function is impure if its specification contains the reserved word impure; otherwise, it is said to be pure. A procedure designator is always an identifier. A function designator is either an identifier or an operator symbol<br />3.3.2 Subprogram bodies:<br /> A subprogram body specifies the execution of a subprogram.<br />subprogram_body ::=<br /> subprogram_specification is<br /> subprogram_declarative_part<br /> begin<br /> subprogram_statement_part<br /> end [ subprogram_kind ] [ designator ] ;<br />3.3.3 Package declarations:<br />A package declaration defines the interface to a package. The scope of a declaration within a package can be extended to other design units.<br /> package_declaration ::=<br /> package identifier is<br /> package_declarative_part<br /> end [ package ] [ package_simple_name ] ;<br /> 3.3.4 Package bodies<br />A package body defines the bodies of subprograms and the value of deferred constants declared in the interface to the package.<br /> package_body ::=<br /> package body package_simple_name is<br /> package_body_declarative_part<br /> end [ package body ] [ package_simple_name ] ;<br />3.4 Data Types:<br />3.4.1 Scalar Types:<br />Scalar type can be classified into four types.They are :<br /> a) Enumeration<br /> b) Integer <br /> c) Physical <br /> d) Floating Point<br />a) Enumeration types:<br />An enumeration type definition defines an enumeration type.<br /> enumeration_type_definition ::=<br /> ( enumeration_literal { , enumeration_literal } )<br /> <br /> enumeration_literal ::= identifier | character_literal<br />b) Integer types:<br />An integer type definition defines an integer type whose set of values includes those of the specified range.<br /> integer_type_definition ::= range_constraint.<br />c) Physical types:<br />Values of a physical type represent measurements of some quantity. Any value of a physical type is an integral multiple of the primary unit of measurement for that type.<br />physical_type_definition ::=<br /> range_constraint<br /> units<br /> primary_unit_declaration<br /> { secondary_unit_declaration }<br /> end units [ physical_type_simple_name ]<br />d) Floating point types:<br />Floating point types provide approximations to the real numbers. Floating point types are useful for models in which the precise characterization of a floating point calculation is not important or not determined.<br /> floating_type_definition ::= range_constraint<br />3.4.2 Composite types:<br />Composite types are used to define collections of values. These include both arrays of values (collections of values of a homogeneous type) and records of values (collections of values of potentially heterogeneous types) i.e., they are of two types:<br /> a) Array types<br /> b) Record types<br />a) Array types:<br />An array object is a composite object consisting of elements that have the same subtype. The name for an element of an array uses one or more index values belonging to specified discrete types. The value of an array object is a composite value consisting of the values of its elements<br /> unconstrained_array_definition ::=<br /> array ( index_subtype_definition { , index_subtype_definition } )<br /> of element_subtype_indication<br />constrained_array_definition ::=<br /> array index_constraint of element_subtype_indication<br />b) Record types:<br /> <br />A record type is a composite type, objects of which consist of named elements. The value of a record object is a composite value consisting of the values of its elements.<br />record_type_definition ::=<br /> record<br /> element_declaration<br /> { element_declaration }<br /> end record [ record_type_simple_name ]<br />3.4.3 Access types:<br />An object declared by an object declaration is created by the elaboration of the object declaration and is denoted by a simple name or by some other form of name. In contrast, objects that are created by the evaluation of allocators (see 7.3.6) have no simple name. Access to such an object is achieved by an access value returned by an allocator; the access value is said to designate the object.<br /> access_type_definition ::= access subtype_indication<br />3.4.4 File types:<br />A file type definition defines a file type. File types are used to define objects representing files in the hostsystem environment. The value of a file object is the sequence of values contained in the host system file.<br /> file_type_definition ::= file of type_mark<br />3.5 Data Objects:<br />3.5.1 Object declarations<br />An object declaration declares an object of a specified type. Such an object is called an explicitly declared object.<br />3.5.2 Constant declarations<br />A constant declaration declares a constant of the specified type. Such a constant is an explicitly declared constant.<br /> constant_declaration ::=<br /> constant identifier_list : subtype_indication [ := expression ] ;<br />If the assignment symbol ":=" followed by an expression is present in a constant declaration, the expression specifies the value of the constant; the type of the expression must be that of the constant. The value of a constant cannot be modified after the declaration is elaborated.<br /> <br />3.5.3 Signal declarations<br />A signal declaration declares a signal of the specified type. Such a signal is an explicitly declared signal.<br /> signal_declaration ::=<br />signal identifier_list : subtype_indication [ signal_kind ] [ := expression ] ;<br /> signal_kind ::= register | bus<br />3.5.4 Variable declarations<br />A variable declaration declares a variable of the specified type. Such a variable is an explicitly declared variable.<br /> variable_declaration ::=<br />[ shared ] variable identifier_list : subtype_indication [ := expression ] ;<br />3.5.5 File declarations<br />A file declaration declares a file of the specified type. Such a file is an “explicitly declared file”.<br />file_declaration ::= file identifier_list : subtype_indication [ file_open_information ] ;<br /> <br />3.6 Operators:<br />3.6.1 Logical Operators:<br />The logical operators and, or, nand, nor, xor, xnor, and not are defined for predefined types BIT and BOOLEAN. They are also defined for any one-dimensional array type whose element type is BIT or BOOLEAN. For the binary operators and, or, nand, nor, xor, and xnor, the operands must be of the same base type. <br />Moreover, for the binary operators and, or, nand, nor, xor, and xnor defined on one-dimensional array types, the operands must be arrays of the same length, the operation is performed on matching elements of the arrays, and the result is an array with the same index range as the left operand. <br />3.6.2 Relational Operators:<br />Relational operators include tests for equality, inequality, and ordering of operands. The operands of each relational operator must be of the same type. The result type of each relational operator is the predefined type BOOLEAN.<br />The table of Relational operators is as follows,<br />TABLE 3.1: Relational Operators.<br />OperatorOperationOperand Type Result Type = EqualityAny Type Boolean /= InequalityAny Type Boolean< Less ThanAny ScalarType or Descrete typeBoolean<= Less Than or EqualAny ScalarType or Descrete type Boolean > GreaterThan Any ScalarType or Descrete type Boolean>= Greater Than or EqualAny ScalarType or Descrete type Boolean<br />3.6.3.Shift Operators:<br />The shift operators sll, srl, sla, sra, rol, and ror are defined for any one-dimensional array type whose element type is either of the predefined types BIT or BOOLEAN. <br /> <br /> <br />The table of Shift Operators is as follows, <br /> <br />TABLE 3.2: Shift Operators.<br /> Operation Left operand typeRight operandtypeResulttype SllShift left LogicalAny one-dimensionalarray type whose elementtype is BIT or BOOLEANINTEGERSame as left srlShift right LogicalAny one-dimensionalarray type whose elementtype is BIT or BOOLEANINTEGERSame as left slaShift left arithmeticAny one-dimensionalarray type whose elementtype is BIT or BOOLEANINTEGERSame as left sraShift right arithmeticAny one-dimensionalarray type whose elementtype is BIT or BOOLEANINTEGERSame as left rolRotate leftlogicalAny one-dimensionalarray type whose elementtype is BIT or BOOLEANINTEGERSame as left rorRotate rightLogicalAny one-dimensionalarray type whose elementtype is BIT or BOOLEANINTEGERSame as left<br />3.6.4. Adding Operators:<br />The adding operators + and Ð are predefined for any numeric type and have their conventional mathematical meaning. The concatenation operator & is predefined for any one-dimensional array type.<br />TABLE 3.3: Addition Operators.<br />Operator Operation Left operandtypeRight operandTypeResultType +AdditionAny numeric type Same type Same type -SubtractionAny numeric type Same typeSame type &ConcatenationAny array typeSame array typeSame array type Any array typeSame element typeSame array typeThe element type Any array typeSame array typeThe element typeAny element typeAny array type<br />3.6.5. Multiplying Operators:<br />The operators * and / are predefined for any integer and any floating point type and have their conventional mathematical meaning; the operators mod and rem are predefined for any integer type. For each of these operators, the operands and the result are of the same type.<br /> <br />TABLE 3.4: Multiplying Operators.<br /> Operator Operation Left operand type Right operandTypeResultType *MultiplicationAny integertypeSame typeSame typeAny floating point typeSame typeSame type /DivisionAny integer typeSame typeSame typeAny floating point typeSame typeSame type ModModulusAny integer typeSame typeSame type RemRemaindeAny integer typeSame typeSame type<br />3.6.6. Miscellaneous operators:<br />The unary operator abs is predefined for any numeric type. <br />TABLE 3.5: Unary Operator.<br />OperatorOperation Operand type Result typeAbsAbsolute valueAny numeric typeSame numeric type<br />The exponentiating operator ** is predefined for each integer type and for each floating point type. In either case the right operand, called the exponent, is of the predefined type INTEGER.<br />TABLE 6: Miscellaneous Operators.<br />OperatorOperationLeft operandtype Right operandTypeResultType **ExponentiationAny integer typeINTEGERSame as leftAny floating ptINTEGERSame as left<br />In VHDL mainly there are three types modeling styles.These are :<br /> 1. Behaviorial Modeling.<br /> 2. Data Flow Modeling. <br /> 3. Structural Modeling.<br />3.7 Behaviorial Modeling:<br />3.7 .1 Process statement<br />A process statement defines an independent sequential process representing the behavior of some portion of thedesign.<br />process_statement ::=<br /> [ process_label : ]<br /> [ postponed ] process [ ( sensitivity_list ) ] [ is ]<br /> process_declarative_part<br /> begin<br /> process_statement_part<br /> end [ postponed ] process [ process_label ] ;<br />where the sensitivity list of the wait statement is that following the reserved word process. Such a process statement must not contain an explicit wait statement. Similarly, if such a process statement is a parent of a procedure, then that procedure may not contain a wait statement.<br />3.7.2 Sequential statements:<br />The various forms of sequential statements are described in this section. Sequential statements are used to define algorithms for the execution of a subprogram or process; they execute in the order in which they appear.<br />a)Wait statement<br />The wait statement causes the suspension of a process statement or a procedure.<br /> wait_statement ::=<br /> [ label : ] wait [ sensitivity_clause ] [ condition_clause ] [ timeout_clause ] ;<br /> <br /> sensitivity_clause ::= on sensitivity_list<br /> sensitivity_list ::= signal_name { , signal_name }<br /> condition_clause ::= until condition<br /> condition ::= boolean_expression<br /> timeout_clause ::= for time_expression<br /> <br />b) Assertion statement:<br />An assertion statement checks that a specified condition is true and reports an error if it is not.<br /> assertion_statement ::= [ label : ] assertion ;<br /> assertion ::=<br /> assert condition<br /> [ report expression ]<br /> [ severity expression ]<br />c) Report statement:<br />A report statement displays a message.<br /> report_statement ::=<br /> [ label : ]<br /> report expression<br /> [ severity expression ] ;<br />d) If statement:<br />An if statement selects for execution one or none of the enclosed sequences of statements, depending on the value of one or more corresponding conditions.<br />if_statement ::=<br /> [ if_label : ]<br /> if condition then<br /> sequence_of_statements<br /> { elsif condition then<br /> sequence_of_statements }<br /> [ else<br /> sequence_of_statements ]<br />end if [ if_label ] ;<br />If a label appears at the end of an if statement, it must repeat the if label.<br />For the execution of an if statement, the condition specified after if, and any conditions specified after elsif, are evaluated in succession (treating a final else as elsif TRUE then) until one evaluates to TRUE or all conditions are evaluated and yield FALSE. If one condition evaluates to TRUE, then the corresponding sequence of statements is executed; otherwise, none of the sequences of statements is executed.<br />e) Case statement:<br />A case statement selects for execution one of a number of alternative sequences of statements; the chosen alternative is defined by the value of an expression.<br />case_statement ::=<br />[ case_label : ] <br /> case expression is<br /> case_statement_alternative<br /> { case_statement_alternative }<br /> end case [ case_label ] ;<br />case_statement_alternative ::=<br />when choices =><br />sequence_of_statements<br />The expression must be of a discrete type, or of a one-dimensional array type whose element base type is a character type. This type must be determinable independently of the context in which the expression occurs, but using the fact that the expression must be of a discrete type or a one-dimensional character array type. Each choice in a case statement alternative must be of the same type as the expression; the list of choices specifies for which values of the expression the alternative is chosen.<br />f) Loop statement:<br />A loop statement includes a sequence of statements that is to be executed repeatedly, zero or more times.<br /> loop_statement ::=<br /> [ loop_label : ]<br /> [ iteration_scheme ] loop<br /> sequence_of_statements<br /> end loop [ loop_label ] ;<br />iteration_scheme ::=<br /> while condition<br /> | for loop_parameter_specification<br />parameter_specification ::=<br />identifier in discrete_range<br />g) Next statement:<br />A next statement is used to complete the execution of one of the iterations of an enclosing loop statement (called loop in the following text). The completion is conditional if the statement includes a condition.<br /> next_statement ::=<br /> [ label : ] next [ loop_label ] [ when condition ] ;<br />h) Exit statement:<br />An exit statement is used to complete the execution of an enclosing loop statement (called loop in the following text). The completion is conditional if the statement includes a condition.<br /> exit_statement ::=<br /> [ label : ] exit [ loop_label ] [ when condition ] ;<br /> <br />i) Return statement:<br />A return statement is used to complete the execution of the innermost enclosing function or procedure body<br />.return_statement ::=<br /> [ label : ] return [ expression ] ;<br />j) Null statement:<br /> <br />A null statement performs no action.<br />null_statement ::=<br />[ label : ] null ;<br />3.8 Data Flow Modeling:<br />The various forms of concurrent statements are described in this section. Concurrent statements are used to define interconnected blocks and processes that jointly describe the overall behavior or structure of a design. Concurrent statements execute asynchronously with respect to each other.<br />3.8.1 Block statement:<br />A block statement defines an internal block representing a portion of a design. Blocks may be hierarchically nested to support design decomposition.<br />block_statement ::=<br /> block_label :<br /> block [ ( guard_expression ) ] [ is ]<br /> block_header<br /> block_declarative_part<br /> begin<br /> block_statement_part<br /> end block [ block_label ] ;<br />If a guard expression appears after the reserved word block, then a signal with the simple name GUARD of predefined type BOOLEAN is implicitly declared at the beginning of the declarative part of the block, and the guard expression defines the value of that signal at any given time (see 12.6.4). The type of the guard expression must be type BOOLEAN. Signal GUARD may be used to control the operation of certain statements within the block (see 9.5).<br />3.8.2 Concurrent procedure call statements:<br />A concurrent procedure call statement represents a process containing the corresponding sequential procedure call statement.<br />concurrent_procedure_call_statement ::=<br /> [ label : ] [ postponed ] procedure_call ;<br />For any concurrent procedure call statement, there is an equivalent process statement. The equivalent process statement is a postponed process if and only if the concurrent procedure call statement includes the reserved word postponed.<br />3.8.3 Concurrent assertion statements:<br />A concurrent assertion statement represents a passive process statement containing the specified assertion statement.<br /> concurrent_assertion_statement ::=<br /> [ label : ] [ postponed ] assertion ;<br />3.8.4 Concurrent signal assignment statements<br /> A concurrent signal assignment statement represents an equivalent process statement that assigns values to signals.<br /> concurrent_signal_assignment_statement ::=<br /> [ label : ] [ postponed ] conditional_signal_assignment<br /> | [ label : ] [ postponed ] selected_signal_assignment<br />3.8.5 Conditional signal assignments:<br />The conditional signal assignment represents a process statement in which the signal transform is an if statement.<br /> target <= options waveform1 when condition1 else<br /> waveform2 when condition2 else<br /> waveform3 when condition3 else<br /> --------------<br /> ---------------<br /> waveformN-1 when condition-1 else<br /> waveformN when conditionN;<br />3.8.6 Selected signal assignments:<br />The selected signal assignment represents a process statement in which the signal transform is a case statement.<br /> with expression select<br /> target <= options waveform1 when choice_list1 ,<br /> waveform2 when choice_list2 ,<br /> waveform3 when choice_list3,<br /> --------------<br /> ---------------<br /> waveformN-1 when choice_listN-1,<br /> waveformN when choice_listN ;<br /> 3.9 Structural Modeling:<br /> 3.9.1 Component declarations:<br /> A component declaration declares a virtual design entity interface that may be used in a component instantiation statement. A component configuration or a configuration specification can be used to associate a component instance with a design entity that resides in a library. <br /> component_declaration ::=<br /> component identifier [ is ]<br /> [ local_generic_clause ]<br /> [ local_port_clause ]<br /> end component [ component_simple_name ] ;<br />Each interface object in the local generic clause declares a local generic. Each interface object in the local port clause declares a local port.If a simple name appears at the end of a component declaration, it must repeat the identifier of the component declaration.<br />3.9.2 Component instantiation statements:<br />A component instantiation statement defines a subcomponent of the design entity in which it appears, associates signals or values with the ports of that subcomponent, and associates values with generics of that subcomponent. This subcomponent is one instance of a class of components defined by a corresponding component declaration, design entity, or configuration declaration.<br />component_instantiation_statement ::=<br /> instantiation_label :<br /> instantiated_unit<br /> [ generic_map_aspect ]<br /> [ port_map_aspect ] ;<br />instantiated_unit ::=<br /> [ component ] component_name<br /> | entity entity_name [ ( architecture_identifier ) ]<br />| configuration configuration_name<br /> <br /> <br />CHAPTER 4<br />DESIGN OF HARDWARE MODEL<br /><ul><li>4.1 CONVOLUTION</li></ul>Convolution is an important tool in data processing, in particular in digital signal and image processing. Many image processing operations such as scaling and rotation require re-sampling or convolution filtering for each pixel in the image Digital images can be modified (through convolution) by neighborhood operations; these operations go beyond point wise operations, and include smoothing, sharpening, and edge detection. Convolution has many applications which have great significance in discrete signal processing. It is usually difficult to deal with analog signals. Hence signals are converted to digital state. <br />Many approaches have been attempted to reduce the convolution processing time using hardware and software algorithms but they are restricted to specific applications. The main problem in implementing and computing convolution is speed, area and power which affect any DSP system. Speeding up convolution using a Hardware Description Language for design entry not only increases (improves) the level of abstraction, but also opens new possibilities for using programmable devices. <br />Today, most DSPs suffer from limitations in available address space, or the ability to interface with surrounding systems. The use of high speed field programmable gate arrays i.e. FPGAs, together with DSPs, can often increase the system bandwidth, by providing additional functionality to the general purpose DSPs .In this project, a novel method for computing the linear convolution of two finite length sequences is presented. A 4x4 convolution circuit can be instantiated for larger ones. This method is similar to the multiplication of two decimal numbers, this similarity that makes this method easy to learn and quick to computes.<br />4.2 CONVOLUTION IN TIME DOMAIN<br />When two signals convolution is carried out in time domain it is referred to as convolution in time domain. We are dealing with convolution in time domain in this project. In time domain also the convolution can be continuous or discrete. When the convolution is in time domain is discrete then it is called as convolution in discrete time and when the convolution is performed with respect to continuous time it is called as convolution as convolution in continuous time. Convolution in discrete and continuous time are described in previous chapter. <br />4.3 CONVOLUTION IN FREQUENCY DOMAIN<br />When two signals are convolved in frequency domain then it is called as convolution in frequency domain. It is proved that the convolution in time domain is equivalent to multiplication in frequency domain.<br />Proof:<br />Let f, g belong to L1 (Rn). Let F be the Fourier transform of f and G be the Fourier transform of g:<br />Where the dot between x and ν indicates the inner product of Rn . Let h be the convolution of f and g<br />lefttop<br />Now notice that,<br />Hence by Fubini's theorem we have that so its Fourier transform H is defined by the integral formula<br />Observe that and hence by the argument above we may apply Fubini's theorem again:<br />Substitute y = z − x; then dy = dz, so:<br />These two integrals are the definitions of F(ν) and G(ν), so:<br />Hence, it is proved that the convolution in time domain is equivalent to multiplication in frequency domain.<br />4.4 GENERAL IMPLEMENTATION FLOW<br />The generalized implementation flow diagram of the project is represented as follows:<br /> FIGURE 4.1: GENERAL IMPLEMENTATION FLOW DIAGRAM.<br />Initially the market research should be carried out which covers the previous version of the design and the current requirements on the design. Based on this survey, the specification and the architecture must be identified. Then the RTL modelling should be carried out in VERILOG HDL with respect to the identified architecture. Once the RTL modelling is done, it should be simulated and verified for all the cases. The functional verification should meet the intended architecture and should pass all the test cases. <br />Once the functional verification is clear, the RTL model will be taken to the synthesis process. Three operations will be carried out in the synthesis process such as <br />Translate<br />Map<br />Place and Route<br />The developed RTL model will be translated to the mathematical equation format which will be in the understandable format of the tool. These translated equations will be then mapped to the library that is, mapped to the hardware. Once the mapping is done, the gates were placed and routed. Before these processes, the constraints can be given in order to optimize the design. Finally the BIT MAP file will be generated that has the design information in the binary format which will be dumped in the FPGA board. <br />4.5 IMPLEMENTATION<br />In this project the implementation is carried out by first designed the individual blocks and then these are combined to the final architecture. The individual blocks are shown in block diagram given in the next page.<br />4.5.1 Block diagram<br />The block diagram of the proposed architecture is shown below:<br />FIGURE 4.2: Block Diagram Of Architecture.<br /> Multiplexer 4*1 and 8*1:<br />A multiplexer, sometimes referred to as a "multiplexor" or simply "mux", is a device that selects between a number of input signals. In its simplest form, a multiplexer will have two signal inputs, one control input, and one output.<br />A multiplexer is a device which selects any one of the inputs from 2n inputs and directed to output depending on n-select lines.<br />FIGURE 4.3: 4*1 Multiplexer<br />FIGURE 4.4: 8*1 Mutiplexer.<br />The higher order multiplexers can be implemented using the lower order multiplexers. The 4*1 multiplexer can be implemented using two 2*1 multiplexers and so on. Similarly an 8*1 multiplexer can be implemented using two 4*1 multiplexers.<br /> Serial in parallel out block:<br />A serial-in/parallel-out shift register is similar to the serial-in/ serial-out shift register in that it shifts data into internal storage elements and shifts data out at the serial-out, data-out, pin . It is different in that it makes all the internal stages available as outputs. Therefore, a serial in/parallel-out shift register converts data from serial format to parallel format. If four data bits are shifted in by four clock pulses via a single wire at data-in, below, the data becomes available simultaneously on the four Outputs QA to QD after the fourth clock pulse.<br />FIGURE 4.5: SIPO Shift Register block.<br />The practical application of the serial-in/parallel-out shift register is to convert data from serial format on a single wire to parallel format on multiple wires. Perhaps, we will illuminate four LEDs (Light Emitting Diodes) with the four outputs (QA QB QC QD ).<br />FIGURE 4.6: SIPO inner architecture.<br /> The above details of the serial-in/parallel-out shift register are fairly simple. It looks like a serial-in/ serial-out shift register with taps added to each stage output. Serial data shifts in at SI (Serial Input). After a number of clocks equal to the number of stages, the first data bit in appears at SO (QD) in the above figure. In general, there is no SO pin. The last stage (QD above) serves as SO and is cascaded to the next package if it exists.<br />FIGURE 4.7: SIPO Waveforms.<br />The shift register has been cleared prior to any data by CLR', an active low signal, which clears all type D Flip-Flops within the shift register. Note the serial data 1011 pattern presented at the SI input. This data is synchronized with the clock CLK. This would be the case if it is being shifted in from something like another shift register, for example, a parallel-in/ serial-out shift register (not shown here). On the first clock at t1, the data 1 at SI is shifted from D to Q of the first shift register stage. After t2 this first data bit is at QB. After t3 it is at QC. After t4 it is at QD. Four clock pulses have shifted the first data bit all the way to the last stage QD. The second data bit a 0 is at QC after the 4th clock. The third data bit a 1 is at QB. The fourth data bit another 1 is at QA. Thus, the serial data input pattern 1011 is contained in (QD QC QB QA). It is now available on the four outputs.<br />It will available on the four outputs from just after clock t4 to just before t5. This parallel data must be used or stored between these two times, or it will be lost due to shifting out the QD stage on following clocks t5 to t8 as shown above.<br /> Binary multiplier:<br />The binary multiplier used here is a 4-bit multiplier which takes two four bit inputs and gives an 8-bit output.<br />FIGURE 4.8: Binary Multiplier.<br />The binary multiplier which is employed in convolution here in the present project has a special characteristic that the internal carry will not be forwarded to next stage. So the number of outputs obtained here is seven only because in binary multiplier the MSB part is nothing but the carry obtained from the second MSB so as carry is not forwarded only seven bits will be obtained as output.<br /> Register:<br />A circuit with flip-flops is considered a sequential circuit even in the absence of Combinational logic. Circuits that include flip-flops are usually classified by the function they perform. Two such circuits are registers and counters. <br />A Register is a group of flip-flops. Its basic function is to hold information within a digital system so as to make it available to the logic units during the computing process. However, a register may also have additional capabilities associated with it. It may have combinational gates that perform certain data-processing tasks.<br /> <br /> <br />FIGURE 4.9: An 8-bit Register.<br />Various types of registers are available on the market. A simple 4-bit register is shown below. The common clock input triggers all flip-flops and the <br />binary data available at the four inputs are transferred into the register. The clear input is useful for clearing the register to all 0’s output. <br />Registers capable of shifting their binary contents in one or both directions.A unidirectional 4-bit shift register that uses only flip-flops is as follows: <br />FIGURE 4.10: Shift Register.<br />CHAPTER 5<br />RESULTS AND DISCUSSIONS<br /> 5.1 INTRODUCTION TO MODEL SIMULATOR:<br /> 5.1.1 Basic Simulation Flow<br />The following diagram shows the basic steps for simulating a design in ModelSim.<br />FIGURE 5.1: Basic Simulation Flow - Overview Lab.<br />In ModelSim, all designs are compiled into a library. You typically start a new simulation in ModelSim by creating a working library called "work". "Work" is the library name used by the compiler as the default destination for compiled design units.<br />Compiling Your Design:<br />After creating the working library, you compile your design units into it. The ModelSim library format is compatible across all supported platforms. You can simulate your design on any platform without having to recompile your design.<br />Loading the Simulator with Your Design and Running the Simulation With the design compiled, you load the simulator with your design by invoking the simulator on a top-level module (Verilog) or a configuration or entity/architecture pair (VHDL). Assuming the design loads successfully, the simulation time is set to zero, and you enter a run command to begin simulation.<br />Debugging Your Results<br />If you don’t get the results you expect, you can use ModelSim’s robust debugging environment to track down the cause of the problem.<br />5.1.2 Project Flow<br />A project is a collection mechanism for an HDL design under specification or test. Even though you don’t have to use projects in ModelSim, they may ease interaction with the tool and are useful for organizing files and specifying simulation settings.<br /> The following diagram shows the basic steps for simulating a design within a ModelSim project.<br />FIGURE 5.2: Project Design Flow.<br />As you can see, the flow is similar to the basic simulation flow. However, there are two important differences:<br />You do not have to create a working library in the project flow; it is done for you automatically.<br />Projects are persistent. In other words, they will open every time you invoke ModelSim unless you specifically close them.<br />5.1.3 Multiple Library Flow<br />ModelSim uses libraries in two ways: <br />1) As a local working library that contains the compiled version of your design; <br />2) As a resource library. <br />The contents of your working library will change as you update your design and recompile. A resource library is typically static and serves as a parts source for your design. You can create your own resource libraries, or they may be supplied by another design team or a third party (e.g., a silicon vendor).<br />You specify which resource libraries will be used when the design is compiled, and there arerules to specify in which order they are searched. A common example of using both a working library and a resource library is one where your gate-level design and testbench are compiled into the working library, and the design references gate-level models in a separate resource library.The diagram below shows the basic steps for simulating with multiple libraries.<br />FIGURE 5.3: Multiple Library Flow.<br /> Debugging Tools<br />ModelSim offers numerous tools for debugging and analyzing your design. Several of these tools are covered in subsequent lessons, including:<br /> Using projects<br />  Working with multiple libraries<br />  Setting breakpoints and stepping through the source code<br /> Viewing waveforms and measuring time<br /> Viewing and initializing memories<br /> Creating stimulus with the Waveform Editor<br />  Automating simulation<br />5.1.4 Basic Simulation<br /> <br />FIGURE 5.4: Basic Simulation Flow - Simulation Lab.<br /> Design Files for this Lesson<br />The sample design for this lesson is a simple 8-bit, binary up-counter with an associated Test bench. The pathnames are as follows:<br />Verilog – <install_dir>/examples/tutorials/verilog/basicSimulation/counter.v and tcounter.v<br />VHDL – <install_dir>/examples/tutorials/vhdl/basicSimulation/counter.vhd and tcounter.vhd<br />This lesson uses the Verilog files counter.v and tcounter.v. If you have a VHDL license, use<br />counter.vhd and tcounter.vhd instead. Or, if you have a mixed license, feel free to use the<br />Verilog testbench with the VHDL counter or vice versa.<br />5.1.5 Create the Working Design Library<br />Before you can simulate a design, you must first create a library and compile the source code into that library.<br />1. Create a new directory and copy the design files for this lesson into it.<br />Start by creating a new directory for this exercise (in case other users will be working with these lessons).<br />Verilog: Copy counter.v and tcounter.v files from<br />/<install_dir>/examples/tutorials/verilog/basicSimulation to the new directory.<br />VHDL: Copy counter.vhd and tcounter.vhd files from<br />/<install_dir>/examples/tutorials/vhdl/basicSimulation to the new directory.<br />2. Start ModelSim if necessary.<br />a) Type vsim at a UNIX shell prompt or use the ModelSim icon in Windows. Upon opening ModelSim for the first time, you will see the Welcome to ModelSim dialog. Click Close.<br />b) Select File > Change Directory and change to directory you created in step 1.<br />3. Create the working library.<br />a) Select File > New > Library.<br />This opens a dialog where you specify physical and logical names for the library (Figure 5.5). You can create a new library or map to an existing library. We’ll be doing the former.<br />FIGURE 5.5: The Create a New Library Dialog.<br />b) Type work in the Library Name field (if it isn’t already entered automatically).<br />c) Click OK.<br />ModelSim creates a directory called work and writes a specially-formatted file named _info into that directory. The _info file must remain in the directory to distinguish it as a ModelSim library. Do not edit the folder contents from your operating system; all changes should be made from within ModelSim. ModelSim also adds the library to the list in the Workspace (Figure 5.6) and records the library mapping for future reference in the ModelSim initialization file (modelsim.ini).<br />FIGURE 5.6: Work Library in the Workspace.<br />When you pressed OK in step 3c above, the following was printed to the Transcript:<br />vlib work<br />vmap work work<br />These two lines are the command-line equivalents of the menu selections you made. Many<br />command-line equivalents will echo their menu-driven functions in this fashion.<br />5.1.6 Compile the Design<br />With the working library created, you are ready to compile your source files.You can compile by using the menus and dialogs of the graphic interface, as in the Verilog example below, or by entering a command at the ModelSim> prompt.<br />1. Compile counter.v and tcounter.v.<br />a) Select Compile > Compile. This opens the Compile Source Files dialog (Figure 5.7).<br />If the Compile menu option is not available, you probably have a project open. If so, close the project by making the Workspace pane active and selecting File > Close from the menus.<br />b) Select both counter.v and tcounter.v modules from the Compile Source Files dialog and click Compile. The files are compiled into the work library. c. When compile is finished, click Done.<br />FIGURE 5.7: Compile Source Files Dialog.<br />2. View the compiled design units.<br />a) On the Library tab, click the ’+’ icon next to the work library and you will see two design units (Figure 3-5). You can also see their types (Modules, Entities, etc.) and the path to the underlying source files (scroll to the right if necessary).<br />b) Double-click test_counter to load the design.<br />You can also load the design by selecting Simulate > Start Simulation in the menu bar. This opens the Start Simulation dialog. <br />With the Design tab selected, click the ’+’ sign next to the work library to see the counter and test_counter modules. <br />Select the test_counter module and click OK (Figure 5.8). <br />FIGURE 5.8: Loading Design with Start Simulation Dialog.<br />When the design is loaded, you will see a new tab in the Workspace named sim that displays the hierarchical structure of the design (Figure 4-8). You can navigate within the hierarchy by clicking on any line with a ’+’ (expand) or ’-’ (contract) icon. You will also see a tab named Files that displays all files included in the design.<br />FIGURE 5.9: VHDL Modules Compiled into work Library.<br />5.1.7 Load the Design<br />1. Load the test_counter module into the simulator.<br />a) In the Workspace, click the ‘+’ sign next to the work library to show the files contained there.<br />FIGURE 5.10: Workspace sim Tab Displays Design Hierarchy.<br />2. View design objects in the Objects pane.<br />a) Open the View menu and select Objects. The command line equivalent is: view objects<br />The Objects pane (Figure 3-8) shows the names and current values of data objects in the current region (selected in the Workspace). Data objects include signals, nets, registers, constants and variables not declared in a process, generics, parameters.<br />FIGURE 5.11: Object Pane Displays Design Objects.<br />You may open other windows and panes with the View menu or with the view command. See Navigating the Interface.<br />5.1.8 Run the Simulation<br />Now you will open the Wave window, add signals to it, then run the simulation.<br />1. Open the Wave debugging window.<br />a) Enter view wave at the command line<br />You can also use the View > Wave menu selection to open a Wave window. The Wave window is one of several windows available for debugging. To see a list of the other debugging windows, select the View menu. You may need to move or resize the windows to your liking. Window panes within the Main window can be zoomed to occupy the entire Main window or undocked to stand alone. For details, see Navigating the Interface.<br />2. Add signals to the Wave window.<br />a) In the Workspace pane, select the sim tab.<br />b) Right-click test_counter to open a popup context menu.<br />c) Select Add > To Wave > All items in region (Figure 3-9).<br />All signals in the design are added to the Wave window.<br />FIGURE 5.12: Using the Popup Menu to Add Signals to Wave Window.<br />3. Run the simulation.<br />a) Click the Run icon in the Main or Wave window toolbar.<br />The simulation runs for 100 ns (the default simulation length) and waves are <br />drawn in the Wave window.<br />b) Enter run 500 at the VSIM> prompt in the Main window.<br />The simulation advances another 500 ns for a total of 600 ns .<br />FIGURE 5.13: Waves Drawn in Wave Window.<br />c) Click the Run -All icon on the Main or Wave window toolbar.<br />The simulation continues running until you execute a break command or it <br />hits a statement in your code (e.g., a Verilog $stop statement) that halts the<br />simulation.<br />d) Click the Break icon. The simulation stops running.<br />5.2 INTRODUCTION TO SIMULATION:<br />The Convolution process and the developed architecture for the required functionality were discussed in the previous chapters. Now this chapter deals with the simulation and synthesis results of the Convolution process. Here Modelsim tool is used in order to simulate the design and checks the functionality of the design. Once the functional verification is done, the design will be taken to the Xilinx tool for Synthesis process and the netlist generation.<br />The Appropriate test cases have been identified in order to test this modelled Convolution process architecture. Based on the identified values, the simulation results which describes the operation of the process has been achieved. This proves that the modelled design works properly as per its functionality. <br />5.3 SIMULATION RESULTS:<br />5.3.1 Convolution toplevel: <br />FIGURE 5.14: Convolution Waveform on Wave Window.<br />5.4 INDIVIDUAL MODULES:<br />5.4.1 Multiplexers: <br /> FIG 5.15: 4*1 MUX Waveform on Wave Window.<br />5.4.2 SIPO’s: <br />FIGURE 5.16: SIPO Waveform on Wave Window.<br />5.4.3 Binary Multiplier: <br />FIGURE 5.17: Binary Multiplier waveform on Wave Window.<br />5.4.4 Multiplexer 8*1: <br />FIGURE 5.18: 8*1 MUX Waveform on Wave Window.<br />5.4.5 Register:<br />FIGURE 5.19: Register Waveform on Wave Window.<br />5.5 INTRODUCTION TO FPGA:<br />FPGA stands for Field Programmable Gate Array which has the array of logic module, I /O module and routing tracks (programmable interconnect). FPGA can be configured by end user to implement specific circuitry. Speed is up to 100 MHz but at present speed is in GHz. <br />Main applications are DSP, FPGA based computers, logic emulation, ASIC and ASSP. FPGA can be programmed mainly on SRAM (Static Random Access Memory). It is Volatile and main advantage of using SRAM programming technology is re-configurability. Issues in FPGA technology are complexity of logic element, clock support, IO support and interconnections (Routing). <br />In this work, design of a DWT and IDWT is made using Verilog HDL and is synthesized on FPGA family of Spartan 3E through XILINX ISE Tool. This process includes following:<br />Translate<br />Map<br />Place and Route<br />5.5.1 FPGA Flow<br />The basic implementation of design on FPGA has the following steps.<br />Design Entry<br />Logic Optimization<br />Technology Mapping<br />Placement<br />Routing<br />Programming Unit<br />Configured FPGA<br />Above shows the basic steps involved in implementation. The initial design entry of may be Verilog HDL, schematic or Boolean expression. The optimization of the Boolean expression will be carried out by considering area or speed. <br />FIGURE 5.20: Logic Block<br />In technology mapping, the transformation of optimized Boolean expression to FPGA logic blocks, that is said to be as Slices. Here area and delay optimization will be taken place. During placement the algorithms are used to place each block in FPGA array. Assigning the FPGA wire segments, which are programmable, to establish connections among FPGA blocks through routing. The configuration of final chip is made in programming unit.<br />5.6 XILINX DESIGN FLOW<br />The first step involved in implementation of a design on FPGA involves System Specifications. Specifications refer to kind of inputs and kind of outputs and the range of values that the kit can take in based on these Specifications. After the first step system specifications the next step is the Architecture. Architecture describes the interconnections between all the blocks involved in our design. Each and every block in the Architecture along with their interconnections is modeled in either VHDL or Verilog depending on the ease. All these blocks are then simulated and the outputs are verified for correct functioning. <br />FIGURE 5.21: Xilinx Implementation Design Flow-Chart.<br />After the simulation step the next steps i.e., Synthesis. This is a very important step in knowing whether our design can be implemented on a FPGA kit or not. Synthesis converts our VHDL code into its functional components which are vendor specific. After performing synthesis RTL schematic, Technology Schematic and generated and the timing delays are generated. The timing delays will be present in the FPGA if the design is implemented on it. Place & Route is the next step in which the tool places all the components on a FPGA die for optimum performance both in terms of areas and speed. We also see the interconnections which will be made in this part of the implementation flow.<br />In post place and route simulation step the delays which will be involved on the FPGA kit are considered by the tool and simulation is performed taking into consideration these delays which will be present in the implementations on the kit. Delays here mean electrical loading effect, wiring delays, stray capacitances.<br />After post place and route, comes generating the bit-map file, which means converting the VHDL code into bit streams which is useful to configure the FPGA kit. A bit file is generated this step is performed. After this comes final step of downloading the bit map file on to the FPGA board which is done by connecting the computer to FPGA board with the help of JTAG cable (Joint Test Action Group) which is an IEEE standard. The bit map file consist the whole design which is placed on the FPGA die, the outputs can now be observed from the FPGA LEDs. This step completes the whole process of implementing our design on an FPGA.<br />5.7 XILINX ISE 10.1 SOFTWARE <br />5.7.1 Introduction<br />Xilinx ISE (Integrated Software Environment) 9.2i software is from XILINX company, which is used to design any digital circuit and implement onto a Spartan-3E FPGA device. XILINX ISE 9.2i software is used to design the application, verify the functionality and finally download the design on to a Spartan-3E FPGA device.<br />5.7.2 Xilinx ISE 10.1 software tools<br /> SIMULATION : ISE (Integrated Software Environment) Simulator<br />SYNTHESIS, PLACE & POUTE : XST (Xilinx Synthesis Technology) Synthesizer<br />5.7.3 Design steps using Xilinx ISE 10.1<br />Create an ISE PROJECT for particular embedded system application.<br />Write the assembly code in notepad or write pad and generate the verilog or vhdl module by making use of assembler.<br />Check syntax for the design.<br />Create verilog test fixture of the design.<br />Simulate the test bench waveform (BEHAVIORAL SIMULATION) for functional verification of the design using ISE simulator.<br />Synthesize and implement the top level module using XST synthesizer. <br />5.8 SYNTHESIS RESULT<br />The developed convolution project is simulated and verified their functionality. Once the functional verification is done, the RTL model is taken to the synthesis process using the Xilinx ISE tool. In synthesis process, the RTL model will be converted to the gate level net-list mapped to a specific technology library. Here in this Spartan 3E family, many different devices were available in the Xilinx ISE tool.The target device is SPARTAN 2 FPGA kit.In order to synthesis this design the device named as “XC3S100E” has been chosen and the package as “TQ144” with the device speed such as “5”.<br />5.8.1 Synthesis Results<br />The developed convolution project is simulated and verified their functionality. Once the functional verification is done, the RTL model is taken to the synthesis process using the Xilinx ISE tool. In synthesis process, the RTL model will be converted to the gate level netlist mapped to a specific technology library. Here in this Spartan 3E family, many different devices were available in the Xilinx ISE tool. In order to synthesis this design the device named as “XC3S500E” has been chosen and the package as “FG320” with the device speed such as “-4”.<br />This design is synthesized and its results were analyzed as follows.<br /> <br />FIGURE 5.22 :Design or pin diagram.<br />FIGURE 5.23: Synthesis Result 1.<br />FIGURE 5.24: Synthesis Result 2.<br />PROGRAM CODES FOR INDIVIDUAL MODULES<br />Program for 4*1 Mux:<br />LIBRARY IEEE;<br />USE IEEE.STD_LOGIC_1164.ALL;<br />USE IEEE.STD_LOGIC_ARITH.ALL;<br />USE IEEE.STD_LOGIC_SIGNED.ALL;<br />entity MUX41 is<br /> port(CLK,RST:in std_logic;<br /> LOAD:BUFFER std_logic;<br /> S1:in std_logic_vector(1 downto 0);<br /> IN0,IN1,IN2,IN3:in std_logic_vector (3 downto 0);<br /> PO:out std_logic_vector(3 downto 0));<br />end entity;<br />Program for SIPO:<br />LIBRARY IEEE;<br />USE IEEE.STD_LOGIC_1164.ALL;<br />USE IEEE.STD_LOGIC_ARITH.ALL;<br />USE IEEE.STD_LOGIC_SIGNED.ALL;<br />entity SIPO is<br /> port(CLK,L:in std_logic;<br /> SIN:in std_logic_vector(3 downto 0);<br /> POUT0,POUT1,POUT2,POUT3:buffer std_logic_vector(3 downto 0));<br />end entity;<br />architecture SIPO of SIPO is<br /> type ARR is array(3 downto 0)of std_logic_vector(3 downto 0);<br /> signal MEM:ARR;<br /> signal COUNT: integer range 0 to 4;<br />begin<br /> process(CLK,L,SIN)is<br /> --variable COUNT: integer range 0 to 4;<br /> begin<br /> <br /> if(L='0')then<br /> COUNT<=0;<br /> POUT0<=(others=>'0');<br /> POUT1<=(others=>'0');<br /> POUT2<=(others=>'0');<br /> POUT3<=(others=>'0');<br /> MEM<=(others=>(others=>'0'));<br /> else<br /> if(CLK'EVENT and CLK='1')then<br /> if(COUNT<=3)then<br /> MEM(COUNT)<=SIN;<br /> COUNT<=COUNT + 1;<br /> else<br /> POUT0<=MEM(0);<br /> POUT1<=MEM(1);<br /> POUT2<=MEM(2);<br /> POUT3<=MEM(3);<br /> end if;<br /> end if;<br /> end if;<br /> end process;<br /> end SIPO;<br />Program for Binary Multiplier:<br />LIBRARY IEEE;<br />USE IEEE.STD_LOGIC_1164.ALL;<br />USE IEEE.STD_LOGIC_ARITH.ALL;<br />USE IEEE.STD_LOGIC_SIGNED.ALL;<br />entity MUL IS<br /> PORT(CLK,RST:in std_logic;<br /> LD:buffer std_logic;<br /> A0,A1,A2,A3,B0,B1,B2,B3:in std_logic_vector(3 downto 0);<br /> S0,S1,S2,S3,S4,S5,S6:out std_logic_vector(7 downto 0));<br />end entity;<br />architecture M of MUL is<br />Signal S11,S12,S13,S14,S21,S22,S23,S24,S31,S32,S33,S34,S41,S42,S43,S44:std_logic_vector(7 downto 0);<br />--signal SX0,SX1,SX2,SX3,SX4,SX5,SX6: signed(7 downto 0);<br />Begin<br /> S11<=A0*B0;<br /> S12<=A1*B0;<br /> S13<=A2*B0;<br /> S14<=A3*B0;<br /> <br /> S21<=A0*B1;<br /> S22<=A1*B1;<br /> S23<=A2*B1;<br /> S24<=A3*B1<br /> S31<=A0*B2;<br /> S32<=A1*B2;<br /> S33<=A2*B2;<br /> S34<=A3*B2;<br /> <br /> S41<=A0*B3;<br /> S42<=A1*B3;<br /> S43<=A2*B3;<br /> S44<=A3*B3;<br /> <br />process(CLK,RST,A0,A1,A2,A3,B0,B1,B2,B3)is<br /> begin<br /> if(CLK'EVENT and CLK='1')then<br /> if(RST='0')then<br /> S0<="00000000";<br /> S1<="00000000";<br /> S2<="00000000";<br /> S3<="00000000";<br /> S4<="00000000";<br /> S5<="00000000";<br /> S6<="00000000";<br /> LD<='0';<br /> else<br /> S0<=S11;<br /> S1<=S12 + S21;<br /> S2<=S13 + S22 + S31;<br /> S3<=S14 + S23 + S32 + S41;<br /> S4<=S24 + S33 + S42;<br /> S5<=S34 + S43;<br /> S6<=S44;<br /> LD<='1';<br /> end if;<br /> end if; <br /> end process;<br /> <br /> --SX0<=S11;<br /> --SX1<=S12 + S21;<br /> --SX2<=S13 + S22 + S31;<br /> --SX3<=S14 + S23 + S32 + S41;<br /> --SX4<=S24 + S33 + S42;<br /> --SX5<=S34 + S43;<br /> --SX6<=S44;<br /> <br />END; <br />Program for 8*1 Mux:<br />LIBRARY IEEE;<br />USE IEEE.STD_LOGIC_1164.ALL;<br />USE IEEE.STD_LOGIC_ARITH.ALL;<br />USE IEEE.STD_LOGIC_SIGNED.ALL;<br />entity MUX81 is<br /> port(CLK,RST:in std_logic;<br /> S2:in std_logic_vector(2 downto 0);<br /> I0,I1,I2,I3,I4,I5,I6:in std_logic_vector (7 downto 0);<br /> YO:out std_logic_vector(7 downto 0));<br />end entity;<br />architecture MUX2 of MUX81 is<br />begin<br /> process(CLK,RST,S2)is<br /> begin<br /> if(CLK'EVENT and CLK='1')then<br /> if(RST='0')then<br /> YO<="00000000";<br /> else <br /> case S2 is<br /> when "000"=>YO<=I0;<br /> when "001"=>YO<=I1;<br /> when "010"=>YO<=I2;<br /> when "011"=>YO<=I3;<br /> when "100"=>YO<=I4;<br /> when "101"=>YO<=I5;<br /> when "110"=>YO<=I6;<br /> when others=>YO<="ZZZZZZZZ";<br /> end case; <br /> end if;<br /> end if;<br /> end process;<br /> end MUX2;<br />Program for Register:<br />LIBRARY IEEE;<br />USE IEEE.STD_LOGIC_1164.ALL;<br />USE IEEE.STD_LOGIC_ARITH.ALL;<br />USE IEEE.STD_LOGIC_SIGNED.ALL;<br />entity REG8 is<br /> port(CLK,RST:in std_logic;<br /> RIN:in std_logic_vector(7 downto 0);<br /> RO:out std_logic_vector(7 downto 0));<br />end entity;<br />architecture REG of REG8 is<br />begin<br /> process(CLK,RST,RIN)is<br /> begin<br /> if(CLK'EVENT and CLK='1')then<br /> if(RST='0')then<br /> RO<="00000000";<br /> else <br /> RO<=RIN;<br /> end if;<br /> end if;<br /> end process; <br />end REG;<br />Program for Convolution:<br />LIBRARY IEEE;<br />USE IEEE.STD_LOGIC_1164.ALL;<br />USE IEEE.STD_LOGIC_ARITH.ALL;<br />USE IEEE.STD_LOGIC_SIGNED.ALL;<br />entity CONVOLUTION4 IS<br /> port(CLK,RST:in std_logic;<br /> SE1:in std_logic_vector(1 downto 0);<br /> SE2:in std_logic_vector(2 downto 0);<br /> A0,A1,A2,A3,B0,B1,B2,B3:in std_logic_vector(3 downto 0);<br /> CONVOLUTION_OUT:out std_logic_vector(7 downto 0));<br />end entity;<br /> architecture CONVOLUTION of CONVOLUTION4 is<br /> component MUX41 is<br /> port(CLK,RST:in std_logic;<br /> LOAD:BUFFER std_logic;<br /> S1:in std_logic_vector(1 downto 0);<br /> IN0,IN1,IN2,IN3:in std_logic_vector (3 downto 0);<br /> PO:out std_logic_vector(3 downto 0));<br /> end component;<br /> <br /> component SIPO is<br /> port(CLK,L:in std_logic;<br /> SIN:in std_logic_vector(3 downto 0);<br /> POUT0,POUT1,POUT2,POUT3:buffer std_logic_vector(3 downto 0));<br /> end component;<br /> component MUL IS<br /> PORT(CLK,RST:in std_logic;<br /> LD:buffer std_logic;<br /> A0,A1,A2,A3,B0,B1,B2,B3:in std_logic_vector(3 downto 0);<br /> S0,S1,S2,S3,S4,S5,S6:out std_logic_vector(7 downto 0));<br /> end component;<br /> component MUX81 is<br /> port(CLK,RST:in std_logic;<br /> S2:in std_logic_vector(2 downto 0);<br /> I0,I1,I2,I3,I4,I5,I6:in std_logic_vector (7 downto 0);<br /> YO:out std_logic_vector(7 downto 0));<br /> end component;<br /> <br /> component REG8 is<br /> port(CLK,RST:in std_logic;<br /> RIN:in std_logic_vector(7 downto 0);<br /> RO:out std_logic_vector(7 downto 0));<br /> end component;<br /> <br /> signal MX1,MX2,P01,P02,P03,P04,P11,P12,P13,P14:std_logic_vector(3downto 0);<br /> signal SM0,SM1,SM2,SM3,SM4,SM5,SM6,MO:std_logic_vector(7 downto 0);<br /> SIGNAL L1,L2,LD1:std_logic;<br /> <br /> begin<br /> M1:MUX41 port map (CLK=>CLK,<br /> RST=>RST,<br /> LOAD=>L1,<br /> S1=>SE1,<br /> IN0=>A0,<br /> IN1=>A1,<br /> IN2=>A2,<br /> IN3=>A3,<br /> PO=>MX1);<br /> <br /> M2:MUX41 port map (CLK=>CLK,<br /> RST=>RST,<br /> LOAD=>L2,<br /> S1=>SE1,<br /> IN0=>B0,<br /> IN1=>B1,<br /> IN2=>B2,<br /> IN3=>B3,<br /> PO=>MX2); <br /> <br /> <br /> SIPO1:SIPO port map(CLK=>CLK,<br /> L=>L1,<br /> SIN=>MX1,<br /> POUT0=>P01,<br /> POUT1=>P02,<br /> POUT2=>P03,<br /> POUT3=>P04);<br /> <br /> SIPO2:SIPO port map(CLK=>CLK,<br /> L=>L2,<br /> SIN=>MX2,<br /> POUT0=>P11,<br /> POUT1=>P12,<br /> POUT2=>P13,<br /> POUT3=>P14);<br /> <br /> MULT:MUL port map(CLK=>CLK,<br /> RST=>RST,<br /> LD=>LD1,<br /> A0=>P01,<br /> A1=>P02,<br /> A2=>P03,<br /> A3=>P04,<br /> B0=>P11,<br /> B1=>P12,<br /> B2=>P13,<br /> B3=>P14,<br /> S0=>SM0,<br /> S1=>SM1,<br /> S2=>SM2,<br /> S3=>SM3,<br /> S4=>SM4,<br /> S5=>SM5,<br /> S6=>SM6);<br /> <br /> MUX8:MUX81 port map (CLK=>CLK,<br /> RST=>LD1,<br /> S2=>SE2,<br /> I0=>SM0,<br /> I1=>SM1,<br /> I2=>SM2,<br /> I3=>SM3,<br /> I4=>SM4,<br /> I5=>SM5,<br /> I6=>SM6,<br /> YO=>MO);<br /> <br /> <br />REG1:REG8 port map (CLK=>CLK,<br /> RST=>RST,<br /> RIN=>MO,<br /> RO=>CONVOLUTION_OUT);<br /> <br />end CONVOLUTION; <br />CONCLUSION<br /> We presented an optimized implementation of discrete linear convolution. This particular model has the advantage of being fine tuned for signal processing; in this case it uses the mean squared error measurement and objective measures of enhancement to achieve a more effective signal processing model. This implementation has the advantage of being optimized based on operation, power and area. To accurately analyze our proposed system, we have coded our design using the Verilog hardware description language and have synthesized it for FPGA products using ISE, Modelsim and DC compiler for other processor usage.<br /> <br />The proposed circuit uses only 5mw and saves almost 35% area and it takes 20ns to complete. This shows improvement of more than 50% less power. As FPGA technology matures and much larger arrays become practical, techniques that allow the automatic generation of highly-parallel architectures will become central to high performance computing. <br />We have also described some simple techniques for generation of convolution pipelines for image processing and other applications. Higher level techniques and approaches are also needed. FPGAs permit restructurable processing, and restructurable interconnects are also becoming available.<br />4152909775825<br />FUTURE SCOPE<br />Extracting a periodic signal from noise.<br />Software Applications:<br />GUI Module.<br />Echo Detection in Linear acoustics.<br />Speech Analysis and pitch.<br />In time-resolved Fluorescence Spectroscopy.<br />In Radiotherapy treatment planning systems , most part of all modern codes can use convolution.<br />In Computational fluid Dynamics.<br />In digital image processing , convolutional filtering plays an important role in many important algorithms in edge detection and related processes.<br />In Optics, many kinds of "blur" are described by convolutions.<br />In Probability theory.<br />In kernel density estimation, a distribution is estimated from sample points by convolution with a kernel, such as an isotropic Gaussian.<br />REFERENCES<br />Bracewell, R. (1986), The Fourier Transform and Its Applications (2nd ed.), McGraw–Hill, ISBN 0071160434.<br />Hörmander, L. (1983), The analysis of linear partial differential operators I, Grundl. Math. Wissenschaft., 256, Springer, ISBN 3-540-12104-8, MR0717035<br />Knuth, Donald (1997), Seminumerical Algorithms (3rd. ed.), Reading, Massachusetts: Addison–Wesley, ISBN 0-201-89684-2<br />Sobolev, V.I. (2001), "Convolution of functions", in Hazewinkel, Michiel, Encyclopaedia of Mathematics, Springer, ISBN 978-1556080104.<br />John W. Pierre, “A Novel Method for Calculating the Convolution Sum of Two Finite Length Sequences”, IEEE transaction on education, VOL.39, NO. 1, 1996.<br />W. W. Smith, J. M. Smith, “Handbook f Real-Time Fast Fourier Transforms”, IEEE Press, 1995, p. 28.<br />R. G. Shoup, “Parameterized convolution filtering in a field programmable gate array,” in selected papers from the Oxford 1993 international workshop on field programmable logic and applications on More FPGAs. Oxford, United Kingdom: Abingdon EE&CS Books,1994, pp. 274–280.<br />Iván Rodríguez, “Parallel Cyclic Convolution Based on Recursive Formulations of Block Pseudocirculant MatricesMarvi Teixeira”, IEEE, transaction on signal processing,2008<br />Thomas Oelsner ,“Implementation of Data Convolution Algorithms in FPGAs”,QuickLogicEurope .<br />Chao Cheng , Keshab K. Parhi ,“Low-Cost Fast VLSI Algorithm for Discrete Fourier Transform”, IEEE,. IEEE transaction on circuits and systems, VOL. 54, 2007<br />J. I. Guo, C. M. Liu, and C. W. Jen, “The efficient memory-based VLSI array designs for DFT and DCT,” IEEE Trans. Circuits Syst. II, Analog Digit. Signal Process., vol. 37, no. 10, 1992, pp. 723–733.<br />