QUARTUSII软件开放性实验报告_第1页
QUARTUSII软件开放性实验报告_第2页
QUARTUSII软件开放性实验报告_第3页
QUARTUSII软件开放性实验报告_第4页
QUARTUSII软件开放性实验报告_第5页
已阅读5页,还剩15页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

开放性实验报告专业:电子信息工程班级:*电信*班姓名:学号:指导老师:实验一:流水灯实验内容利用QUARTUSII软件,构建NIOSII软核系统,编写程序,实现实验箱上LED灯的流水功能。实验原理通过提前设定NIOSII软核处理器的相关寄存器,控制led的IO口的高低电平输出及响应间隔时间,从而改变LED的亮灭并达到流水灯效果。实验步骤硬件设计.构建NIOSII软核NIOSII软核处理器包括cpu,sdram控制器,串行flash控制器,jtag_uart,sysid,pio端口。.PLL模块的构建实验箱的板载有源晶振频率为50MHZ,NIOSII及SDRAM需要100MHZ的时钟源,因此需要用PLL模块进行倍频。PLL模块的配置如图所示:输入时钟频率为50MHZ输出时钟c0为输入时钟的2倍频输出时钟c1为输入时钟的2倍频,相位偏移-75度,为SDRAM提供工作时钟PLL模块:.系统连线及引脚分配qsf文件中的引脚分配:set_location_assignmentPIN_AF21-tosdram_addr[0]set_location_assignmentPIN_AE20-tosdram_addr[1]set_location_assignmentPIN_AF20-tosdram_addr[2]set_location_assignmentPIN_AE19-tosdram_addr[3]set_location_assignmentPIN_B20-tosdram_addr[4]set_location_assignmentPIN_A21-tosdram_addr[5]set_location_assignmentPIN_B21-tosdram_addr[6]set_location_assignmentPIN_A22-tosdram_addr[7]set_location_assignmentPIN_B22-tosdram_addr[8]set_location_assignmentPIN_A23-tosdram_addr[9]set_location_assignmentPIN_AE21-tosdram_addr[10]set_location_assignmentPIN_B23-tosdram_addr[11]set_location_assignmentPIN_B24-tosdram_addr[12]set_location_assignmentPIN_AE22-tosdram_ba[0]set_location_assignmentPIN_AF22-tosdram_ba[1]set_location_assignmentPIN_AE24-tosdram_cas_nset_location_assignmentPIN_B25-tosdram_ckeset_location_assignmentPIN_AF23-tosdram_cs_nset_location_assignmentPIN_AD25-tosdram_dq[0]set_location_assignmentPIN_AC25-tosdram_dq[1]set_location_assignmentPIN_AC26-tosdram_dq[2]set_location_assignmentPIN_AB25-tosdram_dq[3]set_location_assignmentPIN_AB26-tosdram_dq[4]set_location_assignmentPIN_AA25-tosdram_dq[5]set_location_assignmentPIN_AA26-tosdram_dq[6]set_location_assignmentPIN_Y25-tosdram_dq[7]set_location_assignmentPIN_W26-tosdram_dq[8]set_location_assignmentPIN_V25-tosdram_dq[9]set_location_assignmentPIN_V26-tosdram_dq[10]set_location_assignmentPIN_U25-tosdram_dq[11]set_location_assignmentPIN_U26-tosdram_dq[12]set_location_assignmentPIN_T25-tosdram_dq[13]set_location_assignmentPIN_R25-tosdram_dq[14]set_location_assignmentPIN_P24-tosdram_dq[15]set_location_assignmentPIN_N24-tosdram_dq[16]set_location_assignmentPIN_M25-tosdram_dq[17]set_location_assignmentPIN_L25-tosdram_dq[18]set_location_assignmentPIN_K26-tosdram_dq[19]set_location_assignmentPIN_K25-tosdram_dq[20]set_location_assignmentPIN_J26-tosdram_dq[21]set_location_assignmentPIN_J25-tosdram_dq[22]set_location_assignmentPIN_H26-tosdram_dq[23]set_location_assignmentPIN_G25-tosdram_dq[24]set_location_assignmentPIN_F26-tosdram_dq[25]set_location_assignmentPIN_F25-tosdram_dq[26]set_location_assignmentPIN_E26-tosdram_dq[27]set_location_assignmentPIN_E25-tosdram_dq[28]set_location_assignmentPIN_D26-tosdram_dq[29]set_location_assignmentPIN_D25-tosdram_dq[30]set_location_assignmentPIN_C25-tosdram_dq[31]set_location_assignmentPIN_Y26-tosdram_dqm[0]set_location_assignmentPIN_W25-tosdram_dqm[1]set_location_assignmentPIN_H25-tosdram_dqm[2]set_location_assignmentPIN_G26-tosdram_dqm[3]set_location_assignmentPIN_AE23-tosdram_ras_nset_location_assignmentPIN_AE25-tosdram_we_nset_location_assignmentPIN_F21-toclk_sdram软件设计system.h文件中关于PIO_LED的宏定义#definePIO_LED_NAME"/dev/pio_LED"#definePIO_LED_TYPE"altera_avalon_pio"#definePIO_LED_BASE0x00001800#definePIO_LED_SPAN16#definePIO_LED_DO_TEST_BENCH_WIRING0#definePIO_LED_DRIVEN_SIM_VALUE0#definePIO_LED_HAS_TRI0#definePIO_LED_HAS_OUT1#definePIO_LED_HAS_IN0#definePIO_LED_CAPTURE0#definePIO_LED_DATA_WIDTH8#definePIO_LED_RESET_VALUE0#definePIO_LED_EDGE_TYPE"NONE"#definePIO_LED_IRQ_TYPE"NONE"#definePIO_LED_BIT_CLEARING_EDGE_REGISTER0#definePIO_LED_BIT_MODIFYING_OUTPUT_REGISTER0#definePIO_LED_FREQ100000000#defineALT_MODULE_CLASS_pio_LEDaltera_avalon_pio利用system.h文件编写sopc.h,通过操作结构体PIO_STR完成对PIO_寄存器的操作。sopc.h文件:#ifndefSOPC_H_#defineSOPC_H_#include"system.h"#define_LEDtypedefstruct{unsignedlongintDATA;unsignedlongintDIRECTION;unsignedlongintINTERRUPT_MASK;unsignedlongintEDGE_CAPTURE;}PIO_STR;#ifdef_LED#defineLED((PIO_STR*)PIO_LED_BASE)#endif#endifMain.c文件全部源码:#include<stdio.h>#include<unistd.h>#include"../inc/sopc.h"intmain(){inti;while(1){for(i=0;i<8;i++){LED->DATA=~(1<<i);usleep(500000);}}return0;}实验二:数码管显示实验内容利用QUARTUSII软件,构建NIOSII软核处理器系统,在NIOSIDE软件中编写程序,实现实验箱上数码管的动态显示。实验原理在NIOSII软核处理器中添加段选,位选IO,通过控制PIO寄存器,逐次点亮数码管,利用人眼的视觉暂留效应,实现数码管的动态显示。实验步骤硬件设计.构建NIOSII软核NIOSII软核包括cpu,sdram控制器,串行flash,jtag_uart,sysid,段选IO,位选IO。.构建PLL模块PLL输入时钟频率为20MHZPLL输出时钟c0为输入的5倍频PLL输出时钟c1为输入时钟的5倍频,相位偏移为-75度PLL模块:.系统连线及引脚分配利用qsf文件进行引脚分配:set_location_assignment PIN_27 -to RESETset_location_assignment PIN_24 -to CLOCKset_location_assignment PIN_88 -to S_DB[0]set_location_assignment PIN_87 -to S_DB[1]set_location_assignment PIN_86 -to S_DB[2]set_location_assignment PIN_84 -to S_DB[3]set_location_assignment PIN_82 -to S_DB[4]set_location_assignment PIN_81 -to S_DB[5]set_location_assignment PIN_80 -to S_DB[6]set_location_assignment PIN_77 -to S_DB[7]set_location_assignment PIN_45 -to S_DB[8]set_location_assignment PIN_46 -to S_DB[9]set_location_assignment PIN_47 -to S_DB[10]set_location_assignment PIN_48 -to S_DB[11]set_location_assignment PIN_56 -to S_DB[12]set_location_assignment PIN_57 -to S_DB[13]set_location_assignment PIN_58 -to S_DB[14]set_location_assignment PIN_59 -to S_DB[15]set_location_assignment PIN_64 -to S_A[0]set_location_assignment PIN_63 -to S_A[1]set_location_assignment PIN_61 -to S_A[2]set_location_assignment PIN_60 -to S_A[3]set_location_assignment PIN_31 -to S_A[4]set_location_assignment PIN_33 -to S_A[5]set_location_assignment PIN_34 -to S_A[6]set_location_assignment PIN_35 -to S_A[7]set_location_assignment PIN_37 -to S_A[8]set_location_assignment PIN_39 -to S_A[9]set_location_assignment PIN_67 -to S_A[10]set_location_assignment PIN_40 -to S_A[11]set_location_assignment PIN_43 -to S_CLKset_location_assignment PIN_69 -to S_BA[0]set_location_assignment PIN_68 -to S_BA[1]set_location_assignment PIN_74 -to S_nCASset_location_assignment PIN_41 -to S_CKEset_location_assignment PIN_72 -to S_nRASset_location_assignment PIN_75 -to S_nWEset_location_assignment PIN_70 -to S_nCSset_location_assignment PIN_44 -to S_DQM[1]set_location_assignment PIN_76 -to S_DQM[0]set_location_assignment PIN_169 -to DIG[0]set_location_assignment PIN_168 -to DIG[1]set_location_assignment PIN_165 -to DIG[2]set_location_assignment PIN_164 -to DIG[3]set_location_assignment PIN_175 -to DIG[4]set_location_assignment PIN_173 -to DIG[5]set_location_assignment PIN_171 -to DIG[6]set_location_assignment PIN_170 -to DIG[7]set_location_assignment PIN_185 -to SEL[5]set_location_assignment PIN_182 -to SEL[4]set_location_assignment PIN_181 -to SEL[3]set_location_assignment PIN_180 -to SEL[2]set_location_assignment PIN_179 -to SEL[1]set_location_assignment PIN_176 -to SEL[0]软件设计system.h中关于段选IO和位选IO的宏定义#defineDIG_NAME"/dev/DIG"#defineDIG_TYPE"altera_avalon_pio"#defineDIG_BASE0x00001800#defineDIG_SPAN16#defineDIG_DO_TEST_BENCH_WIRING0#defineDIG_DRIVEN_SIM_VALUE0#defineDIG_HAS_TRI0#defineDIG_HAS_OUT1#defineDIG_HAS_IN0#defineDIG_CAPTURE0#defineDIG_DATA_WIDTH8#defineDIG_RESET_VALUE0#defineDIG_EDGE_TYPE"NONE"#defineDIG_IRQ_TYPE"NONE"#defineDIG_BIT_CLEARING_EDGE_REGISTER0#defineDIG_BIT_MODIFYING_OUTPUT_REGISTER0#defineDIG_FREQ100000000#defineALT_MODULE_CLASS_DIGaltera_avalon_pio#defineSEL_NAME"/dev/SEL"#defineSEL_TYPE"altera_avalon_pio"#defineSEL_BASE0x00001810#defineSEL_SPAN16#defineSEL_DO_TEST_BENCH_WIRING0#defineSEL_DRIVEN_SIM_VALUE0#defineSEL_HAS_TRI0#defineSEL_HAS_OUT1#defineSEL_HAS_IN0#defineSEL_CAPTURE0#defineSEL_DATA_WIDTH6#defineSEL_RESET_VALUE0#defineSEL_EDGE_TYPE"NONE"#defineSEL_IRQ_TYPE"NONE"#defineSEL_BIT_CLEARING_EDGE_REGISTER0#defineSEL_BIT_MODIFYING_OUTPUT_REGISTER0#defineSEL_FREQ100000000#defineALT_MODULE_CLASS_SELaltera_avalon_pio利用system.h文件编写的sopc.h文件:#ifndefSOPC_H_#defineSOPC_H_#include"system.h"#define_DIGtypedefstruct{unsignedlongintDATA;unsignedlongintDIRECTION;unsignedlongintINTERRUPT_MASK;unsignedlongintEDGE_CAPTURE;}SEL_STR;typedefstruct{unsignedlongintDATA;unsignedlongintDIRECTION;unsignedlongintINTERRUPT_MASK;unsignedlongintEDGE_CAPTURE;}DIG_STR;#ifdef_DIG#defineSEL((SEL_STR*)SEL_BASE)#defineDIG((DIG_STR*)DIG_BASE)#endif#endifmain.c文件全部源码:#include<stdio.h>#include<unistd.h>#include"../inc/sopc.h"unsignecharsegtab[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};unsignedcharbittab[6]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf};intmain(){inti=0;while(1){SEL->DATA=bittab[i];DIG->DATA=segtab[i++];if(i==6)i=0;usleep(500000);}return0;}实验三.定时器应用实验内容在QUARTUSII软件中构建NIOSII软核系统,在NIOSIDE软件中编写程序,实现对固定时间段的计数。实验原理配置NIOSII软核的定时器,当定时器溢出时计数,利用数码管的动态显示技术值。实验步骤硬件设计.构建NIOSII软核系统NIOSII软核包括cpu,sdram控制器,串行flash,jtag_uart,sysid,段选IO,位选IO,定时器。(2).构建PLL模块PLL输入时钟频率为20MHZPLL输出时钟c0为输入的5倍频PLL输出时钟c1为输入时钟的5倍频,相位偏移为-75度PLL模块:(3).系统连线及引脚分配利用qsf文件进行引脚分配:set_location_assignment PIN_27 -to RESETset_location_assignment PIN_24 -to CLOCKset_location_assignment PIN_88 -to S_DB[0]set_location_assignment PIN_87 -to S_DB[1]set_location_assignment PIN_86 -to S_DB[2]set_location_assignment PIN_84 -to S_DB[3]set_location_assignment PIN_82 -to S_DB[4]set_location_assignment PIN_81 -to S_DB[5]set_location_assignment PIN_80 -to S_DB[6]set_location_assignment PIN_77 -to S_DB[7]set_location_assignment PIN_45 -to S_DB[8]set_location_assignment PIN_46 -to S_DB[9]set_location_assignment PIN_47 -to S_DB[10]set_location_assignment PIN_48 -to S_DB[11]set_location_assignment PIN_56 -to S_DB[12]set_location_assignment PIN_57 -to S_DB[13]set_location_assignment PIN_58 -to S_DB[14]set_location_assignment PIN_59 -to S_DB[15]set_location_assignment PIN_64 -to S_A[0]set_location_assignment PIN_63 -to S_A[1]set_location_assignment PIN_61 -to S_A[2]set_location_assignment PIN_60 -to S_A[3]set_location_assignment PIN_31 -to S_A[4]set_location_assignment PIN_33 -to S_A[5]set_location_assignment PIN_34 -to S_A[6]set_location_assignment PIN_35 -to S_A[7]set_location_assignment PIN_37 -to S_A[8]set_location_assignment PIN_39 -to S_A[9]set_location_assignment PIN_67 -to S_A[10]set_location_assignment PIN_40 -to S_A[11]set_location_assignment PIN_43 -to S_CLKset_location_assignment PIN_69 -to S_BA[0]set_location_assignment PIN_68 -to S_BA[1]set_location_assignment PIN_74 -to S_nCASset_location_assignment PIN_41 -to S_CKEset_location_assignment PIN_72 -to S_nRASset_location_assignment PIN_75 -to S_nWEset_location_assignment PIN_70 -to S_nCSset_location_assignment PIN_44 -to S_DQM[1]set_location_assignment PIN_76 -to S_DQM[0]set_location_assignment PIN_169 -to DIG[0]set_location_assignment PIN_168 -to DIG[1]set_location_assignment PIN_165 -to DIG[2]set_location_assignment PIN_164 -to DIG[3]set_location_assignment PIN_175 -to DIG[4]set_location_assignment PIN_173 -to DIG[5]set_location_assignment PIN_171 -to DIG[6]set_location_assignment PIN_170 -to DIG[7]set_location_assignment PIN_185 -to SEL[5]set_location_assignment PIN_182 -to SEL[4]set_location_assignment PIN_181 -to SEL[3]set_location_assignment PIN_180 -to SEL[2]set_location_assignment PIN_179 -to SEL[1]set_location_assignment PIN_176 -to SEL[0]软件设计软件全部

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论