Question: Lab Assignment # 2 Using a Linear Feedback Shift Register ( LFSR ) as shown below, write a code that generates a sequence of random

Lab Assignment # 2
Using a Linear Feedback Shift Register (LFSR) as shown below, write a code that generates a sequence of random numbers from 1 to 65535. Save the numbers in an array and check that the generated sequence contains no repetitions.
For the random number generator use the following approach, and write a function named generateRand() that generates the whole sequence and saves it in an array. The function should have the mask used as a random number generator as an argument, and return a pointer to the generated array.
You need to use the function count the number of ones in a register written in a previous lab. Once the array is generated, write another function that checks that the generated array does not contain any repetitions.
Submit your code in a well-structured file (hw2_your_id.asm), with comments and good separations between the different functions.
The code should contain the following functions:
The main function, which mainly consists of calling other functions
array_pointer generateRand(mask):
with mask as input, and pointer to the generated array as output
this function may need to call the function
int count_number_of_ones(integer), this function counts the number of ones in the input integer passed as a register, and returns the number of ones in another register.
This function is mainly used to compute the output of the XOR gates in the LFSR.
int check_repetitions(array pointer): this function checks that the generated array does not contain any repetitions.
It has a pointer, to the generated array, as input
returns 0 if the array has no repetitions, and 1 if there are any repetitions.
To finally check that your code is working properly, display the array as integer numbers separated by a new line, copy paste the output on an Excel sheet and sort the numbers to visually check that there are no repetitions.
Lab Assignment # 2 Using a Linear Feedback Shift

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!