首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Verilog :此FF/Latch将在优化过程中进行修剪

Verilog :此FF/Latch将在优化过程中进行修剪
EN

Stack Overflow用户
提问于 2012-11-28 09:35:53
回答 2查看 1.6K关注 0票数 1

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

代码语言:javascript
复制
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

我收到的一些警告

代码语言:javascript
复制
Xst:1710 - FF/Latch <returns_0> (without init value) has a constant value of 0 in block <vend>. This FF/Latch will be trimmed during the optimization process.
Xst:1710 - FF/Latch <change_0> (without init value) has a constant value of 0 in block <vend>. This FF/Latch will be trimmed during the optimization process.
Xst:2677 - Node <money_count_0> of sequential type is unconnected in block <vend>.
EN

回答 2

Stack Overflow用户

发布于 2012-11-28 10:34:13

看起来这个错误是指这样一个事实:changereturns的MSB总是为0,所以它不会综合逻辑(因为它会无端浪费门)。

你有没有试过模拟这个?

票数 1
EN

Stack Overflow用户

发布于 2013-04-18 11:48:45

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

代码语言:javascript
复制
module foo(
     input a,
     output reg b);

    // Runs on startup.
    initial
    begin
        b = 1'b0;
    end
endmodule
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13596361

复制
相关文章

相似问题

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