Konstruktion av Vippor och Latchar Datorarkitektur 1 (1DT038) Fördjupning November 2009 karl.marklund@it.uu.se
Om du läser IT (1DT038) är detta material överkurs du bör dock redan vara bekant med hur det går till att konstruera minnesceller (vippor och latchar) mha grindar från kursen i elkretsteori.
A simple cominational circuit Q = 1 when at least one of A and B equals 1 Q = 1 when both A and B equal 0 A B Q Q 0 0 0 1 0 1 1 0 1 0 1 0 Q = 0 when at least one of A and B equals 1 1 1 1 0 Q = 0 when at least one of A or B equal 1
When Q 0 is true, the bottom NOR-gate actcs like an inverter (no matter the value of S) and Q 1 becomes false... What happens if we change to true here?... which becomes the input to the top NOR-gate Q 1 = true = Q 0 (Q is unchanged) A pair of cross-coupled NOR-gates. Due to the feedback loop, this is no longer a cominational circuit - it s an sequential circuit.
What happens if we change back to false again? Asserting R will give Q = false...... which becomes the input to the bottom NORgate Q = true... which becomes the input to the upper NORgate Q = false
Deasserting R won t change anything, Q remains false no matter the value of R. What happens if we change to true here? When both R and S are deasserted, the cross-coupled NOR-gats remembers the values of Q and Q
What happens if we change S back to false?... which becomes the input to the top NOR-gate Q = true Asserting S gives Q = false...
Again, when both R and S are deasserted, the crosscoupled NOR-gats remembers the values of Q and Q Deasserting S won t change anything...
R S Q n+1 Q n+1 0 0 Q n Q n 0 1 1 0 1 0 0 1 1 1?? Logisim DEMO
R S Q n+1 Q n+1 both zero 0 0 Q n Q n 0 1 1 0 1 0 0 1 1 1 0 0 Overriding the memory feedback action. What happens if both R and S drops (voltage change is not instanteneous) to zero simultaneously?
R drops first...... resulting in Q = 1 S drops first...... resulting in Q = 0
An example of sequential logic: The output depends not only on the present input but also on the history of the input. R S Q n+1 Q n+1 0 0 Q n Q n 0 1 1 0 1 0 0 1 1 1 Restricted If both R and S drops to zero at the same time metastability
R S Q Q R S Q n+1 Q n+1 0 0 Q n Q n 0 1 1 0 1 0 0 1 1 1 Restricted A SR Latch (Set and Reset Latch) can store 1-bit of data.
SR Latch Setting C to 1 will only reset Q if D is 0 at the same time. D Latch D can only function as Set when C (clock/ enable) is true.
C D Q n+1 Q n+1 Comment 0 X Q n Q n No Change 1 0 0 1 Reset 1 1 1 0 Set
C Q A D Latch (Data Latch) can store 1-bit of data. D Q C D Q n+1 Q n+1 Comment 0 X Q n Q n No Change 1 0 0 1 Reset 1 1 1 0 Set
R S Q Q A latch is a sequential device that watches all of its inputs continuously and changes its outputs at any time. SR Latch R S Q n+1 Q n+1 0 0 Q n Q n 0 1 1 0 1 0 0 1 1 1 Restricted A flip-flop is a sequential device that samples its inputs and changes its outputs only at times determined by a clocking signal. C D Q Q D Latch / Flip-Flop C D Q n+1 Q n+1 Comment 0 X Q n Q n No Change 1 0 0 1 Reset 1 1 1 0 Set
C D Q Q D Latch C D Q n+1 Q n+1 Comment 0 X Q n Q n No Change 1 0 0 1 Reset 1 1 1 0 Set D C Q When the latch is open (C=1) Q follows D (a transparent latch)
Changing C back to zero The output Q of the master latch follows input D when clock is high (which closes the slave latch).
Changing C back to zero opens the slave latch taking the Q output of the master latch as D input.
D C Q Output Q only changes on falling clock edges (non transparent).
C D Q n+1 Q n+1 Comment non-falling X Q n Q n No Change 1 1 0 Set 0 0 1 Reset
The triangle indicates an edge-trigged latch a flip flop. C Q A D Flip-Flop The inversion bubble on the clock input indicate a falling-edge triggered flip-flop D Q C D Q n+1 Q n+1 Comment non-falling X Q n Q n No Change 1 1 0 Set 0 0 1 Reset
Logisim DEMO 8 bit D flip-flop register
Clock 8 D Flip-Flops used to form a 8 bit register. 0001 0011 2 A falling edge trigged D flip-flop C Q D Q
Clock goes to high... output remains unchanged. 0001 0011 2
Clock falls back to low... output equals input. 0001 0011 2
Changing input... does not affect ouput. 1000 1100 2