书写Verilog仿真激励时需要注意的细节

书写Verilog仿真激励时需要注意的细节_第1张图片

         分析上面的EMIF时序,可以将其分为3部分,开始、中间和结束三部分。在书写激励时,开始和结束部分一定要满足时序要求,这是平时在书写激励时不容易注意的点。

reg CE,clk,AOE,ARE,AWE,ARDY;
reg [21:2] EA;
reg [31:0] ED;
task emif_interface(input  [21:2] addr);
	begin
	block start,
	//BE[3:0]、EA[21:2]、ARDY为无关态,不需要赋值
		CE<=1;
		AOE<=1;
		ARE<=1;
		AWE<=1;
		#3 ;
	//block start 
		@(posedge clk);
			#1 CE<=0;
			BE<='d1;
			EA<=addr;
			AOE<=1;
		@(posedge clk);
		@(posedge clk);
			#2 ARE<=0;
		@(posedge clk);
		@(negedge clk);
			#1  ARDY<=0;
		@(posedge clk);
		@(posedge clk);
		@(negedge clk);
			#1  ARDY<=1;
		@(posedge clk);
			#1  ARDY<=z;
		@(posedge clk);
			#1 ED<='d3;
		@(posedge clk);
			#2 ARE<=1;
		@(negedge clk);
			#1 ED<=z;	
	//结束块
		@(posedge clk);
			#CE<=1;
			AOE<=1;	
	end
	endtask

在时序开始时,根据时序图先对某些信号赋值,延后延时一段时间,这样就可以保证时序正确。如下所示:

		CE<=1;
		AOE<=1;
		ARE<=1;
		AWE<=1;
		#3 ;


 

你可能感兴趣的:(verilog,FPGA,fpga开发)