首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Verilog电梯

Verilog电梯
EN

Stack Overflow用户
提问于 2014-12-18 21:21:06
回答 1查看 1.8K关注 0票数 1

我正在用Verilog和ISE西林一起建电梯。不幸的是,我遇到了一个错误:

意料之外的reg (也注册)预期的结束模块。

但是我确实需要登记簿。有人看到错误了吗?

代码语言:javascript
复制
----------------------------------------------------------------------------------------
module user_ctrl

          #(parameter FLOORS     = 30,
                      FLOOR_BITS =  5)


          (input  wire                    CLK,
           input  wire                    RESET,

           input  wire [(FLOOR_BITS-1):0] CURRENT_FLOOR_IN,           // cabin stage
           input  wire                    HALTED,
           input  wire [(FLOORS-1)    :0] FLOOR_REQUEST,              // floor button pressed
           input  wire                    MANUAL_DOOR_CLOSE_IN,       // close button pressed  
           input  wire                    MANUAL_DOOR_OPEN_IN,        // open button pressed         
           input  wire                    MANUAL_ALARM_IN,            // alarm button pressed

           output wire [(FLOOR_BITS-1):0] CURRENT_FLOOR_OUT,          // forward to cabin display
           output wire                    MANUAL_DOOR_CLOSE_OUT,      // door close cmd
           output wire                    MANUAL_DOOR_OPEN_OUT,       // door open cmd
           output wire                    MANUAL_ALARM_OUT,           // user alarm         
           output wire [(FLOORS-1)    :0] DESTINATIONS,               // destinations
           output reg  [(FLOOR_BITS-1):0] CLEAR_FLOOR_BUTTON,         // reset_button
           output reg                     CLEAR_FLOOR_BUTTON_VALID);  // validate reset_button

/* =============================INSERT CODE HERE======================================*/reg
reg [(FLOOR_BITS-1):0] floor; // sets the register

assign CURRENT_FLOOR_OUT = floor; //allocation of outputs and inputs
assign MANUAL_DOOR_CLOSE_OUT = MANUAL_DOOR_CLOSE_IN;
assign MANUAL_DOOR_OPEN_OUT = MANUAL_DOOR_OPEN_IN;
assign MANUAL_ALARM_OUT = MANUAL_ALARM_IN;
assign DESTINATIONS = FLOOR_REQUEST;

always @ (posedge HALTED)begin //to clear the buttons when elevator is stopped
        floor = CURRENT_FLOOR_IN;
        CLEAR_FLOOR_BUTTON_VALID = 1;
        CLEAR_FLOOR_BUTTON = CURRENT_FLOOR_IN;
    end

always @ (negedge HALTED)begin //to let the buttons enlighten when elavator is moving
    CLEAR_FLOOR_BUTTON_VALID = 0;
    end

/* ====================================================================================*/

endmodule
EN

回答 1

Stack Overflow用户

发布于 2014-12-18 21:25:19

从本行末尾移除reg。更改:

代码语言:javascript
复制
/* =============================INSERT CODE HERE======================================*/reg

至:

代码语言:javascript
复制
/* =============================INSERT CODE HERE======================================*/
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27555918

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档