Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Basic question...confusing me....

Status
Not open for further replies.

Guru59

Full Member level 4
Joined
Jul 10, 2006
Messages
217
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Activity points
2,812
Can any one explain the functionality of "&&" operator....

for example:::

a = 1010
b = 0001

then what is the value of " a && b " .....


Thanks
 

hey, its very simple.
single &, | represent bitwise operators. while double & ,| ( ie && , || ) represents logical operators.

o/p of logical operators is a single bit. i.e. 1 (if true, non-zero) or 0 (if false , zero).
In ur case both "a" and "b" are non zero, hence the o/p is TRUE (in digital terminology it is 1 )

Hope it helped u.

If the queston was a&b, then ans is 0000
 

it seems like logic operator,&& is AND .
so if a or b is zero,the ans is 0.
if both a and b are not zero ,the ans is 1.
 

The && operator is only 2-state. It is either 1 or 0 depending on the operands.

The & operator is 4-state. It can be 1, 0, X or Z depending on the operands.

&& is called a logical operator because both sides need to be 1 in order for the output to be 1. In all other cases, it is 0. So if you had a = 0010 and b = 0110,

a && b would give you 0 (or compile error depending on your synthesizer).

A better (and proper) way to use && would be:

(a == 0010 && b == 0110)

& is a bitwise operator because it takes the bitwise AND of both operands.

So, a & b would result in 0010.
 

hey is'nt && operator concantenation operator in vhdl and verilog...
a="1010";
b="0001";
then "a && b" must be "10100001"...

hope i'm right... correct me if i'm wrong...
 

concatenation in verilog is done is using braces {} with , seperating the objects to be concatenated. && is used for bitwise ANDing.
 

& operator is used for concatenation in vhdl:D:D:D:D
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top