Professional Documents
Culture Documents
Logical Operations -
Part I
1
Boolean Operations
A boolean variable can only have one of the two
values, i.e, can either be 1 or 0.
Given a sequence of bits, each of these bits
can be considered one boolean variable.
A boolean operation is applied simultaneously
to each bit.
Logical operations are defined for boolean
variables.
Unary boolean operations
Unary boolean operations
01000001100000000000000000110101
and 00000000011111111111111111111111
00000000000000000000000000110101
Extracted
bits
Example 14.2
What is the result of using mask1 with the
given bit sequence?
01000001100000000000000000110101
and 11111111000000000000000000000000
Example 14.3
01000001100000000000000000110101
and 00000000011111111111111111111111
00000000000000000000000000110101
cleared
00000000000000000000000000110101
or 01000011100000000000000000000000
01000011100000000000000000110101
merged
Example 14.4
Heres a SAL code that demonstrates
masking and merging:
in
x 0 0 0 0 1 0 1 0
y 0 1 0 1 0 1
0
x discard 1 0 1 0 1 0 0 0 in
y 0 0 1 0 1 0 1
x 0 1 0 1 0 1 0
y 0 0 1 0 1 0 1
y 1 0 1 0 1 0 1
replicated
discard
x 1 1 0 1 0 1 0
0 0 1 0 1 0 1
20