2014-12-10 1 views
0

나는 Verilog 코딩의 초보자이므로 모든 도움을받을 수 있습니다.변수 4 비트를 선언했지만 "배열을 색인 할 수 없습니다"오류가 발생합니다. Vivado를 사용하여 NEXYS 4 프로그램하기

내 상위 모듈에서 저는 세 개의 모듈을 호출합니다. 슬로우 클럭은 시계를 볼 수있는 속도로 늦 춥니 다. 카운터는 9로 카운트 한 다음 0으로 재설정합니다. 다른 카운터 모듈은 카운터 모듈에서 생성 된 번호를 표시합니다.

내 오류는 다음과 같습니다 :

[Synth 8-1751] cannot index into non-array count1 
[Synth 8-1751] cannot index into non-array count1 
[Synth 8-1751] cannot index into non-array count1 
[Synth 8-1751] cannot index into non-array count1 

내 코드 :

module Clock(
output [7:0] SSEG_AN, 
output [7:0] SSEG_CA, 
input CLK 
); 

wire [3:0] count; 

slowclock slwclk(CLK,Clk_Slow); 

counterten sec(Clk_Slow,rc,count1); 

displaycounter display(count, SSEG_AN, SSEG_CA, CLK); 

assign count[0]=count1[0]; 
assign count[1]=count1[1]; 
assign count[2]=count1[2]; 
assign count[3]=count1[3]; 
endmodule 

module slowclock (clk,Clk_Slow); 
input clk; 
output reg Clk_Slow = 0; 
reg [31:0] counter_out = 32'h00000000; 

always @(posedge clk) begin 
    counter_out <= counter_out + 32'h00000001; 
    if (counter_out > 32'h02F5E100) begin 
     Clk_Slow <= ~Clk_Slow; 
     counter_out<= 32'h00000000; 
    end 
end 
endmodule 

module counterten(
input clk, 
output reg rc, 
output [3:0] count 
); 

reg [3:0] tmp = 4'b0000; 

always @(posedge clk) begin 
    if (tmp == 9) begin 
     rc = 1; 
     tmp = 4'b0000; 
    end 
    else begin 
     tmp = tmp + 4'b0001; 
     rc = 0; 
    end 
end 

assign count = tmp; 

endmodule 

module displaycounter (count, SSEG_AN, SSEG_CA, CLK); 
output reg [7:0] SSEG_AN; 
output reg [7:0] SSEG_CA; 
input [3:0] count; 
input CLK; 

always @(negedge CLK) begin 
     SSEG_AN = 8'b11111110; 
     case(count) 
      4'b0000: SSEG_CA = 8'b11000000; //0 
      4'b0001: SSEG_CA = 8'b11111001; //1 
      4'b0010: SSEG_CA = 8'b10100100; //2 
      4'b0011: SSEG_CA = 8'b10110000; //3 
      4'b0100: SSEG_CA = 8'b10011001; //4 
      4'b0101: SSEG_CA = 8'b10010010; //5 
      4'b0110: SSEG_CA = 8'b10000010; //6 
      4'b0111: SSEG_CA = 8'b11111000; //7 
      4'b1000: SSEG_CA = 8'b10000000; //8 
      4'b1001: SSEG_CA = 8'b10010000; //9 
      default: SSEG_CA = 8'b11111111; //default all off 
     endcase 
end 

endmodule 

답변

1

당신은 wire [3:0] count;count 4 개 비트를 선언했지만 오류에 대한 1을 계산한다. 선언되지 않았으므로 1 비트 와이어로 생성됩니다.

그냥 당신이 원하는 빈번하지 않은 이름에 대한 추정 된 1 비트 그물로 이어지는 변수를 선언하거나 오타를 확인하는 것을 잊지 하나에 최상위 모듈의 아주 일반적으로 Clock

+2

wire [3:0] count1;를 추가 , 나는 항상 파일의 상단에 'default_nettype none'을 사용하도록 제안한다. 그런 식으로 컴파일러/합성 도구에이 1 비트 net 유추를하지 말고 인식 할 수없는 이름 대신 오류를 던지라고합니다. – Unn