【芯片前端】可能是定向验证的巅峰之作——auto_testbench

前言

【芯片前端】一键生成简易版本定向RTL验证环境的脚本——auto_verification

在完成这一版后,在实战中我发现,每次生成之后我需要有大量的修改,于是深思熟虑之后做了一版大的修改,并且重命名为auto_testbench,毕竟这才符合定向testbench的定义。

这一版本的主要改动为:

  1. 增加了接口随机性;
  2. 增加对valid型接口适配,对于valid信号都会寻找对应的ready信号,data会查找对应的valid/ready信号,在此基础上进行随机;
  3. 重新生成后,旧的目录文件以xxx_bak的方式保存,以便保留改动;
  4. 优化了tb.f的结构;
  5. 优化了输出testbench结构;

环境适配

由于后续我计划将更多工具和脚本融合到一起,因此我将auto_testbench直接和其他工具放在了一个git中,当然也可以单独使用:

适用于芯片前端设计与验证工作,融合多种功能的project公共环境

下载于本地虚拟机后,在本地的cshrc中加入这两句话:


                
  • 5
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 9
    评论
好的,下面是一个简单的testbench,用于验证上面的cordic_cos函数: ```verilog `timescale 1ns / 1ns module test_cordic_cos; reg signed [31:0] theta; wire signed [31:0] cos_theta; wire signed [31:0] expected_cos_theta; initial begin $monitor("theta=%d, cos_theta=%d, expected_cos_theta=%d", theta, cos_theta, expected_cos_theta); #10 theta = 0; expected_cos_theta = $signed(32'h7fffffff); #10 theta = 8192; expected_cos_theta = $signed(32'h00000000); #10 theta = 16384; expected_cos_theta = $signed(32'h80000000); #10 theta = 24576; expected_cos_theta = $signed(32'hffffffff); #10 theta = 32768; expected_cos_theta = $signed(32'h7fffffff); #10 theta = 40960; expected_cos_theta = $signed(32'h00000000); #10 theta = 49152; expected_cos_theta = $signed(32'h80000000); #10 theta = 57344; expected_cos_theta = $signed(32'hffffffff); #10 theta = 65536; expected_cos_theta = $signed(32'h7fffffff); #10 theta = 73728; expected_cos_theta = $signed(32'h00000000); #10 theta = 81920; expected_cos_theta = $signed(32'h80000000); #10 theta = 90112; expected_cos_theta = $signed(32'hffffffff); #10 theta = 98304; expected_cos_theta = $signed(32'h7fffffff); #10 theta = 106496; expected_cos_theta = $signed(32'h00000000); #10 theta = 114688; expected_cos_theta = $signed(32'h80000000); #10 theta = 122880; expected_cos_theta = $signed(32'hffffffff); #10 $finish; end cordic_cos cos1(.theta(theta), .cos_theta(cos_theta)); endmodule ``` testbench中通过向theta输入不同的角度值,验证计算得到的cos_theta值是否与预期值expected_cos_theta一致。在这个testbench中,我们验证了cordic_cos函数在输入的角度分别为0度、90度、180度、270度、360度时的计算结果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

尼德兰的喵

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值