Mavzu: Bit logic operations



Yüklə 6,54 Kb.
tarix24.12.2023
ölçüsü6,54 Kb.
#193632
DMK

Mavzu:Bit logic operations

Nayimov ma’murjon 11b-21 tja

Bitwise logical operators Bitwise intersection (and) Bitwise union (or) Bitwise exclusive (xor) Unary bitwise inverse The bitwise logical operators examine one bit at a time in their operands and compute the corresponding bit value in the result. The bitwise operators and, or, and xor are binary operators that have a left and right operand. The bitwise operator not is a unary operator that has only a right operand. The result type of all four bitwise operators is integer. Note that EPL integers are 64 bits wide.


Logic and bit operations • Computers represent information by bits. • A bit has two possible values, namely zero and one. This meaning of the word comes from binary digit, since zeroes and ones are the digits used in binary representations of numbers. The well-known statistician John Tuley introduced this terminology in 1946. (There were several other suggested words for a binary digit, including binit and bigit, that never were widely accepted.) • A bit can be used to represent a truth value, since there are two truth values, true and false. • A variable is called a Boolean variable if its values are either true or false. • Computer bit operations correspond to the logical connectives. We will also use the notation OR, AND and XOR for ∨ , ∧ and exclusive ∨. • A bit string is a sequence of zero or more bits. The length of the string is the number of bits in the string.
• We can extend bit operations to bit strings. We define bitwise OR, bitwise AND and bitwise XOR of two strings of the same length to be the strings that have as their bits the OR, AND and XOR of the corresponding bits in the two strings.
• Example: Find the bitwise OR, bitwise AND and bitwise XOR of the bit strings 01101 10110 11000 11101 Solution:
The bitwise OR is 11101 11111 The bitwise AND is 01000 10100 and the bitwise XOR is 10101 01011.
• The circuits in computers and other electronic devices have inputs, each of which is either a 0 or a 1, and produce outputs that are also 0s and 1s. • Circuits can be constructed using any basic element that has two different states. Such elements include switches that can be in either the “on” or the “off” position and optical devices that can either be lit or unlit. • In 1938 Claude Shannon showed how the basic rules of logic, first given by George Boole in 1854 in his The Laws of Thought, could be used to design circuits.
Logic gates • Boolean algebra is used to model the circuitry of electronic devices, including electronic computers. • Each input and output of such a device can be thought of as a member of the set {0, 1}. • An electronic computer is made up of a number of circuits. Each circuit can be designed using the rules of Boolean algebra. • The basic elements of circuits are called gates. • A gate is an electronic device that operates on a collection of binary inputs and produces a binary output. Logic gates • Boolean algebra is used to model the circuitry of electronic devices, including electronic computers. • Each input and output of such a device can be thought of as a member of the set {0, 1}. • An electronic computer is made up of a number of circuits. Each circuit can be designed using the rules of Boolean algebra. • The basic elements of circuits are called gates. • A gate is an electronic device that operates on a collection of binary inputs and produces a binary output.
Types of logic gates
• The inverter accepts a Boolean value as input and produces the complement of this value as its output. The symbols used for an inverter is shown in Figure 1 (a). The input to the inverter is shown on the left side entering the element, and the output is shown on the right side leaving the element.
• The second type gate is the OR gate. The input to this gate are the values of two or more Boolean variables. The output is the Boolean sum or their values. The symbol used for an OR gate is shown in Figure 1(b). The inputs to the OR gate are shown on the left side entering the element and the output is shown on the right side leaving the element.
• The third type of gate is the AND gate. The inputs to this gate are the values of two or more Boolean variables. The output is the Boolean product or their values. The symbol used for an AND gate is shown in Figure 1(c). The inputs to an AND gate are shown on the left side entering the element, and the output is shown on the right side leaving the element.
• We will permit multiple inputs to AND and OR gates, like in Figure 2.
Yüklə 6,54 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin