Loading simulator…
The write decoder, six storage DFFs, hold/load MUXes, Clock wiring, and nReset wiring are already complete. The missing logic implements the parallel key comparison, Valid qualification, Match, and lowest-index priority.
1. Build the Entry 0 Comparator
Compare each bit of Search_Key[1:0] with the corresponding stored Entry 0 key bit:
CMP0_1 = Search_Key[1] ⊕ Key0[1]
CMP0_0 = Search_Key[0] ⊕ Key0[0]
Invert both XOR results:
EQ0_1 = CMP0_1'
EQ0_0 = CMP0_0'
Then combine the two equality signals:
EQUAL0 = EQ0_1 · EQ0_0
EQUAL0 is therefore 1 only when both stored key bits equal the search key.
2. Build the Entry 1 Comparator
Build the same comparison path for Entry 1:
CMP1_1 = Search_Key[1] ⊕ Key1[1]
CMP1_0 = Search_Key[0] ⊕ Key1[0]
EQ1_1 = CMP1_1'
EQ1_0 = CMP1_0'
EQUAL1 = EQ1_1 · EQ1_0
The two entry comparisons operate in parallel because Search_Key[1:0] is applied to both comparator paths.
3. Qualify Each Match with its Valid Bit
Connect each equality result to the corresponding Valid bit:
M0 = Valid0 · EQUAL0
M1 = Valid1 · EQUAL1
A stored key therefore cannot produce a match when its entry is invalid.
4. Generate the Match Output
Connect M0 and M1 to the final OR gate:
Match = M0 + M1
Match becomes 1 when either valid entry contains the search key.
5. Generate the Priority Match Index
Entry 0 has priority when both entries match. Invert M0 and AND it with M1:
Match_Index = M0' · M1
Therefore:
M0=1, M1=0 → Match_Index=0
M0=0, M1=1 → Match_Index=1
M0=1, M1=1 → Match_Index=0
The supplied write/storage circuitry remains unchanged. A selected entry updates on the rising edge of Clock, and the completed lookup path responds combinationally after the stored values settle. When nReset = 0, both Valid bits clear, so M0 = 0, M1 = 0, Match = 0, and Match_Index = 0.