05.03.2013 Views

Automotive Innovators Hit High Gear in - Xilinx

Automotive Innovators Hit High Gear in - Xilinx

Automotive Innovators Hit High Gear in - Xilinx

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

XCELLENCE IN AUTOMOTIVE & ISM<br />

features of the roadway image most likely<br />

to represent lane boundaries.<br />

To improve the performance of the<br />

edge detection with respect to noise, the<br />

first stage of the pipel<strong>in</strong>e is a 2-D 5x5<br />

Gaussian noise reduction (GNR). The<br />

second stage is histogram stretch<strong>in</strong>g<br />

(HST), a technique developers use to<br />

enhance the contrast of the image,<br />

exploit<strong>in</strong>g as much as possible the whole<br />

gray-level range. The third step, the horizontal/vertical<br />

gradient (HVG), enhances<br />

those pixels <strong>in</strong> which a significant change<br />

<strong>in</strong> local <strong>in</strong>tensity is seen. Developers perform<br />

HVG by comput<strong>in</strong>g the 2-D 5x5<br />

gradients of the image (via the 2-D<br />

Euclidean distance).<br />

The edge-th<strong>in</strong>n<strong>in</strong>g (ETH) block determ<strong>in</strong>es<br />

which po<strong>in</strong>ts are edges by threshold<strong>in</strong>g<br />

the gradient magnitude and<br />

apply<strong>in</strong>g non-maximum suppression to<br />

generate th<strong>in</strong> contours (one-pixel thick).<br />

The lane-mark<strong>in</strong>g pattern search (LMPS)<br />

acts as a filter, select<strong>in</strong>g a subset of edge<br />

po<strong>in</strong>ts that display a particular configuration<br />

consistent with the lane mark<strong>in</strong>gs,<br />

and remov<strong>in</strong>g spurious edge po<strong>in</strong>ts that<br />

arise due to shadows, other vehicles, trees,<br />

signs and so on. The last step of the<br />

pipel<strong>in</strong>e is a 3x3 morphological filter<strong>in</strong>g<br />

(MRP) the system uses for the f<strong>in</strong>al clean<strong>in</strong>g<br />

of the lane-mark<strong>in</strong>g candidate’s map.<br />

In the Simul<strong>in</strong>k model, we have implemented<br />

the various stages of the imagepreprocess<strong>in</strong>g<br />

subsystem us<strong>in</strong>g a mixture<br />

of Simul<strong>in</strong>k blockset functions and MAT-<br />

LAB blocks. Because of its ability to<br />

process large amounts of data through<br />

parallel hardware paths, an FPGA is wellsuited<br />

for the implementation of the lane<br />

detection function of our model.<br />

Therefore, we targeted this function as the<br />

start<strong>in</strong>g po<strong>in</strong>t for transition<strong>in</strong>g the LDW<br />

Simul<strong>in</strong>k design to an FPGA.<br />

With this partition<strong>in</strong>g, the FPGA performs<br />

the process<strong>in</strong>g-<strong>in</strong>tensive pixel-level<br />

analysis of each frame and reduces the data<br />

from a 10-bit gray-scale image to a simple<br />

b<strong>in</strong>ary image for our downstream process<strong>in</strong>g.<br />

For the entire system design, we are<br />

target<strong>in</strong>g an XA Spartan-3A DSP 3400,<br />

but we could also fit the system on a smaller<br />

3A DSP 1800 or a 3E 1600.<br />

System Generator Overview<br />

The System Generator for DSP design tool<br />

works with<strong>in</strong> Simul<strong>in</strong>k. It uses the Xil<strong>in</strong>x<br />

DSP blockset for Simul<strong>in</strong>k and will automatically<br />

<strong>in</strong>voke the Xil<strong>in</strong>x CORE<br />

Generator tool to generate highly optimized<br />

netlists for the DSP build<strong>in</strong>g blocks.<br />

You can access the Xil<strong>in</strong>x DSP blockset via<br />

the Simul<strong>in</strong>k Library browser, which you<br />

can, <strong>in</strong> turn, launch from the standard MAT-<br />

LAB toolbar. More than 90 DSP build<strong>in</strong>g<br />

blocks are available for construct<strong>in</strong>g a DSP<br />

system, along with FIR filters, FFTs, FEC<br />

cores, embedded process<strong>in</strong>g cores, memories,<br />

arithmetic, logical and bit-wise blocks. Every<br />

block is cycle- and bit-accurate and you can<br />

configure each of them for latency, area vs.<br />

speed performance optimization, number of<br />

I/O ports, quantization and round<strong>in</strong>g.<br />

Two blocks, called Gateway-In and<br />

Gateway-Out, def<strong>in</strong>e the boundary of the<br />

FPGA system from the Simul<strong>in</strong>k simulation<br />

model. The Gateway-In block converts<br />

the float<strong>in</strong>g-po<strong>in</strong>t <strong>in</strong>put to a<br />

fixed-po<strong>in</strong>t number. Afterwards, the tool<br />

correctly manages all the bit growth <strong>in</strong><br />

fixed-po<strong>in</strong>t resolution, depend<strong>in</strong>g on the<br />

mathematic operation you are implement<strong>in</strong>g<br />

dur<strong>in</strong>g the follow<strong>in</strong>g functional stages.<br />

S<strong>in</strong>ce Simul<strong>in</strong>k is built on top of<br />

MATLAB, System Generator allows the<br />

use of the full MATLAB language for<br />

<strong>in</strong>put-signal generation and output analysis.<br />

You can use the From-Workspace and<br />

To-Workspace blocks from the Simul<strong>in</strong>k<br />

Source and S<strong>in</strong>k libraries to read an <strong>in</strong>put<br />

signal from a MATLAB variable (From-<br />

Workspace) or to store a partial result of a<br />

signal to a MATLAB variable (To-<br />

Workspace). Furthermore, you can set a lot<br />

of parameters of the System Generator<br />

blocks via MATLAB variables, thus allow<strong>in</strong>g<br />

you to customize the design <strong>in</strong> sophisticated<br />

ways, just by updat<strong>in</strong>g a MATLAB script<br />

conta<strong>in</strong><strong>in</strong>g all such variables (you can assign<br />

MATLAB functions to the model and call<br />

them back before open<strong>in</strong>g it, or even before<br />

start<strong>in</strong>g or after stopp<strong>in</strong>g the simulation).<br />

Another important feature of System<br />

Generator for DSP is the hardware-software<br />

co-simulation. You can synthesize a<br />

portion of the design <strong>in</strong>to the target FPGA<br />

board (hardware model), leav<strong>in</strong>g the<br />

rema<strong>in</strong><strong>in</strong>g part as a software model <strong>in</strong> the<br />

host PC. That allows you to make an <strong>in</strong>cremental<br />

transition from software model to<br />

hardware implementation. The tool transparently<br />

creates and manages the communication<br />

<strong>in</strong>frastructure via Ethernet and<br />

shared memories (between the host PC and<br />

the target FPGA device). In such a way,<br />

when runn<strong>in</strong>g a simulation, the part you’ve<br />

implemented <strong>in</strong> the hardware is really runn<strong>in</strong>g<br />

on the target silicon device, while the<br />

software model emulates the rest <strong>in</strong> the host<br />

PC. You can use the shared memories to<br />

store, for example, the <strong>in</strong>put image and the<br />

generated output image. The Ethernet<br />

communication provides enough bandwidth<br />

for pseudo-real-time process<strong>in</strong>g. You<br />

can f<strong>in</strong>d more details <strong>in</strong> the user manual.<br />

The flexible partition<strong>in</strong>g between software<br />

model and hardware process<strong>in</strong>g,<br />

comb<strong>in</strong>ed with the hardware-software cosimulation<br />

capabilities, provides you with<br />

a powerful verification tool to measure<br />

compliance between the orig<strong>in</strong>al softwareonly<br />

algorithm and the production-<strong>in</strong>tent<br />

hardware implementation. You can use<br />

Simul<strong>in</strong>k itself to compare the results of<br />

the software processed data to the hardware<br />

processed data. This functionality is<br />

especially useful <strong>in</strong> driver assistance applications,<br />

where the general system <strong>in</strong>put<br />

images are nondeterm<strong>in</strong>istic.<br />

Now, let’s exam<strong>in</strong>e <strong>in</strong> detail how to<br />

model an image-process<strong>in</strong>g algorithm <strong>in</strong><br />

System Generator for DSP us<strong>in</strong>g as an<br />

example, for the sake of conciseness, the<br />

GNR, which is the first module of the<br />

image-preprocess<strong>in</strong>g pipel<strong>in</strong>e.<br />

System Generator<br />

Implementation of GNR Function<br />

Random variations <strong>in</strong> <strong>in</strong>tensity values—aka<br />

noise—often corrupt images. Such variations<br />

have a Gaussian or normal distribution<br />

and are very common among different<br />

sensors—that is, CMOS cameras. L<strong>in</strong>earsmooth<strong>in</strong>g<br />

filters are a good way to remove<br />

Gaussian and, <strong>in</strong> many cases, other types of<br />

noise as well. To achieve such functionality,<br />

we can implement a l<strong>in</strong>ear f<strong>in</strong>ite impulse<br />

response (FIR) filter us<strong>in</strong>g the weighted<br />

sum of the pixels <strong>in</strong> successive w<strong>in</strong>dows.<br />

Before start<strong>in</strong>g the implementation of the<br />

22 Xcell Journal Fourth Quarter 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!