Verilog中的Xst:3002

Verilog中的Xst:3002,verilog,synthesis,Verilog,Synthesis,我正在ISE 14.7上创建一个下行计数器。 我设置了一个异步重置(rst_n),每当它变为0时,计数器的值将被设置为init_值 但当我综合代码时, 出现警告:Xst3002 代码: 请参考搜索字符串“Spartan6 异步设置/重置”以了解更多详细信息 异步设置和重置的寄存器实例列表: 单位为0的值 以单位表示的值_1 以单位表示的值_2 以单位表示的值_3 该警告似乎是因为[3:0]值而出现的。但我对此一无所知。 我已尝试将异步重置更改为0,警告消失。 但这不是我想要的。这种设计存在一些问

我正在ISE 14.7上创建一个下行计数器。 我设置了一个异步重置(rst_n),每当它变为0时,计数器的值将被设置为init_值

但当我综合代码时, 出现警告:Xst3002

代码:

请参考搜索字符串“Spartan6 异步设置/重置”以了解更多详细信息

异步设置和重置的寄存器实例列表: 单位为0的值 以单位表示的值_1 以单位表示的值_2 以单位表示的值_3

该警告似乎是因为[3:0]值而出现的。但我对此一无所知。 我已尝试将异步重置更改为0,警告消失。
但这不是我想要的。

这种设计存在一些问题。首先,
init\u value\u tmp
似乎没有设置值。其次,由于它是一个非常量,Spartan-6体系结构可能无法使用内置重置功能实际重置为该值。更改
值此设计存在一些问题。首先,
init\u value\u tmp
似乎没有设置值。其次,由于它是一个非常量,Spartan-6体系结构可能无法使用内置重置功能实际重置为该值。改变
值只是一个侧面的想法。重置后,您应该向
借用
提供一些值。请使用注释更新代码,说明您实际需要的内容,以及您的电路可能的行为只是一个附带想法。重置时,您应该将一些值驱动到
借用
。请使用注释更新代码,说明您实际需要的内容以及您的电路可能的行为。我已尝试更改
值,因此不能使用非常量作为重置值?@JackyHuang。通常,异步重置在硅级别有一个特殊的实现,并且可能只能重置为FPGA比特流中固定的值。我现在正在仔细查看Spartan-6 CLB用户指南以了解更多详细信息。我感谢您的时间和努力。:)非常感谢。我也会亲自查看用户指南。无论是什么实现,都应该避免异步重置为非常量值。这样做需要逻辑驱动异步设置/复位输入到触发器。这不是同步设计,因此应该避免。我已尝试更改
值,因此不能使用非常量作为重置值?@JackyHuang,两者兼而有之。通常,异步重置在硅级别有一个特殊的实现,并且可能只能重置为FPGA比特流中固定的值。我现在正在仔细查看Spartan-6 CLB用户指南以了解更多详细信息。我感谢您的时间和努力。:)非常感谢。我也会亲自查看用户指南。无论是什么实现,都应该避免异步重置为非常量值。这样做需要逻辑驱动异步设置/复位输入到触发器。这不是同步设计,因此应该避免。
`timescale 1ns / 1ps

module downcounter(value, borrow, clk, rst_n, decrease, init_value, limit);
    output reg [3:0]value;              //value of counter
    output reg borrow;                  //borrow indicator
    input clk, rst_n, decrease;         //clock; active low reset; to decrease
    input [3:0]init_value, limit;       //initial value; counter limit

    reg [3:0]value_tmp, init_value_tmp; //for always block

    //Combinational logic
    always @(value or decrease or limit or borrow)begin
        if(~decrease) begin value_tmp = value; borrow = 0; end      //if decrease is 0, the counter stops counting down.
        else begin
            if(value == 0)begin value_tmp = limit; borrow = 1; end  //if the value is 0, the next value would be the limit.
            else begin value_tmp = value + 4'b1111; borrow = 0; end //Ex: limit = 9, so that value(now) = 0, then value(next) = 9 in decimal.
        end
    end
    //Sequentical logic
    always @(posedge clk or negedge rst_n) begin
        if(~rst_n) value <= init_value_tmp;             //asynchronous reset. set the value to initial value
        else begin
            value <= value_tmp;
        end
    end
endmodule
      1) Remove either the set or reset from all registers and latches
         if not needed for required functionality
      2) Modify the code in order to produce a synchronous set
         and/or reset (both is preferred)
      3) Ensure all registers have the same initialization value as the
         described asynchronous set or reset polarity
      4) Use the -async_to_sync option to transform the asynchronous
         set/reset to synchronous operation
         (timing simulation highly recommended when using this option)
always @(posedge clk) begin
    if(~rst_n) value <= init_value_tmp;
    else begin
        value <= value_tmp;
    end
end