我想使我的zed板上的LED从一侧闪烁到另一侧,这是我的代码:
module blinky(
input wire clk,
input wire reset,
input wire direction,
output reg [7:0] leds
);
always @(posedge clk) begin
if (reset==1) begin
// reset the leds to the default state
leds <=1;
end
else begin
// move the light from right to left
if (direction == 1)
// standard way to do a rotation in Verilog
leds<= {leds[6:0],leds[7]};
end
// move the light from left to right
else begin
leds <= {leds[0],leds[6:1]};
end
end
end
endmodule
我何时写此陈述:
否则开始 leds <= {leds [0],leds [6:1]};结束
我得到语法错误。我不明白为什么。谁能帮助我正确使用语法?我在Google上搜索后发现了几种方法,但都给了我同样的错误。