Verilog:此FF/锁存器将在优化过程中进行修剪

Verilog:此FF/锁存器将在优化过程中进行修剪,verilog,Verilog,我正在使用Xilinx ISE项目导航器(第28d页)为自动售货机编写verilog代码。我的代码怎么了?这么多警告,但没有错误 module vend( input clk, input reset, input cancel, input sel1, input sel2, inout [6:0] money, input Rs_10, input Rs_20, output reg product, outpu

我正在使用Xilinx ISE项目导航器(第28d页)为自动售货机编写verilog代码。我的代码怎么了?这么多警告,但没有错误

module vend(
    input clk,
    input reset,
    input cancel,
    input sel1,
    input sel2,
    inout [6:0] money,
    input Rs_10,
    input Rs_20,
    output reg product,
    output reg [6:0] change,
    output reg [6:0] returns
    ); 
     wire wait_1,wait_2;
     reg st_1,st_2,st_3,st_4;
     wire pr_1,pr_2;
     reg nx_1,nx_2;
     reg snacks,coffee;
     reg snack_c,coffee_c;
     reg [6:0] money_count;

always @(posedge clk)

begin   : count
if (sel1==1)
    begin
    if(pr_1==1)
          begin
    nx_1<=wait_1;

          if((Rs_10) & ~(Rs_20))
    begin
    nx_1<=st_1;
    money_count=(money_count+7'b0001010);
          if(money_count>=7'b0011110)
    begin
                                    nx_1<=snacks;
    change<=({0,money_count}-7'b0011110);
                                    snack_c<=snack_c-1;
    disable count;
    end
    nx_1<=wait_1;
    if(cancel==1)
    begin
    returns<=({0,money_count});
    disable count;
    end

    end
    if(~(Rs_10) &(Rs_20))
    begin

    nx_1<=st_2;
    money_count=(money_count+7'b0010100);
    if(money_count>=7'b0011110)
    begin
                                    nx_1<=snacks;
    change<=({0,money_count}-7'b0011110);
                                    snack_c<=snack_c-1;
    disable count;
          end
                                    nx_1<=wait_1;
    if(cancel==1)
    begin
          returns<=({0,money_count});
    disable count;
    end
    end

    end
    end 
    else
            begin
                snack_c<=1'd4;
                nx_1<=reset;
                product<=0;
            end


          if (sel2==1)
    begin
    if(pr_2==1)
    begin
    nx_2<=wait_2;

    if((Rs_10) & ~(Rs_20))
    begin
    nx_2<=st_3;
    money_count=(money_count+7'b0001010);
    if(money_count>=7'b0101000)
    begin
    nx_2<=coffee;
    change<=({0,money_count}-7'b0101000);
    coffee_c<=coffee_c-1;
    disable count;
    end
    nx_2<=wait_2;
    if(cancel==1)
    begin
    returns<={0,money_count};
    disable count;

    end

    end
          if(~(Rs_10) &(Rs_20))
    begin

    nx_2<=st_4;
                                money_count=money_count+7'b0010100;
    if(money_count>=7'b0101000)
    begin
    nx_2<=coffee;
    change<=({0,money_count}-7'b0101000);
    coffee_c<=coffee_c-1;
    disable count;
    end
    nx_2<=wait_2;
    if(cancel==1)
    begin
    returns<=({0,money_count});
    disable count;

    end
    end

    end
    end 
        else
            begin
                coffee_c<=1'd4;
                nx_2<=reset;
                product<=0;
            end

end 
endmodule
模块供应商(
输入时钟,
输入复位,
输入取消,
输入sel1,
输入sel2,
在没有[6:0]钱的情况下,
输入Rs_10,
输入Rs_20,
输出reg产品,
输出寄存器[6:0]更改,
输出寄存器[6:0]返回
); 
接线等待1,等待2;
注册st_1、st_2、st_3、st_4;
电线pr_1、pr_2;
注册号nx_1,nx_2;
reg零食、咖啡;
注册快餐店、咖啡店;
reg[6:0]货币计数;
始终@(posedge clk)
开始:计数
if(sel1==1)
开始
如果(pr_1==1)
开始

nx_1错误似乎是指
更改
返回
的MSB总是
0
,因此它不会合成逻辑(因为它会无缘无故地浪费门)


你试过模拟这个吗

错误似乎是指
change
returns
的MSB总是
0
,因此它不会合成逻辑(因为它会无缘无故地浪费门)


你试过模拟这个吗

当我模拟并且只有z值时,这是因为我的模块中没有初始块。始终记住初始化寄存器和变量

module foo(
     input a,
     output reg b);

    // Runs on startup.
    initial
    begin
        b = 1'b0;
    end
endmodule

当我模拟并且只有z值时,这是因为我的模块中没有初始块。始终记住初始化寄存器和变量

module foo(
     input a,
     output reg b);

    // Runs on startup.
    initial
    begin
        b = 1'b0;
    end
endmodule

是的,我试过模拟部分。模拟已经完成,但只给出z值。如何解决该问题?是的,我试过模拟部分。模拟已经完成,但只给出z值。如何解决该问题??