Ste*_* Li 0 verilog input system-verilog test-bench
任何人都可以帮助我创建一个测试平台或仅为我的以下代码创建输入代码吗?我正在使用赛灵思。
module fsmb (input rst,clk,a,
output reg x);
parameter sta = 2'b00, stb = 2'b01, stc = 2'b10,
std = 2'b11;
reg[1:0] st, nst;
always @(posedge clk)
begin
if (rst)
st <= 2'b00;
else
st <= nst;
end
always @*
begin
st = nst; x =0'b0;
case (st)
sta: if(a) nst = stb;
else nst = sta;
stb: if(a) nst = stc;
else nst = stb;
stc: begin
if(a) nst = stc;
else nst = std;
x =1'b1;
end
std: begin
if(a) nst = stc;
else nst = sta;
x = 1'b1;
end
default: nst = sta;
endcase
end
endmodule
Run Code Online (Sandbox Code Playgroud)
测试台 101
例子:
module tb;
reg rst,clk,a;
wire x;
initial begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
rst = 1;
a = 0;
#50 rst = 0;
#50 $finish;
end
fsmb fsmb (
.clk (clk),
.rst (rst),
.a (a),
.x (x)
);
endmodule
Run Code Online (Sandbox Code Playgroud)
EDA playgound上提供了其他简单的测试平台示例。您可以注册一个免费帐户并查看示例,例如:Published Playgounds -> D 触发器
归档时间: |
|
查看次数: |
1296 次 |
最近记录: |