Parity Error Detection Simulation

written by Teresa Carrigan



Top

WHAT IS IT?

This model demonstrates the detection of single bit errors in bit patterns stored using either even or odd parity.

Top

HOW IT WORKS

First, a random eight-bit binary number is generated. Any bit that is a 1 will hatch a yellow copy of itself. The red arrow then discards pairs of yellow 1 bits. If there are no yellow bits left over, the current parity is even; if there is a bit left over, the current parity is odd.

Next, the current parity is compared to the parity used when the bit pattern was stored. If they match, then no error is detected. If they do not match, then an error was detected.

Top

HOW TO USE IT

The setup button generates a random eight-bit binary number.

The step button demonstrates the next step, and then stops so you can take notes. This is useful when you are first learning the method.

The go button does every remaining step, at a speed determined by the slow-motion slider. This is useful when you do not need to take notes between each step.

The show-again button starts the exact problem from the beginning. You may then click either the step button or the go button to see the same demonstration.

The quiz button will generate a random bit pattern and ask the user if an error was detected, using a specified parity.

The slow-motion slider is an easy way to adjust the speed of the display. Set it to zero if you want to show the final result as quickly as possible. 0.5 is a good setting for most purposes.

The parity choice box specifies whether even or odd parity will be demonstrated.

Top

THINGS TO NOTICE

Any bits that are zero are always ignored. The number of bits does not change the parity either.

The receiver must know not only whether the message was sent using even or odd parity, but also whether the parity bit is the first or last bit. This means that even if no error is detected, we cannot determine the data bits, because we are not told whether the parity bit was first or last.

When an error is detected, there is no way to fix the error, other than to ask for the message to be sent again.

Top

THINGS TO TRY

Set slow-motion to 0.5, click setup, and then click go.

Set the parity to a type you wish to drill, and click setup. Work each step by hand, and then click the step button to check your answer.

Top

EXTENDING THE MODEL

Allow the user to input the starting bit pattern.

Top

NETLOGO FEATURES

one-step uses the NetLogo run command combined with a global integer variable step to run the next step, without needing nested ifelse blocks.

without-interruption runs all the commands in the block without allowing other agents to "interrupt". That is, other agents are put "on hold" and do not execute any commands until the commands in the block are finished.

Top

RELATED MODELS

Top

CREDITS AND REFERENCES

This model was written by Teresa W. Carrigan, 2004.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:

  1. this copyright notice is included.
  2. this model will not be redistributed for profit without permission from Teresa Carrigan.
Contact Teresa Carrigan for appropriate licenses for redistribution for profit.

To refer to this model in academic publications, please use: Carrigan, T. (2004). Parity Error Detection Simulation Blackburn College, Carlinville, IL.

In other publications, please use: Copyright 2004 by Teresa W. Carrigan. All rights reserved.

Top

FOR MORE INFORMATION

For more information on parity, see:
  1. Null, L. and Lobur, J. Essentials of Computer Organization and Architecture, First Edition. Jones and Bartlett. page 65.


Home

Applets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.