pinmingwulang 发表于 2013-7-1 16:25:35

cannot match operand(s) in the condition to the corresponding edges 问题的解决

always@(posedge sys_clk or negedgesysrst)
   begin
      if ((!sysrst)||(!den))
          begin
          slwrs<=0;
          temp<=0;
          end
       else if (temp==0) begin
          slwrs<=0;
          temp<=1;
          end
       else if ((temp==1 )&& (Vsync==0)) begin
          slwrs<=0;
          temp<=1;
          end
       else if ((temp==1) && (Vsync==1)) begin
          slwrs<=0;
          temp<=2;
          end
       else if ((temp==2)&&(Vsync==1)) begin
          slwrs<=0;
          temp<=2;
          end
       else if ((temp==2 )&& (Vsync==0)) begin
          slwrs<=0;
          temp<=3;
          end
       else if (temp==3) begin
          if (flagb==1) begin
             slwrs<=1;
             temp<=3;
             end
          else
             slwrs<=0;
             temp<=3;
            
       end
       else
          ;
end
    endmodule代码如上,    在 if ((!sysrst)||(!den))出现错误,错误信息为 Error (10200): Verilog HDL Conditional Statement error at senddata.v(30): cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct。跪求大神帮忙!!!!!!

至芯兴洪 发表于 2013-7-1 21:24:48

(!sysrst)||(!den)这种写法不对,sysrst是异步复位,den是清零使能,是需要分开写的,表现出两个不同信号的不同作用。(!sysrst)||(!den)和在一起写就只是一个使能,不需要negedgesysrst了。

pinmingwulang 发表于 2013-7-2 10:49:36

至芯兴洪 发表于 2013-7-1 21:24 static/image/common/back.gif
(!sysrst)||(!den)这种写法不对,sysrst是异步复位,den是清零使能,是需要分开写的,表现出两个不同信号的 ...

非常感谢,我对verilog语言不是很熟,这个程序是从vhdl程序转换过来的,在vhdl中的写法就是这样的,请问如果要改的话,应该怎么改呢?
好像只写if(!den)也会出现这样的错误。

至芯兴洪 发表于 2013-7-2 21:53:30

异步复位
always@(posedge sys_clk or negedgesysrst)
   begin
      if (!sysrst)
          begin
          slwrs<=0;
          temp<=0;
          end
       else if (~den)
       begin
         slwrs<=0;
          temp<=0;
         end
      else
   begin
       if (temp==0)
      ......................................................
    end
end
同步复位
always@(posedge sys_clk )
   begin
      if (!sysrst)
          begin
          slwrs<=0;
          temp<=0;
          end
       else if (~den)
       begin
         slwrs<=0;
          temp<=0;
         end
      else
   begin
       if (temp==0)
      ......................................................
    end
end

你看看是否可行

pinmingwulang 发表于 2013-7-5 11:28:07

至芯兴洪 发表于 2013-7-2 21:53 static/image/common/back.gif
异步复位
always@(posedge sys_clk or negedgesysrst)
   begin


没有出现错误,非常感谢:D
页: [1]
查看完整版本: cannot match operand(s) in the condition to the corresponding edges 问题的解决