当前位置:网站首页>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 | |
边栏推荐
- [data mining] Chapter 3 basis of data analysis
- [data mining] nearest neighbor and Bayesian classifier
- Swift simple implementation of to-do list
- FPGA基础进阶
- Mlx90640 infrared thermal imager temperature measurement module development notes (4)
- Get to know opencv4.x for the first time --- add salt and pepper noise to the image
- CCF 201509-2 日期计算
- 深度估计自监督模型monodepth2论文总结和源码分析【理论部分】
- 无线振弦采集仪应用工程安全监测
- SD/SDIO/EMMC
猜你喜欢

CUDA explanation - why GPU is used in deep learning

Swift simple implementation of to-do list

AMD EPYC 9664旗舰规格曝光:96核192线程 480MB缓存 3.8GHz频率

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

数字IC设计SOC入门进阶

First knowledge of opencv4.x --- drawing shapes on images

Camera attitude estimation

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

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

CDA Level1知识点总结之多维数据透视分析
随机推荐
VS无线振弦采集仪蓝牙功能的使用
CCF 201512-3 画图
目标检测与分割之MaskRCNN代码结构流程全面梳理+总结
无向连通图邻接表的创建输出广度深度遍历
C语言基础
深度估计自监督模型monodepth2在自己数据集的实战——单卡/多卡训练、推理、Onnx转换和量化指标评估
数字IC设计SOC入门进阶
无线振弦采集仪应用工程安全监测
AMD EPYC 9664旗舰规格曝光:96核192线程 480MB缓存 3.8GHz频率
Principle analysis of self supervised depth estimation of fish eye image and interpretation of omnidet core code
CDA Level1多选题精选
¥ 1-1 SWUST OJ 941: implementation of consolidation operation of ordered sequence table
ADC简介
[deep learning] convolutional neural network
手持振弦VH501TC采集仪传感器的连接与数据读取
无线振弦采集仪参数配置工具的设置
First knowledge of opencv4.x --- drawing shapes on images
BSP3 电力监控仪(功率监控仪)端子定义和接线
MLX90640 红外热成像仪测温模块开发笔记(四)
从Anaconda到TensorFlow到Jupyter一路踩坑一路填平