我遇到了问题。在这段代码中,我希望在reg'的每次更改中滚动文本。但是,当我在FPGA板上执行此代码(EP2C8F256C8)时,它并没有改变。它只显示固定的单词。这段代码有什么问题?
module segment(clk, fnd_data, fnd_ctrl);
input clk;
output [7:0] fnd_data;
output [5:0] fnd_ctrl;
reg [7:0] fnd_data;
reg [5:0] fnd_ctrl;
reg [2:0] fnd_state;
reg [3:0] sec;
reg [13:0] fnd_count;
reg fnd_clock;
initial begin
fnd_state = 0;
fnd_count = 0;
fnd_clock = 0;
sec = 0;
end
always @ (posedge clk)
begin
if(fnd_count == 10000)
begin
fnd_count = 0;
fnd_clock = ~fnd_clock;
end
else
begin
fnd_count = fnd_count + 1;
end
end
always @ (posedge fnd_clock)
begin
if(sec == 11)
begin
sec = 0;
end
else
begin
sec = sec+1;
end
end
always @ (posedge fnd_clock)
begin
case(sec)
0:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b00000000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b00000000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b00000000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b00000000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b00000000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b00000000;
fnd_state = 0;
end
1:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b00000000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b00000000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b00000000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b00000000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b00000000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b01110010;
fnd_state = 0;
end
2:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b00000000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b00000000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b00000000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b00000000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b01110010;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b11111100;
fnd_state = 0;
end
3:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b00000000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b00000000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b00000000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b01110010;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b11111100;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b11101100;
fnd_state = 0;
end
4:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b00000000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b00000000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b01110010;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b11111100;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b11101100;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b10110110;
fnd_state = 0;
end
5:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b00000000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b01110010;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b11111100;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b11101100;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b10110110;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b10011110;
fnd_state = 0;
end
6:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b01110010;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b11111100;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b11101100;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b10110110;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b10011110;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b01100000;
fnd_state = 0;
end
7:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b11111100;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b11101100;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b10110110;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b10011110;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b01100000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b00000000;
fnd_state = 0;
end
8:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b11101100;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b10110110;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b10011110;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b01100000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b00000000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b00000000;
fnd_state = 0;
end
9:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b10110110;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b10011110;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b01100000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b00000000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b00000000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b00000000;
fnd_state = 0;
end
10:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b10011110;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b01100000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b00000000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b00000000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b00000000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b00000000;
fnd_state = 0;
end
11:
if (fnd_state == 0)
begin
fnd_ctrl = 6'b011111;
fnd_data = 8'b01100000;
fnd_state = 1;
end
else if (fnd_state == 1)
begin
fnd_ctrl = 6'b101111;
fnd_data = 8'b00000000;
fnd_state = 2;
end
else if (fnd_state == 2)
begin
fnd_ctrl = 6'b110111;
fnd_data = 8'b00000000;
fnd_state = 3;
end
else if (fnd_state == 3)
begin
fnd_ctrl = 6'b111011;
fnd_data = 8'b00000000;
fnd_state = 4;
end
else if (fnd_state == 4)
begin
fnd_ctrl = 6'b111101;
fnd_data = 8'b00000000;
fnd_state = 5;
end
else if (fnd_state == 5)
begin
fnd_ctrl = 6'b111110;
fnd_data = 8'b00000000;
fnd_state = 0;
end
endcase
end
endmodule
(我觉得很难理解我的英语。我很抱歉。)