⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 counter_tb.vhd

📁 人民邮电出版社出版的《FPGA硬件接口设计实践》一书的代码
💻 VHD
字号:
---------------------------------------------------------------------------------------------------
--
-- Title       : Test Bench for counter
-- Design      : UART
-- Author      : Xinghua Lou
-- Company     : Tsinghua University
--
---------------------------------------------------------------------------------------------------
--
-- File        : $DSN\src\TestBench\counter_TB.vhd
-- Generated   : 4/12/2005, 4:11 PM
-- From        : $DSN\src\counter.vhd
-- By          : Active-HDL Built-in Test Bench Generator ver. 1.2s
--
---------------------------------------------------------------------------------------------------
--
-- Description : Automatically generated Test Bench for counter_tb
--
---------------------------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;

	-- Add your library and packages declaration here ...

entity counter_tb is
	-- Generic declarations of the tested unit
		generic(
		MAX_COUNT : INTEGER := 10 );
end counter_tb;

architecture TB_ARCHITECTURE of counter_tb is
	-- Component declaration of the tested unit
	component counter
		generic(
		MAX_COUNT : INTEGER := 10 );
	port(
		clk : in std_logic;
		reset_n : in std_logic;
		ce : in std_logic;
		overflow : out std_logic );
	end component;

	-- Stimulus signals - signals mapped to the input and inout ports of tested entity
	signal clk : std_logic := '0';
	signal reset_n : std_logic;
	signal ce : std_logic;
	-- Observed signals - signals mapped to the output ports of tested entity
	signal overflow : std_logic;

	-- Add your code here ...

begin

	-- Unit Under Test port map
	UUT : counter
		generic map (
			MAX_COUNT => MAX_COUNT
		)

		port map (
			clk => clk,
			reset_n => reset_n,
			ce => ce,
			overflow => overflow
		);

	-- Add your stimulus here ...
	-- 产生时钟信号
	clk_gen : process
	begin
		clk <= not clk;
		wait for 50 ns;
	end process;

	-- 测试主流程
	main: process
	begin
		reset_n <= '0';
		ce <= '0';	
		wait for 100 ns;
		reset_n <= '1';
		ce <= '1';
		
		wait;
		
	end process;
	
end TB_ARCHITECTURE;

configuration TESTBENCH_FOR_counter of counter_tb is
	for TB_ARCHITECTURE
		for UUT : counter
			use entity work.counter(counter);
		end for;
	end for;
end TESTBENCH_FOR_counter;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -