Parity Simulation

written by Teresa Carrigan



Top

WHAT IS IT?

This model demonstrates storing of bit patterns using either even or odd parity.

Top

HOW IT WORKS

A random bit pattern is generated, with the number of bits specified by the number-of-digits slider. 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.

Finally, one extra bit is added to the original bit pattern. If the current parity is the same as the specified parity, then we add a 0 bit. If the current parity is incorrect, we add a 1 bit.

Top

HOW TO USE IT

The setup button generates a random bit pattern using the number of bits specified by the number-of-digits slider.

The random button generates random settings for the number-of-digits slider, parity choice box, and placement choice box. Then a random bit pattern is generated.

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 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 number-of-digits slider specifies the number of bits for the random bit pattern generated when the setup button is pushed.

The quiz button will generate a random bit pattern and ask the user how it would be sent using a specified parity.

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

The placement choice box specifies whether the parity bit added at the end will be placed at the far right or the far left of the other bits.

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.

Top

THINGS TO TRY

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

Set the parity and placement 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 Simulation model. 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.