EE4OI4 Engineering Design UP1core Library Functions
2 UP1 core library functions In complex designs, intellectual property (IP) cores are frequently used. An IP core is a previously developed synthesizable hardware design that provides a widely used functions. Some of IP cores are commercially licensed IP cores reduce development time by providing common hardware functions for use in a new design.
3 UP1 core library DEC_7SEGHexadecimal to Seven-segment decoder DEBOUNCEPushbutton debounce circuit ONEPULSEPushbutton single pulse circuit CLK_DIV25MHz clock divider with 7 frequency outputs VGA_SYNCVGA synch signal generator for UP1 CHAR_ROMCharacter font ROM for video character generations KEYBOARDReads keyboard scan codes from the UP1 MOUSEReads mouse data and outputs cursor row and column address
4 UP1 core library COMPONENT VGA_SYNC PORT(clock_25Mhz, red, green, blue: INSTD_LOGIC; red_out, green_out, blue_out, horiz_sync_out, vert_sync_out: OUTSTD_LOGIC; pixel_row, pixel_column: OUT STD_LOGIC_VECTOR(9 DOWNTO 0)); END COMPONENT;
5 Video display VGA video signal: 5 active signals –Horizontal Sync. & Vertical Sync.: TTL logic levels –RGB: analog signals (0.7 to 1 volt peak to peak) Screen has 640x480 pixels Video signal redraws the entire screen 60 times per second
6 Video display Major component inside a VGA computer monitor is the color CRT. Electron beam is scanned over the screen in a sequence of horizontal lines to generate an image The deflection yoke deflects the electron beam to the appropriate position on the face of CRT Light is generated when the beam is turned on by a video signal and it strikes a color phosphor on the CRT. Face of CRT contains three different phosphors one type for each primary color (red, green, blue)
7 VGA Image by 480 Pixel Layout.
8 UP1core VGA_SYNC
9 VGA display Generation of colors of pixels based on their location on the display
10 Video LED Design Example
11 Video Color Bar Design Example
12 Character Display Displaying textual data: a pixel pattern or font is needed to display each different character Character font can be stored in a ROM implemented inside the FLEX. A memory initialization file (.mif) is used to initialize the ROM CHAR_ROM function in UP1core functions is a character ROM. Characters are stored in consecutive memory cells. Each character is stored in eight memory cells (each memory cell 8 bits) Each character consists of an 8x8 dot map
13 Character Display A B C
14 UP1core CHAR_ROM
15 Character Display The function char_rom has three inputs: –character_address: the starting address of memory location containing the character we want to be displayed –font_row and font_col: inputs that determine which bit of the memory partition containing the character should be displayed at a particular time (which dot of the character font should be displayed) If each dot in a character font is mapped to pixel on the display, each character requires 8x8 pixels on the display. If each dot in a character font is mapped to a 2x2 pixel area on the display, each character requires 16x16 pixels on the display.
16
17 Character Test Design Example
18 Interfacing to the PS/2 keyboard Altra UP-1 supports the use of either a mouse or keyboard using the PS/2 connector on the board The connector provides electrical connection between the keyboard/mouse and the board It is necessary to design a hardware interface using FLEX to communication with a keyboard or mouse. UP1core library has the required VHDL codes for a keyboard interface (keyboard.vhd) and mouse interface (mouse.vhd)
19 Keyboard scan codes Keyboards are normally encoded by placing the key switches in a matrix of rows and columns All rows and columns are periodically scanned to find any key state changes. Key data is passed serially to the computer from the keyboard using scan code. Each key has a unique scan code based on the key switch matrix row and column address
20 Keyboard scan codes Scan code consists of Make and Break codes. One make code is sent every time a key is pressed When several keys are hit at the same time several make codes are sent (this happens in fast typing and in using shift and ctrl) When a key is released, a break code is sent. By using this break code if several keys are pressed at the same time it can be distinguished which one was released If a key is held down, the make code is continuously sent at typematic (autorepeat) rate.
21 Key Numbers for Scan Code.
22
23
24 UP1 Keyboard function UP1core library has a VHDL code that reads the scan code bytes for the keyboard keyboard.vhd has five inputs and two outputs: Inputs: –keyboard_clk: connected to keyboard clock pin keyboard_data: connected to keyboard data pin –clock_25Mhz: connected to UP1 clock pin –reset: clears the internal registers and buffers –read: a handshaking signal. It’s rising edge clears the scan_ready signal Outputs: –scan_code: scan code of the key pressed –scan_ready: is high when the scan code is ready.
25 Keyboard UP1core
26 Example design using the Keyboard UP1core.
27
28 Symbol for MOUSE UP1core.
29 UP1 Mouse function Inputs: –clock_25Mhz: connected to UP1 clock pin –Reset: clears the internal registers and buffers Bi-directional data lines: –mouse_clk: connected to mouse clock pin –Mouse_data: connected to keyboard data pin Outputs: –left_button: high if the left button is pressed –right_button: high if the right button is pressed –mouse_cursor_row[9..0], mouse_cursor_column[9..0]: contain the current address of the mouse cursor in 640x480 screen area
30 Example Design Using Mouse UP1core