本帖最后由 swustlx86 于 2012-11-19 15:52 编辑
本次试验涉及到BASYS2开发板的LED、滑动开关和数码管显示单元。 1、 功能描述: 滑动开关控制对应的LED的亮和灭,并且SW0~SW3控制数码管的显示,相当于用数码管进行4位二进制数据的显示。 2、 更改:由于使用ADEPT下载BIT文件一直存在问题,如图所示:
咨询了论坛上几位高手意见,并将代码发给他们测试,他们都没有遇到过此类问题,尝试将ISE更换为14.2版本,但这个问题一直没有解决。但是使用ISE直接下载是没有问题的,郁闷ing…… 3、 代码 //SW_TEST.V moduleSW_test(sw,Led,seg,dp); input [7:0]sw; output Led; output seg; output dp;
reg [7:0] Led; reg [6:0] seg; reg dp; always@(sw) begin Led[7:0] =sw[7:0]; dp=1'b0; case(sw[3:0]) 4'b0000: seg[6:0] = 7'b1000000; 4'b0001: seg[6:0] = 7'b1111001; 4'b0010: seg[6:0] = 7'b0100100; 4'b0011: seg[6:0] = 7'b0110000; 4'b0100: seg[6:0] = 7'b0011001; 4'b0101: seg[6:0] = 7'b0010010; 4'b0110: seg[6:0] = 7'b0000010; 4'b0111: seg[6:0] = 7'b1111000; 4'b1000: seg[6:0] = 7'b0000000; 4'b1001: seg[6:0] = 7'b0010000; 4'b1010: seg[6:0] = 7'b0001000; 4'b1011: seg[6:0] = 7'b0000011; 4'b1100: seg[6:0] = 7'b1000110; 4'b1101: seg[6:0] = 7'b0100001; 4'b1110: seg[6:0] = 7'b0000110; 4'b1111: seg[6:0] = 7'b0001110; endcase end
endmodule //Basys2Bist.ucf NET "seg<0>" LOC ="L14"; # Bank = 1, Signal name = CA NET "seg<1>" LOC ="H12"; # Bank = 1, Signal name = CB NET "seg<2>" LOC ="N14"; # Bank = 1, Signal name = CC NET "seg<3>" LOC ="N11"; # Bank = 2, Signal name = CD NET "seg<4>" LOC ="P12"; # Bank = 2, Signal name = CE NET "seg<5>" LOC ="L13"; # Bank = 1, Signal name = CF NET "seg<6>" LOC ="M12"; # Bank = 1, Signal name = CG NET "dp" LOC = "N13"; #Bank = 1, Signal name = DP
NET "Led<7>" LOC ="G1" ; # Bank = 3, Signal name = LD7 NET "Led<6>" LOC ="P4" ; # Bank = 2, Signal name = LD6 NET "Led<5>" LOC = "N4"; # Bank = 2, Signal name = LD5 NET "Led<4>" LOC ="N5" ; # Bank = 2, Signal name= LD4 NET "Led<3>" LOC ="P6" ; # Bank = 2, Signal name = LD3 NET "Led<2>" LOC ="P7" ; # Bank = 3, Signal name = LD2 NET "Led<1>" LOC ="M11" ; # Bank = 2, Signal name = LD1 NET "Led<0>" LOC ="M5" ; # Bank = 2, Signal name= LD0
NET "sw<7>" LOC ="N3"; # Bank = 2, Signal name= SW7 NET "sw<6>" LOC ="E2"; # Bank = 3, Signal name= SW6 NET "sw<5>" LOC ="F3"; # Bank = 3, Signal name= SW5 NET "sw<4>" LOC ="G3"; # Bank = 3, Signal name= SW4 NET "sw<3>" LOC ="B4"; # Bank = 3, Signal name= SW3 NET "sw<2>" LOC ="K3"; # Bank = 3, Signal name= SW2 NET "sw<1>" LOC ="L3"; # Bank = 3, Signal name= SW1 NET "sw<0>" LOC ="P11"; # Bank = 2, Signal name= SW0 4、 一系列的检查及生成文件,此处省去1W字…… 5、 打开Impact
点击 Boundary Scan;(在此感谢CMika),右键选择Initialize Chain,
点击右键,加载文件.bit和.mcs.然后点右键,选择Program.
6、 效果图如下:(手机不给力,将就看看,呵呵)
|