NIOS Pixel Display
SDRAM 512Mb Clock Reset_bar CPU Onchip Memory External Memory Controller JTAG UART Pixel DMA Resampler Scaler Dual Port FIFO VGA Controller Timer System ID VGA Connector PLL 2 tj
SDRAM Controller Creates the signals required to r/w the SDRAM (does not provide the DRAM clk) 3 tj
Pixel Buffer DMA Controller Reads frames from external memory and passes them into the video processing chain 4 tj
RGB Resampler Converts from 16bit RGB to 10bit RGB 5 tj
Scaler Scales the video by replicating pixels or removing pixels 6 tj
Dual Clock FIFO Allows different incoming and outgoing data rates 7 tj
VGA Controller Block Creates and drives the required VGA signals 8 tj
Create NIOS System On-chip Memory Size = 100,000 bytes 9 tj
Create NIOS System PLL Basic Functions Clocks and PLLs PLL Avalon ALTPLL 50MHz in no areset or locked c0 100MHz c1 100MHz -3ns phase shift c2 25MHz 10 tj
Create NIOS System Pixel Buffer DMA Controller IP Catalog Library University Program Audio and Video Video Pixel Buffer DMA Controller x-y mode Width 320 Height 240 Color space 16bit RGB 11 tj
Create NIOS System RGB Resampler IP Catalog Library University Program Audio and Video Video RGB Resampler 16 bit RGB incoming 30 bit RGB outgoing 12 tj
Create NIOS System RGB Scaler IP Catalog Library University Program Audio and Video Video Scaler Width Scaling 2 Height Scaling 2 Width 320 Height 240 10 bits 3 planes 13 tj
Create NIOS System Dual Clock FIFO IP Catalog Library University Program Audio and Video Video Dual Clock FIFO Color Bits 10 Color Planes - 3 14 tj
Create NIOS System VGA Controller IP Catalog Library University Program Audio and Video Video VGA Controller DE1-SOC VGA Connector VGA 640x480 15 tj
Create NIOS System SDRAM Controller IP Catalog Library Memory Interfaces and Controllers SDRAM SDRAM Controller Memory Profile 16 bits 1 chip select 4 banks 13 rows 10 columns Timing CAS = 3 2 initialization refresh cycles 7.8125 us refresh command 100us delay after pu 70ns refresh duration 20ns precharge duration 5.5ns access time 14ns write recovery time 16 tj
Create NIOS System Connections 17 tj
Create NIOS System Connections 18 tj
Create NIOS System Connections goes to resampler 19 tj
Create NIOS System Connections goes to vga controller 20 tj
Create NIOS System Connections 21 tj
Create NIOS System Generate the HDL When complete File Exit to exit Qsys 22 tj
Create Quartus System VGA Pixel Driver Create a top level schematic or instantiate into a VHDL file File New Block Diagram / Schematic Entry File Save As nios_pixel_top Project Add Files navigate to the project synthesis select the nios_pixel.qip file 23 tj
Create Quartus System VGA Pixel Driver Create a top level schematic or instantiate into a VHDL file 24 tj
Create Quartus System VGA Pixel Driver Prepare to synthesize assignments device device and Pin options Single Uncompressed with memory initialization Import the pins (qsf file) Be sure to set your top level entity Start Compilation 25 tj
Create Quartus System VGA Pixel Driver Complete the HW setup Download the HW project onto the board DO NOT CLOSE either of these windows 26 tj
Create Eclipse System Create the BSP Remember to change the properties for small systems Create an empty project 27 tj
Create Eclipse System Open system.h in the bsp scroll down to the Pixel Buffer These define parameters for the Pixel Buffer 28 tj
Create Eclipse System Expand drivers inc in the bsp Open altera_up_avalon_pixel_buffer_with_dma.h 29 tj
Create Eclipse System Expand drivers inc in the bsp Open altera_up_avalon_pixel_buffer_with_dma.h 30 tj
Create Eclipse System Expand drivers inc in the bsp Open altera_up_avalon_pixel_buffer_with_dma.h 31 tj
Create Eclipse System Expand drivers inc in the bsp Open altera_up_avalon_pixel_buffer_with_dma.h 32 tj
Create Eclipse System Write a program to print some Pixels to the screen ///////////////// // Includes ///////////////// #include "altera_up_avalon_video_pixel_buffer_dma.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <stdint.h> int main(void){ // define a pointer of type pixel_buffer... // to use as a reference in the dma functions // alt_up_pixel_buffer_dma_dev * pixel_buf_dma_dev; // open the Pixel Buffer port // - command is in drivers/inc/alter...video_pixel_buffer_dma.h // name reference is in system.h // - "/dev/video_pixel_buffer_dma_0" // pixel_buf_dma_dev = alt_up_pixel_buffer_dma_open_dev ("/dev/video_pixel_buffer_dma_0"); // Check for error and output to the console // if ( pixel_buf_dma_dev == NULL) printf ("Error: could not open pixel buffer device \n"); else printf ("Opened pixel buffer device \n"); 33 tj
Create Eclipse System Write a program to print some Pixels to the screen // Clear the screen // - command is in drivers/inc/alter...video_pixel_buffer_dma.h // - wait until done before continuing // alt_up_pixel_buffer_dma_clear_screen (pixel_buf_dma_dev, 0); usleep(1000000);// 1sec // Draw a box // - command is in drivers/inc/alter...video_pixel_buffer_dma.h // alt_up_pixel_buffer_dma_draw_box (pixel_buf_dma_dev, 150, 100, 200, 150, 0xFA72, 0); 34 tj
Create Eclipse System Write a program to print some Pixels to the screen // // Party Time // while(1){ uint16_t X0 = rand() % 320; uint16_t Y0 = rand() % 240; uint16_t XX = X0 + rand() % 100; uint16_t YY = Y0 + rand() % 100; uint16_t color = rand() % 0xFFFF; alt_up_pixel_buffer_dma_draw_box (pixel_buf_dma_dev, X0, Y0, XX, YY, color, 0); usleep(250000); X0 = rand() % 320; Y0 = rand() % 240; XX = X0 + rand() % 100; YY = Y0 + rand() % 100; color = rand() % 0xFFFF; alt_up_pixel_buffer_dma_draw_rectangle (pixel_buf_dma_dev, X0, Y0, XX, YY, color, 0); usleep(250000); } 35 tj
Create Eclipse System Compile the software Select the code file (pixel.c) Project Build Project Right Click on the project run as Nios II Hardware 36 tj