HDLBits答案——Verification: Writing Testbenches
2024-10-21 03:46:03
1 clock
module top_module ( );
reg clk;
dut U1(.clk(clk));
initial begin
clk = 0;
end
always begin
#5;
clk = ~clk;
end
endmodule
2 Tb/tb1
module top_module ( output reg A, output reg B );//
// generate input patterns here
initial begin
A = 0;
B = 0;
#10;
A = 1;
#5;
B = 1;
#5;
A = 0;
#20;
B = 0;
end
endmodule
3 Tb/and
module top_module();
reg a,b,out;
initial begin
a = 0;
b = 0;
#10;
a = 0;
b = 1;
#10;
a = 1;
b = 0;
#10;
a = 1;
b = 1;
end
andgate U1({a,b},out);
endmodule
4 Tb/tb2
module top_module();
reg clk;
reg in;
reg [2:0] s;
reg out;
q7 U1(.clk(clk), .in(in), .s(s), .out(out));
initial begin
clk = 0;
in = 0;
s = 3'd2;
#10;
in = 0;
s = 3'd6;
#10;
in = 1;
s = 3'd2;
#10;
in = 0;
s = 3'd7;
#10;
in = 1;
s = 3'd0;
#30;
in = 0;
end
always begin
#5;
clk = ~clk;
end
endmodule
5 Tb/tff
module top_module ();
reg clk,reset,t,q;
tff U1(.clk(clk),
.reset(reset),
.t(t),
.q(q));
initial begin
clk = 0;
t = 0;
reset = 0;
end
always begin
#5;
clk = ~clk;
end
initial begin
reset = 1'b0;
#3;
reset = 1'b1;
#10;
reset = 1'b0;
end
always@(posedge clk)begin
if(reset)
t = 1;
else
t = 0;
end
endmodule
最新文章
- C#对DBF文件的操作
- Linux---从start_kernel到init进程启动
- KO+bootstrap 模态窗全选绑定
- The CompilerVersion constant identifies the internal version number of the Delphi compiler.
- NullPointerException异常的原因??
- springmvc学习(二)——使用RequestMapper请求映射
- ld: 18 duplicate symbols for architecture i386 .linker command failed with exit code 1 (use -v to see invocation)_
- MyEclipse添加ibatis DTD文件实现xml的自动提示功能
- HBase数据的导入和导出
- Ajax 与 Comet
- Sublimetext3安装Emmet插件步骤
- win10的系统下怎么设置网页的字体变大
- (C++)string类杂记
- Java8将List转为Map
- 网络爬虫之html2md
- BZOJ.1109.[POI2007]堆积木Klo(DP LIS)
- FatMouse' Trade(杭电ACM---1009)
- javascript 运算符优先级
- 【VS Hacks】定制VS
- 部署kettle7.1
热门文章
- 在Yarn集群上跑spark wordcount任务
- Rust-函数
- 使用ConfigMap配置您的应用程序
- 20. 使用Fluentd发送告警邮件
- Docker方式安装Jenkins并且插件更改国内源
- (WebFlux)004、WebFilter踩坑记录
- C++面向对象编程之转换函数、explicit、one-argument
- 路径分析—PostgreSQL+GeoServer+Openlayers(二)
- python-D2-计算机与编程语言
- React + Springboot + Quartz,从0实现Excel报表自动化