OpenCores
URL https://opencores.org/ocsvn/bluespec-h264/bluespec-h264/trunk

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [LumaChromaParallel/] [DeblockParallel.bsv] - Blame information for rev 90

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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 90 jamey.hick
 
32
interface ParallelDeblockFilter;
33
 
34
   // Interface for inter-module io
35
   interface Put#(EntropyDecOT) ioinchroma;
36
   interface Put#(EntropyDecOT) ioinluma;
37
   interface Get#(DeblockFilterOT) ioout;
38
 
39
   // Interface for module to memory
40
   interface Client#(MemReq#(TAdd#(PicWidthSz,5),32),MemResp#(32)) mem_client_data;
41
   interface Client#(MemReq#(PicWidthSz,13),MemResp#(13)) mem_client_parameter;
42
 
43
endinterface
44
 
45
 
46
module mkDeblockFilterParallel (ParallelDeblockFilter);
47 88 jamey.hick
  FIFO#(ChromaFlag) dataTags <- mkFIFO();
48
  FIFO#(ChromaFlag) parameterTags <- mkFIFO();
49
  IDeblockFilter deblockfilterluma <- mkDeblockFilter(Luma);
50
  IDeblockFilter deblockfilterchroma <- mkDeblockFilter(Chroma);
51
  FIFO#(MemReq#(TAdd#(PicWidthSz,5),32)) dataMemReqQ       <- mkFIFO;
52
  FIFO#(MemReq#(PicWidthSz,13))          parameterMemReqQ  <- mkFIFO;
53
  FIFOF#(DeblockFilterOT) outputFIFOLuma <- mkFIFOF;
54
  FIFOF#(DeblockFilterOT) outputFIFOChroma <- mkFIFOF;
55
  FIFO#(DeblockFilterOT) outputFIFO <- mkFIFO;
56
 
57
  rule memReqChroma;
58
    MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterchroma.mem_client_data.request.get;
59
     dataMemReqQ.enq(req);
60
     if(req matches tagged LoadReq .addrt)
61
       begin
62
          dataTags.enq(Chroma);
63
       end
64
  endrule
65
 
66
  rule memReqLuma;
67
    MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterluma.mem_client_data.request.get;
68
     dataMemReqQ.enq(req);
69
 
70
     if(req matches tagged LoadReq .addrt)
71
       begin
72
          dataTags.enq(Luma);
73
       end
74
  endrule
75
 
76
  rule parameterReqLuma;
77
     MemReq#(PicWidthSz,13) req <- deblockfilterluma.mem_client_parameter.request.get;
78
     parameterMemReqQ.enq(req);
79 90 jamey.hick
 
80 88 jamey.hick
     if(req matches tagged LoadReq .addrt)
81
       begin
82
          parameterTags.enq(Luma);
83
       end
84
  endrule
85
 
86
  rule parameterReqChroma;
87
     MemReq#(PicWidthSz,13) req <- deblockfilterchroma.mem_client_parameter.request.get;
88
     parameterMemReqQ.enq(req);
89
     if(req matches tagged LoadReq .addrt)
90
       begin
91
          parameterTags.enq(Chroma);
92
       end
93
  endrule
94
 
95
   mkConnection(deblockfilterchroma.ioout, fifoToPut(fifofToFifo(outputFIFOChroma)));
96
   mkConnection(deblockfilterluma.ioout, fifoToPut(fifofToFifo(outputFIFOLuma)));
97
 
98
   rule outMatch (outputFIFOLuma.first == outputFIFOChroma.first);
99
      outputFIFOLuma.deq;
100
      outputFIFOChroma.deq;
101
      outputFIFO.enq(outputFIFOLuma.first);
102
   endrule
103
 
104
   rule outLuma(outputFIFOLuma.first matches tagged DFBLuma .data);
105
      outputFIFOLuma.deq;
106
      outputFIFO.enq(outputFIFOLuma.first);
107
   endrule
108
 
109
   rule outChroma(outputFIFOChroma.first matches tagged DFBChroma .data);
110
      outputFIFOChroma.deq;
111
      outputFIFO.enq(outputFIFOChroma.first);
112
   endrule
113
 
114
  interface Client mem_client_data;
115
    interface Get request  = fifoToGet(dataMemReqQ);
116
    interface Put response;
117
       method Action put(MemResp#(32) dataIn);
118
          if(dataTags.first == Luma)
119
             begin
120 90 jamey.hick
 
121 88 jamey.hick
                deblockfilterluma.mem_client_data.response.put(dataIn);
122
                dataTags.deq;
123
             end
124
          else
125
             begin
126 90 jamey.hick
 
127 88 jamey.hick
                deblockfilterchroma.mem_client_data.response.put(dataIn);
128
                dataTags.deq;
129
             end
130
       endmethod
131
    endinterface
132
  endinterface
133
 
134
  interface Client mem_client_parameter;
135
    interface Get request  = fifoToGet(parameterMemReqQ);
136
    interface Put response;
137
      method Action put(MemResp#(13) dataIn);
138
          if(parameterTags.first == Luma)
139
             begin
140 90 jamey.hick
 
141 88 jamey.hick
                deblockfilterluma.mem_client_parameter.response.put(dataIn);
142
                parameterTags.deq;
143
             end
144
          else
145
             begin
146
                deblockfilterchroma.mem_client_parameter.response.put(dataIn);
147
                parameterTags.deq;
148
             end
149
       endmethod
150
    endinterface
151
  endinterface
152
 
153
  interface Get ioout = fifoToGet(outputFIFO);
154
 
155
 
156 90 jamey.hick
  interface Put ioinchroma;
157 88 jamey.hick
     method Action put(EntropyDecOT dataIn);
158
 
159
      case (dataIn) matches
160
        tagged  PBoutput .xdata: begin
161
           match {.chromaFlag, .vec} = xdata;
162 90 jamey.hick
           if(chromaFlag == Chroma)
163
              begin
164
 
165
                 deblockfilterchroma.ioin.put(dataIn);
166
              end
167
        end
168
 
169
         default:   begin
170
                       deblockfilterchroma.ioin.put(dataIn);
171
                    end
172
      endcase
173
     endmethod
174
  endinterface
175
 
176
 
177
  interface Put ioinluma;
178
     method Action put(EntropyDecOT dataIn);
179
 
180
      case (dataIn) matches
181
        tagged  PBoutput .xdata: begin
182
           match {.chromaFlag, .vec} = xdata;
183 88 jamey.hick
           if(chromaFlag == Luma)
184
              begin
185 90 jamey.hick
 
186 88 jamey.hick
                 deblockfilterluma.ioin.put(dataIn);
187
              end
188
        end
189
 
190
         default:   begin
191
                       deblockfilterluma.ioin.put(dataIn);
192
                    end
193
      endcase
194
     endmethod
195
  endinterface
196 90 jamey.hick
 
197
 
198 88 jamey.hick
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.