Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ function named Ifsr that accepts feedback path and initial states as unsigned integers and the number of random bits to be

Write a C++ function named Ifsr that accepts feedback path and initial states as unsigned integers and the number of random bits to be printed as arguments. The function will print the random bits by creating an LFSR with the provided feedback path and initial states. The least significant bit of feedback path argument will be po and the least significant bit of initial states will be so. For example, let the parameters be 3, 34, and 50 (1fsr (3,34,50)). 3 is equal to (00000000000000000000000000000011)2. Therefore, only p = 1 and po = 1. 34 is equal to (00000000000000000000000000100010) 2. It is the initial state of LFSR. In the first iteration: The function prints the first random bit, which is 0 as the least significant bit of 00000000000000000000000000100010. Then, the function computes the next bit in LFSR as S32 = (S1 AND P1) XOR (So AND po) = 1. Then, the function shifts all bits to right by one and sets the most significant bit as S32 = 1. Therefore, at the end of the first iteration, the states of LFSR will be 10000000000000000000000000010001. The function repeats the same process 50 times and prints 01000100000000000000000000000000110011000000000000.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here is a C function named Ifsr that creates an LFSR Linear Feedback Shift Register with the provide... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Numbers And Computers

Authors: Ronald T Kneusel

1st Edition

3319172603, 9783319172606

More Books

Students also viewed these Programming questions

Question

Differentiate between classical and operant conditioning.

Answered: 1 week ago