如果自己不想写这些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;

最新文章

  1. linux开启FTP以及添加用户配置权限,只允许访问自身目录,不能跳转根目录
  2. 数据仓库之SSIS开发
  3. fetch_20newsgroups 数据集导入失败: no handlers could be fetch_20newsgroups
  4. for循环嵌套执行效率
  5. JS实现复选框全选全不选以及子复选框带动全选框的选中
  6. 2010年山东省第一届ACM大学生程序设计竞赛 Balloons (BFS)
  7. Js~数组的操作push,pop,shift,unshift
  8. ubuntu 中c 语言编程(学习)
  9. ProgressMonitorInputStream
  10. 集群配置虚拟主机及部署Hadoop集群碰到的问题
  11. xftp上传失败之解决办法
  12. iOS多线程篇:NSThread简单介绍和使用
  13. hadoop2.x HDFS HA linux环境搭建
  14. Visual Studio 2019 double clicking project(custom behavior)
  15. mysql 开发基础系列16 视图
  16. Java 调用翻译软件实现英文文档翻译
  17. Dig
  18. BZOJ1201 [HNOI2005]数三角形 大力出奇迹
  19. 抛异常 throw的注意事项
  20. Numpy 通用函数

热门文章

  1. linux cd命令不带路径参数
  2. linux usermod修改用户所在组方法
  3. shorter concat [reverse longer]
  4. Oracle EBS Report 输出字符字段前部"0"被Excel自动去掉问题
  5. Android开发之点击两次Back键退出App
  6. Java面试题-锁
  7. CodeForces Good Bye 2014 B. New Year Permutation
  8. (十二)学习CSS之box-sizing 属性
  9. 基于WebForm+EasyUI的业务管理系统形成之旅 -- ParamQueryGrid行、列合并(Ⅸ)
  10. MySQL查询大小写是否敏感问题分析