Assign statement with less than or equal ....

Status
Not open for further replies.

Muthuraja.M

Advanced Member level 4
Joined
Jul 20, 2013
Messages
101
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Visit site
Activity points
634
Hi all,

I want to know the operation of the below assign statement.

assign carry = (ai+bi+di) >= 2;

This assign statement is used to compute carry operation in full adder.

How this statement gives the carry as output . pls explain me....

Thanks in advance ....
 

assign carry = (ai + bi + di)>=2 ? 0 : 1;

used "?" operator, "<condition> ? <pass condition> : <failled condition>;
 

i dont understand ur answer rca pls explain with any two examples the bits containing carry as 1 and 0 respectively..

a = b= d = 1

and

a=1 , b=d=0

pls explain with these two examples....
 

"?" is a verilog operator, google or verilog book will explain that as:

assign toto = <condition> ? <pass condition> : <failled condition>;

toto could be write by <pass condition> or <failled condition> function of the <condition> result.
 

i know about the conditional operator . But i want to know that how did u say that the statement that is posted by
me is conditional operator assignment .


That wat i need to know rca...
 

Muthuraja.M

rca should have said the assignment you posted is equivalent to a conditional operator.

assign carry = (ai + bi + di)>=2 ? 0 : 1; // does the opposite of what you wanted
assign carry = (ai + bi + di)>=2 ? 1 : 0; // is equivalent to what you posted assign carry = (ai+bi+di) >= 2;
 

why we use 2 over there is that 2 is in binary or decimal number .

i want that only ...
 

The 2 is decimal, binary can only have the digits 0 & 1.

assuming ai, bi, and di are all single bit values then the result of ai + bi + di will be a 2-bit value. so 2'b00 & 2'b01 will result in carry = 1'b0 and 2'b10 & 2'b11 will result in carry = 1'b1.

Regards
 

ok i understand ...

thanks rca and ads-ee.

But how the 1st bit only takes as carry .
 

the <pass condition> and <fail condition> is single bit.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…