technical interview Q & A for high-tech professionals
Interview Questions
Electronics Hardware
Computer Software
Quick Thinking Tests
General questions
Phone screening questions
Submit your Q or A

Technical articles
Technical discussion
Resume and interview
How to get a job in Silicon Valley
How much are you worth on market?
Do you need an agent?

Break point
Written Exam
Logic Tests
Professional Test
Tomato company
Cup of coffee
How stock market works
Engineering jokes

About Hitequest
About Hitequest
Home page


=Electronics Hardware Questions=


Q: What is the difference between a flip-flop and a latch?

	 _______                   	   _______
   D	|	|   Q		     D    |	  |   Q
   -----|	|----		     -----|	  |----
  clock |	|		   enable |	  |
   ----->	|   _		     -----|	  |   _
   	|	|   Q		   	  |	  |   Q
   	|	|----		   	  |	  |----
	|_______|		   	  |_______|

The example shows D-latch and D-FF.
The simplest form  of data storage is latch.
It's output responds immediately
to changes at the input and the input state will be 
remembered, or "latched" onto. 
While "enable" input is active the input of the latch is transparent
to the output, once "enable" is deactivated the output remains locked.
Flip-flops use clock as a control input. 
The transition on output Q occurs only at the edge
of the clock pulse. Input data must present T_setup time before the
clock edge and remain T_hold time after.

* RESET input, while it is not shown, is present in most FF.

module DFF (Q,_Q,D,clk,rst);
output Q,_Q;
input D,clk,rst;
reg Q,_Q;

always @(posedge clk or posedge rst)
  if (rst) Q  <= 0;
  else     Q  <= D;  
  _Q <= !Q;


module DLatch (Q,_Q,D,en,rst);
output Q,_Q;
input D,en,rst;
reg Q,_Q;

always @(en or D or posedge rst)
  if (rst)     Q  <= 0;
  else if (en) Q  <= D;  
  _Q <= !Q;