I am to implement an 8-to-1 multiplexer using the variables m(1,3,5,6,8,13). The function is:
F(A,B,C,D) = A′B′C′D + A′B′CD + A′BC′D + A′BCD′ + AB′C′D′ + ABC′D
I feel I have a basic idea of how multiplexers work, however I'm not entirely sure what to do with the numbers given. I created a truth table with ABCD and plugged it into the function. Then I created the multiplexer based upon the output. (Which I got to be: D', D', D', D, D, 0, D', 0) The only thing I haven't done, and I can't figure out how to do, is the variables. How do they relate to the function and multiplexer?
A multiplexer works as a switch. It selects one of the available inputs I and based on the given address bits S sends the selected input's value on the output Z.
For example:
–––––––––––
| MUX | +-------++-----+-----++-----+
| | | index || a_1 | a_0 || f |
D_0 –––| I_0 | |---------------------------|
D_1 –––| I_1 Z |––– f | 0 || 0 | 0 || D_0 |
D_2 –––| I_2 | | 1 || 0 | 1 || D_1 |
D_3 –––| I_3 | | 2 || 1 | 0 || D_2 |
| | | 3 || 1 | 1 || D_3 |
| S | +-------++-----+-----++-----+
–––––––––––
| |
a_1 a_0
In the example the output function is defined:
f = ¬a_1⋅¬a_0⋅D_0 + ¬a_1⋅a_0⋅D_1 + a_1⋅¬a_0⋅D_2 + a_1⋅a_0⋅D_3
In your case, the output is described by the given function of four variables and the multiplexer is supposed to be an 8:1, so there will be three variables used as the address bits (a, b and c) and the fourth (d) as the partitioned off input signal – parameter of the function f(d) representing the output value.
f(a,b,c,d)=¬a⋅¬b⋅¬c⋅d + ¬a⋅¬b⋅c⋅d + ¬a⋅b⋅¬c⋅d + ¬a⋅b⋅c⋅¬d + a⋅¬b⋅¬c⋅¬d + a⋅b⋅¬c⋅d
index || a | b | c | d || f(a,b,c,d) | f(d)
---------------------------------------------
0 || 0 | 0 | 0 | 0 || 0 | d
1 || 0 | 0 | 0 | 1 || 1 | d
2 || 0 | 0 | 1 | 0 || 0 | d
3 || 0 | 0 | 1 | 1 || 1 | d
---------------------------------------------
4 || 0 | 1 | 0 | 0 || 0 | d
5 || 0 | 1 | 0 | 1 || 1 | d
6 || 0 | 1 | 1 | 0 || 1 | ¬d
7 || 0 | 1 | 1 | 1 || 0 | ¬d
---------------------------------------------
8 || 1 | 0 | 0 | 0 || 1 | ¬d
9 || 1 | 0 | 0 | 1 || 0 | ¬d
10 || 1 | 0 | 1 | 0 || 0 | 0
11 || 1 | 0 | 1 | 1 || 0 | 0
---------------------------------------------
12 || 1 | 1 | 0 | 0 || 0 | d
13 || 1 | 1 | 0 | 1 || 1 | d
14 || 1 | 1 | 1 | 0 || 0 | 0
15 || 1 | 1 | 1 | 1 || 0 | 0
The truth table has been reduced to 8 lines by partitioning the input signal d off. Now the number of rows matches the number of multiplexer's inputs.
index || a | b | c || f(d)
-----------------------------
0 || 0 | 0 | 0 || d
1 || 0 | 0 | 1 || d
2 || 0 | 1 | 0 || d
3 || 0 | 1 | 1 || ¬d
-----------------------------
4 || 1 | 0 | 0 || ¬d
5 || 1 | 0 | 1 || 0
6 || 1 | 1 | 0 || d
7 || 1 | 1 | 1 || 0
In the following picture is a graphical representation of the multiplex.
Multiplexer (MUX)
MUX is a data selector
It allows digital information from several sources be routed into one single line for transmission over the line to a destination
A B C D are the sources and Q is the output. a b are the data selectors
Here is the truth table for 4:1 multiplexer
a | b | Q
0 | 0 | A
0 | 1 | B
1 | 0 | C
1 | 1 | D
The output Q is
Q = A+B+C+B
A=a'b' , B = a'b , C=ab' , D= ab
Q = a'b' + a'b + ab' + ab
Related
I need to design Programmable Logic Array (PLA) circuit with given functions. How can I design circuit with POS form functions. Can someone explain that? enter image description here
Below is the design process completed for F, the other two outputs, G and H, can done in a similar fashon.
F Truth Table
A B C D # F G H
0 0 0 0 0 1
0 0 0 1 1 0
0 0 1 0 2 0
0 0 1 1 3 1
0 1 0 0 4 1
0 1 0 1 5 1
0 1 1 0 6 0
0 1 1 1 7 0
1 0 0 0 8 0
1 0 0 1 9 0
1 0 1 0 10 1
1 0 1 1 11 1
1 1 0 0 12 0
1 1 0 1 13 0
1 1 1 0 14 1
1 1 1 1 15 1
F Karnaugh Map:
AB\CD 00 01 11 10
\
----------
00 0 | 1 x 1 | 0
----------
--------
01 | 1 y 1 | 0 0
--------
----------
11 0 0 | 1 1 |
| z |
| |
10 0 0 | 1 1 |
----------
F Sum Of Product Boolean:
(A'B'D)+(A'BC')+(AC)
x y z ==>(for ref):
x=(A'B'D)
y=(A'BC')
z=(AC)
F Logic Circuit:
------- ------
A---NOT---| | ------- | |
| AND |---| | | |
B---NOT---| | | AND | x | |
------- | |--------------| |
D---------------------------| | | |
------- | |
| | F
------- | OR |---
A---NOT---| | ------- ------ | |
| AND |---| | y | | | |
C---NOT---| | | AND |---| | | |
------- | | | | y+z | |
B---------------------------| | | |-----| |
------- | OR | | |
------- | | | |
A---NOT---| | z | | | |
| AND |---------------------| | ------
C---NOT---| | | |
------- | |
------
Suppose I have two matrices MatrixA and MatrixB given as follows (where i is the row number and j is the column number:
MatrixA | MatrixB
i | j | val | i | j | val
---|---|---- | ---|---|----
1 | 1 | 3 | 1 | 1 | 2
1 | 2 | 5 | 1 | 2 | 3
1 | 3 | 9 | 2 | 1 | 7
2 | 1 | 2 | 2 | 2 | -1
2 | 2 | 1 | 3 | 1 | 0
2 | 3 | 3 | 3 | 2 | -4
3 | 1 | 3 |
3 | 2 | -1 |
3 | 3 | 2 |
4 | 1 | 0 |
4 | 2 | 7 |
4 | 3 | 6 |
In a more familiar form, they look like this:
MatrixA = 3 5 9 MatrixB = 2 3
2 1 3 7 -1
-1 2 0 0 -4
7 0 6
I'd like to calculate their product (which is demonstrated in this YouTube video):
Product = 41 -32
11 -7
12 -5
14 -3
In the unpivoted column form I used earlier, this is
i | j | val
---|---|----
1 | 1 | 41
1 | 2 | -32
2 | 1 | 11
2 | 2 | -7
3 | 1 | 12
3 | 2 | -5
4 | 1 | 12
4 | 2 | -3
I'm looking for a general calculation that multiplies any compatible k x n and n x m matrices together as a calculated table.
I think I've got it figured out. If MatrixA is k x n and MatrixB is n x m dimensional:
Product =
ADDCOLUMNS(
CROSSJOIN(VALUES(MatrixA[i]), VALUES(MatrixB[j])),
"val",
SUMX(
ADDCOLUMNS(
SELECTCOLUMNS(GENERATESERIES(1, DISTINCTCOUNT(MatrixA[j])), "Index", [Value]),
"A", LOOKUPVALUE(MatrixA[val], MatrixA[i], [i], MatrixA[j], [Index]),
"B", LOOKUPVALUE(MatrixB[val], MatrixB[i], [Index], MatrixB[j], [j])),
[A] * [B]))
The CROSSJOIN creates a new table with columns [i] and [j] which has k x m rows. For each i and j row pair in this cross join table, the value for that cell is computed as the sum product of i row of MatrixA with j column of MatrixB. The GENERATESERIES bit just creates an Index list that has a length of the matching dimension n.
For example, when i = 3 and j = 2, the middle section for the given example is
ADDCOLUMNS(
SELECTCOLUMNS(GENERATESERIES(1, DISTINCTCOUNT(MatrixA[j])), "Index", [Value]),
"A", LOOKUPVALUE(MatrixA[val], MatrixA[i], 3, MatrixA[j], [Index]),
"B", LOOKUPVALUE(MatrixB[val], MatrixB[i], [Index], MatrixB[j], 2))
which generates the table
Index | A | B
------|-----|----
1 | -1 | 3
2 | 2 | -1
3 | 0 | -4
where the [A] column is the 3rd row of MatrixA and the [B] column is the 2nd row of MatrixB.
So my state diagram has seven states (000 to 110), an input B button, and four outputs P, Q, R, and S.
I've made the truth table, which has 16 rows (two of which have Xs). I'm supposed to make 7 K-Maps out of this, S2' S1' S0' P Q R and S. I understand that the input B (0, 1) will be on the column side (or row), but I'm having trouble with the rows. S2 is most significant digit, S0 least.
I've never seen a K-Map with 3 bits (S2/S1/S0) on one side, but I don't know how to represent it in any other way. And if it is three bits, what order do those numbers go in? For two, I know it's 00/01/11/10.
If it's two, which seems like the right idea, then how do you decide between two of the three (S2/S1/S0)? Does the input B side get an additional variable next to it (so it would be S2/S1 on the column and B/S0 on the rows?). How do you decide which of the S2/S1/S0 is put on the other side, does it even matter?
One big help for me would be to see an example of a truth table/k-maps for a S2/S1/S0 state diagram. I've only ever seen examples of S1/S0, so no more than 4 states (00/01/10/11).
Thank you for any help you can provide. I'm sorry if my question is confusing. Please let me know if I can be any clearer about my problem.
First there are the answers to your questions:
Number of cells in every Karnaugh map matches the number of all possible input combinations. The way how the map's cells are indexed has to correspond to the truth table. In the following picture are examples of the different sizes of Karnaugh maps, where the visualisation of neighbouring cells is still pretty easy.
As you can see, the point is, that two neighbouring cells differ only in one variable's value, four neighbouring cells differ in two variables' values and so on. That is why you should look for groups that have the size of the 2^n. Map's indexing could look a bit mixed up, but that is for the purpose of displaying all the relationships between each and every row in the truth table.
If you index a K-map, but do not know, which lines are for which variables and in which order they should go in, then you can check it like this:
index 0 = where not a single variable is true
index 1 = where only the least significant bit is true (for a truth table ordered abcd that would be the d)
index 2 = where only the second least significant bit is true (for the same truth table that would be the c)
index 4 = where only the third least significant bit is true (for the same truth table that would be the b)
index 8 = where only the fourth least significant bit is true (for the same truth table that would be the a)
As for an example: Here you can see a state diagram of a 01364 sequence generator implemented as a Moore machine. All edges of the machine are labelled by an input value of a reset button.
The machine's desired behaviour and the output values matching the states can be described by this transition table:
state || output (decimal) | reset || next state
-------------------------------------------------
S_0 || 0 | 0 || S_1
|| | 1 || S_0
-------------------------------------------------
S_1 || 1 | 0 || S_2
|| | 1 || S_0
-------------------------------------------------
S_2 || 3 | 0 || S_3
|| | 1 || S_0
-------------------------------------------------
S_3 || 6 | 0 || S_4
|| | 1 || S_0
-------------------------------------------------
S_4 || 4 | 0 || S_0
|| | 1 || S_0
After encoding the states' representation to match the decimal outputs in binary (q_2, q_1 and q_0; d_2, d_1 and d_0), the transition table looks like this:
state || q_2 | q_1 | q_0 | reset || d_2 | d_1 | d_0 || next state
-------------------------------------------------------------------
S_0 || 0 | 0 | 0 | 0 || 0 | 0 | 1 || S_1
|| | | | 1 || 0 | 0 | 0 || S_0
-------------------------------------------------------------------
S_1 || 0 | 0 | 1 | 0 || 0 | 1 | 1 || S_2
|| | | | 1 || 0 | 0 | 0 || S_0
-------------------------------------------------------------------
S_2 || 0 | 1 | 1 | 0 || 1 | 1 | 0 || S_3
|| | | | 1 || 0 | 0 | 0 || S_0
-------------------------------------------------------------------
S_3 || 1 | 1 | 0 | 0 || 1 | 0 | 0 || S_4
|| | | | 1 || 0 | 0 | 0 || S_0
-------------------------------------------------------------------
S_4 || 1 | 0 | 0 | 0 || 0 | 0 | 0 || S_0
|| | | | 1 || 0 | 0 | 0 || S_0
It is useful to study the transition table for every possible combination of inputs, because there are some 'do not care' (x) output values (for the states, that are not present in the sequence), which can be used for minimisation by Karnaugh maps.
index | state || q_2 | q_1 | q_0 | reset || d_2 | d_1 | d_0 || next state
---------------------------------------------------------------------------
0 | S_0 || 0 | 0 | 0 | 0 || 0 | 0 | 1 || S_1
1 | S_0 || 0 | 0 | 0 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
2 | S_1 || 0 | 0 | 1 | 0 || 0 | 1 | 1 || S_2
3 | S_1 || 0 | 0 | 1 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
4 | - || 0 | 1 | 0 | 0 || x | x | x || -
5 | - || 0 | 1 | 0 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
6 | S_2 || 0 | 1 | 1 | 0 || 1 | 1 | 0 || S_3
7 | S_2 || 0 | 1 | 1 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
8 | S_4 || 1 | 0 | 0 | 0 || 0 | 0 | 0 || S_0
9 | S_4 || 1 | 0 | 0 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
10 | - || 1 | 0 | 1 | 0 || x | x | x || -
11 | - || 1 | 0 | 1 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
12 | S_3 || 1 | 1 | 0 | 0 || 1 | 0 | 0 || S_4
13 | S_3 || 1 | 1 | 0 | 1 || 0 | 0 | 0 || S_0
---------------------------------------------------------------------------
14 | - || 1 | 1 | 1 | 0 || x | x | x || -
15 | - || 1 | 1 | 1 | 1 || 0 | 0 | 0 || S_0
Finally you can see, that the functions defining the d_2, d_1 and d_0 (that is the binary encoded state/output matching the number in the 01364 sequence) can be simply marked out in the following K-maps.
f(d_2) = q_1 ⋅ ¬(reset)
f(d_1) = q_0 ⋅ ¬(reset)
f(d_0) = ¬(q_2) ⋅ ¬(q_1) ⋅ ¬(reset)
(All images were generated using latex.)
let say i have this data on my table
select * from user.weekly_job;
got :
Staff | JobType
A | 1
A | 3
A | 5
A | 2
A | 3
B | 3
B | 5
B | 2
B | 2
but i need all data from staff which contained the occurence of each job type like this :
Staff | 1 | 2 | 3 | 4 | 5
A | 1 | 1 | 2 | 0 | 1
B | 0 | 2 | 1 | 0 | 1
how to do this with oracle query?
If you have a fixed count of JobType values:
select STAFF,
SUM(CASE WHEN JobType=1 THEN 1 ELSE 0 END) as "1",
SUM(CASE WHEN JobType=2 THEN 1 ELSE 0 END) as "2",
SUM(CASE WHEN JobType=3 THEN 1 ELSE 0 END) as "3",
SUM(CASE WHEN JobType=4 THEN 1 ELSE 0 END) as "4",
SUM(CASE WHEN JobType=5 THEN 1 ELSE 0 END) as "5"
FROM t
GROUP BY STAFF
SQLFiddle demo
I have seen a different style of Karnaugh Map for logic design. This is the style they used:
Anyone knows how this K-Map done? How to comprehend with this kind of map? Or how they derived from that equation from that map. The map is quite different from the common map like this:
The maps relate to each other this way, the only difference is the cells' (terms') indexes corresponding to the variables or the order of the variables.
The exclamation mark is only an alternative to the negation of a variable. !A is the same as ¬A, also sometimes noted A'.
!A A A !A ↓CD\AB → 00 01 11 10
+----+----+----+----+ +----+----+----+----+
!B | 1 | 0 | 1 | 0 | !D 00 | 1 | 1 | 1 | 0 |
+----+----+----+----+ +----+----+----+----+
B | 1 | 1 | 1 | 1 | !D ~ 01 | 1 | x | x | 1 |
+----+----+----+----+ +----+----+----+----+
B | x | x | x | x | D 11 | x | x | x | x |
+----+----+----+----+ +----+----+----+----+
!B | 1 | 1 | x | x | D 10 | 0 | 1 | 1 | 1 |
+----+----+----+----+ +----+----+----+----+
!C !C C C
If you are unsure, of the indexes in the given K-map, you can always check that by writing the corresponding truth-table.
For example the output value of the first cell in the "strange" K-map is equal to 1 if !A·!B·!C·!D (all variables in its negation), that corresponds with the first line of the truth-table, so the index is 0. And so on.
index | A B C D | y
=======+=========+===
0 | 0 0 0 0 | 1
1 | 0 0 0 1 | 1
2 | 0 0 1 0 | 0
3 | 0 0 1 1 | x ~ 'do not care' state/output
-------+---------+---
4 | 0 1 0 0 | 1
5 | 0 1 0 1 | x
6 | 0 1 1 0 | 1
7 | 0 1 1 1 | x
-------+---------+---
8 | 1 0 0 0 | 0
9 | 1 0 0 1 | 1
10 | 1 0 1 0 | 1
11 | 1 0 1 1 | x
-------+---------+---
12 | 1 1 0 0 | 1
13 | 1 1 0 1 | x
14 | 1 1 1 0 | 1
15 | 1 1 1 1 | x
You can use the map the same way you would use the "normal" K-map to find the implicants (groups), because all K-maps indexing needs to conform to the Gray's code.
You can see the simplified boolean expression is the same in both styles of these K-maps:
f(A,B,C,D) = !A·!C + A·C + B + D = ¬A·¬C + A·C + B + D
!A·!C is marked red,
A·C blue,
B orange
and D green.
The K-maps were generated using latex's \karnaughmap command and tikz library.
it's the same in principle just the rows and columns (or the variables) are in a different order
The red labels are for when the variable is true, the blue for when it's false
It's actually the same map, but instead of A they have C and instead of B they have A and instead of C they have D and instead of D they have B