Q:

Create a truth table of the function PRIME(A,B,C,D) where A,B,C,D are the bits of a 4-bit number. A is the highest significant bit and D is the least significant.

Accepted Solution

A:
Answer:The output is 1 for:[tex]1_{10} = (0001)_{2}[/tex][tex]2_{10} = (0010)_{2}[/tex][tex]3_{10} = (0011)_{2}[/tex][tex]5_{10} = (0101)_{2}[/tex][tex]7_{10} = (0111)_{2}[/tex][tex]11_{10} = (1011)_{2}[/tex][tex]13_{10} = (1101)_{2}[/tex]Step-by-step explanation:The first step is creating the truth table, from the most significant bit to the least significant. Then, each value is converted to decimal, like these two examples:[tex](1111)_{2} = 1*2^{0} + 1*2^{1} + 1*2^{2} + 1*2^{3} = 15[/tex][tex](1110)_{2} = 0*2^{0} + 1*2^{1} + 1*2^{2} + 1*2^{3} = 14[/tex]After the conversion, if the decimal equivalent of the 4-bit number is prime, the output is 1.So, the output is 1 for 1,2,3,5,7,11,13SoA - B - C - D - Decimal - Output0 - 0 - 0 - 0 -       0       -    00 - 0 - 0 - 1  -        1       -     10 - 0 - 1 - 0 -         2      -     10 - 0 - 1 - 1 -          3      -     10 - 1 - 0 - 0 -         4      -    00 - 1 - 0 - 1 -          5      -     10 - 1 - 1 - 0 -          6      -    00 - 1 - 1 - 1  -          7      -     11 - 0 - 0 - 0 -         8     -      01 - 0 - 0 - 1 -          9     -      01 - 0 - 1 - 0 -          10    -      01 - 0 - 1 - 1  -          11     -      11 - 1 - 0 - 0 -          12    -      0 1 - 1 - 0 - 1 -           13    -       11 - 1 - 1 - 0 -           14   -        01 - 1 - 1 - 1 -            15   -        0