一个verilog条件判断的问题
时间:10-02
整理:3721RD
点击:
Hi all,
I have a simple problem about the verilog. Please have a look at the following codes.
Code:
module test;
initial begin
bit [3:0] a;
a = 4'b1000;
if (~a)
$display("t1");
else
$display("t2");
end
endmodule
Simulated in Questa, "t2" is printed.
My question is why "t2" is printed? As I thought, ~a = 4'b0111, so "t1" should be printed.
Thank you for your replies.
verilog have bit keyword?
just sv has!
if u put bit [3:0] a; out of initial block ,
and change to reg 【3:0】 a;
you will get it ...t1!
不好意思,是sv.说错了.
改成reg的确可以得到t1。但是我想知道为什么reg可以,bit不可以。我看了一下协议,if的判断只有0跟非0,难道跟有符号数有关?
请指教一下。
谢谢
i just think u r a foreigner...
but i am wrong...
verilog没有bit关键字吧。请仔细学习verilog
看到bit,我很惊讶。
一般申明为reg,bit只是在sv中使用
学习了。
学习了~
"bit" o, thanks for this knowledge
学习....
有人能告诉我下,bit是什么吗,怎么应用?
