Consider the following RTL code intended for logic synthesis: module rtl_…
Consider the following RTL code intended for logic synthesis: module rtl_circuit ( input wire clk, input wire a, input wire b, input wire c, output reg q1, output reg q2 ); always @(posedge clk) begin q1 <= a & b; if (c) q2 <= q1; else q2 <= b; end endmodule When mapped to a generic standard-cell library containing D-flip-flops, 2-to-1 multiplexers, AND gates, and clock-gating cells, what is the exact hardware topology synthesized for outputs q1 and q2 ?
- q1 is driven by a DFF with an AND gate ($a \ \& \ b$) on its D-input. q2 is driven by a DFF whose D-input is fed by a 2:1 MUX: when $c=1$, the MUX selects the **input** $(a \ \& \ b)$; when $c=0$, it selects $b$.
- q1 is driven by a DFF with an AND gate ($a \ \& \ b$) on its D-input. q2 is driven by a DFF whose D-input is fed by a 2:1 MUX: when $c=1$, the MUX selects the **Q-output** of flip-flop q1 ; when $c=0$, it selects $b$.
- A single flip-flop is inferred for q1 , while q2 is inferred as a combinational transparent latch because c is not in the sensitivity list.
- Two flip-flops are inferred, but because non-blocking assignments were used, q2 bypasses the register stage and connects combinatorially to q1 .
Correct answer
B. q1 is driven by a DFF with an AND gate ($a \ \& \ b$) on its D-input. q2 is driven by a DFF whose D-input is fed by a 2:1 MUX: when $c=1$, the MUX selects the **Q-output** of flip-flop q1 ; when $c=0$, it selects $b$.
Explanation
1. Both q1 and q2 are assigned inside an edge-triggered always @(posedge clk) block. This mandates that both q1 and q2 are registered outputs mapped to D-type flip-flops (no latches can be inferred from an edge-triggered sensitivity list). 2. For q1 : It has no condition; its D-input is directly driven by the output of an AND gate computing $a \cdot b$. 3. For q2 : It is conditionally assigned based on signal c . In RTL, the assignment q2 <= q1; uses the registered state of q1 (the Q-pin output of the q1 register, not its pre-register D-input). 4. The multiplexer driving the D-input of flip-flop q2 has: * Select line $= c$ * Data 1 input (when $c = 1$) connected to the **Q pin of q1** . * Data 0 input (when $c = 0$) connected to signal **$b$**.