我是verilog编码的初学者,所以非常感谢所有帮助。
在我的顶级模块中,我调用了三个模块。 slowclock将板上的时钟降低到可见速度。 counterten计数为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
答案 0 :(得分:1)
您已使用count
声明wire [3:0] count;
4位,但错误大约是 1 。因为没有声明它被创建为1位线。
只需将wire [3:0] count1;
添加到顶级模块Clock