1 |
88 |
jamey.hick |
// The MIT License
|
2 |
|
|
|
3 |
|
|
// Copyright (c) 2006-2007 Massachusetts Institute of Technology
|
4 |
|
|
|
5 |
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
|
|
// of this software and associated documentation files (the "Software"), to deal
|
7 |
|
|
// in the Software without restriction, including without limitation the rights
|
8 |
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
|
|
// copies of the Software, and to permit persons to whom the Software is
|
10 |
|
|
// furnished to do so, subject to the following conditions:
|
11 |
|
|
|
12 |
|
|
// The above copyright notice and this permission notice shall be included in
|
13 |
|
|
// all copies or substantial portions of the Software.
|
14 |
|
|
|
15 |
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 |
|
|
// THE SOFTWARE.
|
22 |
|
|
import GetPut::*;
|
23 |
|
|
import ClientServer::*;
|
24 |
|
|
import H264Types::*;
|
25 |
|
|
import FIFOF::*;
|
26 |
|
|
import FIFO::*;
|
27 |
|
|
import IDeblockFilter::*;
|
28 |
|
|
import mkDeblockFilter::*;
|
29 |
|
|
import Connectable::*;
|
30 |
|
|
|
31 |
|
|
(*synthesize*)
|
32 |
|
|
module mkDeblockFilterParallel (IDeblockFilter);
|
33 |
|
|
FIFO#(ChromaFlag) dataTags <- mkFIFO();
|
34 |
|
|
FIFO#(ChromaFlag) parameterTags <- mkFIFO();
|
35 |
|
|
IDeblockFilter deblockfilterluma <- mkDeblockFilter(Luma);
|
36 |
|
|
IDeblockFilter deblockfilterchroma <- mkDeblockFilter(Chroma);
|
37 |
|
|
FIFO#(MemReq#(TAdd#(PicWidthSz,5),32)) dataMemReqQ <- mkFIFO;
|
38 |
|
|
FIFO#(MemReq#(PicWidthSz,13)) parameterMemReqQ <- mkFIFO;
|
39 |
|
|
FIFOF#(DeblockFilterOT) outputFIFOLuma <- mkFIFOF;
|
40 |
|
|
FIFOF#(DeblockFilterOT) outputFIFOChroma <- mkFIFOF;
|
41 |
|
|
FIFO#(DeblockFilterOT) outputFIFO <- mkFIFO;
|
42 |
|
|
|
43 |
|
|
rule memReqChroma;
|
44 |
|
|
MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterchroma.mem_client_data.request.get;
|
45 |
|
|
dataMemReqQ.enq(req);
|
46 |
|
|
if(req matches tagged LoadReq .addrt)
|
47 |
|
|
begin
|
48 |
|
|
dataTags.enq(Chroma);
|
49 |
|
|
end
|
50 |
|
|
endrule
|
51 |
|
|
|
52 |
|
|
rule memReqLuma;
|
53 |
|
|
MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterluma.mem_client_data.request.get;
|
54 |
|
|
dataMemReqQ.enq(req);
|
55 |
|
|
|
56 |
|
|
if(req matches tagged LoadReq .addrt)
|
57 |
|
|
begin
|
58 |
|
|
dataTags.enq(Luma);
|
59 |
|
|
end
|
60 |
|
|
endrule
|
61 |
|
|
|
62 |
|
|
rule parameterReqLuma;
|
63 |
|
|
MemReq#(PicWidthSz,13) req <- deblockfilterluma.mem_client_parameter.request.get;
|
64 |
|
|
parameterMemReqQ.enq(req);
|
65 |
|
|
|
66 |
|
|
if(req matches tagged LoadReq .addrt)
|
67 |
|
|
begin
|
68 |
|
|
parameterTags.enq(Luma);
|
69 |
|
|
end
|
70 |
|
|
endrule
|
71 |
|
|
|
72 |
|
|
rule parameterReqChroma;
|
73 |
|
|
MemReq#(PicWidthSz,13) req <- deblockfilterchroma.mem_client_parameter.request.get;
|
74 |
|
|
parameterMemReqQ.enq(req);
|
75 |
|
|
if(req matches tagged LoadReq .addrt)
|
76 |
|
|
begin
|
77 |
|
|
parameterTags.enq(Chroma);
|
78 |
|
|
end
|
79 |
|
|
endrule
|
80 |
|
|
|
81 |
|
|
mkConnection(deblockfilterchroma.ioout, fifoToPut(fifofToFifo(outputFIFOChroma)));
|
82 |
|
|
mkConnection(deblockfilterluma.ioout, fifoToPut(fifofToFifo(outputFIFOLuma)));
|
83 |
|
|
|
84 |
|
|
rule outMatch (outputFIFOLuma.first == outputFIFOChroma.first);
|
85 |
|
|
outputFIFOLuma.deq;
|
86 |
|
|
outputFIFOChroma.deq;
|
87 |
|
|
outputFIFO.enq(outputFIFOLuma.first);
|
88 |
|
|
endrule
|
89 |
|
|
|
90 |
|
|
rule outLuma(outputFIFOLuma.first matches tagged DFBLuma .data);
|
91 |
|
|
outputFIFOLuma.deq;
|
92 |
|
|
outputFIFO.enq(outputFIFOLuma.first);
|
93 |
|
|
endrule
|
94 |
|
|
|
95 |
|
|
rule outChroma(outputFIFOChroma.first matches tagged DFBChroma .data);
|
96 |
|
|
outputFIFOChroma.deq;
|
97 |
|
|
outputFIFO.enq(outputFIFOChroma.first);
|
98 |
|
|
endrule
|
99 |
|
|
|
100 |
|
|
interface Client mem_client_data;
|
101 |
|
|
interface Get request = fifoToGet(dataMemReqQ);
|
102 |
|
|
interface Put response;
|
103 |
|
|
method Action put(MemResp#(32) dataIn);
|
104 |
|
|
if(dataTags.first == Luma)
|
105 |
|
|
begin
|
106 |
|
|
deblockfilterluma.mem_client_data.response.put(dataIn);
|
107 |
|
|
dataTags.deq;
|
108 |
|
|
end
|
109 |
|
|
else
|
110 |
|
|
begin
|
111 |
|
|
deblockfilterchroma.mem_client_data.response.put(dataIn);
|
112 |
|
|
dataTags.deq;
|
113 |
|
|
end
|
114 |
|
|
endmethod
|
115 |
|
|
endinterface
|
116 |
|
|
endinterface
|
117 |
|
|
|
118 |
|
|
interface Client mem_client_parameter;
|
119 |
|
|
interface Get request = fifoToGet(parameterMemReqQ);
|
120 |
|
|
interface Put response;
|
121 |
|
|
method Action put(MemResp#(13) dataIn);
|
122 |
|
|
if(parameterTags.first == Luma)
|
123 |
|
|
begin
|
124 |
|
|
deblockfilterluma.mem_client_parameter.response.put(dataIn);
|
125 |
|
|
parameterTags.deq;
|
126 |
|
|
end
|
127 |
|
|
else
|
128 |
|
|
begin
|
129 |
|
|
deblockfilterchroma.mem_client_parameter.response.put(dataIn);
|
130 |
|
|
parameterTags.deq;
|
131 |
|
|
end
|
132 |
|
|
endmethod
|
133 |
|
|
endinterface
|
134 |
|
|
endinterface
|
135 |
|
|
|
136 |
|
|
interface Get ioout = fifoToGet(outputFIFO);
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
interface Put ioin;
|
140 |
|
|
method Action put(EntropyDecOT dataIn);
|
141 |
|
|
|
142 |
|
|
case (dataIn) matches
|
143 |
|
|
tagged PBoutput .xdata: begin
|
144 |
|
|
match {.chromaFlag, .vec} = xdata;
|
145 |
|
|
if(chromaFlag == Luma)
|
146 |
|
|
begin
|
147 |
|
|
deblockfilterluma.ioin.put(dataIn);
|
148 |
|
|
end
|
149 |
|
|
else
|
150 |
|
|
begin
|
151 |
|
|
deblockfilterchroma.ioin.put(dataIn);
|
152 |
|
|
end
|
153 |
|
|
end
|
154 |
|
|
|
155 |
|
|
default: begin
|
156 |
|
|
deblockfilterluma.ioin.put(dataIn);
|
157 |
|
|
deblockfilterchroma.ioin.put(dataIn);
|
158 |
|
|
end
|
159 |
|
|
endcase
|
160 |
|
|
endmethod
|
161 |
|
|
endinterface
|
162 |
|
|
endmodule
|