18 UVM Scoreboard

UVM scoreboard是一个检查DUT功能的组件。它用analysis export从monitor接受transaction事务以进行检查。

uvm_scoreboard class declaration:

virtual class uvm_scoreboard extends uvm_component

User-defined scoreboard class declaration:

 用户定义的scoreboard是从 uvm_scoreboard 扩展而来的,而 uvm_scoreboard 又派生自 uvm_component。

class <scoreboard_name> extends uvm_scoreboard;

1 uvm_scoreboard class hierarchy

3 Scoreboard Usage

  1. 使用analysis export从monitor接收transaction以进行检查。
  2. scoreboard有一个参考模型reference model可以与design行为进行比较。reference model也称为预测器predictor,它实现design行为,以便scoreboard可以将 DUT 结果与相同驱动刺激的参考模型reference model结果进行比较。

3 How to write scoreboard code in UVM?

  1. 创建一个从 uvm_scoreboard 扩展的用户定义的scoreboard类,并将其注册到工厂中。
  2. 声明analysis export以从monitor接收sequence item或transaction。
  3. 编写标准 new() 函数。由于记分板是一个 uvm_component。new() 函数有两个参数:字符串名称name和 uvm_component 父类parent。
  4. 实现 build_phase 并创建 TLM analysis export实例。
  5. 实现一个 write 方法来接收来自monitor的事务。
  6. 实现run_phase 以在整个仿真时间内检查 DUT 功能。

3.1 Scoreboard Example

class scoreboard extends uvm_scoreboard;uvm_analysis_imp #(seq_item, scoreboard) item_collect_export;seq_item item_q[$];`uvm_component_utils(scoreboard)function new(string name = "scoreboard", uvm_component parent = null);super.new(name, parent);item_collect_export = new("item_collect_export", this);endfunctionfunction void build_phase(uvm_phase phase);super.build_phase(phase);endfunctionfunction void write(seq_item req);`uvm_info(get_type_name, $sformatf("Received transaction = %s", req), UVM_LOW);item_q.push_back(req);endfunctiontask run_phase (uvm_phase phase);seq_item sb_item;forever beginwait(item_q.size > 0);if(item_q.size > 0) beginsb_item = item_q.pop_front();// Checking comparing logic...        endendendtask
endclass

4 UVM Scoreboad types

根据设计功能,记分板可以通过两种方式实现。

  1. in-order scoreboard
  2. out-of-order scoreboard

4.1 In-order scoreboard

有序记分板(in-order scoreboard)对于输出顺序与stimuli激励相同的设计很有用。比较器将以相同的顺序比较预期输出流和实际输出流。他们将独立抵达。因此,评估必须阻塞,直到预期transaction和实际transaction都存在。

要实现此类scoreboard,更简单的方法是实现 TLM analysis FIFO。有关更多详细信息,请访问TLM analysis FIFO部分。在下面的示例中,有两个monitor,其分析端口连接到记分板以提供输入和输出事务。 

class inorder_sb extends uvm_scoreboard;`uvm_component_utils(inorder_sb)uvm_analysis_export #(txn) in_export, out_export;uvm_tlm_analysis_fifo #(txn) in_fifo, out_fifo;function new (string name = "inorder_sb" , uvm_component parent = null) ;super.new(name, parent);endfunctionfunction void build_phase (uvm_phase phase);in_fifo    = new("in_fifo", this);out_fifo   = new("out_fifo", this);in_export  = new("in_export", this);out_export = new("out_export", this);endfunctionfunction void connect_phase (uvm_phase phase);in_export.connect(in_fifo.analysis_export);out_export.connect(out_fifo.analysis_export);endfunctiontask run_phase( uvm_phase phase);txn in_txn;txn exp_txn, act_txn;forever beginin_fifo.get(in_txn);process_data(in_txn, exp_txn); out_fifo.get(act_txn);if (!exp_txn.compare(act_txn)) begin`uvm_error(get_full_name(), $sformat("%s does not match %s", exp_txn.sprint(), act_txn.sprint()), UVM_LOW);endendendtask// Reference model task process_data(input txn in_txn, output txn exp_txn);// Generate expected txn for driven stimulus......endtask
endclass

4.2 Out-of-order scoreboard

无序记分板out-of-order scoreboard对于输出顺序与驱动输入激励stimuli不同的设计很有用。基于输入激励参考模型将生成 DUT 的预期结果,并且实际输出预计以任何顺序出现。因此,需要存储从输入激励生成的此类不匹配事务,直到从待比较的 DUT 接收到相应的输出为止。为了存储此类事务,关联数组被广泛使用。根据索引值,transactions存储在预期和实际关联数组中。当匹配的数组索引发生比较时,关联数组中的条目将被删除。

class txn extends uvm_sequence_item;int id;  // other class properties//...
endclassclass out_of_order_sb extends uvm_scoreboard;`uvm_component_utils(out_of_order_sb)uvm_analysis_export #(txn) in_export, out_export;uvm_tlm_analysis_fifo #(txn) in_fifo, out_fifo;// associative array of class type as txn and indexed by inttxn expected_out_array[int];txn actual_out_array[int];// Store idx in separate queues.int expected_out_q[$], actaul_out_q[$];function new (string name = "out_of_order_sb" , uvm_component parent = null) ;super.new(name, parent);endfunctionfunction void build_phase (uvm_phase phase);in_fifo    = new("in_fifo", this);out_fifo   = new("out_fifo", this);in_export  = new("in_export", this);out_export = new("out_export", this);endfunctionfunction void connect_phase (uvm_phase phase);in_export.connect(in_fifo.analysis_export);out_export.connect(out_fifo.analysis_export);endfunctiontask run_phase( uvm_phase phase);txn in_txn, out_txn;forever beginfork      begin in_fifo.get(in_txn);process_data(in_txn);endbeginout_fifo.get(out_txn);actual_out_array[out_txn.id] = out_txn;actaul_out_q.push_back(out_txn.id);endjoincompare_data();endendtask// check_phase to check whether any entry is pending in queues.function void check_phase(uvm_phase phase);super. check_phase(phase);if(expected_out_q.size() != 0) `uvm_info (get_full_name(), $sformatf("expected_out_q size = %0d", expected_out_q.size()), UVM_LOW);if(actaul_out_q.size() != 0) `uvm_info (get_full_name(), $sformatf("actaul_out_q size = %0d", actaul_out_q.size()), UVM_LOW);endfunctiontask process_data(txn in_txn);txn exp_out_txn;// Using reference models, generate output for input stimulus.// store expected output (exp_out_txn) in expected_out_array......expected_out_array[in_txn.id] = exp_out_txn;expected_out_q.push_back(in_txn.id);endtasktask compare_data();int idx;txn exp_txn, act_txn;if(expected_out_q.size() > && actaul_out_q.size() > 0) beginidx = expected_out_q.pop_front();// Look for idx in actual_out_array to see whether the output has been received for a driven stimulus or not.if(actual_out_array.exists(idx)) begin exp_txn = expected_out_array[idx];act_txn = actual_out_array[idx];if(!exp_txn.compare(act_txn)) begin`uvm_error(get_full_name(), $sformat("%s does not match %s", exp_txn.sprint(), act_txn.sprint()), UVM_LOW);endelse beginexpected_out_array.delete(idx);actual_out_array.delete(idx);endendelse expected_out_q.push_back(idx); // exp_idx is not found in actual_out_array.endendtask
endclass

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/309621.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

在thingsboard中跨设备动态时间段求遥测平均值

有a,b两个传感器,a传感器是电流,b传感器是振动频率。 当a传感器的电流大于x时,表明设备开始工作。 当a传感器的电流小于x时,表明设备停止工作。 要求,在规则链里求出设备工作时间段的振动频率的平均值,并基于平均值来判断是否发送告警。 这是一个典型的 在thingsboard中…

VSCODE 修改Test模式下的的java jvm堆内存大小

在settings.json中添加如下语句 "java.test.config": {"vmArgs": ["-Xmx12G"]},

Ps:八大混合模式及其在色彩渲染上的运用

在所有的图层混合模式中&#xff0c;有八种比较特别。 特别之处在于&#xff0c;其它的混合模式在修改图层的“不透明度”或“填充”时&#xff0c;效果是一样的。 而这八种混合模式使用“填充”比使用“不透明度”可带来更好的效果&#xff0c;有时甚至可以说是惊艳。 提示&am…

【前端面经】即时设计

目录 前言一面git 常见命令跨窗口通信vue 响应式原理发布订阅模式翻转二叉树Promise.all()扁平化数组面试官建议 二面Event Loop 原理Promise 相关css 描边方式requestAnimationReact 18 新特性JSX 相关react 输出两次函数式编程React 批处理机制http请求头有哪些本地存储性能优…

oracle-存储结构

文件包括 控制文件.ctl、数据文件.dbf、日志文件.log这三类放在存储上。 参数文件&#xff1a;空间的划分&#xff0c;进程的选用&#xff08;.ora&#xff09; oracle启动的时候需要读一下&#xff0c;数据库启动后&#xff0c;参数文件并不关闭&#xff0c;但即使文件丢了&a…

基于Python的电商手机数据可视化分析和推荐系统

1. 项目简介 本项目旨在通过Python技术栈对京东平台上的手机数据进行抓取、分析并构建一个简单的手机推荐系统。主要功能包括&#xff1a; 网络爬虫&#xff1a;从京东获取手机数据&#xff1b;数据分析&#xff1a;统计各厂商手机销售分布、市场占有率、价格区间和好评率&am…

RSA加密解密——用shell加密java解密

功能描述 使用shell opensll对明文进行RSA加密&#xff0c;将密文用java的RSA工具对密文解密。这应该是全网第一个同时用到shell和java的RSA加密解密教程。中间有很多坑&#xff0c;都踩过了&#xff0c;可以放心使用代码。 正确的实现流程 shell端 首先生成公钥私钥 &…

[数据结构]树与二叉树的性质

文章目录 0.二叉树的形态和基本性质1.完全二叉树的叶子节点个数2.树的叶子节点个数3.线索二叉树4.树和森林和二叉树5.平衡二叉树的最少结点数6.树/二叉树/森林的转换 0.二叉树的形态和基本性质 一棵二叉树具有5中基本形态n个结点可以构造的二叉树种数: C2n-n/n1 一棵树 n个结点…

项目记录:利用Redis实现缓存以提升查询效率

一、概述 当我们查询所有数据时&#xff0c;如果缓存中没有&#xff0c;则去数据库查询&#xff0c;如果有&#xff0c;直接查缓存的数据就行。注意定期更新缓存数据。 二、主体代码 private static final String ROOM_SCHEDULES_HASH "RoomSchedules";Overridepu…

【十】【C语言\动态规划】376. 摆动序列、673. 最长递增子序列的个数、646. 最长数对链,三道题目深度解析

动态规划 动态规划就像是解决问题的一种策略&#xff0c;它可以帮助我们更高效地找到问题的解决方案。这个策略的核心思想就是将问题分解为一系列的小问题&#xff0c;并将每个小问题的解保存起来。这样&#xff0c;当我们需要解决原始问题的时候&#xff0c;我们就可以直接利…

微信小程序开发系列-08自定义组件模版特性

微信小程序开发系列目录 《微信小程序开发系列-01创建一个最小的小程序项目》《微信小程序开发系列-02注册小程序》《微信小程序开发系列-03全局配置中的“window”和“tabBar”》《微信小程序开发系列-04获取用户图像和昵称》《微信小程序开发系列-05登录小程序》《微信小程序…

红队打靶练习:MISDIRECTION: 1

信息收集 1、arp ┌──(root㉿ru)-[~/kali] └─# arp-scan -l Interface: eth0, type: EN10MB, MAC: 00:0c:29:69:c7:bf, IPv4: 192.168.12.128 Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan) 192.168.12.1 00:50:56:c0:00:08 …