Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are two question in this code. where you have You do this please what is the functions or code that is supposed to

There are two question in this code. where you have "You do this " please what is the functions or code that is supposed to be there. Thanks. #include #include

using namespace std;

void printstate(bool *s) { /* This function prints out the 25 bit register*/ cout << "state: "; for(int i =0; i < 25;i++) cout << s[i]; cout << endl; }

void leftshift(bool *s) { /*This function shifts the 25 bit register one place to the left*/ //You do this! }

void timestep(bool *s) { /* This function executes one time step of the NLFSR. * The state variable s (which is an array of bool types of length 25) * should be updated according to the NLFSR update rule as discussed * in the project description.*/ //You do this! }

void runnlfsr(bool *s, int numsteps, bool print) { /*This function runs the LFSR from the state s for numsteps steps*/ for(int i =0 ; i < numsteps; i++) { if(print) { cout << s[0]; } timestep(s); } cout << endl; }

#define INITIALSTATE {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} const bool t[25] = INITIALSTATE;

void setstate(bool *s) {/*This function makes the state equal to the initial state (defined above)*/ for(int i=0; i < 25; i++) s[i]=t[i]; }

bool period_over(bool *s) {/*This function returns true iff the current state is equal to the initial state*/ for(int i = 0; i < 25;i++) { if(t[i] != s[i]) return false; } return true; }

int main() { bool state[25]; setstate(state); runnlfsr(state,50,true); setstate(state); runnlfsr(state,(1 << 25)-1,false); // 2**25 -1 runnlfsr(state,50,true); return 1; }

int main2() { bool state[25]; setstate(state); timestep(state); int i = 1; while(!period_over(state)) { timestep(state);

i++; } cout << "done in " << i << " steps" << endl; printstate(state); return 1; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

What would you do?

Answered: 1 week ago

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago