A program in C and in MIPS assembly language program that generates pseudorandom

 

 

 

Write a program in C and in MIPS assembly language program that generates pseudorandom 32 bit numbers using a linear feedback shift register.

See Wikipedia entry on LFSR:
The entry above includes example C code for a 16 bit LFSR
The function should have one int argument and return value as in the prototype:
int lfsr32 ( int n );

If argument n==0, your lfsr32 function must save in memory and return 32 new LFSR bits based on the last result
If argument n!=0, your lfsr32 function should save the seed value n in the memory location holding the LFSR value.
The last LFSR result should be stored in a global variable in C and a labeled .word in the .data section of your MIPS code.
Start with initial seed value 0x55AAFF00 and write a main() function that calls your lfsr32 function and prints out the first 10 unsigned 32 bit random number values.

 

 

 

This question has been answered.

Get Answer