M
mynewlifever@yahoo.com.cn
Guest
Somebody told me that one of those two always blocks will infer to
latch. But I donnot know which one. I think both of them write all the
condition that will happen.Some books told me if you write code like
this
begin
if
else if
end
or like this
case:
state0:
state1:
endcase
will syn latches.But these two always blocks use else or default.So I
realy donot know which one.
I need help,please help me.Thank you!
the first always block:
always @(en or ina or inb)
begin
if(en)
begin
data_out = ina;
end
else
begin
data_out =inb;
end
end
the second always block:
input [3:0] data_in;
always @(data_in)
begin
case (data_in)
0: out1=1'b1;
1,3: out2 = 1'b1;
2,4,5,6,7: out3 = 1'b1;
default : out4 = 1'b1;
endcase
end
latch. But I donnot know which one. I think both of them write all the
condition that will happen.Some books told me if you write code like
this
begin
if
else if
end
or like this
case:
state0:
state1:
endcase
will syn latches.But these two always blocks use else or default.So I
realy donot know which one.
I need help,please help me.Thank you!
the first always block:
always @(en or ina or inb)
begin
if(en)
begin
data_out = ina;
end
else
begin
data_out =inb;
end
end
the second always block:
input [3:0] data_in;
always @(data_in)
begin
case (data_in)
0: out1=1'b1;
1,3: out2 = 1'b1;
2,4,5,6,7: out3 = 1'b1;
default : out4 = 1'b1;
endcase
end