NRZi Algorithm

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ASSIGNMENT

on

DATA
COMMUNICATION
(CS 3001)

By
Chinmay Mohanty
Q5. Design an algorithm and a logic circuit that will generate NRZI
signal for a given bit stream.

In telecommunication, a non-return-to-zero (NRZ) line code is a binary code in which ones are
represented by one significant condition, usually a positive voltage, while zeros are represented
by some other significant condition, usually a negative voltage, with no other neutral or rest
condition.

Non-return-to-zero, inverted (NRZI, also known as Non-return to Zero IBM, Inhibit code or IBM
code) was devised by Bryon E. Phelps (IBM) in 1956. It is a method of mapping a binary signal to
a physical signal for transmission over some transmission media. The two-level NRZI signal
distinguishes data bits by the presence or absence of a transition at a clock boundary.

Which bit value corresponds to a transition varies in practice, and the name NRZI is used for
both. Run-length limited (RLL) codes are generally described using the convention that a logical
1 is transmitted as a transition, and a logical 0 is transmitted as no transition. The HDLC and
Universal Serial Bus protocols use the opposite convention: a logical 0 is transmitted as a
transition, and a logical 1 is transmitted as no transition.

Example:

The representation and coding of NRZ-I is done in:

1. Algorithm
2. Logic Circuit Design
#include<iostream>
#include<string>
using namespace std;
//Program - CPP simulation of Encoding Algorithm NRZ-I

/*
Input - Data as string
Output - Timing diagram of the various encoding algorithms
*/

int main(void)
{
string data;
cout<<"Enter the data: - ";
cin>>data;
int len = data.length();

cout<<"\n";
cout<<"Encoded Signal:\n";

// In NRZI algorithm whenever 1 occurs output changes (if low, then to high,
else if high, then to low)

// zero is represented by __, lower-to-higher one is _- and Higher-to-Lower One


is -_

string nrzi="";
for(int i=0; i<len ; i++)
{
if( i==0 )
{
if( data[i] == '0') nrzi+= "__";
else nrzi+="_-";
}
else if( data[i] == '0' )
{
if( nrzi[i*2-1] == '_') nrzi += "__";
else nrzi += "--";
}

else if ( data[i] == '1' )


{
if( nrzi[i*2-1] == '_') nrzi += "_-";
else nrzi += "-_";
}
cout<<nrzi.substr(i*2,2);
}
}

OUTPUT:
Enter the data :- 10011001111000110101100

Encoded Signal:
_------__------__--__--------__----____--_____

Logic Circuit

You might also like