text

zedboard基于vivado的试验

试验①:点亮一个led灯,使用一个按钮做复位。

project_2.v

module project_2(
    input clk,	//时钟输入
    input rst,	//复位,高电平有效
    output reg led //led输出

    );
    always@(posedge clk or posedge rst)begin
        if(rst)	//复位按钮按下就给led一个低电平
            led<=1'b0;
        else		//否则给一个高电平
            led<=1'b1;
    end
endmodule

生成的schematic图像

image-20240313155454443

手动添加管脚约束:

时钟引脚:Y9

led灯引脚:T22

复位rst引脚: P16

image-20240313155620519

生成的project_2.xdc文件:

set_property PACKAGE_PIN Y9 [get_ports clk]
set_property PACKAGE_PIN T22 [get_ports led]
set_property PACKAGE_PIN P16 [get_ports rst]
set_property IOSTANDARD LVCMOS33 [get_ports clk]
set_property IOSTANDARD LVCMOS33 [get_ports led]
set_property IOSTANDARD LVCMOS33 [get_ports rst]

经过生成比特流之后,链接板子进行写入。

2024年3月13日15:40:52

F22红灯点亮(注意将串联的开关处于打开状态)

c9aa1efa2e321994d6a6b077229b108

按下按键P16,程序复位。

db4759cb269fde8ce85c24b291f20c7

试验②:流水灯

project_3.v

module project_3(
input           clock,//100M
input           reset,//SW0
output  [7:0]   led//LED0~LED7
    );
 
reg [32:0]  count;
reg [2:0]   led_cnt;
reg [7:0]   led_reg;
 
//0.5s计数    
always@(posedge clock or negedge reset)begin
        if(!reset)
            count   <=  32'd0;
        else if(count == 32'd50000000 - 1'b1) 
            count   <=  32'd0;
        else
            count   <=  count   +   1'b1;
end
 
//led计数0~7
always@(posedge clock or negedge reset)begin
        if(!reset)
            led_cnt   <=  3'd0;
        else if(count == 32'd50000000 - 1'b1) 
            led_cnt   <=  led_cnt   +   1'b1;
        else
            led_cnt   <=  led_cnt;
end
 
//根据计数值点亮led
always@(posedge clock or negedge reset)begin
        if(!reset)
            led_reg   <=  8'b00000000;
        else case(led_cnt) 
            0: led_reg  <=  8'b00000001;
            1: led_reg  <=  8'b00000010;
            2: led_reg  <=  8'b00000100;
            3: led_reg  <=  8'b00001000;
            4: led_reg  <=  8'b00010000;
            5: led_reg  <=  8'b00100000;
            6: led_reg  <=  8'b01000000;
            7: led_reg  <=  8'b10000000;
         default:led_reg  <=  8'b00000000;
        endcase     
end 
assign  led =   led_reg;                     
endmodule

生成的schematic图像

image-20240313175933880

手动添加管脚约束:

image-20240313175958451

38de29eb0d682672c55bc3f0d1bd8ae

7c3ee10bc16b3a8804d169cbb002ebe

4833f1ac6fff10a155a552649585085

27ca2021b95cb8d76848dd458318384

ae43c3e2e0a9030ea334d8cbd14ac15

https://blog.csdn.net/weiwei_fpga/article/details/125015925

posted @ 2024-03-14 09:22  L707  阅读(13)  评论(0编辑  收藏  举报