1
votes

When I want to make an elevator-like programme project, whatever I do to edit my module it always says:

Assignment under multiple single edges is not supported for synthesis

Some variables:

tar_floor : user input, target floor;
cur_floor : current floor located;
clk_cnt : variable added 1 each time to count.

always @(posedge clk or posedge clr) begin

if(clr)
begin
    cur_floor = 0; //if clear button pressed,clear all statement
    tar_floor=0;
    upordown=0; 
    clk_cnt=0;
    ryg=3'b001; //green
    rgb=3'b111;
end

if(tar_floor==cur_floor) //nothing to do
begin
    clk_cnt=0;
    upordown=0; 
    clk_cnt=0;
    ryg=3'b001; //green
    rgb=3'b111;
end
else 
begin//when up or down  
    clk_cnt = clk_cnt +1;
    if (tar_floor>cur_floor)
    begin
        ryg=3'b100;//red
        if (clk_cnt[27])
            rgb=rgb+1;
        if(clk_cnt[28])
        begin
            if (cur_floor<=6)
                cur_floor=cur_floor+1;
        end
    end

    if (tar_floor<cur_floor)
    begin
        ryg=3'b010;//yello
        if (clk_cnt[27])
            rgb=rgb+1;
        if(clk_cnt[28])
        begin
            if (cur_floor>=1)
                cur_floor=cur_floor-1;
        end
    end
end
end

wire tmp=cur_floor;
mytask_sub A1(.a_to_g(a_to_g),.cur_floor(tmp));//call show sub modudle

endmodule

At clk_cnt = clk_cnt +1;, it says:

Assignment under multiple single edges is not supported for synthesis

Please help me solve this error.

1

1 Answers

3
votes

Synthesis requires you to structure your code like this:

always @(posedge clk or posedge clr)
    if(clr)
       // asynchronous statement when clr rises 
       // and any clk rising edge while clr is true
    else
       // synchronous statement when clk rises and clr is false

You are missing the else clause