Xilinx 中的意外警告 [英] Unexpected warnings in Xilinx

查看:47
本文介绍了Xilinx 中的意外警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的代码中,我存储了按下播放器 1 和播放器 2 按钮的历史记录.代码编译没有错误,但有警告.我无法解决这些警告.我在这里发布代码.

In the following code, I am storing the history of buttons player 1 and player 2 pressed. The code compiles without errors but has warnings. I am unable to solve these warnings. I am posting the code here.

module game(clk50,red,green,blue,hsync,vsync, button,led);

input [8:0] button;
 input clk50;
 output  red;
 output  green;
 output  blue,led;
 output hsync;
 output vsync;
 // divide input clock by two, and use a global 
// clock buffer for the derived clock
reg clk25_int;
always @(posedge clk50) begin
clk25_int <= ~clk25_int;
end
wire clk25;
BUFG bufg_inst(clk25, clk25_int);
wire [9:0] xpos;
wire [9:0] ypos;

Grid_Display Grid_Displayinst(clk25,xpos, ypos, red, green, blue, button,led);

endmodule

module Grid_Display(clk25,xpos,ypos,red,green,blue, button,led);

 input clk25;
 input [9:0] xpos;//responsible for current pixel display location
 input [9:0] ypos;// responsible for current display row

 input [8:0] button;

 //spartan 3 kit has 3-bits per pixel, so 2^3 means 8 colours can be selected.

 output red; // colour 1
 output green; // colour 2
 output blue; // colur 3
 output led;

 //reg tempRed,tempGreen,tempBlue, GridRed,GridGreen,GridBlue;

 reg player1,player2;

 reg [8:0] player1History=0,player2History=0;


 wire grid = ((xpos >= 4 && xpos <= 799 &&  ypos >= 160 && ypos <= 165) || 
              (xpos >= 4 && xpos <= 790 &&  ypos >= 310 && ypos <= 315) ||
              (xpos >= 200 && xpos <= 205 &&  ypos >= 0 && ypos <= 520) || 
              (xpos >= 440 && xpos <= 445 &&  ypos >= 0 && ypos <= 520));



always @(posedge clk25)
begin

  player1History=  button ^ player2History;
  player2History=  button ^ player1History;

  player1 = ((player1History[0] && (xpos >=50 && xpos<=150 && ypos >= 20 && ypos <=120) ) || (player1History[1] && (xpos >=250 && xpos<=350 && ypos >= 20 && ypos <=120))
          || (player1History[2] && (xpos >=490 && xpos<=590 && ypos >= 20 && ypos <=120)) || (player1History[3] && (xpos >=50 && xpos<=150 && ypos >= 180 && ypos  <=280))
          || (player1History[4] && (xpos >=250 && xpos<=350 && ypos >= 180 && ypos <=280)) || (player1History[5] && (xpos >=490 && xpos<=590 && ypos >= 180 && ypos <=280))
          || (player1History[6] && (xpos >=50 && xpos<=150 && ypos >= 330 && ypos <=430)) || (player1History[7] && (xpos >=250 && xpos<=350 && ypos >= 330 && ypos <=430))
          || (player1History[8] && (xpos >=490 && xpos<=590 && ypos >= 330 && ypos <=430)));

  player2 = ((player2History[0] && (xpos >=50 && xpos<=150 && ypos >= 20 && ypos <=120) ) || (player2History[1] && (xpos >=250 && xpos<=350 && ypos >= 20 && ypos <=120))
          || (player2History[2] && (xpos >=490 && xpos<=590 && ypos >= 20 && ypos <=120)) || (player2History[3] && (xpos >=50 && xpos<=150 && ypos >= 180 && ypos <=280))
          || (player2History[4] && (xpos >=250 && xpos<=350 && ypos >= 180 && ypos <=280)) || (player2History[5] && (xpos >=490 && xpos<=590 && ypos >= 180 && ypos <=280))
          || (player2History[6] && (xpos >=50 && xpos<=150 && ypos >= 330 && ypos <=430)) || (player2History[7] && (xpos >=250 && xpos<=350 && ypos >= 330 && ypos <=430))
          || (player2History[8] && (xpos >=490 && xpos<=590 && ypos >= 330 && ypos <=430)));

end 

 assign red = (grid || player1 );
 assign green = (grid || player2);
 assign blue = (grid );

endmodule

我该如何解决这些警告?

How can I solve these warnings?

WARNING:Xst:2211 - "grid.v" line 104: Instantiating black box module <dummyModule>.
WARNING:Xst:1710 - FF/Latch <player2> (without init value) has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_0> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_1> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_2> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_3> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_4> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_5> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_6> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_7> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <player2History_8> has a constant value of 0 in block <Grid_Display>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:2036 - Inserting OBUF on port <led> driven by black box <dummyModule>. Possible simulation mismatch.

问候

推荐答案

您所有关于 FF/Latch 修整的警告基本上都归结为 player2History 始终为 0 的问题,因此正在对其进行优化.

All your warnings about FF/Latch trimming basically boil down to the issue that player2History is always 0, and as such it is being optimized out.

它看起来不应该总是 0,但事实证明它是正确的,因为您使用了错误类型的阻塞语句这一事实的有趣副作用.

It wouldn't look like it should always be 0, but it turns out to be true due to an interesting side effect of the fact that you used the wrong type of blocking statements.

问题在于您的 always 块中的这两行:

The issue is in these two lines in your always block:

always @(posedge clk25) begin
 player1History=  button ^ player2History;
 player2History=  button ^ player1History;

然后您的逻辑评估如下:

Your logic then evaluates like this:

  1. 在开始时 player2History (p2h) 为零.
  2. 在时钟的某个位置,假设按钮不为零.此时 p2h 仍然为零,所以 p1h = button ^ 0 只是意味着 p1h 被分配了 button 的值.
  3. 现在评估下一条语句,您正在评估 button ^ p1h,但由于我们刚刚分配了 p1h = button,您实际上是在评估 按钮^按钮,我们知道它总是0.
  4. 由于在这种情况下 p2h 不可能不为零,因此从您的设计中删除了触发器.
  1. At beginning of time player2History (p2h) is zero.
  2. On some posedge of the clock, assume button is nonzero. At this point p2h is still zero, so p1h = button ^ 0 just means that p1h gets assigned the value of button.
  3. Now the next statement is evaluated, and you're evaluating button ^ p1h, but since we just assigned p1h = button, you're really evaluating button ^ button, which we know is always 0.
  4. Since it's not possible in this case for p2h to ever be non-zero, the flops were removed from your design.

您可能想要做的是使用 <= 运算符进行 p1h 和 p2h 阻塞赋值.当您使用非阻塞时,这意味着两个语句都是并行计算的,因此 p1h 和 p2h 都根据它们的旧值进行计算,而不是先计算第一行,然后在第二行中使用此结果.

What you probably meant to do was to make p1h and p2h non- blocking assignments, with the <= operator. When you use nonblocking it means that both statements are evaulated in parallel, so both p1h and p2h are evaluated against their old values, instead of first computing the first line, and then using this result in the second line.

理解阻塞语句和非阻塞语句之间的区别在verilog中非常重要,如果你不理解概念或何时使用它们,那么你应该寻求额外的培训材料.

Understanding the difference between blocking and non-blocking statements is very important in verilog, and if you don't understand the concept or when to use them, then you should seek additional training materials.

这篇关于Xilinx 中的意外警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆