Gevyaa 发表于 2010-8-2 16:50:16

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

这是我做的电梯程序的一个部分,不知错在哪
module ji(reset,clk,Oup,Odown,floor,shu);//panding shangsheng haishi xiajiang
input reset,clk,floor,shu;
output Oup,Odown;
reg Oup,Odown;
wire floor,shu;
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)
a=a+2^i;
if(shu)
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 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)
a=a+2^i;
if(shu)
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 anniu;
output recode;
wire reset,clk;
wire anniu;
reg recode;
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<=0;
         elsebegin
             if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==1)
                     b=1;
                     if(b==0) begin
               recode<=1;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==2)
                     b=1;
                     if(b==0) begin
               recode<=2;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==3)
                     b=1;
                     if(b==0) begin
               recode<=3;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==4)
                     b=1;
                     if(b==0) begin
               recode<=4;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==5)
                     b=1;
                     if(b==0) begin
               recode<=5;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==6)
                     b=1;
                     if(b==0) begin
               recode<=6;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==7)
                     b=1;
                     if(b==0) begin
               recode<=7;a=a+1; end
               end
               else if(anniu) begin
               for(i=0;i<=7;i=i+1)
                  if(recode==8)
                     b=1;
                     if(b==0) begin
               recode<=8;a=a+1; end
               end
               else begin
                  recode<=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中的去掉

Gevyaa 发表于 2010-8-4 12:39:52

我要用到一个二维数组

Gevyaa 发表于 2010-8-4 14:23:01

那memory型如何用?

zhouliang 发表于 2010-8-5 14:03:48

那你可以写成output 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 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 recode;

zhouliang 发表于 2010-8-5 19:32:13

看来涉及到数组需要systemverilog,memory方面的知识,此需专业人士指点,祝你好运
页: [1] 2
查看完整版本: 究竟错在哪里!!!!!!!!!!!!!!!!!!!!!!!!