Dinglei_hello · 2021年12月24日

System Verilog面试题(一)

1 什么是SVA?

SVA是System Verilog Assertion。

2 什么是Callback?

Callback (回调)是指更改验证组件(driver、sequencer或者monitor)的行为而不更改组件代码的机制。它可以用于功能覆盖率建模,错误注入等功能。

3 什么是“factory pattern工厂模式”?

factory 方法通常用来指创建对象的方法,对象的类型已经事先注册到表中。

一般对象创建方案


// Normal Type based object creation
// Class object
class my_class;
   int i;
endclass

program main;
   // Create object type my_class
   my_class obj1;
   obj1 = new
endprogram

使用factory机制创建对象


// Using Factory I should be able to do the following
program main;
   base_class my_class_object;   
   base_class = factory.create_object("my_class"); // See here the type of the object to be created is passed as a string so we dont know the exact type of the object
endprogram
4 数据类型logic、reg 和wire有什么区别?

从赋值的角度:

  • Logic:支持连续赋值、阻塞赋值和非阻塞赋值
  • Reg:阻塞赋值和非阻塞赋值
  • Wire:支持连续赋值

从存储的角度:

Wire不能保存值,Logic和Reg都能保存值

5 clocking 语句块的作用是什么?

1、指定设计的同步特性、
2、提供了一种干净的方式来驱动和采样信号
3、指定skew,避免竞争冒险

module M1(ck, enin, din, enout, dout);
input ck;
input [31:0] din ;
output [31:0] dout ;

clocking sd @(posedge ck);
input #2ns din ;
output #3ns dout;
endclocking:sd


reg [7:0] sab ;
initial begin
sab = sd.din[7:0];
end
endmodule:M1
6 有什么方法可以避免testbench 和RTL之间的竞争冒险?

1、使用program
2、使用clocking语句块
3、使用非阻塞赋值

monitor和driver应该完全分开,并行执行,方便在验证平台中复用模块级的agent。

7 阐述SV中的Event regions?

systemverilog event是同步对象的句柄,可以将其传递给各个子程序,用于事件同步。 

8 在SV中coverages 的类型有哪些?

Code Coverage和Functional Coverage。可以使用covergroup或者cover关键字来建模功能覆盖率

使用covergroup:


class eth_frame;
// Definitions as above
covergroup cov;
  coverpoint dest {
    bins bcast[1] = {48'hFFFFFFFFFFFF};
    bins ucast[1] = default;
  }

  coverpoint type {
    bins length[16] = { [0:1535] };
    bins typed[16] = { [1536:32767] };
    bins other[1] = default;
  }
  
  psize: coverpoint payload.size {
    bins size[] = { 46, [47:63], 64, [65:511], [512:1023], [1024:1499], 1500 };
  }

  sz_x_t: cross type, psize;
endgroup

endclass

使用cover:


module Amod2(input bit clk);
  bit X, Y;
  sequence s1;
    @(posedge clk) X ##1 Y;
  endsequence
  CovLavel: cover property (s1);
  ...
endmodule
作者:验证哥布林
原文链接:
https://mp.weixin.qq.com/s/cHtgLObvNMK6fzZ2GAsalg
微信公众号:
 title=

推荐阅读

更多IC设计技术干货请关注IC设计技术专栏
推荐阅读
关注数
11135
内容数
1221
主要交流IC以及SoC设计流程相关的技术和知识
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息