你好,这是我的第一个verilog程序,我得到的输出值是'x‘。谁能解释一下。如有任何帮助,将不胜感激!
module circuit (a,b,c,d,o);
input a,b,c,d;
output o;
wire e,f,g,h,i,j,k,l,m,n;
not (a,e);
not (b,f);
not (g,c);
not (d,h);
and (i,e,g);
and (j,e,f,c,h);
and (k,a,f,g,h);
and (l,a,c);
and (m,b,g,d);
and (n,b,c,d);
or (o,i);
or (o,j);
or (o,k);
or (o,l);
or (o,m);
or (o,n);
endmodule
module TB_circuit();
reg a1,b1,c1,d1;
wire o1;
circuit dut(.a(a1),.b(b1),.c(c1),.d(d1),.o(o1));
initial
begin
a1=1;b1=0;c1=0;d1=0;#100;
$display(o1);
end
endmodule发布于 2021-02-08 10:55:30
您的or%s都在单独驱动o。如果所有驱动程序发送的值都不相同,这将导致X。使用单个or门驱动o。
更改:
or (o,i);
or (o,j);
or (o,k);
or (o,l);
or (o,m);
or (o,n);至:
or (o, i, j, k, l, m, n);此外,还需要交换not的端口。
所有Verilog基元门的第一个端口都是输出。
更改:
not (a,e);
not (b,f);
not (g,c);
not (d,h);至:
not (e,a);
not (f,b);
not (g,c);
not (h,d);https://stackoverflow.com/questions/66094874
复制相似问题