Assume that X consists of 3 bits, x2 x1 x0. Write four logic functions that are true if and only if X contains only one 0 X contains an even number of 0s X when interpreted as an unsigned binary number is less than 4 X when interpreted as a signed (two's complement) number is negative

Respuesta :

Answer:

a) [tex](\frac{}{x} .x_{1}.x_{0} ) + x_{2} .x_{1}.x_{0} + (x_2.\frac{}{x}x_{0})[/tex]

b) (ₓ₂.ₓ₁.ₓ₀) + (ₓ₂.⁻ₓ₁.ₓ₀) +(⁻ₓ₂.ₓ₁.⁻ₓ₀) + (⁻ₓ₂.⁻ₓ₁.ₓ₀)

c) ⁻x₂

d) x₂

note ⁻x is the same as [tex]\frac{}{x}[/tex]

Explanation:

X contains only one 0

This means that either [tex]x_{2},x_{1}, or x_{0}[/tex] must be 0. Lets assume that [tex]x_{2} = 0[/tex]

then [tex]x_{1} = 1[/tex] and [tex]x_{0} = 1[/tex].

Therefore [tex]\frac{}{x} .x_{1}.x_{0} = 1[/tex]. lets apply the same reasoning for cases

[tex]x_{1} = 0[/tex] and [tex]x_{0} = 0[/tex]. Thus if X contains only one 0,

[tex](\frac{}{x} .x_{1}.x_{0} ) + x_{2} .x_{1}.x_{0} + (x_2.\frac{}{x}x_{0})=1[/tex].

On the other hand, if the above equality holds, then one of the "addends" must be 1. if [tex]\frac{}{x} .x_{1}.x_{0} = 1[/tex], we must have [tex]x_{0} = 1[/tex], [tex]x_{1} = 1[/tex] and [tex]\frac{}{x_{2} }[/tex] = 1, so [tex]x_{2} = 0[/tex]

therefore x contains only one 0.

proceeding similarly to other case.

The required logic function is [tex](\frac{}{x} .x_{1}.x_{0} ) + x_{2} .x_{1}.x_{0} + (x_2.\frac{}{x}x_{0})[/tex]

X contains even number of zeros

x has 3 digits, so x contains even number of zeros if and only if it contains 0 zeros or 2 zero.

suppose that it contains 0 zeros. Then [tex]x_{2} =x_{1} =x_{0} = 1[/tex] so [tex]x_{2} .x_{1} .x_{0} = 1.[/tex]

suppose that x contains 2 zeros then it contains exactly 1 one, similarly to the first subtask we conclude that then we have

(ₓ₂.⁻ₓ₁.⁻ₓ₀)+(⁻ₓ₂.ₓ₁.⁻ₓ₀)+(⁻ₓ₂.⁻ₓ₁.ₓ₀) = 1

so if x contains even numbers of zeros then

(ₓ₂.ₓ₁.ₓ₀) + (ₓ₂.⁻ₓ₁.ₓ₀) +(⁻ₓ₂.ₓ₁.⁻ₓ₀) + (⁻ₓ₂.⁻ₓ₁.ₓ₀) = 1

now suppose that the above equality holds, then at least one of the addends must be 1. if (ₓ₂.ₓ₁.ₓ₀) = 1  we have ₓ₂ = ₓ₁ = ₓ₀ = 1

so x contains even numbers of zeros. If ₓ₂.⁻ₓ₁.⁻ₓ₀ = 1 we must have x₂ = ⁻x₁= ⁻x₀ = 1, so x₂ = 1, x₁ = 0, x₀ = 0. So x contains even number of zeros similarly for the other addends.

Therefore we can conclude that the required logic function is

(x₂.x₁.x₀) + (x₂.⁻x₁.⁻x₀) + (⁻x₂.x₁.⁻x₀) + (⁻x₂.⁻x₁.x₀)

x interpreted as and unsigned integer is less that 4

using the properties of the binary base, we know that x < 4 if and only if x₂ = 0. So x < 4 if and only ⁻x₂ = 1, thus the required logic function is ⁻x₂

x interpreted as a signed integer is negative

using the definition of two complement it is easy to see that x is negative if and only if x₂=1, so therefore the required logic function is x₂.

Note ⁻x is the same as [tex]\frac{}{x}[/tex]