初学FPGA仿真问题
时间:10-02
整理:3721RD
点击:
小弟初学FPGA,以前做实验用过,现在自学发现quartus11.0不能仿真了,我习惯边学边仿真,只能依葫芦画瓢写了个testbench,但我没啥基础,写完发现输入一直是高阻态,求各位前辈帮忙解答解答,万分感谢~源码:
module test(clk,a,b);
input clk,a;
output b;
reg b = 0;
always@(posedge clk)
begin
b <= a;
end
endmodule
测试:
`timescale 1 ns/ 1 ps
module test_vlg_tst();
reg a;
reg clk;
wire b;
test i1 (
.a(a),
.b(b),
.clk(clk)
);
initial begin
a = 1;
forever
#20 a = ~a;
end
initial begin
clk = 0;
forever
#10 clk = ~clk;
end
endmodule
仿真结果:
clk,a一直是高阻态,b是0。
module test(clk,a,b);
input clk,a;
output b;
reg b = 0;
always@(posedge clk)
begin
b <= a;
end
endmodule
测试:
`timescale 1 ns/ 1 ps
module test_vlg_tst();
reg a;
reg clk;
wire b;
test i1 (
.a(a),
.b(b),
.clk(clk)
);
initial begin
a = 1;
forever
#20 a = ~a;
end
initial begin
clk = 0;
forever
#10 clk = ~clk;
end
endmodule
仿真结果:
clk,a一直是高阻态,b是0。
你可以改成这样 always #10 clk=~clk;
initial
begin
clk=0;
a=1;
forever #20 a=~a;
end
always #10 clk=~clk;
initial
begin
clk=0;
a=1;
forever #20 a=~a;
end
sampleofbus sampleofbus(.a(a),