homework 4

0 comments

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

int lfsr32 ( int n );

  • If argument n==0, your lfsr32 function must save in memory and return 32 new LFSR bits (32 shift/XOR operations since 1 new bit per shift) 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.

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
  • a screen shot showing both working
  • the .c and .asm source code pasted into the file

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}