Forum Discussion

ElShang's avatar
ElShang
Icon for New Contributor rankNew Contributor
12 hours ago

Quartus 10200 Error and "always" inference rules

Hello to the community.

Though in general I understand what is wrong and how to fix it, I'm still willing to know the root cause. So I hope someone will give some clues.

I'm using the infamous "Digital Design and Computer Architecture" book as a guide and there is Exercise 4.22 with the following Verilog code:

module fsm2 (input clk, reset, input a, b,
                        output y);
    reg [1:0] state, nextstate;
    
    parameter S0 = 2’b00;
    parameter S1 = 2’b01;
    parameter S2 = 2’b10;
    parameter S3 = 2’b11;

    always @ (posedge clk, posedge reset)
        if (reset) state <= S0;
        else       state <= nextstate;

    always @ (*)
        case (state)
            S0: if (a ^ b) nextstate = S1;
                else       nextstate = S0;
            S1: if (a & b) nextstate = S2;
                else       nextstate = S0;
            S2: if (a | b) nextstate = S3;
                else       nextstate = S0;
            S3: if (a | b) nextstate = S3;
                else       nextstate = S0;
        endcase

    assign y = ( state == S1 ) | ( state == S2 );
endmodule

The point of my interest are lines 10 to 12:

always @ (posedge clk, posedge reset)
    if (reset) state <= S0;
    else       state <= nextstate;

More specifically, an error 10200 triggered by changing the "posedge reset" to "negedge reset" . But if change the if statement to this:

always @(posedge clk, negedge reset)
    if (!reset) state <= S0;
    else        state <= nextstate;

then it builds fine.

Surprisingly, Questa does not care about this and attempts to simulate it in both cases.

With my programmer's bias, both statements seem completely fine. Yes, they look somewhat weird in the "error-issuing" form but are still executable.

=====

So my question is, are there any resources where the peculiarities of the always statements are described? I know that synthesizer somehow infers the clock and reset signals from the sensitivity list, but I haven't seen any formal description of it.

Any suggestions are welcomed.

1 Reply

  • ai_responder's avatar
    ai_responder
    Icon for Community Manager rankCommunity Manager

    The root cause is a strict pattern-matching rule the Quartus synthesizer applies when inferring asynchronous DFF control signals. The edge keyword in the sensitivity list and the polarity of the if condition must be consistent with each other.
    Specifically, this error occurs when trying to model a DFF with multiple control signals because the Quartus software only infers a secondary signal from a single secondary signal in an IF condition. Error: Verilog HDL Conditional Statement error at : If-Else Statement does not match any sensitivity list edge The synthesizer pairs the sensitivity-list edge with the if-condition polarity:

    • posedge reset → the if condition must assert on the high level: if (reset)
    • negedge reset → the if condition must assert on the low level: if (!reset)
    When you write always @(posedge clk, negedge reset) if (reset), the edge says "active on falling edge" but the condition says "active when high" — these are contradictory, so error 10200 fires. Questa tolerates this because it simulates behaviorally without having to map to a physical DFF primitive; Quartus synthesis must commit to a specific hardware cell and its polarity pins.
    The workaround is to edit the design to specify only one edge per if condition (e.g., separate if/else-if for each reset signal), or generate the OR of the reset signals outside the always construct. Error: Verilog HDL Conditional Statement error at : If-Else Statement does not match any sensitivity list edge
    For formal coding-style guidance, the Quartus Prime Pro Edition User Guide: Design Recommendations is the primary reference. It documents how the synthesizer infers clocks and asynchronous controls from the sensitivity list, and also highlights the synchronous-reset alternative: when you use synchronous resets, the reset signal is not put in the sensitivity list 3. Recommended Design Practices — Quartus® Prime Pro Edition User Guide — which sidesteps the edge/polarity matching requirement entirely. AN 917 ("Reset Design Techniques for Hyperflex Architecture FPGAs") also covers this conversion explicitly, showing the before (asynchronous) and after (synchronous) pattern:
    Asynchronous: `always @(posedge clk or negedge rstb) begin if (!rstb) control <= 'd0;` 1.4.1.1. Converting to Synchronous Resets — AN 917: Reset Design Techniques for Hyperflex Architecture FPGAs
    Synchronous: `always @(posedge clk) begin if (!rstb) control <= 'd0; else control <= new_value; end` 1. AN 917: Reset Design Techniques for Hyperflex® Architecture FPGAs — AN 917: Reset Design Techniques for Hyperflex Architecture FPGAs
    The bottom line: always keep the edge specifier and if-condition polarity consistent (posedge→active-high check, negedge→active-low check), or switch to a synchronous reset to avoid the constraint altogether.


    Note: To continue using AI Responder, please start your next inquiry with ai_responder

    Disclaimer: AI-generated responses may contain errors or omissions. Please verify technical guidance with official Altera documentation before implementation.

    Thank you very much.