Write a program in C and in MIPS assembly language program that generates pseudo
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: https://en.wikipedia.org/wiki/Linear-feedback_shift_registerLinks to an external site.
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.
Use taps / bits numbered 32,22,2,1 where bit 1 is the left-most bit and bit 32 is the right-most.
You must submit THREE files:
1) Your .asm MIPS assembly file
2) Your .c source file
3) A brief report document file in .pdf .doc or .docx including:
a description of the program
2 screen shots showing both C and MIPS versions working
the .c and .asm source code pasted into the file
Requirements: 1h | .doc file
ATTACHMENTS
Leave a Reply