Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Syntax 为什么我会有语法错误?_Syntax_Verilog - Fatal编程技术网

Syntax 为什么我会有语法错误?

Syntax 为什么我会有语法错误?,syntax,verilog,Syntax,Verilog,我想让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

我想让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
模块闪烁(
输入线时钟,
输入线复位,
输入导线方向,
输出调节[7:0]发光二极管
);
始终@(posedge clk)开始
如果(重置==1)开始
//将LED重置为默认状态

发光二极管我想你忘记了
开始
之后如果(方向==1)

很难发现的原因之一是,缩进非常不稳定


编码大纲非常个人化。 我更喜欢我的
开始
与我的
结束
保持一致,就像我的编辑器所给出的那样 很好的匹配线。 我还使用3个空格作为缩进,因为深度缩进我无法跟踪 一切都在哪里。但正如我所说,这是个人的:


如果(方向==1)
,我想你忘了在
之后开始

很难发现的原因之一是,缩进非常不稳定


编码大纲非常个人化。 我更喜欢我的
开始
与我的
结束
保持一致,就像我的编辑器所给出的那样 很好的匹配线。 我还使用3个空格作为缩进,因为深度缩进我无法跟踪 一切都在哪里。但正如我所说,这是个人的:


可能有很多原因我们无法解释,因为您尚未显示完整的!代码。e、 g.您的
else
可能放置错误。可能有许多原因我们无法说明,因为您没有显示完整的代码!代码。e、 g.您的
else
可能放置错误。