当前位置:网站首页>IC验证中的force/release 学习整理(6)研究对 wire 类型信号的影响

IC验证中的force/release 学习整理(6)研究对 wire 类型信号的影响

2022-06-12 04:47:00 那么菜

前面章节,我们学习了怎么查看force信号,以及怎么在基于UVM平台下对信号进行force操作。今天,我们细致的研究下,force 信号对 RTL 代码中 wire 类型信号的影响。

先看例子:下面的例子中,clk,rst ,counter 三个信号,均声明为 reg 类型变量。在此基础之上,我们添加一个wire counter_q 类型信号。 我们着重关注一下 counter_q [7:0] 信号,该信号8bit,是一个计数器counter 所驱动。

顶层TB 代码:

`timescale 1ns/1ps
import uvm_pkg::*;
//`include "uvm_pkg.sv"
//`include "uvm_macros.svh"
module tb_top();

reg clk,rst;

reg [7:0] counter;
wire [7:0] counter_q;

initial begin
clk = 0; 
forever #5 clk = ~ clk;
end

initial begin
rst = 1;
#30 rst = 0 ; 
#25 rst = 1;

end

always @ (posedge clk or negedge rst) begin
  if(!rst) 
     counter <= 8'b0;
  else
     counter <= counter +1;
end

assign counter_q = counter ;


initial begin
run_test("helloworld_test") ;
end

initial begin
$fsdbDumpfile("tb_top.fsdb");
$fsdbDumpvars(0,"tb_top")
原网站

版权声明
本文为[那么菜]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_16423857/article/details/125234524