当前位置:网站首页>Introduction to testbench
Introduction to testbench
2022-07-25 09:56:00 【Work makes me happy】
This is a testbench Simple example .
`timescale 1ns/1ps
module tb_top();
//-------------------------------------------------------
reg sys_clk_100mhz;
reg sys_clk_200mhz;
reg sys_clk_400mhz;
reg rst;
reg wen;
reg ren;
reg [ 9:0] addra ;
reg [31:0] dina ;
reg [ 9:0] addrb ;
wire[31:0] doutb ;
//-------------------------------------------------------
//-------------------------------------------------------
always #5 sys_clk_100mhz = ~sys_clk_100mhz;
always #2.5 sys_clk_200mhz = ~sys_clk_200mhz;
always #1.25 sys_clk_400mhz = ~sys_clk_400mhz;
//-------------------------------------------------------
//-------------------------------------------------------
bram_i32o32_d1024 bram_i32o32_d1024 (
.clka ( sys_clk_400mhz ),// input wire clka
.wea ( wen ),// input wire [0 : 0] wea
.addra ( addra ),// input wire [9 : 0] addra
.dina ( dina ),// input wire [31 : 0] dina
.clkb ( sys_clk_400mhz ),// input wire clkb
.addrb ( addrb ),// input wire [9 : 0] addrb
.doutb ( doutb ) // output wire [31 : 0] doutb
);
//-------------------------------------------------------
//-------------------------------------------------------
initial begin
sys_clk_100mhz = 1'b0 ;
sys_clk_200mhz = 1'b0 ;
sys_clk_400mhz = 1'b0 ;
rst = 1'b1 ;
wen = 1'b0 ;
ren = 1'b0 ;
addra = 0;
addrb = 0;
dina = 0;
#10
rst = 1'b0 ;
#100
wen = 1'b1 ;
addra = 0;
dina = 0;
#2.5
wen = 1'b1 ;
addra = 1;
dina = 1;
#2.5
wen = 1'b1 ;
addra = 2;
dina = 2;
#2.5
wen = 1'b1 ;
addra = 3;
dina = 3;
#2.5
wen = 1'b0 ;
ren = 1'b1 ;
addra = 0;
#2.5
wen = 1'b0 ;
ren = 1'b1 ;
addra = 1;
#2.5
wen = 1'b0 ;
ren = 1'b1 ;
addra = 2;
#2.5
wen = 1'b0 ;
ren = 1'b1 ;
addra = 3;
#2.5
wen = 1'b0 ;
ren = 1'b0 ;
end
//-------------------------------------------------------
endmodule
Make a clock
Use initial sentence ----------
reg clock;
initial begin
clock=0;
forever #10 clock=~clock;
end
Use always sentence ---------------
reg clock;
initial
clock=0;
always
#10 clock=~clock;Reference resources
| 1、 author | post |
| Verilog Of testbench introduction | |
边栏推荐
- Gartner 2022年顶尖科技趋势之超级自动化
- VCS常用命令
- ARMV8体系结构简介
- 从Anaconda到TensorFlow到Jupyter一路踩坑一路填平
- Chmod and chown invalidate the files of the mounted partition
- Store to-do items locally (improve on to-do items)
- Android & kotlin: puzzle solution
- 单目深度估计自监督模型Featdepth解读(上)——论文理解和核心源码分析
- ESP32定时中断实现单、双击、长按等功能的按键状态机Arduino代码
- ¥ 1-2 example 2.2 put the union of two sets into the linear table
猜你喜欢

SystemVerilog syntax

First knowledge of opencv4.x --- image convolution
![[data mining] Chapter 3 basis of data analysis](/img/ec/5d988371ea19919148ab6ef4d0247d.png)
[data mining] Chapter 3 basis of data analysis

MLX90640 红外热成像传感器测温模块开发笔记(三)

OC -- Inheritance and polymorphic and pointer

Exciting method and voltage of vibrating wire sensor by hand-held vibrating wire acquisition instrument

Mixed supervision for surface defect detection: from weakly to fully supervised learning

深度估计自监督模型monodepth2论文总结和源码分析【理论部分】

MLX90640 红外热成像仪测温模块开发笔记(一)

Evolution based on packnet -- review of depth estimation articles of Toyota Research Institute (TRI) (Part 2)
随机推荐
VCS常用命令
单目深度估计自监督模型Featdepth解读(下)——openMMLab框架使用
MLX90640 红外热成像传感器测温模块开发笔记(三)
TensorFlow raw_rnn - 实现seq2seq模式中将上一时刻的输出作为下一时刻的输入
ISP图像信号处理
Segmentation-based deep-learning approach for surface-defectdetection(基于分割的表面缺陷深度学习检测方法)
How Android uses ADB command to view application local database
Preliminary understanding and implementation of wechat applet bottom navigation bar
ESP32定时中断实现单、双击、长按等功能的按键状态机Arduino代码
CCF 201512-4 送货
CCF 201604-2 俄罗斯方块
TensorFlow2 安装快速避坑汇总
Visualization of sensor data based on raspberry pie 4B
目标检测与分割之MaskRCNN代码结构流程全面梳理+总结
Hyperautomation for the enhancement of automation in industries 论文翻译
¥ 1-2 example 2.2 put the union of two sets into the linear table
TM1638 LED数码显示模块ARDUINO驱动代码
工程仪器振弦传感器无线采集仪的采集数据发送方式及在线监测系统
无线振弦采集仪参数配置工具的设置
Android & kotlin: puzzle solution