2016-09-03 2 views
0
I은 ​​X 및 Y와 Adult FriendFinder에서의 가장 작은 값을 찾는와 Costcalculator Adult FriendFinder에서 (X, xcost) '에 yfind 문제가

; 비용 계산기 yfind (Y, ycost);의 Verilog 코드 움직임 추정기

아래 코드를 참조하십시오. 누군가 의견을 남길 수 있습니까? 어떤 이유로 전체 코드를 가져올 수 없습니다. 단지이 줄을 코드로 인식합니다. 미안하지만 확실하지 않은 경우.

always @(posedge clk) // sequential circuit 

    begin 

    Costcalculator xfind (X,xcost); 
    Costcalculator yfind (Y,ycost); 

    if(reset) 
     begin 
     i=0; 
     R<=0; 
     xcost<=0; 
     ycost<=0; 
     mode0<=0; 
     mode1<=0; 
     mode2<=0; 
     mode3<=0; 
     mode4<=0; 
     mode5<=0; 
     mode6<=0; 
     end //if end 
     else 
     begin 
      for (i=1; i<43; i=i+1) 
     begin 
       R<=xcost+ycost; 
     costholder <= SAD+(lambda*R); // Here we calculate the cost of a sub-blocks As the clock 
       if (i<17) 
     mode0<=costholder+mode0; 
     else if(i>16 && i<25) 
     mode1<=costholder+mode1; 
     else if(i>24 && i<33) 
     mode2<=costholder+mode2; 
     else if(i==33 || i==34 || i==35 || i==36) 
     mode3<=costholder+mode3; 
     else if(i==37 || i==38) 
     mode4<=costholder+mode4; 
     else if(i==39 || i==40) 
     mode5<=costholder+mode5; 
     else if(i==41) 
     mode6<=costholder+mode6; 

     end //for end 
    end //else end 
    end //always end  

모듈 Costcalculator는 :

//**********************************************************‌​** 
module Costcalculator (motionvector, cost); // X AND Y COST CALCULATOR 
input [4:0]motionvector; 
output [2:0]cost; 
reg [2:0]cos; 
wire [3:0] vector; 
assign vector = {motionvector[3:0] }; 

always @* begin 
case (vector) 0 : cos=0; 
1,2 : cos=1; 
3,4,5,6 : cos=2; 
7,8,9,10,11,12,13,14 : cos=3; 
15 : cos=4; 
endcase 
end 
assign cost = cos; 
endmodule 
//**********************************************************‌​** 
+2

무엇이 오류입니까? 나는'Constcalculator'가 모듈이라고 믿습니다. 절차 블록에서 모듈을 인스턴스화 할 수 없습니다. – sharvil111

+0

1) 최소한의 (작동하지 않는) 디자인을 만들고, 2) 모든 관련 코드가 있는지 확인하고, 3) 잘못된 것에 대한 단서를 제공해야합니다. 따라서 모든 관련성없는 코드를 제거하고 "비용 계산기"가 무엇인지, 아마도 사용 된 구문을 고려하여 sharvil111에서 지적한 모듈을 알려주고 3) 오류 코드를 제공하거나 잘못된 점을 알려주십시오. 그렇지 않으면 대답하기 불가능 ... – chrisvp

+0

여기 코드의 나머지 부분입니다 : –

답변

1

always 블록 외부에서 모듈을 복용 한 후에는이 곳에서 xconstyconst를 운전하고 있습니다. 반면에 나는 XY의 드라이버를 보지 못했습니다. Costcalculator 이후

방금 ​​입력 상단/래퍼 모듈에서 제로로XY를 제공해야, 순전히 조합 모듈입니다. 오류로

//.. some stuff 
if(reset) begin 
//... some other signals 
X <= 0; 
Y <=0; 
//... 

여러 드라이버, 당신은 xconstyconst 형태로 두 모듈을 주도했다. 재설정시 XY을 포장 모듈에서 0으로 제공하면 자동으로 vector이 0으로 이동하고 궁극적으로 모듈의 출력 인 cost이 0이됩니다. 따라서 변수 xconstyconst이 0이됩니다.

자세한 내용은 this similar forum question를 참조하십시오.