Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Background : One possible consequence of an input change event on a logic gate i

ID: 3596541 • Letter: B

Question

Background: One possible consequence of an input change event on a logic gate is an output change. In a simple simulator, this occurs at a constant delay after the input change event, so the code in the input-change event routine would look something like this:

schedule( time + delay, ... );

A problem: In a real logic simulator, gate delays are not constant. Rather, they vary slightly and randomly each time a gate's output is changed. Rewrite the above code fragment so that delays vary over approximately a 10% range from 0.95 to 1.05 times the base delay for the gate. (0.5 points)

Explanation / Answer

Let real logic simulator, uses

schedule( time + delay2, ... );      instead of           schedule( time + delay, ... );

The problem boils down to have delay2 not constant rather vary randomly from 0.95 to 1.05 times the base delay.

It needs a random number generator. let the randon number generator be a function rand()
Let us also assume that the value produced by the rand() function is in range 0 to 1 (if not we can always normalize by dividing with the maximum value)

Consider following value for delay2

delay2 = delay*(0.9 + 0.2*rand())

When rand() produce 0; delay2 has value 0.9delay
When rand() produce 1; delay2 has value 1.1delay

Therefore delay2 havs value in range 0.9delay tot 1.1delay