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.
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 )
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.