Finding the result after N clocks states - digital

This is the diagram of 5 D flip-flops. At first, EDCBA = 00000, after 6 clock beats, EDCBA = ?
I drew the timeline values of E, D,C,B,A but got the wrong result. My teacher told me that the answer is EDCBA = 01111. but I got 11110. Please help me find the way to solve this exercise

After the first cycle where not A = 1 is switched to E: 10000
After the second cycle where not A = 1 is switched to E, and E is switched to D: 11000
After the third cycle where not A = 1 is switched to E, and E is switched to D, and D is switched to C: 11100
After the forth cycle where not A = 1 is switched to E, and E is switched to D, D is switched to C, and C is switched to B: 11110
After the fifth cycle where not A = 1 is switched to E, and E is switched to D, D is switched to C, C is switched to B, and B is switched to A: 11111
After the sixth cycle where not A = 0 is switched to E, and E is switched to D, D is switched to C, C is switched to B, and B is switched to A: 11111

Related

GoogleQuery returning output in one row only

I'm using query but the output is weird. I just copied this sheet and the original file is working properly. As you can see in the output are all stuck in one row but it should be a three or more row base on the reference. The code is literally copy paste, no as in the whole sheet is made from "Make a copy" function of googlesheet then i just renamed the file. Is there any fix to this? Thank you!
my code : =QUERY(Main!A:AO, "Select A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, AN, AO where J ='A'")
Use the (optional) headers argument: use 1 if you want a header row, 0 if not.
See if this works
=QUERY(Main!A:AO, "Select A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, AN, AO where J ='A'", 1)
or you can leave it empty (after comma) which equals to have 0 there
=QUERY(Main!A:AO, "select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,AN,AO where J ='A'", )

How can I solve equations with F#?

How can I solve equations with F#?
For example (just a loose syntax I made up):
define a, b where (a + b = 5) and (a - b = 1)
define c where (c = c / 2)
print a, b, c
I want it to output 3, 2 and 0.
Also, can it do things like define d where d = c + a using solutions from previously defined equations?

Dependency Preserving in decomposition of tables

I am confused with dependency preserving property of database relations (tables). Do we have to look at initial FD set or what else? I tried to solve some problems on this subject. The questions before this one all feed my initial estimation, which is 'look at the given FD set. If you don't lose any of them in your new relation set, then this is dependency preserving'.
But when I come to this question I am confused.
Consider the relation R = (A B C D E F G H) and the following FD set:
FD1 E -› D
FD2 B, E -› C G
FD3 D, G -› E
FD4 C -› A B
FD5 E, G -› C
FD6 A, E -› B D
FD7 C, E, D -› G
FD8 A, G -› E
These are the given relations
R1 (E F G H)
R2 (A B E G)
R3 (C D E G)
R4 (A B C)
Answer says that this decomposition is dependency preserving. According to my estimation we lose FD2 so, this must not be dependency preserving.
I need an expert to clarify this concept for me.
This question was a part of homework questions. I wasn't sure if I am thinking right when I do the homework.
In my answer I wrote:
This decomposition is not dependency preserving because in this decomposition we loose the FD DF--> BC .
And my database teacher accepted this answer as an right answer I wanted to clearify the subject here also.
Ferda
The decomposition is dependency preserving as FD2 BE->CG can be achieved by relations R2(BE->G) and R3(EG->C).
Closure of BE gives CG.

ASIC design - combinational logic

I had an interview a few days back and this was the question they asked me in one of the rounds:
A mux which gives output a when select line is 1 and b when it is 0. The output is represented as C. This has to be implemented with and and not gates only.
I got it almost but was not sure how the output is received finally in combinational ckt. It is a very simple thing I missed here. I gave the select line to an and gate and input a and the select line and the input b through a not gate to another and gate so I got the output as A and B but how can we have one output alone? either a or b?
C = (A and not(S)) or (B and S)
= not(not(A and not(S)) and not(B and S))
A input 1,
B input 2,
S input select line,
C output,
C = (A & S) | (A & ~S);
Its simple bro!

Match 2 columns, but bring along all associated rows from the second column

What is the easiest way for Example1 to be converted to Example2 (I would be doing this with much longer lists)? Column C and D shall be associated to Col B for the output of Example2. This is not just to make Col B replicate Col A, although that is part of the solution. Thank you in advance!
Example1:
Col A Col B Col C Col D
a e d c
l l o a
e x g t
x a s s
Example2:
Col A Col B Col C Col D
a a s s
l l o a
e e d c
x x g t
It is not totally clear what you want to achieve and what the data qualities are, so a few assumptions:
all items in Col A are also in Col B
items in Col A are unique
Consider the following screenshot. Column A has been copied into column F. The formula in G1 is
=INDEX(B$1:B$4,MATCH($F1,$B$1:$B$4,0))
Copy the formula across to I1 and then copy G1 to I1 down.
If that does not do what you need, please edit your question, add a better data sample and more explanation.

Resources