Sie sind auf Seite 1von 7

Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

A FPGA Paint Brush Application

Vince Edwards
Vince.Edwards@selu.edu

Michael Courtney
Michael.Courtney@selu.edu

Kuo-pao Yang
kyang@selu.edu

Southeastern Louisiana University


Hammond, Louisiana 70402, USA

Abstract

This paper describes a Field Programmable Gate Array (FPGA) paint program similar to the
one found on the Windows operating system. This paint brush application uses a modern
educational kit that has recently been available for Computer Science hardware courses. The
educational package employs state-of-the-art technology in both hardware and software. This
new technology is currently being used in many universities and many electronic commercial
products. With an integrated design environment and its reconfigurable capabilities on the
board where hardware can be changed on the fly, we implement the system-on-chip
application and immediately see execution results. Further development of this program can
lead to a more complex and sophisticated application.

Keywords: Hardware/software co-design, Embedded computing education, FPGA-based


design, System-on-chip

1. INTRODUCTION Integrated Circuit (ASIC) to perform


operations in hardware. ASICs are designed
We have developed a FPGA-based program to perform specific sets of instructions for
similar to the Microsoft Paint application on accelerating a variety of applications, and
the Windows operating system. This FPGA thus they are very fast and efficient.
paint brush application is displayed on a VGA However, the circuits cannot be changed
monitor and uses a mouse to draw different after fabrication. The circuits need to be
figures, to fill colors, and to clear drawing redesigned and re-fabricated if any parts of
area. The VGA monitor and the USB mouse the application require modification.
are connected to a reconfigurable education
board. This project is hardware and The second method is to use software-
software co-design accomplished using the programmed microprocessors, which
custom hardware and its software toolkit. execute a set of instructions to perform
computations for general purposes. By
Program execution is conventionally interpreting the software instructions, the
accomplished by one of two primary functionality of the system is altered without
methods. The first is to use hardwired changing any hardware. However, the
technology, an Application Specific downside of this flexibility is that the

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 1
Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

performance degrades. The processor needs 1. The Cyclone II is a SRAM based FPGA
to read each instruction from memory, device with 475 I/O pins. All connections
decode its meaning, and then execute it, so are made through the Cyclone II device, and
the performance is significantly poorer than thus developers can configure the FPGA
that of an ASIC. through the USB blaster to implement any
system design. The FPGA will retain this
Reconfigurable computing is intended to fill
configuration as long as power is applied to
the gap between hardware and software
the board. The EPCS16 chip provides non-
methods, achieving potentially much higher
volatile storage of the bit stream, so that the
performance than microprocessors, while
information is retained even when the power
maintaining a higher level of flexibility than
supply to the DE2 board is turned off. When
ASICs. Reconfigurable devices, field
the board's power is turned on, the
programmable gate arrays (FPGAs), contain
configuration data in the EPCS16 device is
arrays of computational logic blocks whose
automatically loaded into the Cyclone II.
functionality is determined through multiple
programmable configuration bits. Custom The DE2 board offers a rich set of features
digital circuits are mapped into the as shown in Figure 1 and Figure 2. This
reconfigurable hardware to form the board contains standard connectors for
necessary circuit. A variety of applications microphone, line-in, line-out (16-bit audio
that have been shown to exhibit significant CODEC), video-in (TV Decoder), and VGA
speedups using reconfigurable FPGA (10-bit DAC); these features can be used to
hardware include data encryption (Elbirt create CD-quality audio applications and
2000), automatic target recognition professional-looking video. It is also
(Rencher 1997), error detection (Atieno possible to connect other user defined
2006), string pattern matching (Weinhardt boards to the DE2 board by means of two
1999), boolean satisfiability (Zhong 1998), expansion headers.
data compression (Huang 2000), and
The Altera Quartus II software is comprised
genetic algorithms (Graham 1996).
of an integrated design environment that
This project is based on an existing one at includes everything from design entry to
Cornell University (ECE 2008) and then we device programming. Developers can
made a number of fine adjustments to fit it combine different types of design files in a
into our environment. In this project, an hierarchical project. The software
interface is created between the hardware recognizes schematic capture diagrams and
and software by taking full advantage of the hardware description languages such as
system-on-a-programmable-chip (SOPC) VHDL and Verilog. The Quartus II Compiler
builder, which provides features to ease analyzes and synthesizes the designed files
writing software and to accelerate system and then generates the configuration bit
simulation. We then developed and altered stream for the assigned device. It then
the application using the Integrated downloads the configuration bit stream into
Development Environment (IDE), which the target device via the USB connection.
comes with the software package. The System developers can simulate the
mouse is integrated and gives the user the designed component, examine the timing
ability to draw or paint, or basically just issues related to the target device, and
manipulate all functions of the program. modify the I/O pin assignments before the
The monitor is used to display the functions configuration is downloaded onto the chip on
that are being transmitted from the DE2 the DE2 board. The Quartus II computer-
board onto the screen. aided design tools work with both the chips
on the DE2 and other Altera devices. NIOS
2. EQUIPMENT AND SOFTWARE II processors implement a 32-bit instruction
PACKAGE set based on a general-purpose RISC
architecture (Yiannacouras 2005, 2006).
The DE2 package that we used includes the Because it is a soft-core configurable
hardware board and software (Yang 2008). processor (Sheldon 2006), FPGA developers
The Cyclone II chip on the DE2 board is can choose from a myriad of system
reconfigurable and is currently used in many configurations, picking the best-fit CPU core
electronic commercial products. A block (Sharma 2004), selecting processor
diagram of the DE2 board is shown in Figure peripherals, and meeting performance goals.

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 2
Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

The software development environment of fill and thus achieves better speed and
the NIOS II IDE uses a standard GNU GCC performance. The functionalities provided
compiler tool chain and Eclipse IDE to by this paint brush application are drawing a
compile projects. The NIOS II IDE provides point, line, square, circle, polygon, clearing
a helpful interface for building complex the pixels using the eraser, spray paint, fill
embedded programs. System designers can color, pick color, clear drawing area and
create their own custom peripherals that can various color options in a color pallet at the
be integrated with NIOS II processor bottom of the screen.
systems. For performance-critical systems
Now that we have completed our
that spend most CPU cycles executing a
implementation, our FPGA drawing program
specific section of code, it is a common
works as the follows. First, the user chooses
technique to create a custom peripheral that
a specific function such as a line or circle,
implements the same function in hardware.
and then chooses the color at the bottom of
Using this approach, performance is
the screen. The default color is black and
improved significantly. The processor is free
the color remains the current color at the
to perform other functions in parallel while
bottom left corner of the screen until
the custom peripheral operates on data.
another color is chosen. Next, the user
selects a starting point on the canvas to
3. RESULTS AND DISCUSSIONS
start the shape and then an endpoint to
This project focuses on the development of complete the shape.
the FPGA paint brush application shown in We discovered some drawbacks to the Altera
the Figure 3. It downloads the configuration system. Analysis of the memory and CPU
bit streams from the host computer onto the usage of the program revealed that Altera’s
Cyclone II FPGA through the USB blaster IDE takes a lot of time and consums a lot of
port. An existing VGA controller on the memory in order to compile the code and
board handles a VGA monitor with the transfer downloadable bit streams, when
resolution of 640x480. The NIOS II software even a small change is made to the
in this project is used to interface the program. With this being the first year FPGA
ISP1362 USB drive for the mouse and also was introduced to our IS department we
interacts with the VGA adapter implemented encountered issues adapting to the learning
in the hardware. The movement of the curve of the software. First issue was
mouse cursor is sent to the VGA adapter. finding the right drivers and getting them to
The software development module sends work with the board. There where specific
coordinates and colors to be displayed at instructions on obtaining the updated drivers
particular pixels on the VGA screen. The located on the Altera website and
mouse is used to control all functions of the downloading it to the system. We could not
application such as drawing lines or circles, get the computers to recognize the USB
etc. blaster from the DE2 board. We finally got
This software module runs the various that to work. Then, we had second issue
algorithms for drawing the various shapes with the VGA monitor not showing anything
and sends these values to the SRAM. The except for a white screen with very faint
VGA controller reads from the SRAM and lines going up and down. It started to work
displays on the VGA screen. The complete after we slightly modified the VGA controller
functionality of the paint brush application from the DE2 default design settings.
and the realization of different figures and The most important thing we have learned
shapes on the VGA screen was replicated from this project is the Principle of
using various graphics algorithms. Equivalence of Hardware and Software (Null
Bresenham’s Algorithm (Harris 2004) is used 2006). We choose this FPGA Paint Brush
for line and circle drawing. The Edge Fill project because we are interested in learning
Algorithm (Smith 1979) is used for detecting how to work with hardware and
the edges of a closed figure and filling color understanding the difference between this
inside its boundary. The Fencing Technique hardware approach and Microsoft Paint. This
(Chalmers 2003) is applied to reduce the project encourages student research and
scan area. This decreases the number of development. We also realize that using
pixels being inverted for every polygon color FPGA gives a concrete structure to abstract

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 3
Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

lessons. IS students may also discover after Microcontroller Design and system-on-
programming the board, that the FPGA can chip.” http://www.ece.cornell.edu
be reprogrammed at any time which can
Graham, P., Nelson, B. (1996) “Genetic
reduce development cost since the
Algorithms in Software and in
instructions can be programmed at any
Hardware—A Performance Analysis of
time. We now believe this principle:
Workstations and Custom Computing
anything that can be done with software can
Machine Implementations.” IEEE
also be done with hardware, and anything
Symposium on FPGAs for Custom
that can be done with hardware can also be
Computing Machines, Napa, CA, 216-
done with software.
225.

4. CONCLUSION Harris, M., Reingold E. (2004) “Line


Drawing, Leap Years, and Euclid.” ACM
This project introduces a FPGA Paint Brush Computing Surveys (CSUR), vol. 36, no.
application similar to Microsoft Paint. It is 1, 68-80.
based on the existing project at Cornell
Huang, W., Saxena, N., Mccluskey, E.
University and then we made a number of
(2000) “A Reliable LZ Data Compressor
fine adjustments to fit it into our
on Reconfigurable Coprocessors.” IEEE
environment. Altera’s Quartus II and NIOS
Symposium on Field-Programmable
II IDE are employed to compile the
Custom Computing Machines, 249-258.
implementation, simulate the results,
program and control the Cyclone II FPGA Null, L., Lobur, J. (2006) “The Essentials of
chip through USB ports on the DE2 board. Computer Organization and Architecture,
This project broadens the traditional Second Edition.” Jones and Barlett
knowledge of our IS majors, since we Publishers.
usually do not have opportunities to work Rencher, M., Hutchings, B. (1997)
with real hardware. Though the paint “Automated Target Recognition on
program that we are using is just a mock SPLASH2.” IEEE Symposium on Field-
version of the original Microsoft Paint Programmable Custom Computing
features, the implementation of this program Machines, 192-200.
helps our IS students to understand and
appreciate the work that goes into larger, Sharma, A., Compton, K., Ebeling, C.,
more complex hardware solutions. Hauck, S. (2004) “Exploration of
Pipelined FPGA Interconnect Structures.”
5. REFERENCES Proceedings of the 2004 ACM/SIGDA
12th International Symposium on Field
Atieno, L., Allen, J., Goeckel, D., Tessier, R.
Programmable Gate Arrays, Monterey,
(2006) “An Adaptive Reed-Solomon
California, 13-22.
Errors-and-Erasures Decoder.”
Proceedings of the 2006 ACM/SIGDA Sheldon, D., Kumar, R., Vahid, F., Tullsen,
14th International Symposium on Field D., Lysecky, R. (2006) “Conjoining Soft-
Programmable Gate Arrays, Monterey, core FPGA Processors.” Proceedings of
California, 150-158. the 2006 IEEE/ACM International
Conference on Computer-aided Design,
Chalmers, A., Cater, K., Maflioli, D. (2003)
San Jose, California, 694-701.
“Visual attention models for producing
high fidelity graphics efficiently.” Smith, A. (1979) “Tint fill.” ACM SIGGRAPH
Proceedings of the 19th Spring Computer Graphics, vol. 13, no. 2,
Conference on Computer Graphics 276-283.
(SCCG’03), 39-46. Weinhardt, M. and Luk, W. (1999) “Pipeline
Elbirt, A., Paar, C. (2000) “A FPGA Vectorization for Reconfigurable
Implementation and Performance Systems.” IEEE Symposium on Field-
Evaluation of the Serpent Block Cipher.” Programmable Custom Computing
ACM/SIGDA International Symposium on Machines, 52-62.
FPGAs, 33-40. Yang, K.P., Beaubouef, T., (2008) “A Field
Electrical and Computer Engineering (ECE) Programmable Gate Array Media Player
at Cornell University (2008) “Advanced for Realmedia Files.” Journal of

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 4
Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

Computing Sciences in Colleges, vol.


23, no. 6, June, 2008, 133-139.
Yiannacouras, P., Rose, J., Steffan, G.
(2005) “The Microarchitecture of FPGA-
based Soft Processors.” Proceedings of
the 2005 international conference on
Compilers, architectures and synthesis
for embedded systems, San Francisco,
California, 202-212.
Yiannacouras, P., Steffan, G., Rose, J.
(2006) “Application-Specific
Customization of Soft Processor
Microarchitecture.” Proceedings of the
2006 ACM/SIGDA 14th Int. Symposium
on Field Programmable Gate Array,
Monterey, California, 201-210.
Zhong, P., Martinosi, M., Ashar, P., Malik, S.
(1998) “Accelerating Boolean
Satisfiability with Configurable
Hardware.” IEEE Symposium on Field-
Programmable Custom Computing
Machines, 186-195.

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 5
Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

Appendices

Figure 1: Block Diagram of the DE2 Board

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 6
Edwards, Courtney, and Yang Sat, Nov 8, 4:00 - 4:30, Pueblo B

Figure 2: Layout and Components of the Altera DE2 Board

Figure 3: FPGA Paint Brush Application

Proc ISECON 2008, v25 (Phoenix): §3722 (refereed)


c 2008 EDSIG, page 7

Das könnte Ihnen auch gefallen