URL
https://opencores.org/ocsvn/bluespec-h264/bluespec-h264/trunk
Subversion Repositories bluespec-h264
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 8 to Rev 9
- ↔ Reverse comparison
Rev 8 → Rev 9
/trunk/src/mkPrediction.bsv
14,7 → 14,7
import FIFO::*; |
import FIFOF::*; |
import Vector::*; |
|
import RegFile::*; |
import Connectable::*; |
import GetPut::*; |
import ClientServer::*; |
187,7 → 187,8
Reg#(Bit#(2)) interPassingCount <- mkReg(0); |
Reg#(Vector#(4,Bit#(4))) interRefIdxVector <- mkRegU(); |
Reg#(Vector#(4,Bit#(2))) interSubMbTypeVector <- mkRegU(); |
RFile1#(Bit#(4),Tuple2#(Bit#(14),Bit#(12))) interMvFile <- mkRFile1Full(); |
// Fix this at some point |
RegFile#(Bit#(4),Tuple2#(Bit#(14),Bit#(12))) interMvFile <- mkRegFileFull(); |
Reg#(Bit#(15)) interMvDiffTemp <- mkReg(0); |
FIFO#(Tuple2#(Bit#(15),Bit#(13))) interMvDiff <- mkFIFO; |
Reg#(Bit#(5)) interNewestMv <- mkReg(0); |
/trunk/src/mkDeblockFilter.bsv
487,7 → 487,7
Bit#(2) blockHor = {tpl_1(rowToColumnStoreBlock.first())[2],tpl_1(rowToColumnStoreBlock.first())[0]}; |
//Bit#(1) chromaFlag = tpl_2(rowToColumnStoreBlock.first()); |
Bool storeBottomRightBlock = tpl_3(rowToColumnStoreBlock.first()) == 1; |
$display( "TRACE Deblocking Filter: rowToColumnRotate rotating block (%0d, %0d) rowtoColumnState: %d bottomRightBlock: %d", blockHor, blockVer, rowToColumnState, storeBottomRightBlock); |
|
if(storeBottomRightBlock) // The right bottom block is not complete until the top filtering has occured |
// It has to be rotated to the column major ordering used in the top vector |
// memory |
497,22 → 497,23
Bit#(PicWidthSz) adjustedMbHor = ((currMbHor==0) ? (picWidth-1) : truncate(currMbHor-1)); |
|
case(rowToColumnState) |
2'b00: data_out = {(rowToColumnStore[3].first())[31:24], (rowToColumnStore[2].first())[31:24], |
(rowToColumnStore[1].first())[31:24], (rowToColumnStore[0].first())[31:24]}; |
2'b00: data_out = {(rowToColumnStore[3].first())[7:0], (rowToColumnStore[2].first())[7:0], |
(rowToColumnStore[1].first())[7:0], (rowToColumnStore[0].first())[7:0]}; |
|
2'b01: data_out = {(rowToColumnStore[3].first())[23:16], (rowToColumnStore[2].first())[23:16], |
2'b01: data_out = {(rowToColumnStore[3].first())[15:8], (rowToColumnStore[2].first())[15:8], |
(rowToColumnStore[1].first())[15:8], (rowToColumnStore[0].first())[15:8]}; |
|
2'b10: data_out = {(rowToColumnStore[3].first())[23:16], (rowToColumnStore[2].first())[23:16], |
(rowToColumnStore[1].first())[23:16], (rowToColumnStore[0].first())[23:16]}; |
|
2'b10: data_out = {(rowToColumnStore[3].first())[15:8], (rowToColumnStore[2].first())[15:8], |
(rowToColumnStore[1].first())[15:8], (rowToColumnStore[0].first())[15:8]}; |
|
2'b11: begin |
data_out = {(rowToColumnStore[3].first())[7:0], (rowToColumnStore[2].first())[7:0], |
(rowToColumnStore[1].first())[7:0], (rowToColumnStore[0].first())[7:0]}; |
data_out = {(rowToColumnStore[3].first())[31:24], (rowToColumnStore[2].first())[31:24], |
(rowToColumnStore[1].first())[31:24], (rowToColumnStore[0].first())[31:24]}; |
mapM_(deque, rowToColumnStore); // Deq the vector elements |
rowToColumnStoreBlock.deq(); |
end |
endcase |
$display( "TRACE Deblocking Filter: rowToColumnRotate rotating block (%0d, %0d) rowtoColumnState: %d bottomRightBlock: %d, data: %h", blockHor, blockVer, rowToColumnState, storeBottomRightBlock, data_out); |
// The block hor calculation may be questionable... between U and V. |
if(chromaFlag == 0) |
begin |
527,37 → 528,37
else // pass data along to vertical filter |
begin |
rowToColumnState <= rowToColumnState + 1; |
Bit#(32) data_out = 0; |
case(rowToColumnState) |
2'b00: verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()), |
{(rowToColumnStore[3].first())[7:0], |
(rowToColumnStore[2].first())[7:0], |
(rowToColumnStore[1].first())[7:0], |
(rowToColumnStore[0].first())[7:0]}, |
tpl_2(rowToColumnStoreBlock.first()))); |
2'b01: verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()), |
{(rowToColumnStore[3].first())[15:8], |
(rowToColumnStore[2].first())[15:8], |
(rowToColumnStore[1].first())[15:8], |
(rowToColumnStore[0].first())[15:8]}, |
tpl_2(rowToColumnStoreBlock.first()))); |
2'b10: verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()), |
{(rowToColumnStore[3].first())[23:16], |
(rowToColumnStore[2].first())[23:16], |
(rowToColumnStore[1].first())[23:16], |
(rowToColumnStore[0].first())[23:16]}, |
tpl_2(rowToColumnStoreBlock.first()))); |
2'b00: data_out = {(rowToColumnStore[3].first())[7:0], |
(rowToColumnStore[2].first())[7:0], |
(rowToColumnStore[1].first())[7:0], |
(rowToColumnStore[0].first())[7:0]}; |
|
2'b01: data_out = {(rowToColumnStore[3].first())[15:8], |
(rowToColumnStore[2].first())[15:8], |
(rowToColumnStore[1].first())[15:8], |
(rowToColumnStore[0].first())[15:8]}; |
|
2'b10: data_out = {(rowToColumnStore[3].first())[23:16], |
(rowToColumnStore[2].first())[23:16], |
(rowToColumnStore[1].first())[23:16], |
(rowToColumnStore[0].first())[23:16]}; |
|
2'b11: begin |
verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()), |
{(rowToColumnStore[3].first())[31:24], |
(rowToColumnStore[2].first())[31:24], |
(rowToColumnStore[1].first())[31:24], |
(rowToColumnStore[0].first())[31:24]}, |
tpl_2(rowToColumnStoreBlock.first()))); |
|
data_out = {(rowToColumnStore[3].first())[31:24], |
(rowToColumnStore[2].first())[31:24], |
(rowToColumnStore[1].first())[31:24], |
(rowToColumnStore[0].first())[31:24]}; |
mapM_(deque, rowToColumnStore); // Deq the vector elements |
rowToColumnStoreBlock.deq(); |
end |
endcase |
verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()), |
data_out, |
tpl_2(rowToColumnStoreBlock.first()))); |
|
$display( "TRACE Deblocking Filter: rowToColumnRotate rotating block (%0d, %0d) rowtoColumnState: %d bottomRightBlock: %d, data: %h", blockHor, blockVer, rowToColumnState, storeBottomRightBlock, data_out); |
end |
endrule |
|
569,7 → 570,6
Bit#(1) chromaFlagLocal = tpl_2(columnToRowStoreBlock.first()); |
Bit#(2) blockHor = {blockNumCols[2],blockNumCols[0]}; |
Bit#(2) blockVer = {blockNumCols[3],blockNumCols[1]} - 1; // Subtract 1, because these output values lag slightly |
$write( "TRACE Deblocking Filter: columnToRow rotate block(%0d, %0d) columnToRowState %d, topValues: %d", blockHor, blockVer, columnToRowState, topValues); |
columnToRowState <= columnToRowState + 1; |
|
case(columnToRowState) // not to sure about this ordering |
595,6 → 595,7
columnToRowStoreBlock.deq(); |
end |
endcase |
$write( "TRACE Deblocking Filter: columnToRow rotate block(%0d, %0d) columnToRowState %d, topValues: %d, data: %h", blockHor, blockVer, columnToRowState, topValues, data_out); |
|
Bit#(PicWidthSz) currMbHorT = truncate(currMbHor); |
// Actually send the data out. This stuff is not the bottom row or left column, and is therefore done. |
653,7 → 654,7
process <= Cleanup; |
end |
//check for last macro block |
leftVector.upd({1'b0,blockVer,columnToRowState},data_out); |
leftVector.upd({1'b0,blockVer,columnToRowState}, {data_out[7:0], data_out[15:8],data_out[23:16],data_out[31:24]}); |
end |
else |
begin |
662,7 → 663,7
begin |
process <= Cleanup; |
end |
leftVector.upd({1'b1,blockHor[1],blockVer[0],columnToRowState},data_out); |
leftVector.upd({1'b1,blockHor[1],blockVer[0],columnToRowState}, {data_out[7:0], data_out[15:8],data_out[23:16],data_out[31:24]}); |
end |
end |
|
756,7 → 757,8
Vector#(3,Bit#(5)) tc0MbLeft = arrayToVector(tc0_table[indexA]); |
if(filter_test({pixelq[15:0],pixelp[31:16]},alphaMbLeft,betaMbLeft)) |
begin |
let bsData = bSfile.sub((chromaFlag==0?blockNum:{blockNum[1:0],pixelVer[1],1'b0})); |
//let bsData = bSfile.sub((chromaFlag==0?blockNum:{blockNum[1:0],pixelVer[1],1'b0})); |
let bsData = bSfile.sub(blockNum); |
result = filter_input({pixelq,pixelp},chromaFlag==1,tpl_1(bsData),alphaMbLeft,betaMbLeft,tc0MbLeft); |
end |
end |
764,10 → 766,12
begin |
if(filter_test({pixelq[15:0],pixelp[31:16]},alphaInternal,betaInternal)) |
begin |
let bSData = bSfile.sub((chromaFlag==0?blockNum:{blockNum[1:0],pixelVer[1],1'b0})); |
//let bSData = bSfile.sub((chromaFlag==0?blockNum:{blockNum[1:0],pixelVer[1],1'b0})); |
let bSData = bSfile.sub(blockNum); |
result = filter_input({pixelq,pixelp},chromaFlag==1,tpl_1(bSData),alphaInternal,betaInternal,tc0Internal); |
end |
end |
Bit#(PicWidthSz) currMbHorT = truncate(currMbHor); |
|
if(leftEdge) |
begin |
775,7 → 779,7
//Check to store this value to the memory. I think the rotation is off here. |
// I should also adjust the vertical Mb... Figure out MbHorT |
Bit#(PicWidthSz) currMbHorT = truncate(currMbHor); |
Bit#(PicHeightSz) adjustedMbVer = currMbHorT==0 ? currMbVer-1 : currMbVer; |
Bit#(PicHeightSz) adjustedMbVer = ((currMbHorT==0) && (currMbVer!=0)) ? currMbVer-1 : currMbVer; |
Bit#(PicWidthSz) adjustedMbHor = currMbHorT==0 ? picWidth-1 : currMbHorT-1; |
// In this case we buffer the bottom vertical element, since it has to be used again |
if((blockVer == 3) || ((chromaFlag == 1) && (blockVer == 1))) |
793,7 → 797,7
$display("TRACE mkDeblockFilter: (Left Vector) Outputting Luma ver{mbVer, blockVer(2), state(2)}: %b, hor{mbHor, blockHor(2)}: %b, data: %h",{adjustedMbVer,blockVer,pixelNum},{adjustedMbHor,2'b11} ,result[31:0] ); |
outfifo.enq(DFBLuma {ver:{adjustedMbVer,blockVer,pixelVer}, |
hor:{adjustedMbHor,2'b11}, |
data:result[31:0]}); |
data:{result[7:0],result[15:8],result[23:16],result[31:24]}}); |
end |
else |
begin |
801,7 → 805,7
outfifo.enq(DFBChroma {uv:blockHor[1], |
ver:{adjustedMbVer,blockVer[0],pixelVer}, |
hor:{adjustedMbHor,1'b1}, |
data:result[31:0]}); |
data:{result[7:0],result[15:8],result[23:16],result[31:24]}}); |
end |
end |
else |
920,7 → 924,7
Bit#(5) betaMbTop = beta_table[indexB]; |
Vector#(3,Bit#(5)) tc0MbTop = arrayToVector(tc0_table[indexA]); |
tempV <- topVector.sub({blockHor,columnNumber}); |
$display( "TRACE Deblocking Filter: vertical P (top) addr %h, data %h ",{blockVer,columnNumber}, tempV); |
$display( "TRACE Deblocking Filter: vertical P (top) addr %h, orig data %h ",{blockVer,columnNumber}, tempV); |
alpha = alphaMbTop; |
beta = betaMbTop; |
tc0 = tc0MbTop; |
929,7 → 933,7
begin |
// We read this value from the original vector |
tempV <- workVectorCols.sub({blockHor, columnNumber}); |
$display( "TRACE Deblocking Filter: vertical P (work) addr %h, data %h ",{blockHor, blockVer - 1, columnNumber}, tempV); |
$display( "TRACE Deblocking Filter: vertical P (work) addr %h, orig data %h ",{blockHor, blockVer - 1, columnNumber}, tempV); |
alpha = alphaInternal; |
beta = betaInternal; |
tc0 = tc0Internal; |
940,10 → 944,12
resultV = {tpl_2(verticalFilterBlock.first()),tempV}; |
|
// Apply filter, only if filter test passes, and we are either filtering the top edge, or we aren't on the top edge |
$display( "TRACE Deblocking Filter: vertical Filter test: P1P0Q0Q1: %h",{workV[15:8],workV[7:0],tempV[31:24],tempV[23:16]}); |
if((filter_test({workV[15:8],workV[7:0],tempV[31:24],tempV[23:16]},alpha,beta)) && (!topEdge || filterTopMbEdgeFlag)) |
begin |
let bsData = bSfile.sub((chromaFlag==0?{blockHor[1],blockVer[1],blockHor[0],blockVer[0]}: |
{blockHor[0],blockVer[0],columnNumber})); |
let bsData = bSfile.sub(blockNumCols); |
//let bsData = bSfile.sub((chromaFlag==0?{blockHor[1],blockVer[1],blockHor[0],blockVer[0]}: |
// {blockHor[0],blockVer[0],1'b0,columnNumber[1]})); |
resultV = filter_input(resultV,chromaFlag==1,tpl_2(bsData),alpha,beta,tc0); |
end |
//Write out the result data 31:0 are the done q values |
993,6 → 999,7
end |
end |
|
$display( "TRACE Deblocking Filter: vertical P data %h ", resultV[31:0]); |
$display( "TRACE Deblocking Filter: vertical Q (work) addr %h, data %h, original data: %h ",{blockHor,blockVer,columnNumber}, resultV[63:32], workV); |
|
workVectorCols.upd({blockHor,columnNumber}, resultV[63:32]); |
1047,6 → 1054,8
begin |
chromaFlag <= 0; |
process <= Passing; |
Bit#(PicWidthSz) temp = truncate(currMbHor); |
parameterMemReqQ.enq(StoreReq {addr:temp,data:{curr_intra,curr_qpc,curr_qpy}}); |
left_intra <= curr_intra; |
left_qpc <= curr_qpc; |
left_qpy <= curr_qpy; |
/trunk/src/mkFinalOutput.bsv
65,21 → 65,25
index <= index + 4; |
if(infifo.first() matches tagged YUV .xdata) |
begin |
$display("OUT %h", xdata[31:24]); |
$display("OUT %h", xdata[23:16]); |
$display("OUT %h", xdata[15:8]); |
$display("OUT %h", xdata[7:0]); |
if( xdata[7:0] != rfile.sub(index)) |
begin |
$display("ccl5finalout ERROR %h, index %d", xdata[7:0], index); |
$display("mkFinalOutput: ccl5finalout ERROR %h, index %d", xdata[7:0], index); |
end |
if( xdata[15:8] != rfile.sub(index + 1)) |
begin |
$display("ccl5finalout ERROR %h, index %d", xdata[15:8], index + 1); |
$display("mkFinalOutput: ccl5finalout ERROR %h, index %d", xdata[15:8], index + 1); |
end |
if( xdata[23:16] != rfile.sub(index+2)) |
begin |
$display("ccl5finalout ERROR %h, index %d", xdata[23:16], index+2); |
$display("mkFinalOutput: ccl5finalout ERROR %h, index %d", xdata[23:16], index+2); |
end |
if( xdata[31:24] != rfile.sub(index+3)) |
begin |
$display("ccl5finalout ERROR %h, index %d", xdata[31:24], index+3); |
$display("mkFinalOutput: ccl5finalout ERROR %h, index %d", xdata[31:24], index+3); |
end |
infifo.deq(); |
end |
/trunk/src/H264Types.bsv
11,16 → 11,16
import Vector::*; |
import RegFile::*; |
|
typedef 7 PicWidthSz;//number of bits to represent the horizontal position of a MB |
typedef 7 PicHeightSz;//number of bits to represent the vertical position of a MB |
typedef 14 PicAreaSz;//number of bits to represent the 2D position of a MB (max 16) |
Bit#(PicWidthSz) maxPicWidthInMB=127;//(2^PicWidthSz)-1 |
typedef 6 PicWidthSz;//number of bits to represent the horizontal position of a MB |
typedef 6 PicHeightSz;//number of bits to represent the vertical position of a MB |
typedef 12 PicAreaSz;//number of bits to represent the 2D position of a MB (max 16) |
Bit#(PicWidthSz) maxPicWidthInMB=63;//(2^PicWidthSz)-1 |
|
Bit#(PicAreaSz) maxPicAreaInMB=14'b10000000000000; |
typedef 25 FrameBufferSz;//number of bits to address the frame buffer (5+PicAreaSz+6) |
typedef 16 MaxRefFrames;//max number of frames in the frame buffer |
Bit#(5) maxRefFrames=16;//max number of frames in the frame buffer |
Bit#(FrameBufferSz) frameBufferSize=25'b0110110000000000000000000;//size of frame buffer ((maxRefFrames+2)*maxPicAreaInMB*1.5*64) |
Bit#(PicAreaSz) maxPicAreaInMB=12'b10000000000000; |
typedef 19 FrameBufferSz;//number of bits to address the frame buffer (5+PicAreaSz+6) |
typedef 4 MaxRefFrames;//max number of frames in the frame buffer |
Bit#(5) maxRefFrames=4;//max number of frames in the frame buffer |
Bit#(FrameBufferSz) frameBufferSize=19'h7ffff;//size of frame buffer ((maxRefFrames+2)*maxPicAreaInMB*1.5*64) |
|
Integer entropyDec_infifo_size = 2; |
Integer inverseTrans_infifo_size = 8; |
41,16 → 41,18
|
interface RFile1#(type idx_t, type d_t); |
method Action upd(idx_t x1, d_t x2); |
method d_t sub(idx_t x1); |
method ActionValue#(d_t) sub(idx_t x1); |
endinterface |
|
module mkRFile1#( idx_t lo, idx_t hi ) ( RFile1#(idx_t, d_t) ) |
provisos (Bits#(idx_t, si),Bits#(d_t, sa)); |
RegFile#(idx_t,d_t) rf <- mkRegFile(lo,hi); |
RWire#(Bit#(0)) sched_hack <- mkRWire(); |
method Action upd( idx_t index, d_t data ); |
rf.upd( index, data ); |
endmethod |
method d_t sub( idx_t index ); |
method ActionValue#(d_t) sub( idx_t index ); |
sched_hack.wset(0); |
return rf.sub(index); |
endmethod |
endmodule |
58,10 → 60,12
module mkRFile1Full( RFile1#(idx_t, d_t) ) |
provisos (Bits#(idx_t, si),Bits#(d_t, sa),Bounded#(idx_t) ); |
RegFile#(idx_t,d_t) rf <- mkRegFileFull(); |
RWire#(Bit#(0)) sched_hack <- mkRWire(); |
method Action upd( idx_t index, d_t data ); |
rf.upd( index, data ); |
endmethod |
method d_t sub( idx_t index ); |
method ActionValue#(d_t) sub( idx_t index ); |
sched_hack.wset(0); |
return rf.sub(index); |
endmethod |
endmodule |
/trunk/src/mkInterpolator.bsv
449,7 → 449,7
Vector#(4,Bit#(15)) readdata = replicate(0); |
if(yfracl==0) |
begin |
readdata = workFile.sub({(1-workFileFlag),1'b0,work2VerNum[1],work2HorNum,work2VerNum[0]}); |
readdata <- workFile.sub({(1-workFileFlag),1'b0,work2VerNum[1],work2HorNum,work2VerNum[0]}); |
for(Integer ii=0; ii<4; ii=ii+1) |
tempResult8[ii] = (readdata[ii])[12:5]; |
resultFile.upd({work2VerNum[1],work2HorNum,work2VerNum[0]},tempResult8); |
475,7 → 475,7
end |
else if(xfracl==0 || xfracl==2)//vertical interpolation |
begin |
readdata = workFile.sub({(1-workFileFlag),work2VerNum,work2HorNum[0]}); |
readdata <- workFile.sub({(1-workFileFlag),work2VerNum,work2HorNum[0]}); |
for(Integer ii=0; ii<4; ii=ii+1) |
begin |
tempResult8[ii] = interpolate15to8(work2Vector15[ii],work2Vector15[ii+4],work2Vector15[ii+8],work2Vector15[ii+12],work2Vector15[ii+16],readdata[ii]); |
525,7 → 525,7
offset = offset-2; |
if(yfracl == 2) |
begin |
readdata = workFile.sub({(1-workFileFlag),work2VerNum[2:0],work2HorNum}); |
readdata <- workFile.sub({(1-workFileFlag),work2VerNum[2:0],work2HorNum}); |
for(Integer ii=0; ii<8; ii=ii+1) |
work2Vector15Next[ii] = work2Vector15[ii+4]; |
for(Integer ii=0; ii<4; ii=ii+1) |
543,8 → 543,8
end |
end |
else |
begin |
Vector#(4,Bit#(8)) readdata8 = storeFile.sub({(1-workFileFlag),work2VerNum[2:0],work2HorNum}); |
begin |
Vector#(4,Bit#(8)) readdata8 <- storeFile.sub({(1-workFileFlag),work2VerNum[2:0],work2HorNum}); |
for(Integer ii=0; ii<8; ii=ii+1) |
work2Vector8Next[ii] = work2Vector8[ii+4]; |
for(Integer ii=0; ii<4; ii=ii+1) |
564,7 → 564,7
verOffset = reqdata.offset; |
else |
verOffset = reqdata.offset+1; |
readdata = workFile.sub({(1-workFileFlag),work2VerNum[2:0],(work2HorNum-2+(verOffset==0?0:1))}); |
readdata <- workFile.sub({(1-workFileFlag),work2VerNum[2:0],(work2HorNum-2+(verOffset==0?0:1))}); |
for(Integer ii=0; ii<4; ii=ii+1) |
begin |
Bit#(2) offsetplusii = verOffset+fromInteger(ii); |
747,7 → 747,8
|
rule work2Chroma ( reqregWork2 matches tagged Valid .vdata &&& vdata matches tagged IPWChroma .reqdata &&& !work2Done &&& !work8x8Done ); |
Vector#(16,Bit#(1)) resultReadyNext = resultReady; |
resultFile.upd({work2VerNum[1],work2HorNum,work2VerNum[0]},storeFile.sub({(1-workFileFlag),1'b0,work2VerNum[1],work2HorNum,work2VerNum[0]})); |
Vector#(4,Bit#(8)) resultData <- storeFile.sub({(1-workFileFlag),1'b0,work2VerNum[1],work2HorNum,work2VerNum[0]}); |
resultFile.upd({work2VerNum[1],work2HorNum,work2VerNum[0]},resultData); |
resultReadyNext[{work2VerNum[1],work2HorNum,work2VerNum[0]}] = 1; |
work2HorNum <= work2HorNum+1; |
if(work2HorNum == 3) |
767,7 → 768,8
|
|
rule outputing( !outDone && resultReady[{outBlockNum[1],outPixelNum,outBlockNum[0]}]==1 ); |
outfifo.enq(resultFile.sub({outBlockNum[1],outPixelNum,outBlockNum[0]})); |
Vector#(4,Bit#(8)) outputData <- resultFile.sub({outBlockNum[1],outPixelNum,outBlockNum[0]}); |
outfifo.enq(outputData); |
outPixelNum <= outPixelNum+1; |
if(outPixelNum == 3) |
begin |
/trunk/src/mkBufferControl.bsv
87,7 → 87,7
rule removing ( state==Remove || state==RemoveOutput || state==RemoveFound ); |
if(state!=RemoveFound) |
begin |
Tuple2#(Bit#(16),Bit#(5)) temp = rfile.sub(tempPic); |
Tuple2#(Bit#(16),Bit#(5)) temp <- rfile.sub(tempPic); |
if(tpl_1(temp)==tempNum) |
begin |
state <= RemoveFound; |
100,7 → 100,8
else |
begin |
Bit#(5) tempPrev = shortTermPicListPrev(tempPic); |
rfile.upd(tempPrev,rfile.sub(tempPic)); |
let rData <- rfile.sub(tempPic); |
rfile.upd(tempPrev,rData); |
if(tempCount==picCount) |
begin |
picCount <= picCount-1; |
135,7 → 136,7
rule searching ( state matches tagged Search ); |
if(tempCount<picCount) |
begin |
Tuple2#(Bit#(16),Bit#(5)) temp = rfile.sub(tempPic); |
Tuple2#(Bit#(16),Bit#(5)) temp <- rfile.sub(tempPic); |
if(tpl_1(temp)==tempNum) |
begin |
returnList.enq(Valid tpl_2(temp)); |
151,7 → 152,7
rule listingAll ( state matches tagged ListAll ); |
if(tempCount<picCount) |
begin |
Tuple2#(Bit#(16),Bit#(5)) temp = rfile.sub(tempPic); |
Tuple2#(Bit#(16),Bit#(5)) temp <- rfile.sub(tempPic); |
returnList.enq(Valid tpl_2(temp)); |
tempPic <= shortTermPicListPrev(tempPic); |
tempCount <= tempCount+1; |
273,7 → 274,8
rule clearing ( state matches tagged Clear ); |
if(tempPic<maxRefFrames) |
begin |
if(rfile.sub(tempPic) matches tagged Valid .data &&& picCount!=0) |
let rData <- rfile.sub(tempPic); |
if(rData matches tagged Valid .data &&& picCount!=0) |
picCount <= picCount-1; |
rfile.upd(tempPic,Invalid); |
tempPic <= tempPic+1; |
286,7 → 288,7
rule listingAll ( state matches tagged ListAll ); |
if(tempPic<maxRefFrames) |
begin |
Maybe#(Bit#(5)) temp = rfile.sub(tempPic); |
Maybe#(Bit#(5)) temp <- rfile.sub(tempPic); |
if(temp matches tagged Valid .data) |
returnList.enq(Valid data); |
tempPic <= tempPic+1; |
306,7 → 308,8
endmethod |
|
method Action insert( Bit#(5) frameNum, Bit#(5) slot ) if(state matches tagged Idle); |
if(rfile.sub(frameNum) matches tagged Invalid) |
let rData <- rfile.sub(frameNum); |
if(rData matches tagged Invalid) |
picCount <= picCount+1; |
rfile.upd(frameNum,Valid slot); |
//$display( "TRACE BufferControl: LongTermPicList insert %h %h %h", picCount, frameNum, slot); |
313,7 → 316,8
endmethod |
|
method Action remove( Bit#(5) frameNum ) if(state matches tagged Idle); |
if(rfile.sub(frameNum) matches tagged Invalid) |
let rData <- rfile.sub(frameNum); |
if(rData matches tagged Invalid) |
$display( "ERROR BufferControl: LongTermPicList removing not found"); |
else |
picCount <= picCount-1; |
328,7 → 332,8
endmethod |
|
method Action search( Bit#(5) frameNum ) if(state matches tagged Idle); |
returnList.enq(rfile.sub(frameNum)); |
let rData <- rfile.sub(frameNum); |
returnList.enq(rData); |
//$display( "TRACE BufferControl: LongTermPicList search %h %h", picCount, frameNum); |
endmethod |
|
779,7 → 784,8
if(shortTermPicList.resultSlot() matches tagged Valid .xdata)////////////////////////////////////////////////////////////////////////////////////////// |
begin |
shortTermPicList.deq(); |
tempSlot <= refPicList.sub(refIdx); |
let picListData <- refPicList.sub(refIdx); |
tempSlot <= picListData; |
refPicList.upd(refIdx,xdata); |
refPicListCount <= refIdx+1; |
tempSlot2 <= xdata; |
786,8 → 792,9
end |
else if(longTermPicList.resultSlot() matches tagged Valid .xdata)/////////////////////////////////////////////////////////////////////////////////////may get stuck? |
begin |
let picListData <- refPicList.sub(refIdx); |
longTermPicList.deq(); |
tempSlot <= refPicList.sub(refIdx); |
tempSlot <= picListData; |
refPicList.upd(refIdx,xdata); |
refPicListCount <= refIdx+1; |
tempSlot2 <= xdata; |
796,7 → 803,8
begin |
if(refPicListCount<num_ref_idx_l0_active && tempSlot!=tempSlot2) |
begin |
tempSlot <= refPicList.sub(refPicListCount); |
let picListData <- refPicList.sub(refPicListCount); |
tempSlot <= picListData; |
refPicList.upd(refPicListCount,tempSlot); |
refPicListCount <= refPicListCount+1; |
end |
910,7 → 918,7
|
rule interLumaReq ( inLoadReqQ.first() matches tagged IPLoadLuma .reqdata &&& !lockInterLoads ); |
inLoadReqQ.deq(); |
Bit#(5) slot = refPicList.sub(zeroExtend(reqdata.refIdx)); |
Bit#(5) slot <- refPicList.sub(zeroExtend(reqdata.refIdx)); |
Bit#(FrameBufferSz) addrBase = (zeroExtend(slot)*zeroExtend(frameinmb)*3)<<5; |
Bit#(TAdd#(PicAreaSz,6)) addr = {(zeroExtend(reqdata.ver)*zeroExtend(picWidth)),2'b00}+zeroExtend(reqdata.hor); |
inLoadOutOfBounds.enq({reqdata.horOutOfBounds,(reqdata.hor==0 ? 0 : 1)}); |
920,8 → 928,8
|
|
rule interChromaReq ( inLoadReqQ.first() matches tagged IPLoadChroma .reqdata &&& !lockInterLoads ); |
inLoadReqQ.deq(); |
Bit#(5) slot = refPicList.sub(zeroExtend(reqdata.refIdx)); |
inLoadReqQ.deq(); |
Bit#(5) slot <- refPicList.sub(zeroExtend(reqdata.refIdx)); |
Bit#(FrameBufferSz) addrBase = (zeroExtend(slot)*zeroExtend(frameinmb)*3)<<5; |
Bit#(TAdd#(PicAreaSz,6)) chromaOffset = {frameinmb,6'b000000}; |
Bit#(TAdd#(PicAreaSz,4)) vOffset = 0; |