INTERACTIVE STUDIO 8-Bit Parallel Logic & Masking Register
Flip bits in Register A and Register B / Mask, then toggle the operation to see the bitwise result and column-by-column breakdown.
Clearing Bits with AND
• Truth Rule: 1 AND 1 = 1, while anything AND 0 = 0.
• How Masking Works: To isolate or extract specific bits, place 1s in the mask where you want to keep data, and 0s where you want to erase data.
• Real-World Example (Networking): A Subnet Mask (e.g. 255.255.255.0 / 11111111.11111111.11111111.00000000) is bitwise ANDed with an IP address to instantly separate the Network ID from the Host ID!
X AND 1 = X (preserves bit), but X AND 0 = 0 (clears bit).
Setting Bits with OR
• Truth Rule: Anything OR 1 = 1, while X OR 0 = X.
• How Setting Flags Works: To force a specific bit ON without disturbing other bits in the register, bitwise OR with a mask that has a 1 only at that position.
• Real-World Example (OS Permissions): File systems store permissions (Read, Write, Execute) as single bits. Running chmod +w ORs the Write flag bit into the permission register.
X OR 1 = 1 (forces bit ON), while X OR 0 = X (leaves bit unchanged).
Flipping Bits & The XOR Cipher
• Truth Rule: X XOR 1 = NOT X (inverts the bit), while X XOR 0 = X (leaves it alone).
• Symmetric Encryption: If you XOR a secret message with a key: Cipher = Message XOR Key. Applying the exact same key again recovers the original message: Cipher XOR Key = Message!
• Graphics & Game Cursors: Old video game consoles used XOR to draw mouse cursors over pixels without needing to save the background in memory—drawing it a second time perfectly erased it.
A XOR A = 0, and (A XOR B) XOR B = A (self-reversing).
Inverting Every Bit (Unary)
• Truth Rule: NOT only takes one input (Unary). Every 0 becomes 1, and every 1 becomes 0.
• Hardware Connection: Bitwise NOT is the exact first step when calculating Two's Complement to store negative numbers in an ALU: -X = (~X) + 1.
• Exam Technique: Ensure you flip every single bit in the full 8-bit register, including all leading zeroes!
~ (0000 0111) = 1111 1000. Adding 1 gives 1111 1001 (−7).
Bitmask Mastery Missions
Apply the correct operation and bitmask to solve real-world CPU hardware challenges.
Standard AQA Logic Gate Symbols
• AND Gate: D-shaped symbol. Outputs 1 only when BOTH inputs are 1 (A · B).
• OR Gate: Curved pointed shield. Outputs 1 when AT LEAST ONE input is 1 (A + B).
• NOT Gate: Triangle with an inversion circle/bubble. Inverts the input (¬A or A̅).
• XOR Gate (Exclusive OR): Curved shield with an extra distinct curved input line. Outputs 1 when inputs are DIFFERENT (A ⊕ B).
The 2n Rule & Binary Sequence
• Row Count: A circuit with n inputs always requires exactly 2n rows.
• 2 inputs (A, B) → 22 = 4 rows (00, 01, 10, 11).
• 3 inputs (A, B, C) → 23 = 8 rows (000, 001, 010 ... 111).
• Strict Binary Order: Always list input combinations in ascending binary order (0, 1, 2, 3...) to avoid skipping combinations and losing marks.
OR vs XOR & Bracket Precedence
• The OR vs XOR Trap: When A=1 and B=1, an OR gate outputs 1, but an XOR gate outputs 0! XOR means "one or the other, BUT NOT BOTH".
• Order of Precedence: Just like BIDMAS in maths, evaluate Brackets first, then NOT, then AND, and finally OR / XOR.
• Intermediate Columns: Always create working columns for bracketed sub-expressions to prevent compounding errors.
1-Bit Adders in the CPU ALU
• Half Adder: Takes two 1-bit inputs (A and B).
• Sum = A XOR B (0+0=0, 1+0=1, 0+1=1, 1+1=0)
• Carry = A AND B (0+0=0, 1+0=0, 0+1=0, 1+1=1)
• Full Adder: Adds two bits A, B PLUS a carry-in from a previous column (Cin). Constructed from two Half Adders and an OR gate.
Past Exam Question • 4 Marks
A security system triggers an alarm (Q) when sensor A is active (1) AND sensor B is inactive (0), OR when sensor C is active (1). Write the Boolean expression and state the output when A=1, B=1, C=0.
View Model Answer & Mark Scheme
Q = (A AND NOT B) OR C• Mark 2: Substitute inputs:
Q = (1 AND NOT 1) OR 0• Mark 3: Simplify sub-terms:
(1 AND 0) OR 0 → 0 OR 0• Mark 4: Final evaluation: Q = 0 (Alarm does NOT trigger).