HDL & Verification
What circuit does logic synthesis create from the Verilog above?
always @(posedge clk)
q <= d;
- AAn AND gate of d and clk
- BA D flip-flop that captures d on the rising clock edge
- CA latch that passes d whenever clk is 1
Show answer and explanation
Answer: B. A D flip-flop that captures d on the rising clock edge
"always @(posedge clk)" means the assignments inside happen only at the instant of the rising clock edge, and synthesis turns this into an edge-triggered flip-flop. q holds the value d had at the rising edge until the next one. Almost all storage in synchronous circuits is written this way. It must be distinguished from a latch, which responds to clock level rather than edges.
- A. The clock serves as an edge trigger; no AND is built.
- B. Correct. posedge means the rising edge.
- C. It is edge-triggered, so it is not a latch.