Tesi Robotica Un co-processore per Stereo-Matching: Architettura | Page 88

i i “LP_Tesi” — 2011/9/9 — 21:20 — page 88 — #88 i 4.6. MODULO DISPARITY i 88 ready: flag che diventa true quando il contatore cnt arriva a width-1, cioè tutti i pixel sono stati inviati; cnt: contatore per il numero di elementi arrivati e spediti. Algoritmo 4.26 Disparity: method 1 2 3 4 method Action put(DirAddr val); let row = val.addr/size; let col = val.addr%size; let localD = absSub(row,col); 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 DispAddr dispA = DispAddr{disp:localD, addr:val.addr/size, color:BLUE}; if(val.dir == BLUE) begin dispA.color = GREEN; dispA.disp = 1; fout.enq(dispA); end else if(val.dir == GREEN) begin if(row >= col) begin dispA.color = BLUE; end else if(row < col) begin dispA.color = RED; end fout.enq(dispA); end endmethod: put 23 24 25 26 27 28 29 30 31 method Action deq() if(!ready); fout.deq(); if(cnt!=fromInteger(width-1)) cnt<=cnt+1; else begin cnt<=0; ready<=True; end endmethod: deq 32 33 method DispAddr get() = fout.first; i i i i