集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1860|回复: 4

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

[复制链接]
pinmingwulang 发表于 2013-7-1 16:25:35 | 显示全部楼层 |阅读模式
  1. always@(posedge sys_clk or negedge  sysrst)
  2.    begin  
  3.         if ((!sysrst)||(!den))
  4.           begin
  5.           slwrs<=0;
  6.           temp<=0;
  7.           end
  8.        else if (temp==0) begin
  9.           slwrs<=0;
  10.           temp<=1;
  11.           end
  12.        else if ((temp==1 )&& (Vsync==0)) begin
  13.           slwrs<=0;
  14.           temp<=1;
  15.           end
  16.        else if ((temp==1) && (Vsync==1)) begin
  17.           slwrs<=0;
  18.           temp<=2;
  19.           end
  20.        else if ((temp==2)&&(Vsync==1)) begin
  21.           slwrs<=0;
  22.           temp<=2;
  23.           end
  24.        else if ((temp==2 )&& (Vsync==0)) begin
  25.           slwrs<=0;
  26.           temp<=3;
  27.           end
  28.        else if (temp==3) begin
  29.           if (flagb==1) begin
  30.              slwrs<=1;
  31.              temp<=3;
  32.              end
  33.           else
  34.              slwrs<=0;
  35.              temp<=3;
  36.             
  37.        end
  38.        else
  39.           ;
  40. end
  41.     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)和在一起写就只是一个使能,不需要negedge  sysrst了。
 楼主| pinmingwulang 发表于 2013-7-2 10:49:36 | 显示全部楼层
至芯兴洪 发表于 2013-7-1 21:24
(!sysrst)||(!den)这种写法不对,sysrst是异步复位,den是清零使能,是需要分开写的,表现出两个不同信号的 ...

非常感谢,我对verilog语言不是很熟,这个程序是从vhdl程序转换过来的,在vhdl中的写法就是这样的,请问如果要改的话,应该怎么改呢?
好像只写
  1. if(!den)
复制代码
也会出现这样的错误。
至芯兴洪 发表于 2013-7-2 21:53:30 | 显示全部楼层
异步复位
always@(posedge sys_clk or negedge  sysrst)
   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
异步复位
always@(posedge sys_clk or negedge  sysrst)
   begin  

没有出现错误,非常感谢
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-6-28 03:19 , Processed in 0.063230 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表