Sometimes called triple-mode redundancy, it is a fault-tolerant form of N-modular redundancy.

If any of the three systems fails, the other two systems can correct and mask the fault

Untitled

Example

In this case, the first two rows are correct. However, the third row has a mismatch, therefore an error is detected. The solution to correcting this is simply by flipping the right bit to 1, since the majority are ones.

Applications

Uses of TMR: Space Satellite and Military applications where transient failures can be caused by noise

TMR is preferred over the more popular and well-known Hamming error codes due to its accuracy in error detection and speed

Usage

So does this work in real life? How do we actually build a triple modular redundant system?

Python implementation

def tmr(a, b, c):
  # Check for a majority vote
  if a == b or a == c:
    return a
  else:
    return b

def get_valid_input(message):
    # Prompt the user for input
    while True:
        try:
            num = int(input(message))
            if num != 0 and num != 1:
                raise ValueError("Invalid input. Please enter either 0 or 1.")
            return num
        except ValueError as e:
            print(e)

# Get input from the user
num1 = get_valid_input("Enter the first number (0 or 1): ")
num2 = get_valid_input("Enter the second number (0 or 1): ")
num3 = get_valid_input("Enter the third number (0 or 1): ")

# Apply Triple Modular Redundancy (TMR)
result = tmr(num1, num2, num3)

# Print the result
print("Result after TMR: ", result)

Easy!

Now let’s do it in hardware, like how most TMR systems are actually implemented on FPGA!

Logic Gate implementation

You’d think something that’s used in space satellites would require some aerospace-grade rocket science-y stuff. Spoiler: all you need is NAND gates to make a majority gate.

Let’s derive it because it’s honestly the fun part

majority-01.png

A B C Out
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1

First, here is the majority gate’s truth table, our desired result

Now, we use the K-Map method to derive the boolean algebra expression

IMG_0A84A6AFE807-1.jpeg

Here we can see that the equivalent boolean expression is BC + AC + AB

Source: Ethanpet113 “Majority Logic.” Wikipedia, Wikimedia Foundation, en.wikipedia.org/wiki/Triple_modular_redundancy#/media/File:Majority_Logic.png

Source: Ethanpet113 “Majority Logic.” Wikipedia, Wikimedia Foundation, en.wikipedia.org/wiki/Triple_modular_redundancy#/media/File:Majority_Logic.png

       Key: L: low; H: high

Equivalently, we can actually use 5 AND gates

Performance

Remind you of the 4 performance metrics: