Download Midterm Solutions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Analog-to-digital converter wikipedia , lookup

Flip-flop (electronics) wikipedia , lookup

Schmitt trigger wikipedia , lookup

Valve RF amplifier wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

Regenerative circuit wikipedia , lookup

Operational amplifier wikipedia , lookup

Opto-isolator wikipedia , lookup

Rectiverter wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Transcript
Midterm Solutions
ECE-C490 Security in Computing
Winter 2005
1a) Given the FS circuit, implement concurrent testing of the FS by monitoring the parity
of its outputs and producing an error alarm signal when that parity is distorted during the
computation.
a
b
Bin
d
Bout
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
1
1
1
0
0
0
1
Even
parity
0
0
0
1
1
0
0
0
Odd
parity
1
1
1
0
0
1
1
1
The even and odd parity bits above are generated to produce the predicted parity. We
then choose either even or odd parity and compare the predicted parity to the parity
actually created by the results. The solution below uses Even parity.
Even parity = ab B in  a bBin
(circuit on next page)
1b) Given the 3-bit adder, design the Encoder for the single parity checking of operands.
Implement the circuit for concurrent testing of the adder using the parity prediction
technique.
(Adder is a chain of three Full Adders, each with carry in/carry out and two single-bit
inputs).
We create a table of the inputs and corresponding outputs:
bi
0
0
0
0
1
1
1
1
xi
0
0
1
1
0
0
1
1
yi
0
1
0
1
0
1
0
1
Di
0
1
1
0
1
0
0
1
bi+1
0
0
0
1
0
1
1
1
Parity
0
1
1
1
1
1
1
0
Now we simply input x, y, D0, D1, D2, and b3 to an XOR, which indicates an error.
1c) Find all the tests for the stuck-at faults for each of the three inputs in the expression
f = (x1x2x3) + (x1’x2) + x2
All we need to do is generate a table that shows the corresponding output for each
possible input set, and compare it to the output when a stuck-at fault is present.
For example, if x2 becomes stuck at 0, the function can never be 1, no matter
what the values of x1 and x3 are.
Overall, you should find a total of eight test sets. In other words, all eight input
sets can be used to test the circuit.
2. You must use Davenport’s book in solving the problem. Otherwise no credit will be
given.
a.) Estimate the number of primes smaller than 1,000. Explain by referring to the
estimation technique.
 ( x) 
x
= 145.
ln( x)
b.) Find all of the primes smaller than 1,000. What is the name of the method you
use? Explain the method.
Using the sieve of Erastosthenes, you should find 170 primes smaller than
1,000.
3a) Define the function Q(n), n  J+ by Q(0) = 2; Q(1) = 6; Q(x) = 6Q(x-1) – 5Q(x-2).
Prove by induction: Q(n) = 5n + 1
50 + 1 = 2 = Q(0), which demonstrates that this is true for n = 0.
51 + 1 = 6 = Q(1) (also true for n = 1).
We assume that Q(n-1) holds  5n-1 + 1
And that Q(n-2) holds  5n-2 + 1
Q(n) = 6(5n-1 + 1) – 5(5n-2+ 1)
= 6*5n-1 - 5n-1 + 6 –5
= 5*5n-1 + 1
= 5n + 1.
3b) Let n = n6n5n4n3n2n1n0 for some decimal number n. Prove that 11|n if and only if 11|
(n0 – n1 + n2 - n3 + n4 – n5 + n6).
n = d0 + 10 * d1 + 100 * d2 + … + 10kdk.
Alternate sum of the digits of number n is: dk – dk-1 + dk-2 - … + (-1)kd0
Let us consider the following expression:
E = (10 + 1) * (d0 + 10(d1 – d0) + 100(d2 – d1 – d0) + … + 10k(dk – dk-1 + dk-2 - …
+ (-1)kd0)) – 10k+1(dk – dk-1 + dk-2 - … + (-1)kd0).
After performing careful multiplication, one can see that E = n.
A term that has a factor of (10 + 1) or 11, is divisible by 11. Thus n is divisible by 11
whenever 10k+1(dk – dk-1 + dk-2 - … + (-1)kd0) is divisible by 11. Since 10k+1 is not
divisible by 11 and 11 is a prime, we can make a conclusion that n is divisible by 11 if
and only if dk – dk-1 + dk-2 - … + (-1)kd0 is divisible by 11. This number is the alternate
sum of digits of n.