convlen_test.v

来自「发一个基于ModelSim仿真的Verilog源代码包」· Verilog 代码 · 共 56 行

V
56
字号

/*****************************************************/
/* module convlen_test                         */
/*****************************************************/
//
//

/* This is the top-level module, convlen_test, to test the convolutional coder. 
The 1-bit message, X, is convolutionally encoded to a 4-bit signal, Y.
In this module the message X is generated using accurate delay.
The digital 4-bit signal Y is coded out. */
//

//

`timescale 1ns/1ns 

module convlen_test;

wire [3:0] Y; // encoder output vector Y[3:0]
reg  X;       // encoder input  vector X[0]
reg Clk, Res; // system clock and control input : clock and reset

//always #500 $display("t    Clk X Y ");

//initial $monitor("%4g",$time,,Clk,,,,X,,Y);

//initial $dumpvars;

initial #3000 $finish;

always #10 Clk = ~Clk; // to generate clock from t=0, and T=20 units 

initial 	   // 注意!!!-使用non-block赋值和内嵌式时延,可以产生精确的绝对时延 .

    
	begin 	  // 产生测试输入序列 X,注意X的变化应当和Clk的有效边沿对齐
	    X <= 0;     
	    Clk <= 0;
	    Res <=#2 1;
		Res <=#5 0; 
		X<= #9 1;
		X<= #29 0;
		X<= #69 1;
		X<= #89 0;
		X<= #109 1;
		X<= #129 0;
	end 
// Hit reset after inputs are stable.

//下面是卷积编码器示例化

convl_en v_1(X,Y[3],Y[2],Y[1],Y[0],Clk,Res);

endmodule

⌨️ 快捷键说明

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