Question

In: Computer Science

5. Implement 2-D error detection mechanism using even parity check. Given a data bit to be...

5. Implement 2-D error detection mechanism using even parity check. Given a data bit to be send, perform the even parity check for the data to be send. Append the parity bit at the end of that data. At the receiver end, the receiver has to check for errors in transmission

Please code in C language.

Solutions

Expert Solution

//Dear Student, I have spent a lot of time on it, so if you got something from it, then give an upvote. Thank you

#include <stdio.h>
int main()
{
    int parity(int a[],int b);
    int n,i;
    printf("Enter the length of the message 4-bit/8-bit/16-bit:");
    scanf("%d",&n);
    int send[n],rec[n],s,r;
    printf("Enter the senders message:");
    for(i=0;i<n;i++)
        scanf("%d",&send[i]);
    s=parity(send,n);
    printf("Enter the receivers message:");
    for(i=0;i<n;i++)
        scanf("%d",&rec[i]);
        r=parity(rec,n);
    printf("Parity bit for sender:%d\n",s);
    printf("Parity bit for receiver:%d\n",r);
    if(s==r){
        printf("No error");
    }
    else{
        printf("Error");
        }return 0;
}
        int parity(int p[],int n)
        {
            int i=n/2;
        int a[i],b[i],c[i];
        int j,k=0;
        for(j=0;j<n/2;j++)
        {
        a[j]=p[j];
        }

        for(j=i;j<n;j++)
        {
            b[k]=p[j];k++;
        }
        for(i=0;i<n/2;i++)
        {
            if(a[i]==b[i])
            {
                c[i]=0;
            }
            else
            {
                c[i]=1;
                
            }
        }
        int count=0;
        for(i=0;i<n/2;i++)
        {
            if(c[i]==1)count++;
        }
        if(count%2==0)
        {
        return 0;
        }
        else
        {
        return 1;
        }
}

The output of above code will display as:


Related Solutions

Two communication devices are using a single-bit even parity check for error detection. The transmitter sends...
Two communication devices are using a single-bit even parity check for error detection. The transmitter sends the byte 10101010 and, because of channel noise, the receiver gets the byte 10011010. Will the receiver detect the error? Why or why not? the receiver gets the byte 10111010. Will the receiver detect the error? Why or why not? Compute the Internet checksum for the data block E3 4F 23 96 44 27 99 D3. Then perform the verification calculation.
Error detection/correction C Objective: To check a Hamming code for a single-bit error, and to report...
Error detection/correction C Objective: To check a Hamming code for a single-bit error, and to report and correct the error(if any) Inputs: 1.The maximum length of a Hamming code 2.The parity of the check bits (even=0, odd=1) 3.The Hamming code as a binary string of 0’s and 1’s Outputs: 1.The original parity bits (highest index to lowest index, left to right) 2.The new parity bits (highest index to lowest index, left to right) 3.The bit-wise difference between the original parity...
2-D bit parity is generated by placing the data bits in a matrix form as shown...
2-D bit parity is generated by placing the data bits in a matrix form as shown below. Then, a parity bit is computed for every row and every column: These parity bits are shown in grey. Assume that even parity is used (as shown below). Assume throughout that the receiver is guaranteed that no more than 2 errors are possible. 1 0 1 0 1 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0...
Given the 21-bit even-parity Hamming code: 0 1010 0111 0011 0000 0101 and assuming there is...
Given the 21-bit even-parity Hamming code: 0 1010 0111 0011 0000 0101 and assuming there is one incorrect bit. a. Which bit is incorrect? My educated guess for what the incorrect bit maybe has me thinking it is the '1' bit at the end of the '0111' byte, but I have no full proof as to why it is that specific bit. Am I in the right area to think that? b. After the error is corrected, what decimal number...
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned...
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned inputs (A and B), a 4-bit unsigned product outputs (P). you must use some full adders and gates (AND, OR, NOT, XOR).
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned...
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned inputs (A and B), a 4-bit unsigned product outputs (P). Please use some full adders and gates (AND, OR, NOT, XOR).
Cyclic Redundancy Check Given the data bits D = 110100101011, the generator G = 110011, r...
Cyclic Redundancy Check Given the data bits D = 110100101011, the generator G = 110011, r = 5. 1) Find the CRC. Give the detailed steps of your computation. 2) What does the sender send? 3) Show how the receiver verifies the received data. Assume there is no error. (mostly need help with this step!)
Try designing a 4 bit Multiplexer using two 2-bit multiplexer design given below and verify the...
Try designing a 4 bit Multiplexer using two 2-bit multiplexer design given below and verify the design by simulating it. module Mux2x1(In0,In1,sel,out); input In0,In1,sel; output out; assign out = (sel)?In1:In0; endmodule Pls include the verilog design module,testbench, waveform
We want to compute Cyclic Redundancy Check (CRC) for the given the data bits D=110001, generator...
We want to compute Cyclic Redundancy Check (CRC) for the given the data bits D=110001, generator G=1001, and 3 CRC bits (i.e., r=3),. Explain the algorithm and implement the CRC computation in a programming language (e.g., C, C++, and Python) with the above setting.
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions: a.6thbit position. b.11thbit position.Assume an odd-parity scheme for this problem.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT