2013-05-15 1 views
-1

다음 코드에서 플레이어 1과 플레이어 2 버튼의 기록을 저장하려고합니다. 코드는 오류없이 컴파일되지만 경고가 있습니다. 나는이 경고를 풀 수 없다. 여기에 코드를 게시하고 있습니다.Xilinx에서 예기치 않은 경고가 발생했습니다.

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 

어떻게 이러한 경고를 해결할 수 있습니까? FF/래치가 player2History은 항상 0이며, 같은 그것을 밖으로 최적화되고 있다는 문제로 귀결 기본적으로 트리밍에 대한

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. 

안부

+0

-1 엄청난 양의 코드와 컴파일러 출력물을 우리에게 공정하게 보여주지 않으면 서. 문제를 재현하는 가장 작은 예제로 질문의 범위를 좁혀주십시오. VETSMOD가 되십시오. – Philippe

답변

5

귀하의 모든 경고.

항상 0이어야하는 것처럼 보이지는 않지만 잘못된 유형의 차단 명령문을 사용한다는 흥미로운 부작용으로 인해 사실로 판명됩니다.

문제는 항상 블록이 두 줄에 있습니다

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

당신의 논리는 다음과 같이 평가 :

  1. 시간 player2History (P2H)의 시작되는 시점은 0이다.
  2. 시계의 일부 포즈에서 버튼이 0이 아닌 것으로 가정합니다. 이 시점에서 p2h는 여전히 0이므로 p1h = button^0은 p1h에 button 값이 할당된다는 것을 의미합니다.
  3. 이제 다음 문을 평가, 당신은 button^p1h을 평가하고 있지만 우리는 단지 p1h = button를 할당하기 때문에, 당신은 정말 P2H이 경우 불가능하기 때문에 우리가 항상 0
  4. 알고있는 button^button을 평가하고 영 (0)이 아닌 플립은 디자인에서 제거되었습니다. 당신은 아마 의미가 무엇

<= 연산자, p1h 및 P2H 차단 할당을 만드는 것이 었습니다. nonblocking을 사용하면 두 문장 모두 병렬로 처리되므로 p1h와 p2h는 첫 번째 라인을 먼저 계산 한 다음 두 번째 라인에서이 결과를 사용하는 대신 이전 값에 대해 평가됩니다.

차단 및 비 차단 문 간의 차이점을 이해하는 것은 Verilog에서 매우 중요하며, 개념을 이해하지 못하거나 사용시기를 알지 못하면 추가 교육 자료를 찾아야합니다.

+0

+1 모든 것을 읽는 것을 괴롭히는 것에 대해 ... :) – EML