我想用synce load和asynce reset进行注册 这是我的模块
module register32bit(indata,load,reset,clk,outdate);
input [31:0]indata;
input load;
input clk;
input reset;
output [31:0] outdate;
wire [31:0] indata;
reg [31:0] outdata;
wire clk;
wire load;
wire reset;
always @(posedge clk or reset) begin
if(reset) begin
outdata <= 0;
end
else if(load) begin
outdata <= indata;
end
end
endmodule
现在问题在于我的tb如何测试模块???
这是我的朋友
我不知道为什么过时的危险&#39; z&#39;价值并且不知道这种使用tb的方式是合乎逻辑的
module tb1();
reg [31:0]indata;
reg load;
reg clk = 0;
reg reset;
wire [31:0]outdata;
initial begin
#0 indata = 32'haef27c80;
#10 load = 1;
#3 clk = 1;
#0 clk = 0;
#10 $finish;
end
register32bit reg32b(
.indata(indata),
.load(load),
.reset(reset),
.clk(clk),
.outdate(outdate)
);
initial begin
$monitor("indata:%b\nclk:%b\nload:%b\nreset:%b\noutdata:%b\n------------",
indata,clk,load,reset,outdate,);
end
endmodule
这是结果
# indata:10101110111100100111110010000000
# clk:0
# load:x
# reset:x
# outdata:z
# ------------
# indata:10101110111100100111110010000000
# clk:0
# load:1
# reset:x
# outdata:z
# ------------
# indata:10101110111100100111110010000000
# clk:0
# load:1
# reset:x
# outdata:zhere
请为我做一个tb,如果注册模块有问题,请告诉我 非常感谢
答案 0 :(得分:0)
您未在模块outdata
中推动输出register32bit
。您没有在测试平台中驾驶电线outdata
。这可能是因为您的代码中出现了拼写错误outdate
。