| 四、操作步骤 4.1创建Quartus工程
 
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 4.2 创建 Verilog 模块
 点击 Quartus 软件工具栏 "File --> New",选择 "Verilog HDL File",点击 "OK"。
 
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 4.3 创建 Verilog 模块
 在 "Structural coding" 处填写逻辑功能定义语句,完整的代码如下所示。
 4.4选择引脚分配复制代码// 创建 Verilog 模块
module my_first_fpga (
        input wire clk, // 50MHz 输入时钟
        output wire LED // LED 输出
);
// 创建一个二进制计数器
        reg [31:0] cnt; // 32-bit 计数器
        initial begin
                cnt <= 32'h00000000; // 计数从 0 开始
        end
        always @(posedge clk) begin
                cnt <= cnt + 1; // 计数值加 1
        end
// 将计数器的第 25 位的值赋值给 ELD[0],使其实现闪烁的功能
        assign LED = cnt[24];
endmodule
点击 Quartus 工具栏的 "Assignments --> Pin Planner"。
 
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 4.5创建时序约束
 编译 Verilog 代码之前,需要为设计创建时序约束,创建 SDC(Synopsys Design Constraints File)文件,该文件指示 Quartus 软件如何进行时序收敛。如果没有这个文件,在编译过程中会提示 "warning" 信息,
 因为 Intel Quartus 软件不会自动进行时序收敛。
 点击 Quartus 工具栏 "File --> New --> Synopsys Design Constraints File",点击 "OK"。
 
 游客,本帖隐藏的内容需要积分高于 2 才可浏览,您当前积分为 0 复制以下代码并粘贴到 "Synopsys Design Constraints File" 中。
 点击 Quartus 软件工具栏 "File --> Save As",将 "Synopsys Design Constraints File" 命名为"my_first_fpga.sdc",点击 "保存"。复制代码# inform quartus that the clk port brings a 50MHz clock into our design so
# that timing closure on our design can be analyzed
create_clock -name clk -period "50MHz" [get_ports clk]
# inform quartus that the LED output port has no critical timing
requirements
# its a single output port driving an LED, there are no timing
relationships
# that are critical for this
set_false_path -from * -to [get_ports LED]
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 4.6 编译 Verilog 代码
 
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 4.7 对 FPGA 编程
 
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 4.8 运行结果
 
 游客,本帖隐藏的内容需要积分高于 1 才可浏览,您当前积分为 0 |