The design scheme of using programmable device CPLD/FPGA to realize VGA image controller

Using programmable device CPLD/FPGA to realize VGA color Display controller has many practical applications in industrial field. The hardware description language VHDL is used to design and simulate the function modules of programmable devices, which can realize the VGA display controller to display various graphics, images, and texts, and realize the animation effect.

Using programmable device CPLD/FPGA to realize VGA color display controller has many practical applications in industrial field. The hardware description language VHDL is used to design and simulate the function modules of programmable devices, which can realize the VGA display controller to display various graphics, images, and texts, and realize the animation effect.

VGA interface and design parameters

The VGA interface is the only interface for communication with the display. Through the CPLD/FPGA device to control RGB signals, horizontal synchronization signals, vertical synchronization signals and other signals, and refer to relevant standards, the VGA display can be controlled. It can be seen that understanding interface standards, controlling timing and setting appropriate parameters are the key to system design.

According to the industrial standard of the main parameters of VGA, the pixel output frequency is 25.175MHz; the horizontal frequency (line frequency) is 31.469KHz; the vertical frequency (refresh rate) is 59.94Hz. Parameter design principle and line synchronization signal (Ts) and display signal (Tdis) ) The relationship is shown in Figure 1.

The design scheme of using programmable device CPLD/FPGA to realize VGA image controller

Design scheme of VGA image controller

The VGA image controller is a larger digital system. Adopting modular design principles, drawing on top-down programming ideas, separating functions and designing according to levels. Combine the VHDL hardware description language design with the schematic design, and simulate each functional module one by one, so that the module entity simulation synthesis of the top-level VGA image controller can be passed smoothly. The VGA controller is mainly composed of the following modules: blanking module, display module, frequency dividing module, grid generation module, Chinese character display module, image control module, animation generation module, LPM-ROM calling module, EEPROM calling module, etc. The VHDL design of the functional module is as follows.

Blanking module

The blanking module is a key part of the entire display controller. The display module, Chinese character module, color bar module, grid module, animation control module, LPM-ROM calling module, etc. are all controlled by the blanking module, and line synchronization signal (HS) And the vertical sync signal (VS) are all generated by this module.

Figure 2 is the simulation result of the blanking module. Since the CLK frequency is quite high and the pixel rate is also very high, in order to observe the HS and VS signals, the waveform ratio is appropriately reduced. Among them, C[9…0]is the pixel coordinate value, and L[8…0]is the scan line signal, which is the abscissa of the pixel.

Display module

The display module is an important part of the entire display controller. The output data of each module must be processed by the module and sent to the display. The display module plays a vital role in the VGA display controller.

The VHDL design of the display module is as follows:

The design scheme of using programmable device CPLD/FPGA to realize VGA image controller

The simulation waveform of the display module is shown in Figure 3.

The design scheme of using programmable device CPLD/FPGA to realize VGA image controller

GRBP is the data signal of the three primary colors, which is generated by the mode control module; the horizontal synchronization signal HS is generated by the blanking module; the vertical synchronization signal VS is generated by the blanking module. The output R, G, and B signals are red, green, and blue signals respectively.

The output signal of the display module is directly connected to the VGA interface, which is a bridge for communication between the controller and the display. This module is implemented in VHDL language, and the structure description in this module uses only 6 sentences in total. To achieve the same function, the video card driver of the general operating system requires a lengthy code to describe. This shows that the VHDL language has great advantages.

Chinese character generation module

The Chinese character generation module can display Chinese characters, characters, etc. on the display. The font information can be obtained by using font extraction software. After the font information of the Chinese character is obtained, the color of the pixel can be defined according to the font information through the abscissa and ordinate on the screen, so that any font, any dot matrix of Chinese characters can be displayed, and Decide the position of Chinese characters on the screen according to your needs. The display principle of English and any other symbols is the same as that of Chinese characters.

Mesh generation module

The grid generation module is used to edit various graphics. The implementation principle of the grid generation module is similar to that of the Chinese character generation module and the color bar generator. Under the control of the abscissa and ordinate of the pixel, various grid patterns can be generated. The nine types of graphics generated by the grid generation module are sent to the display to display in sequence, so you can see the grid gradually changes from small to large. Although it is not an animation effect, the speed of one frame per second still makes the image continuously change and present a sense of movement. The color of the grid and the background can also be set at will. The rate of each frame of image can be controlled by a clock.

The main function of the grid generation module is to edit various graphics, so this module can generate various graphics according to the design scheme. The selection of the grid is a relatively simple image editing. Although this part is called the grid generation module, it can actually edit a variety of color images.

LPM-ROM calling module

LPM is a parameter settable module library. Three LPM-ROMs are used in this design, two of which are used to store Chinese character information, and the other is used to store dynamic color bar information. When calling the LPM-ROM module, an important issue is the generation of *.mif files. This file is generated with the help of font extraction software and WORD editing function. After setting the parameters, generate components as components in the custom component library for calling.

The LPM-ROM calling module provides conditions for building a font library without using external ROM. Directly calling the LPM module can greatly improve efficiency. Chinese characters, characters, etc. can be displayed on the monitor through LPM-ROM.

EEPROM call module

EEPROM calling module is one of the difficulties in design. This module realizes the access to the two EEPROMs (W27E040 and W27C020) attached to the system, through which the monitor can display a variety of color images.

The design scheme of using programmable device CPLD/FPGA to realize VGA image controller

Image mode control module The image mode control module is also a key part of the digital system. Its main part is a fully functional data selector (1 out of 32).

The module consists of a 32-to-1 data selector and a 32-ary reversible counter. The control terminals of the reversible counter are EC, DIR, and CLR, and MD is the counting clock signal. The counting result (that is, corresponding to a mode) is the basis for the data selector to select. Through the control of the reversible counter, the control of the mode selection can be realized.

The image control module has produced 32 kinds of patterns in total, and the effective control of the patterns is realized by the counter. In fact, the function of the image control module can be further expanded. The output of the counter is 8 bits, and there are actually 255 modes in total. Among the 32 input signals, any of them can be reprocessed, such as superposition, exclusive OR (checkerboard generation is the combination of horizontal and vertical color bars). Realized by XOR), phase AND, etc., so that thousands of graphical outputs can be produced.

More than ten modules in the VGA controller are implemented in VHDL language. After the functional simulation is correct, each module generates a component and puts it in the component library. The top-level schematic calls each module (component). The overall design of the VGA image controller has been debugged and passed the functional simulation, timing simulation and hardware simulation synthesis of MAX+PLUSⅡ, and the various functions designed have been implemented on the VGA display.

Concluding remarks

The digital system design can be easily realized by using programmable logic devices, and the VGA controller based on CPLD/FPGA devices can realize the real-time display of the monitor. The performance of the system depends on the system design scheme, hardware description language design and the performance of development tools.

The Links:   G150XTN068 SCE200AA160 LCD-DISPLAY

Bookmark the permalink.

Comments are closed.