集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 7190|回复: 11

究竟错在哪里!!!!!!!!!!!!!!!!!!!!!!!!

[复制链接]
Gevyaa 发表于 2010-8-2 16:50:16 | 显示全部楼层 |阅读模式
这是我做的电梯程序的一个部分,不知错在哪
module ji(reset,clk,Oup,Odown,floor,shu);//panding shangsheng haishi xiajiang
input reset,clk,floor[0:7],shu[0:7];
output Oup,Odown;
reg Oup,Odown;
wire floor[0:7],shu[0:7];
integer a,b,i;
always @(reset or posedge clk)
begin
  a=0;b=0;
  for(i=0;i<=7;i=i+1)
  begin
  if(floor[i])
  a=a+2^i;
  if(shu[i])
  b=b+2^i;
  end
if(reset)begin
Oup<=0;
Odown<=0;end
else
begin
   if(b<a)
   begin
   Oup<=0;
   Odown<=1;
   end
   else if(b>a)begin
   Oup<=1;
   Odown<=0;end
   else begin
   Oup<=0;
   Odown<=0;end
   end
  end
  endmodule

Error (10773): Verilog HDL error at Verilog1.v(22): declaring module ports or function arguments with unpacked array types requires SystemVerilog extensions




又一个出现了相同问题
module men(reset,clk,close,open,topen,tclose,Oup,Odown);
input reset,clk,close,open,Oup,Odown;
output tclose,topen;
reg tclose,topen;
always @(reset or posedge clk)
begin
if(reset)begin
tclose<=1;
topen<=0;
end
else begin
  if((Oup==1)||(Odown==1)) begin
     tclose<=1;
     topen<=0;
     end
  else if((close==1)&&(open==0)) begin
      tclose<=1;
      topen<=0;
      end
      else if((close==0)&&(open==1)) begin
        tclose<=0;
        topen<=1;
        end
        else
        begin
          tclose<=0;
          topen<=1;
          end
         
end
end
endmodule


Error (10773): Verilog HDL error at Verilog1.v(22): declaring module ports or function arguments with unpacked array types requires SystemVerilog extensions
zhouliang 发表于 2010-8-3 10:38:10 | 显示全部楼层
第一个程序改成:
module lift(reset,clk,Oup,Odown,floor,shu);//panding shangsheng haishi xiajiang
input reset,clk;
input[0:7] floor,shu;
output Oup,Odown;
reg Oup,Odown;
integer a,b,i;
always @(posedge reset or posedge clk)
begin
  if(reset)begin
Oup<=0;
Odown<=0;end
else
begin
  a=0;b=0;
  for(i=0;i<=7;i=i+1)
  begin
  if(floor[i])
  a=a+2^i;
  if(shu[i])
  b=b+2^i;
  end
   if(b<a)
   begin
   Oup<=0;
   Odown<=1;
   end
   else if(b>a)begin
   Oup<=1;
   Odown<=0;end
   else begin
   Oup<=0;
   Odown<=0;end
  end
   end
  endmodule


analysis&synthesis通过了,fitter没通过
 楼主| Gevyaa 发表于 2010-8-3 13:37:36 | 显示全部楼层
上两个程序问题解决了,但不知为什么又有一个程序犯了相同错误
module anniu(reset,clk,anniu,recode);
input reset,clk;
input[0:7] anniu;
output[0:7] recode[0:8];
wire reset,clk;
wire[0:7] anniu;
reg[0:7] recode[0:8];
integer i,a,b,c;
always @(reset or clk)
begin
            a=0;b=0;
   if(reset)
     for(i=0;i<=7;i=i+1)
         recode[i]<=0;
         else  begin
             if(anniu[0]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==1)
                     b=1;
                     if(b==0) begin
               recode[a]<=1;a=a+1; end
               end
               else if(anniu[1]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==2)
                     b=1;
                     if(b==0) begin
               recode[a]<=2;a=a+1; end
               end
               else if(anniu[2]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==3)
                     b=1;
                     if(b==0) begin
               recode[a]<=3;a=a+1; end
               end
               else if(anniu[3]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==4)
                     b=1;
                     if(b==0) begin
               recode[a]<=4;a=a+1; end
               end
               else if(anniu[4]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==5)
                     b=1;
                     if(b==0) begin
               recode[a]<=5;a=a+1; end
               end
               else if(anniu[5]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==6)
                     b=1;
                     if(b==0) begin
               recode[a]<=6;a=a+1; end
               end
               else if(anniu[6]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==7)
                     b=1;
                     if(b==0) begin
               recode[a]<=7;a=a+1; end
               end
               else if(anniu[7]) begin
               for(i=0;i<=7;i=i+1)
                  if(recode[i]==8)
                     b=1;
                     if(b==0) begin
               recode[a]<=8;a=a+1; end
               end
               else begin
                  recode[a]<=0;a=a;
                  end
               if(a==7)
                 a=0;
                 
             end   
end
endmodule





Error (10773): Verilog HDL error at anniu.v(4): declaring module ports or function arguments with unpacked array types requires SystemVerilog extensions
zhouliang 发表于 2010-8-4 09:21:18 | 显示全部楼层
我不是说了吗,将recode[0:8]中的[0:8]去掉
 楼主| Gevyaa 发表于 2010-8-4 12:39:52 | 显示全部楼层
我要用到一个二维数组
 楼主| Gevyaa 发表于 2010-8-4 14:23:01 | 显示全部楼层
那memory型如何用?
zhouliang 发表于 2010-8-5 14:03:48 | 显示全部楼层
那你可以写成  output[0:7][0:8] recode;啊
 楼主| Gevyaa 发表于 2010-8-5 16:39:01 | 显示全部楼层
按你的方法做,出现了一个错误Error (10839): Verilog HDL error at dianti.v(25): declaring mulitple packed array dimensions is a SystemVerilog feature
错误位置:reg[0:7][0:8] recode;
 楼主| Gevyaa 发表于 2010-8-5 16:41:18 | 显示全部楼层
按你的方法做,出现了一个错误Error (10839): Verilog HDL error at dianti.v(25): declaring mulitple packed array dimensions is a SystemVerilog feature
错误位置:output[0:7][0:8] recode;
zhouliang 发表于 2010-8-5 19:32:13 | 显示全部楼层
看来涉及到数组需要systemverilog,memory方面的知识,此需专业人士指点,祝你好运
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-5-21 11:53 , Processed in 0.080278 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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