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

📄 counter_tbw.tfw

📁 Verilog编程
💻 TFW
字号:
// E:\ISE6.1\TST
// Verilog Test fixture created by
// HDL Bencher 6.1i
// Thu Apr 26 20:53:30 2007
// 
// Notes:
// 1) This test fixture has been automatically generated from
//   your Test Bench Waveform
// 2) To use this as a user modifiable test fixture do the following:
//   - Save it as a file with a .tf extension (i.e. File->Save As...)
//   - Add it to your project as a testbench source (i.e. Project->Add Source...)
// 

`timescale 1ns/1ns

`define s3	3
`define s2	2
`define C_READ	5
`define C_WRITE	4
`define C_P_CHRG	2
`define C_ACTIVE	3
`define C_L_MODE	0
`define s1	1
`define F_ASSERT	2
`define state_delay	6
`define FWIDTH	32
`define OD	4
`define IF1	2
`define D	10
`define F_IDLE	1
`define C_NOP	7
`define s0	0
`define FCWIDTH	2
`define Q	25
`define RES	5
`define TCKO	0
`define s4	4
`define IF2	3
`define IF0	1
`define N	5
`define C_REFRSH	1
`define BR0	0
`define F_DEASSERT	4
`define FDEPTH	4

module counter_tbw;
	reg rst;
	reg inclk;
	wire outclk;
	reg [25:0] clkdata;

	counter UUT (
		.rst(rst),
		.inclk(inclk),
		.outclk(outclk),
		.clkdata(clkdata)
	);

	integer TX_FILE;
	integer TX_ERROR;

always
begin 			//clock process
	inclk = 1'b0;
	#5
	inclk = 1'b1;
	#5
	#5
	inclk = 1'b0;
	#5
	inclk = 1'b0;
end

initial
begin
	TX_ERROR=0;
	TX_FILE=$fopen("results.txt");

	// --------------------
	rst = 1'b0;
	clkdata = 26'b00000000000000000000000000; //0
	// --------------------
	#20 // Time=20 ns
	// --------------------

	if (TX_ERROR == 0) begin
		$display("No errors or warnings");
		$fdisplay(TX_FILE,"No errors or warnings");
	end else begin
		$display("%d errors found in simulation",TX_ERROR);
		$fdisplay(TX_FILE,"%d errors found in simulation",TX_ERROR);
	end

	$fclose(TX_FILE);
	$stop;

end

task CHECK_outclk;
	input NEXT_outclk;

	#0 begin
		if (NEXT_outclk !== outclk) begin
			$display("Error at time=%dns outclk=%b, expected=%b",
				$time, outclk, NEXT_outclk);
			$fdisplay(TX_FILE,"Error at time=%dns outclk=%b, expected=%b",
				$time, outclk, NEXT_outclk);
			TX_ERROR = TX_ERROR + 1;
		end
	end
endtask

endmodule

⌨️ 快捷键说明

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