该项目将大家一起使用Basys3板创建一个简单的示波器,花费时间约4小时。硬件组件DigilentBasys3软件应用程序和在线服务XilinxVivado设计套件XilinxVitis统一软件平台项目介绍DigilentBasys3板是一款功能强大的板,可用于开始开发FPGA项目。它为用户提供了一个Artix35T设备、USB-UART、四个Pmod——包括一个为XADC配置的Pmod、12位VGA和开关、LED和七段显示器。该项目旨在演示Basys3板的功能,为此我们将创建一个简单的示波器,它可以使用XDACPmod输入通道和VGA显示器来显示波形。为此,我们将使用MicroBlaze控制器来运行应用程序并控制XADC的测量,并确定在VGA屏幕上绘制数据的位置。VGA显示器将是640x480,12位RGB在软件内存中渲染需要3、686、400位。这超过了FPGA中可用的1、800、000位BRAM。处理器也无法以能够达到所需帧速率所需的速度运行。我们将通过使用处理器来确定数据点图来解决这个问题,同时逻辑渲染帧以实时显示。为此,我们将使用我们首先创建的高级综合核心。高级综合核心开始时要重新创建一个HLS核心,它可以在VGA显示器中绘制多达10个样本(当然,您可以稍后更改)。HLS内核将生成一个640像素x480行的AXI流。为了更新每一帧的显示,将有定义样本数据位置的sample_x/_y寄存器、定义数据点大小的寄存器和定义数据点颜色的最终寄存器。创建HLS流需要使用ap_fixed.h和hls_video.h库进行简单定义。我们将有一个32位像素,其中包括每个RGB的8位,还有一个用于混合的8位alpha通道。hud.h文件包括以下几行#include"hls_video.h"#include#include"string.h"#defineWIDTH32//32asalphachanneltypedefap_uintpixel_type;typedefhls::stream>axis;typedefap_axiuvideo_stream;voidhud_gen(axis&op,introw,intcolumn,intplot_x_1,intplot_y_1,intplot_x_2,intplot_y_2,intplot_x_3,intplot_y_3,intplot_x_4,intplot_y_4,intplot_x_5,intplot_y_5,intplot_x_6,intplot_y_6,intplot_x_7,intplot_y_7,intplot_x_8,intplot_y_8,intplot_x_9,intplot_y_9,intplot_x_10,intplot_y_10,intplot_x_11,intplot_y_11,intplot_x_12,intplot_y_12,intplot_x_13,intplot_y_13,intplot_x_14,intplot_y_14,intplot_x_15,intplot_y_15,intplot_x_16,intplot_y_16,intplot_x_17,intplot_y_17,intplot_x_18,intplot_y_18,intplot_x_19,intplot_y_19,intplot_x_20,intplot_y_20,intplot_size,uint32_tplot_colour);虽然代码的主体看起来像#include"hud.h"//#include"char.h"voidhud_gen(axis&op,introw,intcolumn,intplot_x_1,intplot_y_1,intplot_x_2,intplot_y_2,intplot_x_3,intplot_y_3,intplot_x_4,intplot_y_4,intplot_x_5,intplot_y_5,intplot_x_6,intplot_y_6,intplot_x_7,intplot_y_7,intplot_x_8,intplot_y_8,intplot_x_9,intplot_y_9,intplot_x_10,intplot_y_10,intplot_x_11,intplot_y_11,intplot_x_12,intplot_y_12,intplot_x_13,intplot_y_13,intplot_x_14,intplot_y_14,intplot_x_15,intplot_y_15,intplot_x_16,intplot_y_16,intplot_x_17,intplot_y_17,intplot_x_18,intplot_y_18,intplot_x_19,intplot_y_19,intplot_x_20,intplot_y_20,intplot_size,uint32_tplot_colour){#pragmaHLSINTERFACEs_axiliteport=return#pragmaHLSINTERFACEs_axiliteport=plot_y_1#pragmaHLSINTERFACEs_axiliteport=plot_x_1#pragmaHLSINTERFACEs_axiliteport=plot_y_2#pragmaHLSINTERFACEs_axiliteport=plot_x_2#pragmaHLSINTERFACEs_axiliteport=plot_y_3#pragmaHLSINTERFACEs_axiliteport=plot_x_3#pragmaHLSINTERFACEs_axiliteport=plot_y_4#pragmaHLSINTERFACEs_axiliteport=plot_x_4#pragmaHLSINTERFACEs_axiliteport=plot_y_5#pragmaHLSINTERFACEs_axiliteport=plot_x_5#pragmaHLSINTERFACEs_axiliteport=plot_y_6#pragmaHLSINTERFACEs_axiliteport=plot_x_6#pragmaHLSINTERFACEs_axiliteport=plot_y_7#pragmaHLSINTERFACEs_axiliteport=plot_x_7#pragmaHLSINTERFACEs_axiliteport=plot_y_8#pragmaHLSINTERFACEs_axiliteport=plot_x_8#pragmaHLSINTERFACEs_axiliteport=plot_y_9#pragmaHLSINTERFACEs_axiliteport=plot_x_9#pragmaHLSINTERFACEs_axiliteport=plot_y_10#pragmaHLSINTERFACEs_axiliteport=plot_x_10#pragmaHLSINTERFACEs_axiliteport=plot_y_11#pragmaHLSINTERFACEs_axiliteport=plot_x_11#pragmaHLSINTERFACEs_axiliteport=plot_y_12#pragmaHLSINTERFACEs_axiliteport=plot_x_12#pragmaHLSINTERFACEs_axiliteport=plot_y_13#pragmaHLSINTERFACEs_axiliteport=plot_x_13#pragmaHLSINTERFACEs_axiliteport=plot_y_14#pragmaHLSINTERFACEs_axiliteport=plot_x_14#pragmaHLSINTERFACEs_axiliteport=plot_y_15#pragmaHLSINTERFACEs_axiliteport=plot_x_15#pragmaHLSINTERFACEs_axiliteport=plot_y_16#pragmaHLSINTERFACEs_axiliteport=plot_x_16#pragmaHLSINTERFACEs_axiliteport=plot_y_17#pragmaHLSINTERFACEs_axiliteport=plot_x_17#pragmaHLSINTERFACEs_axiliteport=plot_y_18#pragmaHLSINTERFACEs_axiliteport=plot_x_18#pragmaHLSINTERFACEs_axiliteport=plot_y_19#pragmaHLSINTERFACEs_axiliteport=plot_x_19#pragmaHLSINTERFACEs_axiliteport=plot_y_20#pragmaHLSINTERFACEs_axiliteport=plot_x_20#pragmaHLSINTERFACEs_axiliteport=column#pragmaHLSINTERFACEs_axiliteport=row#pragmaHLSINTERFACEs_axiliteport=plot_size#pragmaHLSINTERFACEs_axiliteport=plot_colour#pragmaHLSINTERFACEaxisregisterbothport=opinti=0;inty=0;intx=0;//intbar_pos_x=10;//intbar_width=30;video_streamhud_int;row_loop:for(y=0;ycolumn_loop:for(x=0;xif(y==0&&x==0){hud_int.user=1;}else{if(x==(column-1)){hud_int.last=1;}else{hud_int.last=0;hud_int.user=0;if(((x>=(plot_x_1-plot_size))&(x=(plot_y_1-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_2-plot_size))&(x=(plot_y_2-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_3-plot_size))&(x=(plot_y_3-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_4-plot_size))&(x=(plot_y_4-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_5-plot_size))&(x=(plot_y_5-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_6-plot_size))&(x=(plot_y_6-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_7-plot_size))&(x=(plot_y_7-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_8-plot_size))&(x=(plot_y_8-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_9-plot_size))&(x=(plot_y_9-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_10-plot_size))&(x=(plot_y_10-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_11-plot_size))&(x=(plot_y_11-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_12-plot_size))&(x=(plot_y_12-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_13-plot_size))&(x=(plot_y_13-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_14-plot_size))&(x=(plot_y_14-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_15-plot_size))&(x=(plot_y_15-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_16-plot_size))&(x=(plot_y_16-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_17-plot_size))&(x=(plot_y_17-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_18-plot_size))&(x=(plot_y_18-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_19-plot_size))&(x=(plot_y_19-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}elseif(((x>=(plot_x_20-plot_size))&(x=(plot_y_20-plot_size))&(yhud_int.data=0x7f0000ff;//0x7f0000ff;//shouldbegreenandhighalpha}else{if((y>=0&y=column-3&y=0&xhud_int.data=0x7f0000ff;}else{hud_int.data=0;}}}}op.write(hud_int);}}}请注意我如何使用两个循环在流中创建图像的X和Y元素。在内部循环中,我们处理TUser和TLast信号上的帧开始和行尾边带信号。下一步是使用C来模拟电路,以确保行为符合我们的要求创建的测试台可用于C和Co仿真#include"hud.h"#includeintmain(intargc,char**argv){IplImage*src;IplImage*dst;axisdst_axi;inty;dst=cvCreateImage(cvSize(640,480),IPL_DEPTH_32S,1);//hud_gen(dst_axi,480,640,240,320,5,0x7f0000ff,600,30);hud_gen(dst_axi,480,640,0,141,32,158,64,140,96,145,128,150,160,140,192,130,224,145,256,156,288,135,320,130,352,140,384,149,416,139,448,130,480,140,512,160,544,140,576,145,608,150,5,0x7f0000ff);AXIvideo2IplImage(dst_axi,dst);cvSaveImage("op.bmp",dst);cvReleaseImage(&dst);}运行C模拟为我们提供了一个BMP图像,它应该展示绘制的点在此示例中,数据点是绘制的白点。在性能满意的情况下,下一步是综合和封装IP块以用于新的Vivado项目。在HLS综合之后,预测的资源使用情况为现在我们有了IP块,我们将能够将其添加到我们的项目中并开始Vivado设计。Vivado设计要开始使用Vivado设计,我们需要将以下IP添加到针对Basys3板创建的新项目中。MicroBlaze-64KB数据和指令存储器AXILiteUART视频时序控制器-仅配置为生成视频测试模式生成器-最大行数和列数800、800XADC-启用Vaux6、7、14和15时钟向导-20MHz(MicroBlaze)、25.175MHz(像素时钟)、50MHz(逻辑时钟)视频混合器-最大行数和列数800、800视频轴到视频输出之前在HLS中创建的HUDIPGPIO连接到按钮-光标的未来扩展创建框图时,利用块自动化来配置MicroBlaze-添加内存、调试和休息结构。还利用连接自动化来连接AXI互连。显示界面视图时,端图将类似于下图。完整的设计如下我会将完整的设计放在我的github上进行探索和修改。图像路径将先前创建的HLSIP与TPG合并(允许设置背景颜色)。这些使用视频混合器核心合并,该核心使用alpha混合合并两个流。生成的输出流被转换回并行视频输出格式Pixel、VSync、HSync等,为640、480显示器定时。AXIStream到视频的时序由视频时序发生器控制。在这种方法中,软件应用程序可以使用TPG设置背景并使用HLSIP定义绘图。为了确保设计适用于所有VGA显示器,我们需要确保RGB信号在消隐期间为0。因此,我使用了一个与门逻辑IP块,该IP块由AXI流提供的视频输出启用门控到视频输出块。Basys3上的VGA输出使用每个通道RGB的3个输出。为了提供可重复使用的设计,我们使用了在设计中更常见的8位像素,以允许移植到不同的板上。该项目使用的XDC如下##7segmentdisplayset_propertyPACKAGE_PINW7[get_ports{seven_seg[0]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[0]}]set_propertyPACKAGE_PINW6[get_ports{seven_seg[1]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[1]}]set_propertyPACKAGE_PINU8[get_ports{seven_seg[2]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[2]}]set_propertyPACKAGE_PINV8[get_ports{seven_seg[3]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[3]}]set_propertyPACKAGE_PINU5[get_ports{seven_seg[4]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[4]}]set_propertyPACKAGE_PINV5[get_ports{seven_seg[5]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[5]}]set_propertyPACKAGE_PINU7[get_ports{seven_seg[6]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg[6]}]#set_propertyPACKAGE_PINV7[get_portsdp]#set_propertyIOSTANDARDLVCMOS33[get_portsdp]set_propertyPACKAGE_PINU2[get_ports{seven_seg_led_an[0]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg_led_an[0]}]set_propertyPACKAGE_PINU4[get_ports{seven_seg_led_an[1]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg_led_an[1]}]set_propertyPACKAGE_PINV4[get_ports{seven_seg_led_an[2]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg_led_an[2]}]set_propertyPACKAGE_PINW4[get_ports{seven_seg_led_an[3]}]set_propertyIOSTANDARDLVCMOS33[get_ports{seven_seg_led_an[3]}]set_propertyPACKAGE_PINW5[get_portssys_clock]set_propertyIOSTANDARDLVCMOS33[get_portssys_clock]#create_clock-add-namesys_clk_pin-period10.00-waveform{05}[get_portsclk]##VGAConnectorset_propertyPACKAGE_PING19[get_ports{vgaRed[0]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaRed[0]}]set_propertyPACKAGE_PINH19[get_ports{vgaRed[1]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaRed[1]}]set_propertyPACKAGE_PINJ19[get_ports{vgaRed[2]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaRed[2]}]set_propertyPACKAGE_PINN19[get_ports{vgaRed[3]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaRed[3]}]set_propertyPACKAGE_PINN18[get_ports{vgaBlue[0]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaBlue[0]}]set_propertyPACKAGE_PINL18[get_ports{vgaBlue[1]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaBlue[1]}]set_propertyPACKAGE_PINK18[get_ports{vgaBlue[2]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaBlue[2]}]set_propertyPACKAGE_PINJ18[get_ports{vgaBlue[3]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaBlue[3]}]set_propertyPACKAGE_PINJ17[get_ports{vgaGreen[0]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaGreen[0]}]set_propertyPACKAGE_PINH17[get_ports{vgaGreen[1]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaGreen[1]}]set_propertyPACKAGE_PING17[get_ports{vgaGreen[2]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaGreen[2]}]set_propertyPACKAGE_PIND17[get_ports{vgaGreen[3]}]set_propertyIOSTANDARDLVCMOS33[get_ports{vgaGreen[3]}]set_propertyPACKAGE_PINP19[get_portsHsync]set_propertyIOSTANDARDLVCMOS33[get_portsHsync]set_propertyPACKAGE_PINR19[get_portsVsync]set_propertyIOSTANDARDLVCMOS33[get_portsVsync]set_propertyDRIVE8[get_ports{vgaBlue[3]}]set_propertyDRIVE8[get_ports{vgaBlue[2]}]set_propertyDRIVE8[get_ports{vgaBlue[1]}]set_propertyDRIVE8[get_ports{vgaBlue[0]}]set_propertyDRIVE8[get_ports{vgaGreen[3]}]set_propertyDRIVE8[get_ports{vgaGreen[2]}]set_propertyDRIVE8[get_ports{vgaGreen[1]}]set_propertyDRIVE8[get_ports{vgaGreen[0]}]set_propertyDRIVE8[get_ports{vgaRed[3]}]set_propertyDRIVE8[get_ports{vgaRed[2]}]set_propertyDRIVE8[get_ports{vgaRed[1]}]set_propertyDRIVE8[get_ports{vgaRed[0]}]set_propertyDRIVE8[get_portsHsync]set_propertyDRIVE8[get_portsVsync]set_propertyC_CLK_INPUT_FREQ_HZ300000000[get_debug_coresdbg_hub]set_propertyC_ENABLE_CLK_DIVIDERfalse[get_debug_coresdbg_hub]set_propertyC_USER_SCAN_CHAIN1[get_debug_coresdbg_hub]connect_debug_portdbg_hub/clk[get_netsclk]完成后,可以构建应用程序并导出XSA。资源使用软件开发软件的开发很简单,生成的HLSIP内核带有用于SW开发的驱动程序。软件应用程序必须执行以下操作初始化XADC初始化TPG初始化混音器初始化视频时序控制器初始化HLSIP设置混合器以混合两个640x480流设置TPG以输出所需的背景颜色为640x480时序设置视频时序控制器循环读取XADC并更新应用代码如下#include#include#include"platform.h"#include"xil_printf.h"#include"xparameters.h"#include"xvtc.h"#include"vga_modes.h"#include"xv_tpg.h"#include"xvidc.h"#include"xv_mix.h"#include"xhud_gen.h"#include"xgpio.h"XVtcVtcInst;XVtc_Config*vtc_config;XV_tpgtpg;XV_tpg_Config*tpg_config;XGpio_Config*gpio_config;XGpiogpio;VideoModevideo;intmain(){XVtc_TimingvtcTiming;XVtc_SourceSelectSourceSelect;XV_mixxv_mix;XV_mix_Config*xv_config;XHud_gen_Config*XV_Hud_cfg;XHud_genxv_hud;init_platform();print("HelloWorld\n\r");print("SuccessfullyranHelloWorldapplication");gpio_config=XGpio_LookupConfig(XPAR_GPIO_0_DEVICE_ID);XGpio_CfgInitialize(&gpio,gpio_config,gpio_config->BaseAddress);XGpio_SetDataDirection(&gpio,1,0xFFFFFFFF);XGpio_SetDataDirection(&gpio,2,0x00000000);vtc_config=XVtc_LookupConfig(XPAR_VTC_0_DEVICE_ID);XVtc_CfgInitialize(&VtcInst,vtc_config,vtc_config->BaseAddress);video=VMODE_640x480;vtcTiming.HActiveVideo=video.width;/**vtcTiming.HFrontPorch=video.hps-video.width;/**vtcTiming.HSyncWidth=video.hpe-video.hps;/**vtcTiming.HBackPorch=video.hmax-video.hpe+1;/**vtcTiming.HSyncPolarity=video.hpol;/**vtcTiming.VActiveVideo=video.height;/**vtcTiming.V0FrontPorch=video.vps-video.height;/**vtcTiming.V0SyncWidth=video.vpe-video.vps;/**vtcTiming.V0BackPorch=video.vmax-video.vpe+1;;/**vtcTiming.V1FrontPorch=video.vps-video.height;/**vtcTiming.V1SyncWidth=video.vpe-video.vps;/**vtcTiming.V1BackPorch=video.vmax-video.vpe+1;;/**vtcTiming.VSyncPolarity=video.vpol;/**vtcTiming.Interlaced=0;memset((void*)&SourceSelect,0,sizeof(SourceSelect));SourceSelect.VBlankPolSrc=1;SourceSelect.VSyncPolSrc=1;SourceSelect.HBlankPolSrc=1;SourceSelect.HSyncPolSrc=1;SourceSelect.ActiveVideoPolSrc=1;SourceSelect.ActiveChromaPolSrc=1;SourceSelect.VChromaSrc=1;SourceSelect.VActiveSrc=1;SourceSelect.VBackPorchSrc=1;SourceSelect.VSyncSrc=1;SourceSelect.VFrontPorchSrc=1;SourceSelect.VTotalSrc=1;SourceSelect.HActiveSrc=1;SourceSelect.HBackPorchSrc=1;SourceSelect.HSyncSrc=1;SourceSelect.HFrontPorchSrc=1;SourceSelect.HTotalSrc=1;XVtc_RegUpdateEnable(&VtcInst);XVtc_SetGeneratorTiming(&VtcInst,&vtcTiming);XVtc_SetSource(&VtcInst,&SourceSelect);XVtc_EnableGenerator(&VtcInst);xv_config=XV_mix_LookupConfig(XPAR_XV_MIX_0_DEVICE_ID);XV_mix_CfgInitialize(&xv_mix,xv_config,xv_config->BaseAddress);XV_mix_Set_HwReg_width(&xv_mix,(u32)640);XV_mix_Set_HwReg_height(&xv_mix,(u32)480);XV_mix_Set_HwReg_layerEnable(&xv_mix,(u32)3);XV_mix_Set_HwReg_layerStartX_0(&xv_mix,(u32)0);XV_mix_Set_HwReg_layerStartY_0(&xv_mix,0);XV_mix_Set_HwReg_layerWidth_0(&xv_mix,(u32)640);XV_mix_Set_HwReg_layerHeight_0(&xv_mix,(u32)480);XV_mix_Set_HwReg_layerAlpha_0(&xv_mix,225);XV_mix_Set_HwReg_layerStartX_1(&xv_mix,(u32)0);XV_mix_Set_HwReg_layerStartY_1(&xv_mix,0);XV_mix_Set_HwReg_layerWidth_1(&xv_mix,(u32)640);XV_mix_Set_HwReg_layerHeight_1(&xv_mix,(u32)480);XV_mix_Set_HwReg_layerAlpha_1(&xv_mix,225);XV_mix_EnableAutoRestart(&xv_mix);XV_mix_Start(&xv_mix);XV_Hud_cfg=XHud_gen_LookupConfig(XPAR_HUD_GEN_0_DEVICE_ID);XHud_gen_CfgInitialize(&xv_hud,XV_Hud_cfg);XHud_gen_Set_row(&xv_hud,(u32)480);XHud_gen_Set_column(&xv_hud,(u32)640);//XHud_gen_Set_ball_y(&xv_hud,(u32)(640/2));//XHud_gen_Set_ball_x(&xv_hud,(u32)(280/2));XHud_gen_Set_plot_size(&xv_hud,(u32)5);XHud_gen_Set_plot_colour(&xv_hud,(u32)0x7fffffff);XHud_gen_EnableAutoRestart(&xv_hud);XHud_gen_Start(&xv_hud);XVtc_Enable(&VtcInst);u32height,width,status;tpg_config=XV_tpg_LookupConfig(XPAR_XV_TPG_0_DEVICE_ID);XV_tpg_CfgInitialize(&tpg,tpg_config,tpg_config->BaseAddress);status=XV_tpg_IsReady(&tpg);printf("TPGStatus%u\n\r",(unsignedint)status);XV_tpg_Set_height(&tpg,(u32)video.height);XV_tpg_Set_width(&tpg,(u32)video.width);height=XV_tpg_Get_height(&tpg);width=XV_tpg_Get_width(&tpg);XV_tpg_Set_colorFormat(&tpg,XVIDC_CSF_RGB);XV_tpg_Set_maskId(&tpg,0x0);XV_tpg_Set_motionSpeed(&tpg,0x4);printf("infofromtpg%u%u\n\r",(unsignedint)height,(unsignedint)width);XV_tpg_Set_bckgndId(&tpg,XTPG_BKGND_SOLID_BLUE);//XTPG_BKGND_COLOR_BARS);//);status=XV_tpg_Get_bckgndId(&tpg);printf("Status%x\n\r",(unsignedint)status);XV_tpg_EnableAutoRestart(&tpg);XV_tpg_Start(&tpg);status=XV_tpg_IsIdle(&tpg);printf("Status%u\n\r",(unsignedint)status);XHud_gen_Set_plot_x_1(&xv_hud,64);XHud_gen_Set_plot_y_1(&xv_hud,441);XHud_gen_Set_plot_x_2(&xv_hud,128);XHud_gen_Set_plot_y_2(&xv_hud,458);XHud_gen_Set_plot_x_3(&xv_hud,192);XHud_gen_Set_plot_y_3(&xv_hud,273);XHud_gen_Set_plot_x_4(&xv_hud,256);XHud_gen_Set_plot_y_4(&xv_hud,58);XHud_gen_Set_plot_x_5(&xv_hud,320);XHud_gen_Set_plot_y_5(&xv_hud,9);XHud_gen_Set_plot_x_6(&xv_hud,384);XHud_gen_Set_plot_y_6(&xv_hud,172);XHud_gen_Set_plot_x_7(&xv_hud,448);XHud_gen_Set_plot_y_7(&xv_hud,397);XHud_gen_Set_plot_x_8(&xv_hud,512);XHud_gen_Set_plot_y_8(&xv_hud,477);XHud_gen_Set_plot_x_9(&xv_hud,576);XHud_gen_Set_plot_y_9(&xv_hud,338);XHud_gen_Set_plot_x_10(&xv_hud,640);XHud_gen_Set_plot_y_10(&xv_hud,109);cleanup_platform();return0;}当输出时,这会提供一个漂亮的彩色显示,作为VGA显示的基本范围。另外,我们可以创建一个简单的项目来展示如何在VGA输出上绘制点。未来的改进方向可能如下:添加标签和标记添加光标以在屏幕上报告样本值点之间的线绘制当然,我们需要注意所需的逻辑资源,因为这个项目对设备资源的要求很高。感谢您的关注以上内容翻译自网络,原作者亚当泰勒,如涉及侵权,可联系删除。