前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >FPGA Quartus ll使用

FPGA Quartus ll使用

原创
作者头像
AnieaLanie
发布2022-03-14 14:29:31
1.2K0
发布2022-03-14 14:29:31
举报
文章被收录于专栏:铁子的专栏铁子的专栏

1. 有关FGPA

FPGA是一种新型的嵌入式硬件,使用可编程电路,其电路由程序设计语言编程即时修改并应用。一般的嵌入式电路设计是首先设计好电路,然后生产出电路,而FPGA只需要通过编程即可修改FPGA硬件内部的电路。

Quartus ll是FPGA设计软件

2. FPGA设计工具--Quartus II

Quartus ll及Cyclone IV版本的器件库及FPGA仿真工具ModelSim下载安装地址:

百度网盘下载链接: https://pan.baidu.com/s/1a9d-bq9RZmWrRV542X4IEA 提取码:ifte

使用Quartus创建工程前需要安装设备

使用File->new Project Wizard创建工程,选择芯片型号EP4CE115F23C7,其余的一路next:

添加新的verilog设计文件:

3. 添加verilog设计电路代码

新建verilog文件,添加代码:

代码语言:javascript
复制
module test0( 
    input a , 
    input b, 
    output c, 
    output d, 
    );
 
assign c=a|b;
assign d=a&b;
​
endmodule

编译工程:

打开Tool->Optons ->EDA Tool Options,添加FPGA仿真工具ModelSim所在目录:

右键工程项目,添加Modelsim模拟器:

ModelSim可用于Verilog和VHDL的仿真。

使用Quartus II创建自动产生激励信号的激励文件:

在工程中打开该文件,文件在工程目录下的simulation文件夹中:

修改激励文件:

代码语言:javascript
复制
// Copyright (C) 1991-2013 Altera Corporation
// Your use of Altera Corporation's design tools, logic functions 
// and other software and tools, and its AMPP partner logic 
// functions, and any output files from any of the foregoing 
// (including device programming or simulation files), and any 
// associated documentation or information are expressly subject 
// to the terms and conditions of the Altera Program License 
// Subscription Agreement, Altera MegaCore Function License 
// Agreement, or other applicable license agreement, including, 
// without limitation, that your use is for the sole purpose of 
// programming logic devices manufactured by Altera and sold by 
// Altera or its authorized distributors.  Please refer to the 
// applicable agreement for further details.
​
// *****************************************************************************
// This file contains a Verilog test bench template that is freely editable to  
// suit user's needs .Comments are provided in each section to help the user    
// fill out necessary details.                                                  
// *****************************************************************************
// Generated on "03/11/2022 19:15:26"
                                                                                
// Verilog Test Bench template for design : test0
// 
// Simulation tool : ModelSim (Verilog)
// 
​
`timescale 1 ns/ 1 ps
module tb();
// constants                                           
// general purpose registers
reg eachvec;
// test vector input registers
reg a;
reg b;
// wires                                               
wire c;
wire d;
​
// assign statements (if any)                          
test0 i1 (
// port map - connection between master ports and signals/registers   
    .a(a),
    .b(b),
    .c(c),
    .d(d)
);
initial                                                
begin                                                  
// code that executes only once                        
// insert code here --> begin                          
                                                       
// --> end
a=1;//设置a为1
b=0;//b为0
$display("Running testbench");                       
end                                                    
always                                                 
// optional sensitivity list                           
// @(event1 or event2 or .... eventn)                  
begin                                                  
// code executes for every event on sensitivity list   
// insert code here --> begin                          
                                                       
@eachvec;                                              
// --> end                                             
end                                                    
endmodule

为test0.v文件仿真设置激励文件test0.vt:

点击Tools->RunSimulation启动仿真,波形图结果与c=1|0=1,d=1&0=0计算结果相符合:

4. Quartus II设计电路图

Quartus II有绘制电路图的工具,创建一个电路图文件:

创建D触发器电路:

创建vwf文件,作为时钟信号:

点击list,将输入输出信号全部添加到右边:

编辑时钟信号:

添加D信号:

输出波形:

5. 调用quartus中D触发器元件 dff

添加输入输出:

输出波形:

6. verilogD触发器

创建verilog文件,添加代码如下:

代码语言:javascript
复制
module test2(d,clk,q);
    input d;
    input clk;
    output q;
​
    reg q;
​
    always @ (posedge clk)//我们用正的时钟沿做它的敏感信号
    begin
        q <= d;//上升沿有效的时候,把d捕获到q
    end
endmodule

仿真波形图:

D触发器的功能为:仅在时钟信号Clk为上升沿时触发,输出Q在上升沿触发时转换为与输入D相同的值(0或1)。

7. 参考

[1] Quartus II 13.1的安装及使用

[2] Quartus与ModelsimSE联合仿真

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 有关FGPA
  • 2. FPGA设计工具--Quartus II
  • 3. 添加verilog设计电路代码
  • 4. Quartus II设计电路图
  • 5. 调用quartus中D触发器元件 dff
  • 6. verilogD触发器
  • 7. 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档