cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct

Status
Not open for further replies.

chyavanphadke

Newbie
Joined
Oct 17, 2020
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
30
I wrote a Verilog code for DE-10 Lite in Quartus Prime, I am getting the error it says "cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct". Can you please help?

Code:
module DemoBlink (

    input clk, rst,

    output [9:0] LED

);


reg [24:0] counter;

reg [9:0] temp;


initial begin

    temp <= 1'b0;

    counter <= 0;

end


always @ (posedge clk or posedge rst) begin

  

    if (!rst) begin                                                          // Error is in this line

        temp <= 1'b0;

        counter <= 0;

    end else begin

        counter <= counter + 1;

        if (counter == 8'd25000000) begin

            temp = ~temp;

        end

    end

end



assign LED[0] = temp;


endmodule
 
Last edited by a moderator:

verilog synthesis uses the sensitivity list and code to determine clock vs reset. This avoids the need for an "if rising_edge(clk) then" line.

so in this case, you have "posedge rst" which doesn't match the "if (!rst) begin".
 
verilog synthesis uses the sensitivity list and code to determine clock vs reset. This avoids the need for an "if rising_edge(clk) then" line.

so in this case, you have "posedge rst" which doesn't match the "if (!rst) begin".
@@vGoodtimes, thanks for the explanation. I understood and did accordingly it worked.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…