verilog - Unexpected warnings in Xilinx -


in following code, storing history of buttons player 1 , player 2 pressed. code compiles without errors has warnings. unable solve these warnings. posting 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 two, , use global  // clock buffer derived clock reg clk25_int; @(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 current pixel display location  input [9:0] ypos;// responsible current display row   input [8:0] button;   //spartan 3 kit has 3-bits per pixel, 2^3 means 8 colours can 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));    @(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 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 constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_0> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_1> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_2> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_3> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_4> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_5> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_6> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_7> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:1896 - due other ff/latch trimming, ff/latch <player2history_8> has constant value of 0 in block <grid_display>. ff/latch trimmed during optimization process. warning:xst:2036 - inserting obuf on port <led> driven black box <dummymodule>. possible simulation mismatch. 

regards

all warnings ff/latch trimming boil down issue player2history 0, , such being optimized out.

it wouldn't should 0, turns out true due interesting side effect of fact used wrong type of blocking statements.

the issue in these 2 lines in block:

always @(posedge clk25) begin  player1history=  button ^ player2history;  player2history=  button ^ player1history; 

your logic evaluates this:

  1. at beginning of time player2history (p2h) zero.
  2. on posedge of clock, assume button nonzero. @ point p2h still zero, p1h = button ^ 0 means p1h gets assigned value of button.
  3. now next statement evaluated, , you're evaluating button ^ p1h, since assigned p1h = button, you're evaluating button ^ button, know 0.
  4. since it's not possible in case p2h ever non-zero, flops removed design.

what meant make p1h , p2h non- blocking assignments, <= operator. when use nonblocking means both statements evaulated in parallel, both p1h , p2h evaluated against old values, instead of first computing first line, , using result in second line.

understanding difference between blocking , non-blocking statements important in verilog, , if don't understand concept or when use them, should seek additional training materials.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -