Embedded 更改我的程序的用户逻辑.v

Embedded 更改我的程序的用户逻辑.v,embedded,verilog,fpga,xilinx,hdl,Embedded,Verilog,Fpga,Xilinx,Hdl,我刚刚在Xilinx中创建了一个自定义IP,它生成了我在Verilog中需要的用户逻辑文件,但是我在更改代码时遇到了问题 我需要的是实现数据到达FSL,执行一些加法,然后将值返回到MicroBlaze,数据正在发送,但现在正在返回 enter code here //---------------------------------------------------------------------------- // video - modu

我刚刚在Xilinx中创建了一个自定义IP,它生成了我在Verilog中需要的用户逻辑文件,但是我在更改代码时遇到了问题

我需要的是实现数据到达FSL,执行一些加法,然后将值返回到MicroBlaze,数据正在发送,但现在正在返回

enter code here
                //----------------------------------------------------------------------------
        // video - module
        //----------------------------------------------------------------------------
        // IMPORTANT:
        // DO NOT MODIFY THIS FILE EXCEPT IN THE DESIGNATED SECTIONS.
        //
        // SEARCH FOR --USER TO DETERMINE WHERE CHANGES ARE ALLOWED.
        //
        // TYPICALLY, THE ONLY ACCEPTABLE CHANGES INVOLVE ADDING NEW
        // PORTS AND GENERICS THAT GET PASSED THROUGH TO THE INSTANTIATION
        // OF THE USER_LOGIC ENTITY.
        //----------------------------------------------------------------------------
        //
        // ***************************************************************************
        // ** Copyright (c) 1995-2008 Xilinx, Inc.  All rights reserved.            **
        // **                                                                       **
        // ** Xilinx, Inc.                                                          **
        // ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"         **
        // ** AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND       **
        // ** SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,        **
        // ** OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,        **
        // ** APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION           **
        // ** THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,     **
        // ** AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE      **
        // ** FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY              **
        // ** WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE               **
        // ** IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR        **
        // ** REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF       **
        // ** INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS       **
        // ** FOR A PARTICULAR PURPOSE.                                             **
        // **                                                                       **
        // ***************************************************************************
        //
        //----------------------------------------------------------------------------
        // Filename:          video
        // Version:           1.00.a
        // Description:       Example FSL core (Verilog).
        // Date:              Tue Jul 12 10:03:57 2011 (by Create and Import Peripheral Wizard)
        // Verilog Standard:  Verilog-2001
        //----------------------------------------------------------------------------
        // Naming Conventions:
        //   active low signals:                    "*_n"
        //   clock signals:                         "clk", "clk_div#", "clk_#x"
        //   reset signals:                         "rst", "rst_n"
        //   generics:                              "C_*"
        //   user defined types:                    "*_TYPE"
        //   state machine next state:              "*_ns"
        //   state machine current state:           "*_cs"
        //   combinatorial signals:                 "*_com"
        //   pipelined or register delay signals:   "*_d#"
        //   counter signals:                       "*cnt*"
        //   clock enable signals:                  "*_ce"
        //   internal version of output port:       "*_i"
        //   device pins:                           "*_pin"
        //   ports:                                 "- Names begin with Uppercase"
        //   processes:                             "*_PROCESS"
        //   component instantiations:              "<ENTITY_>I_<#|FUNC>"
        //----------------------------------------------------------------------------

        ////////////////////////////////////////////////////////////////////////////////
        //
        //
        // Definition of Ports
        // FSL_Clk             : Synchronous clock
        // FSL_Rst           : System reset, should always come from FSL bus
        // FSL_S_Clk       : Slave asynchronous clock
        // FSL_S_Read      : Read signal, requiring next available input to be read
        // FSL_S_Data      : Input data
        // FSL_S_Control   : Control Bit, indicating the input data are control word
        // FSL_S_Exists    : Data Exist Bit, indicating data exist in the input FSL bus
        // FSL_M_Clk       : Master asynchronous clock
        // FSL_M_Write     : Write signal, enabling writing to output FSL bus
        // FSL_M_Data      : Output data
        // FSL_M_Control   : Control Bit, indicating the output data are contol word
        // FSL_M_Full      : Full Bit, indicating output FSL bus is full
        //
        ////////////////////////////////////////////////////////////////////////////////

        //----------------------------------------
        // Module Section
        //----------------------------------------
        module video 
        (
            // ADD USER PORTS BELOW THIS LINE 
            // -- USER ports added here 
            // ADD USER PORTS ABOVE THIS LINE 

            // DO NOT EDIT BELOW THIS LINE ////////////////////
            // Bus protocol ports, do not add or delete. 
            FSL_Clk,
            FSL_Rst,
            FSL_S_Clk,
            FSL_S_Read,
            FSL_S_Data,
            FSL_S_Control,
            FSL_S_Exists,
            FSL_M_Clk,
            FSL_M_Write,
            FSL_M_Data,
            FSL_M_Control,
            FSL_M_Full
            // DO NOT EDIT ABOVE THIS LINE ////////////////////
        );

        // ADD USER PORTS BELOW THIS LINE 
        // -- USER ports added here 
        // ADD USER PORTS ABOVE THIS LINE 

        input                                     FSL_Clk;
        input                                     FSL_Rst;
        output                                    FSL_S_Clk;
        output                                    FSL_S_Read;
        input      [0 : 31]                       FSL_S_Data;
        input                                     FSL_S_Control;
        input                                     FSL_S_Exists;
        output                                    FSL_M_Clk;
        output                                    FSL_M_Write;
        output     [0 : 31]                       FSL_M_Data;
        output                                    FSL_M_Control;
        input                                     FSL_M_Full;

        // ADD USER PARAMETERS BELOW THIS LINE 
        // --USER parameters added here 
        // ADD USER PARAMETERS ABOVE THIS LINE


        //----------------------------------------
        // Implementation Section
        //----------------------------------------
        // In this section, we povide an example implementation of MODULE video
        // that does the following:
        //
        // 1. Read all inputs
        // 2. Add each input to the contents of register 'sum' which
        //    acts as an accumulator
        // 3. After all the inputs have been read, write out the
        //    content of 'sum' into the output FSL bus NUMBER_OF_OUTPUT_WORDS times
        //
        // You will need to modify this example for
        // MODULE video to implement your coprocessor

        // Total number of input data.
        localparam NUMBER_OF_INPUT_WORDS  = 64;

        // Total number of output data
        localparam NUMBER_OF_OUTPUT_WORDS = 64;

        // Define the states of state machine
        localparam Idle  = 3'b100;
        localparam Read_Inputs = 3'b010;
        localparam Write_Outputs  = 3'b001;

        reg [0:2] state;

        // Accumulator to hold sum of inputs read at any point in time
        reg [0:31] sum;

        // Counters to store the number inputs read & outputs written
        reg [0:NUMBER_OF_INPUT_WORDS - 1] nr_of_reads;
        reg [0:NUMBER_OF_OUTPUT_WORDS - 1] nr_of_writes;

        // CAUTION:
        // The sequence in which data are read in should be
        // consistent with the sequence they are written in the
        // driver's video.c file

        assign FSL_S_Read  = (state == Read_Inputs) ? FSL_S_Exists : 0;
        assign FSL_M_Write = (state == Write_Outputs) ? ~FSL_M_Full : 0;

        assign FSL_M_Data = sum;

        always @(posedge FSL_Clk) 
        begin  // process The_SW_accelerator
          if (FSL_Rst)               // Synchronous reset (active high)
            begin
               // CAUTION: make sure your reset polarity is consistent with the
               // system reset polarity
               state        <= Idle;
               nr_of_reads  <= 0;
               nr_of_writes <= 0;
               sum          <= 0;
            end
          else
            case (state)
              Idle: 
                if (FSL_S_Exists == 1)
                begin
                  state       <= Read_Inputs;
                  nr_of_reads <= NUMBER_OF_INPUT_WORDS - 1;
                  sum         <= 0;
                end

              Read_Inputs: 
                if (FSL_S_Exists == 1) 
                begin
                  // Coprocessor function (Adding) happens here
                  sum         <= sum + FSL_S_Data;
                  if (nr_of_reads == 0)
                    begin
                      state        <= Write_Outputs;
                      nr_of_writes <= NUMBER_OF_OUTPUT_WORDS - 1;
                    end
                  else
                    nr_of_reads <= nr_of_reads - 1;
                end

              Write_Outputs: 
                if (nr_of_writes == 0) 
                  state <= Idle;
                else
                  if (FSL_M_Full == 0)  nr_of_writes <= nr_of_writes - 1;
            endcase
        end

        endmodule
在此处输入代码
//----------------------------------------------------------------------------
//视频模块
//----------------------------------------------------------------------------
//重要:
//除非在指定的部分中,否则不要修改此文件。
//
//搜索--USER以确定允许更改的位置。
//
//通常,唯一可接受的更改包括添加新的
//传递到实例化的端口和泛型
//用户逻辑实体的。
//----------------------------------------------------------------------------
//
// ***************************************************************************
//**版权所有(c)1995-2008 Xilinx,Inc.保留所有权利**
// **                                                                       **
//**Xilinx公司**
//**XILINX“按原样”提供此设计、代码或信息**
//**出于对您的礼貌,仅用于开发程序和**
//**针对XILINX设备的解决方案。通过提供这种设计,代码**
//**或信息作为此功能的一种可能实现**
//**应用或标准,XILINX不作任何陈述**
//**本实施不存在任何侵权索赔**
//**您有责任获得您可能需要的任何权利**
//**感谢您的实施。XILINX明确否认任何**
//**关于合同充分性的任何保证**
//**实施,包括但不限于任何保证或**
//**表示本实施不存在以下声明:**
//**侵权、对适销性和适用性的默示保证**
//**为特定目的**
// **                                                                       **
// ***************************************************************************
//
//----------------------------------------------------------------------------
//文件名:视频
//版本:1.00.a
//描述:示例FSL核心(Verilog)。
//日期:2011年7月12日星期二10:03:57(通过创建和导入外围设备向导)
//Verilog标准:Verilog-2001
//----------------------------------------------------------------------------
//命名约定:
//低电平有效信号:“*\n”
//时钟信号:“clk”、“clk#U div”、“clk#x”
//重置信号:“重新设置”、“重新设置”
//泛型:“C*”
//用户定义的类型:“*\u类型”
//状态机下一个状态:“*\n”
//状态机当前状态:“*\u cs”
//组合信号:“*\u com”
//流水线或寄存器延迟信号:“*_d#”
//计数器信号:“*cnt*”
//时钟启用信号:“*\u ce”
//输出端口的内部版本:“*\u i”
//设备引脚:“*\u引脚”
//端口:“-名称以大写字母开头”
//进程:“*\u进程”
//组件实例化:“I_3;”
//----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
//
//
//港口的定义
//同步时钟
//FSL_Rst:系统复位,应始终来自FSL总线
//FSL_S_Clk:从异步时钟
//FSL_S_Read:读取信号,需要读取下一个可用输入
//FSL_S_数据:输入数据
//FSL_S_Control:控制位,表示输入数据为控制字
//FSL_S_Exists:数据存在位,表示数据存在于输入FSL总线中
//主异步时钟
//FSL_M_Write:写入信号,允许写入输出FSL总线
//FSL_M_数据:输出数据
//FSL_M_Control:控制位,表示输出数据为控制字
//FSL_M_Full:满位,表示输出FSL总线已满
//
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------
//模块部分
//----------------------------------------
模块视频
(
//在此行下方添加用户端口
//--此处添加了用户端口
//在此行上方添加用户端口
//请勿在此行下方进行编辑////////////////////
//总线协议端口,不添加或删除。
油尖旺,
首先,
FSL_S_Clk,
FSL_S_读取,
FSL_S_数据,
FSL_S_控制,
FSL_S_存在,
油麻角,
FSL____写,
FSL_M_数据,
FSL_M_C