1、工业大学数字电子技术基础实验报告数字电子技术基础第四次实验报告一、 描述QuartusII软件基本使用步骤1.用文本编辑器正确编写源文件(本例run.v),并经modelsim仿真确认该电路设计正确.2.打开QuartusII软件,新建工程New project (注意工程名和设计文件的module名保持一致),选择和开发板一致的FPGA器件型号。(本课程为Cyclone IV E系列EP4CE115F29C7)3.添加文件,点击file-open,之后选择要添加的文件,并勾选Add file to current project.4.编译,Start Compilation ,编译源文件 (
2、如有错误修改后,重新编译)。5. 查看电路结构,使用Tool-RTL viewer工具查看电路图结构,是否和预期设计一致。6.管脚绑定,使用Assignment-pin planner将设计的全部输入/输出接口与开发板的对应管脚进行一一对应。PIN_Y2 -to clkPIN_H19 -to out7PIN_J19 -to out6PIN_E18 -to out5PIN_F18 -to out4PIN_F21 -to out3PIN_E19 -to out2PIN_F19 -to out1PIN_G19 -to out0PIN_M23 -to rst7. Processing-Start Co
3、mpilation,全编译生成可下载文件。(.sof)8. 连接开发板,安装所需驱动程序(在设备管理器中,选择路径为quatus安装路径)9. 点击start开始烧录,完成后开发板上出现流水灯。二、 题目代码以及波形1.跑马灯设计及FPGA实现编写模块源码module run (clk,rst,out);input clk,rst;output 7:0 out; reg 7:0 out; reg 24:0 count; always ( posedge clk or negedge rst ) if(!rst) begin count=16b0; end else begin count=co
4、unt+1; end always ( posedge clk or negedge rst) if(!rst) begin out=8hff; end else begin case ( count24:21 ) 0: out=8b1111_1110; 1: out=8b1111_1101; 2: out=8b1111_1011; 3: out=8b1111_0111; 4: out=8b1110_1111; 5: out=8b1101_1111; 6: out=8b1011_1111; 7: out=8b0111_1111; 8: out=8b1011_1111; 9: out=8b110
5、1_1111; 10:out=8b1110_1111; 11:out=8b1111_0111; 12:out=8b1111_1011; 13:out=8b1111_1101; 14:out=8b1111_1110; 15:out=8b1111_1111; endcase end endmodule 测试模块timescale 1ns/1psmodule tb_run;reg clk_test;reg rst_test;wire 7:0out_test;initialclk_test=0;always #1 clk_test=clk_test;initialbeginrst_test=1;#1r
6、st_test=0;#1rst_test=1;#180rst_test=0;#1rst_test=1;endrun UUT_run(.clk(clk_test),.rst(rst_test),.out(out_test);endmodule仿真后的波形截图综合后的RTL图形1.有限状态机设计(教材Figure 6.86)编写模块源码module sequence (Clock,Resetn,w,z); input Clock,Resetn,w; output z; reg 3:1y,Y; parameter 3:1A=3b000,B=3b001,C=3b010,D=3b011,E=3b100;
7、 always(w,y) case(y) A:if(w) Y=D; else Y=B; B:if(w) Y=D; else Y=C; C:if(w) Y=D; else Y=C; D:if(w) Y=E; else Y=B; E:if(w) Y=E; else Y=B; default: Y=3bxxx; endcase always(negedge Resetn,posedge Clock) if(Resetn=0) y=A; else y=Y; assign z=(y=C)|(y=E);endmodule测试模块timescale 1ns/1psmodule tb_sequence;reg
8、 Clock_test,Resetn_test,w_test;wire z_test;initialbeginClock_test=0;Resetn_test=0;w_test=1;endalways #10 Clock_test=Clock_test;initialbegin#10Resetn_test=1;w_test=1;#10w_test=0;#20w_test=0;#20w_test=0;#20w_test=1;#20w_test=1;#20w_test=0;#20w_test=0;#20w_test=1;#20w_test=0;#20w_test=0;#20w_test=0;#20
9、w_test=1;#20w_test=1;#20w_test=0;#20w_test=0;endsequence UUT_sequence(.Clock(Clock_test),.Resetn(Resetn_test),.w(w_test),.z(z_test);endmodule仿真后的波形截图综合后的RTL图形三、 本次实验收获和心得通过本次试验真正接触了FPGA开发板并向板子上烤了文件,虽然题目较为简单,但是在完成的过程中遇到了不少问题,比如软件内部没有需要的开发板型号,自己通过搜索和下载,找到了相应的扩展包并成功添加进入高版本的quartus II软件当中,我的体会是,数字电路归根到底还是依靠硬件实现的,所以将代码的执行效果反映到硬件上是一个重要环节,应该不断练习,提高自己解决问题的能力;另外通过本次实验,我对有限状态机有了更加深入的了解。
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2