SV学习笔记(4)

学习目标:

SV绿皮书第四章:连接设计和测试平台

学习内容:

1.使用时钟块来控制同步信号的时序
带时钟块的接口

interface arb_if (input bit clk);
	logic [1:0]grant,request;
	logic rst;

	clocking cb @(posedge clk);		//声明cb
		output request;
		input  grant;
	endclocking

	modport TEST(clocking cb,		//使用cb
							output rst);
	modport DUT(input request,rst,output grant);
endinterface

//简单的测试平台
module test(arb_if.TEST arbif);
	initial begin
		arbif.cb.request<=0;
		@arbif.cb;
		$display("@%0t:Grant=%b",$time,arbif.cb.grant);
	end
endmodule

2.在接口中使用过程赋值语句驱动一个异步信号,该信号必须是logic类型的
wire类型变量只能被连续赋值语句驱动
时钟块中的信号始终是同步的,可以定义为logic或者wire
logic信号可以被直接驱动,而wire需要使用额外的代码

3.SV时间片

区域名行为
Active仿真模块中的设计代码
Observed执行System verilog断言
Reactive执行程序中的测试平台部分
Postponed为测试平台的输入采样信号
clocking bus @(posedge clock1);		//定义clocking块bus,由clock1的上升沿来驱动和采样
		default input #10ns  output #2ns  //默认,在时钟块的所有信号在clock1上升沿前10ns对其进行输入采样,后2ns进行输出驱动
		input  data, ready, enable;
		output  negedge  ack;		//下降沿驱动,时间也没了
		input  #1step  addr;		//clock1上升沿前的1step,即保证采样到的数据是上一个时钟周期的数据
	endclocking

问题:

P80–图4.6

学习时间:

早:9-11.30
中:15-17.30
晚:20-21.20


版权声明:本文为yuyi111c原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。