Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In computer simulation, LCM (Linear Congruential Method) is an algorithm for producing a sequence of random numbers in a recursive way. In specific, suppose the

In computer simulation, LCM (Linear Congruential Method) is an algorithm for producing a sequence of random numbers in a recursive way. In specific, suppose the random numbers to be generated are X0, X1, ... , Xn, then X0 is called the seed, and each Xi+1 is generated from Xi (i = 0, 1, 2...n 1) by the following equation: Xi+1 = (AXi + C) mod M where A is the multiplier, C is the increment, and M is the modulus. In this question, we want to generate a 6-bit unsigned random integer (range from 0 to 261 = 63). Suppose the parameters are A = 13, C = 17, M = 64 (or 2 6 ) and the seed is X0 = 19, please write an Assembly program for ATmega2560 to generate the next random number. In the program, you must use the register R16 to store both the seed and the generated random number.

Here is the psudo-code for the instructions:

R16 X_0

R17 A

R1:R0 R16 * R17

R16 R0 (why the value in R1 is discarded?)

R17 C

R16 R16 + R17 // Find you own way to calculate R16 R16 / M

image text in transcribed

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago