TECH FEATURE
Digital Signal Processing
Automating the DSP Implementation Environment
Developing fixed-point DSP algorithms from floating-point tool environments can be a tedious and error-prone process. New techniques can streamline accurate and efficient conversion.
NIRAJ SHAH, CATALYTIC
Digital signal processing is at the core of virtually any product that features the word “digital” as an adjective. At the time of this writing, the market for digital signal processors is $16.4 billion per year and growing at a 25 percent compound annual growth rate (CAGR), which makes this segment one of the fastest growing processor markets.
Despite this explosive growth, however, the processes used for designing, exploring and implementing digital signal processing (DSP) algorithms lack automation in several critical steps in the development process. Yet some technologies are emerging that are able to provide a means of streamlining DSP algorithm development.
Problems with Existing DSP Design Flows
The de facto standard for DSP algorithm exploration and development is Matlab from The MathWorks. The initial representation of a complex DSP algorithm is in the floating-point domain, and Matlab provides powerful simulation, analysis and visualization capabilities for such floating-point representations.
Due to performance, cost and power constraints, the vast majority of DSP algorithms are ultimately executed on fixed-point devices. This means that once the DSP architects have explored alternative algorithmic scenarios in the floating-point solution space, the solution of choice must be quantized into a fixed-point representation for implementation. A key part of this process involves investigating the effects of quantization on the quality and performance associated with the limited representation capability of the fixed-point signals. Examples of the types of quantization effects that need to be evaluated are as follows:
• Overflow or underflow due to improper scaling
• Residual offsets due to truncation or improper rounding
• Instability of algorithms with feedback
• Variables having a dynamic range that exceeds the selected fixed-point representation capability
Unfortunately, although Matlab is extremely powerful in the floating-point domain, the tools provided to aid in the quantization process are somewhat limited. Furthermore, the native simulation engine in Matlab is optimized for vector computations and floating-point mathematical operations. However, in the case of fixed-point representations, in which each operation is “wrapped” with checks for overflow, underflow, rounding and other features that emulate processor-specific characteristics, Matlab’s interpreted language slows down significantly.
Due to these limitations, Matlab’s role in a conventional DSP design flow is restricted to only the initial algorithmic exploration and analysis at the floating-point level. As soon as the algorithm has been proven at this high level of abstraction, the design is taken outside the Matlab environment (Figure 1).

The first step involves hand-translating the original algorithms into equivalent floating-point C representations. The floating-point C model needs to be re-verified to ensure that it exactly matches the original Matlab representation. In turn, this often requires the original Matlab test bench to be hand-translated into the C domain. Next, the floating-point C representation is manually quantized into a fixed-point equivalent. Analyzing this representation to ensure that the reduced dynamic range of the fixed-point signals continues to achieve the desired quality and performance is a non-trivial task in the C domain.
It is apparent that this conventional DSP flow is less than optimally efficient. The manual translation steps—first from floating-point Matlab to floating-point C, and then from floating-point C to fixed-point C—are resource-intensive, time-consuming and prone to error. But the most significant problem is that Matlab’s sophisticated visualization and analysis facilities—such as plotting and statistics—are not available when they are needed most, which is to evaluate the quality of the floating-point to fixed-point conversion.
The key to streamlining the DSP design flow is to move the quantization (the process of converting the original floating-point representations into their fixed-point counterparts) into the Matlab environment (Figure 2). In this case, the algorithm developers will be able to take full advantage of the familiar Matlab environment—including its sophisticated analysis and visualization capabilities—throughout the quantization process. As an added benefit, the developers will be able to make use of their existing test benches throughout the quantization process.
Moving the quantization step into the Matlab environment requires access to three tools and utilities: fixed-point constructs, interactive quantization analysis tools and a Matlab simulation accelerator that dramatically increases the speed of fixed-point simulations.
Fixed-point constructs must provide bit-accurate fixed-point functions for use in the Matlab environment. Such functions must execute fixed-point operations precisely, and the results from these functions must be bit-identical to the operations executed in fixed-point hardware. The constructs must support signed and unsigned operands (with parameterized widths for the integer and fraction portion of the fixed-point representations), complex and real numbers, and all of the commonly used saturation and rounding modes.
The availability of such fixed-point constructs will enable Matlab models to mimic processor-specific effects. For example, the quotient from a 16-bit by 16-bit multiplication might be kept as a 32-bit result or coerced back into a 16-bit format; or a dot-product might take advantage of a larger accumulator before being stored into a 16-bit or 32-bit variable. The constructs should also come equipped with debugging aids, including the capability to flag any overflows and underflows at run time, the ability to issue warnings with regard to any type of mismatches in fixed-point operations, and the ability to display full type information for all statements at run time.
Having the ability to define fixed-point data types within Matlab is not enough. It is also necessary to have tools that provide static and dynamic analysis of programs to aid designers throughout the quantization process. Such tools need the ability to browse through hierarchical Matlab source code, the ability to show how fixed-point types have automatically propagated throughout the design (insofar as such propagation can be meaningfully inferred), and the ability to analyze the effects of fixed-point representation on data variables.
A key feature of static analysis is its ability to take the input signals quantized by the user and use these values to automatically quantize internal variables using “type propagation”. If the tool is designed correctly, it will typically be sufficient to explicitly quantize only 10% of the variables or less in order to obtain a fully quantized design.
In the case of a design featuring an FFT function, for example, the user would commence by quantizing the input signals and the “twiddle factors” for the FFT. Using the static quantization analysis tool, quantizing a variable—which might be at the level of an array—should require only a single statement. Subsequent type propagation will save designers a significant amount of time and effort.
Designers also require dynamic analysis to determine the impact of fixed-point variables on their design. For example, such analysis should display the dynamic range variables take on and highlight variables whose values overflowed their fixed-point representations during a simulation run. It should also suggest quantization formats of variables based on simulation results.
Static and dynamic analysis will form a critical element in the new design flow because they will enable developers to quickly and efficiently gain an overview of their code and its variables, and to fully understand the ramifications of each step in the quantization process.
As was previously noted, the native simulation engine in Matlab is optimized for vector computations and floating-point mathematical operations. However, Matlab’s interpreted language slows down significantly in the case of fixed-point representations. To execute a fixed-point program in Matlab, each operation must be “wrapped” with checks for overflow, saturation, rounding, etc. This results in an explosion of simulation times of 100-1000 times.
The final tool required to fully streamline the flow is one that can automatically convert the fixed-point Matlab representations into a stand-alone fixed-point C program for deployment. Such a tool should also be able to take advantage of processor-specific hardware that exists on common digital signal processors.
An Example Flow
One example of the emerging streamlined design flow described above is provided by Catalytic Inc. As a test case, consider the development of an echo canceller algorithm intended for implementation on a fixed-point DSP.
The echo canceller’s task is to adaptively estimate echo effects and to remove such effects from the signal. The process commences with the creation, simulation and analysis of a floating-point Matlab representation (Figure 3).

The three-dimensional plot on the left of this illustration reflects the convergence of echo canceller taps in time as a speech signal is fed to the equalizer. The spectrogram on the right reflects the uncorrupted speech and the echo remaining after cancellation.
Following a first-pass quantization, the original analysis is repeated on the initial fixed-point design solution (Figure 4). This analysis—which took only a few seconds using a fixed-point simulation accelerator—shows that a significant amount of information is being lost due to the way the algorithm was quantized. The equalizer taps do not converge on the same result and there is a great deal of leftover energy in the echo.
Following a series of modifications to the quantization, it is possible to achieve a fixed-point version of the algorithm that does perform the echo cancellation task satisfactorily (Figure 5).
The key point is that the combination of fixed-point constructs, interactive quantization analysis tools and a fixed-point simulation accelerator allowed this fixed-point analysis to take place within the Matlab environment. This made it possible to take full advantage of Matlab’s extremely powerful and sophisticated visualization and analysis tools, which in turn facilitated the quick and efficient “fine-tuning” of the quantization process.
Using a streamlined DSP design flow as described in this article, developers will be able to use fixed-point constructs and interactive quantization analysis tools to quickly quantize their design. They will also be able to analyze the current state of quantization and identify any bottlenecks at each step during the conversion from floating-point to fixed-point representations. Following quantization, the speed provided by simulation acceleration will make it possible to perform extensive testing of the quantized algorithms while remaining in the Matlab domain.
By means of this new flow, it will be possible to go directly from fixed-point Matlab representations into their fixed-point C counterparts with a high level of confidence that the fixed-point implementation is correct. This will significantly reduce the overall implementation time associated with a design, thereby reducing costs and engineering resources and improving time-to-market.
Catalytic
Palo Alto, CA.
(650) 846-2555.
[www.catalyticinc.com].

