quartus II 自动生成testbench
2024-10-08 06:32:49
如果自己不想写这些testbench的这些固定格式,可以在quartus里自动生成testbench文件的模板,然后往里面写信号就行了
步骤:processing->start->starttest bench template write
这里需要注意的是要在仿真选项里选择一个仿真工具,然后才会生成testbench
自动生成的testbench模板格式如下:
以一位全加器f_adder的testbench为例
-- Copyright (C) - 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 Vhdl 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 "12/01/2015 20:34:30" -- Vhdl Test Bench template for design : f_adder
--
-- Simulation tool : ModelSim-Altera (VHDL)
-- LIBRARY ieee;
USE ieee.std_logic_1164.all; ENTITY f_adder_vhd_tst IS
END f_adder_vhd_tst;
ARCHITECTURE f_adder_arch OF f_adder_vhd_tst IS
-- constants
-- signals
SIGNAL ain : STD_LOGIC;
SIGNAL bin : STD_LOGIC;
SIGNAL cin : STD_LOGIC;
SIGNAL cout : STD_LOGIC;
SIGNAL sum : STD_LOGIC; --所要信号的声明
COMPONENT f_adder
PORT (
ain : IN STD_LOGIC;
bin : IN STD_LOGIC;
cin : IN STD_LOGIC;
cout : OUT STD_LOGIC;
sum : OUT STD_LOGIC
);
END COMPONENT;
BEGIN
i1 : f_adder
PORT MAP (
-- list connections between master ports and signals
ain => ain,
bin => bin,
cin => cin,
cout => cout,
sum => sum
);
init : PROCESS
-- variable declarations
BEGIN
-- code that executes only once
WAIT;
END PROCESS init;
always : PROCESS
-- optional sensitivity list
-- ( )
-- variable declarations
BEGIN
-- code executes for every event on sensitivity list
WAIT;
END PROCESS always;
END f_adder_arch;
这个时候若是直接把该文件进行仿真是不行的,因为里面的激励信号没有初始化(仿真出来的波形会是红色的不确定值)
可以根据需要把信号初始化,例如下面这种:
SIGNAL ain : STD_LOGIC :='';
SIGNAL bin : STD_LOGIC :='';
SIGNAL cin : STD_LOGIC :='';
SIGNAL cout : STD_LOGIC;
SIGNAL sum : STD_LOGIC;
最新文章
- linux开启FTP以及添加用户配置权限,只允许访问自身目录,不能跳转根目录
- 数据仓库之SSIS开发
- fetch_20newsgroups 数据集导入失败: no handlers could be fetch_20newsgroups
- for循环嵌套执行效率
- JS实现复选框全选全不选以及子复选框带动全选框的选中
- 2010年山东省第一届ACM大学生程序设计竞赛 Balloons (BFS)
- Js~数组的操作push,pop,shift,unshift
- ubuntu 中c 语言编程(学习)
- ProgressMonitorInputStream
- 集群配置虚拟主机及部署Hadoop集群碰到的问题
- xftp上传失败之解决办法
- iOS多线程篇:NSThread简单介绍和使用
- hadoop2.x HDFS HA linux环境搭建
- Visual Studio 2019 double clicking project(custom behavior)
- mysql 开发基础系列16 视图
- Java 调用翻译软件实现英文文档翻译
- Dig
- BZOJ1201 [HNOI2005]数三角形 大力出奇迹
- 抛异常 throw的注意事项
- Numpy 通用函数
热门文章
- linux cd命令不带路径参数
- linux usermod修改用户所在组方法
- shorter concat [reverse longer]
- Oracle EBS Report 输出字符字段前部"0"被Excel自动去掉问题
- Android开发之点击两次Back键退出App
- Java面试题-锁
- CodeForces Good Bye 2014 B. New Year Permutation
- (十二)学习CSS之box-sizing 属性
- 基于WebForm+EasyUI的业务管理系统形成之旅 -- ParamQueryGrid行、列合并(Ⅸ)
- MySQL查询大小写是否敏感问题分析