00:00:00.000 Two questions for the collector In the last lesson, we read the same bits in different ways. Now a collector has two questions. Is the channel enabled? Does the format match the legal code? The collector accepts data only when both answers are yes. 00:00:19.535 Read all four truth-table rows Each condition has two values, so we have four rows. A disabled channel cannot pass. An enabled channel with a bad format also fails. Only the last row passes. AND needs both, OR needs at least one, and NOT flips one condition. 00:00:41.670 Bitwise AND compares positions Put zero zero one zero above zero one zero zero. The first one is in the second column from the right. The other is in the third. No column has a pair of ones, so bitwise AND returns four zero bits. 00:01:00.720 Logical AND asks one question per vector Keep the same vectors and use the double ampersand. Logical AND asks whether each whole vector is true. A known binary vector is true if it is nonzero. Both pass that check, so the result is one bit with value one. 00:01:19.180 Two kinds of negation, two widths Use zero zero one zero again. A tilde flips each position and gives one one zero one. The width stays four. An exclamation mark sees a true condition and returns false, a one-bit zero. Look at the result width before using it. 00:01:41.310 The legal code is exactly 0010 Only zero zero one zero is legal. Compare the whole format field with this constant. Then combine the result with the channel enable. A range would need lower and upper comparisons with explicit endpoints. This design accepts one code. 00:01:59.760 Compare a vector containing X Replace the one on the left with X. The other bits give us no known mismatch, so ordinary equality returns X. Case equality compares states exactly and returns zero. Case inequality returns one, so a test can catch an unknown output. 00:02:21.620 Calculate the four-bit XOR Now XOR the four data bits. A zero leaves the running result alone. A one flips it. Zero zero one zero contains one set bit, so the reduction gives one. With the parity bit appended, the whole group has two ones, an even count. 00:02:45.120 Check one flipped bit, then two XOR the received data with the original parity bit. The intact group gives zero. One flip changes the data to zero zero one one and gives one. Two flips give zero one zero zero, restoring a zero syndrome even though the data changed. 00:03:08.930 What slips through a nonzero check? Replace exact equality with a nonzero check. The legal code still passes and zero still fails. That test pair misses the bug. Add zero one zero zero and all ones. Both slip through. With enable high, the mutant lets fourteen illegal codes pass. 00:03:31.920 Write expected results before the test For format checking, pair both enable values with all sixteen codes. For parity, count the ones in each of sixteen inputs. Build the expected results from the requirement and your own calculation. Next we use a decision to select a data path.