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

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [LumaChromaParallel/] [DeblockParallel.bsv] - Diff between revs 91 and 100

Only display areas with differences | Details | Blame | View Log

Rev 91 Rev 100
// The MIT License
// The MIT License
// Copyright (c) 2006-2007 Massachusetts Institute of Technology
// Copyright (c) 2006-2007 Massachusetts Institute of Technology
// Permission is hereby granted, free of charge, to any person obtaining a copy
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// THE SOFTWARE.
import GetPut::*;
import GetPut::*;
import ClientServer::*;
import ClientServer::*;
import H264Types::*;
import H264Types::*;
import FIFOF::*;
import FIFOF::*;
import FIFO::*;
import FIFO::*;
import IDeblockFilter::*;
import IDeblockFilter::*;
import mkDeblockFilter::*;
import mkDeblockFilter::*;
import Connectable::*;
import Connectable::*;
interface ParallelDeblockFilter;
interface ParallelDeblockFilter;
   // Interface for inter-module io
   // Interface for inter-module io
   interface Put#(EntropyDecOT) ioinchroma;
   interface Put#(EntropyDecOT) ioinchroma;
   interface Put#(EntropyDecOT) ioinluma;
   interface Put#(EntropyDecOT) ioinluma;
   interface Get#(DeblockFilterOT) ioout;
   interface Get#(DeblockFilterOT) ioout;
   // Interface for module to memory
   // Interface for module to memory
   interface Client#(MemReq#(TAdd#(PicWidthSz,5),32),MemResp#(32)) mem_client_data;
   interface Client#(MemReq#(TAdd#(PicWidthSz,5),32),MemResp#(32)) mem_client_data;
   interface Client#(MemReq#(PicWidthSz,13),MemResp#(13)) mem_client_parameter;
   interface Client#(MemReq#(PicWidthSz,13),MemResp#(13)) mem_client_parameter;
endinterface
endinterface
module mkDeblockFilterParallel (ParallelDeblockFilter);
module mkDeblockFilterParallel (ParallelDeblockFilter);
  FIFO#(ChromaFlag) dataTags <- mkFIFO();
  FIFO#(ChromaFlag) dataTags <- mkFIFO();
  FIFO#(ChromaFlag) parameterTags <- mkFIFO();
  FIFO#(ChromaFlag) parameterTags <- mkFIFO();
  IDeblockFilter deblockfilterluma <- mkDeblockFilter(Luma);
  IDeblockFilter deblockfilterluma <- mkDeblockFilter(Luma);
  IDeblockFilter deblockfilterchroma <- mkDeblockFilter(Chroma);
  IDeblockFilter deblockfilterchroma <- mkDeblockFilter(Chroma);
  FIFO#(MemReq#(TAdd#(PicWidthSz,5),32)) dataMemReqQ       <- mkFIFO;
  FIFO#(MemReq#(TAdd#(PicWidthSz,5),32)) dataMemReqQ       <- mkFIFO;
  FIFO#(MemReq#(PicWidthSz,13))          parameterMemReqQ  <- mkFIFO;
  FIFO#(MemReq#(PicWidthSz,13))          parameterMemReqQ  <- mkFIFO;
  FIFOF#(DeblockFilterOT) outputFIFOLuma <- mkFIFOF;
  FIFOF#(DeblockFilterOT) outputFIFOLuma <- mkFIFOF;
  FIFOF#(DeblockFilterOT) outputFIFOChroma <- mkFIFOF;
  FIFOF#(DeblockFilterOT) outputFIFOChroma <- mkFIFOF;
  FIFO#(DeblockFilterOT) outputFIFO <- mkFIFO;
  FIFO#(DeblockFilterOT) outputFIFO <- mkFIFO;
  rule memReqChroma;
  rule memReqChroma;
    MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterchroma.mem_client_data.request.get;
    MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterchroma.mem_client_data.request.get;
     dataMemReqQ.enq(req);
     dataMemReqQ.enq(req);
     if(req matches tagged LoadReq .addrt)
     if(req matches tagged LoadReq .addrt)
       begin
       begin
          dataTags.enq(Chroma);
          dataTags.enq(Chroma);
       end
       end
  endrule
  endrule
  rule memReqLuma;
  rule memReqLuma;
    MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterluma.mem_client_data.request.get;
    MemReq#(TAdd#(PicWidthSz,5),32) req <- deblockfilterluma.mem_client_data.request.get;
     dataMemReqQ.enq(req);
     dataMemReqQ.enq(req);
     if(req matches tagged LoadReq .addrt)
     if(req matches tagged LoadReq .addrt)
       begin
       begin
          dataTags.enq(Luma);
          dataTags.enq(Luma);
       end
       end
  endrule
  endrule
  rule parameterReqLuma;
  rule parameterReqLuma;
     MemReq#(PicWidthSz,13) req <- deblockfilterluma.mem_client_parameter.request.get;
     MemReq#(PicWidthSz,13) req <- deblockfilterluma.mem_client_parameter.request.get;
     parameterMemReqQ.enq(req);
     parameterMemReqQ.enq(req);
     if(req matches tagged LoadReq .addrt)
     if(req matches tagged LoadReq .addrt)
       begin
       begin
          parameterTags.enq(Luma);
          parameterTags.enq(Luma);
       end
       end
  endrule
  endrule
  rule parameterReqChroma;
  rule parameterReqChroma;
     MemReq#(PicWidthSz,13) req <- deblockfilterchroma.mem_client_parameter.request.get;
     MemReq#(PicWidthSz,13) req <- deblockfilterchroma.mem_client_parameter.request.get;
     parameterMemReqQ.enq(req);
     parameterMemReqQ.enq(req);
     if(req matches tagged LoadReq .addrt)
     if(req matches tagged LoadReq .addrt)
       begin
       begin
          parameterTags.enq(Chroma);
          parameterTags.enq(Chroma);
       end
       end
  endrule
  endrule
   mkConnection(deblockfilterchroma.ioout, fifoToPut(fifofToFifo(outputFIFOChroma)));
   mkConnection(deblockfilterchroma.ioout, fifoToPut(fifofToFifo(outputFIFOChroma)));
   mkConnection(deblockfilterluma.ioout, fifoToPut(fifofToFifo(outputFIFOLuma)));
   mkConnection(deblockfilterluma.ioout, fifoToPut(fifofToFifo(outputFIFOLuma)));
   rule outMatch (outputFIFOLuma.first == outputFIFOChroma.first);
   rule outMatch (outputFIFOLuma.first == outputFIFOChroma.first);
      outputFIFOLuma.deq;
      outputFIFOLuma.deq;
      outputFIFOChroma.deq;
      outputFIFOChroma.deq;
      outputFIFO.enq(outputFIFOLuma.first);
      outputFIFO.enq(outputFIFOLuma.first);
   endrule
   endrule
   rule outLuma(outputFIFOLuma.first matches tagged DFBLuma .data);
   rule outLuma(outputFIFOLuma.first matches tagged DFBLuma .data);
      outputFIFOLuma.deq;
      outputFIFOLuma.deq;
      outputFIFO.enq(outputFIFOLuma.first);
      outputFIFO.enq(outputFIFOLuma.first);
   endrule
   endrule
   rule outChroma(outputFIFOChroma.first matches tagged DFBChroma .data);
   rule outChroma(outputFIFOChroma.first matches tagged DFBChroma .data);
      outputFIFOChroma.deq;
      outputFIFOChroma.deq;
      outputFIFO.enq(outputFIFOChroma.first);
      outputFIFO.enq(outputFIFOChroma.first);
   endrule
   endrule
  interface Client mem_client_data;
  interface Client mem_client_data;
    interface Get request  = fifoToGet(dataMemReqQ);
    interface Get request  = fifoToGet(dataMemReqQ);
    interface Put response;
    interface Put response;
       method Action put(MemResp#(32) dataIn);
       method Action put(MemResp#(32) dataIn);
          if(dataTags.first == Luma)
          if(dataTags.first == Luma)
             begin
             begin
                deblockfilterluma.mem_client_data.response.put(dataIn);
                deblockfilterluma.mem_client_data.response.put(dataIn);
                dataTags.deq;
                dataTags.deq;
             end
             end
          else
          else
             begin
             begin
                deblockfilterchroma.mem_client_data.response.put(dataIn);
                deblockfilterchroma.mem_client_data.response.put(dataIn);
                dataTags.deq;
                dataTags.deq;
             end
             end
       endmethod
       endmethod
    endinterface
    endinterface
  endinterface
  endinterface
  interface Client mem_client_parameter;
  interface Client mem_client_parameter;
    interface Get request  = fifoToGet(parameterMemReqQ);
    interface Get request  = fifoToGet(parameterMemReqQ);
    interface Put response;
    interface Put response;
      method Action put(MemResp#(13) dataIn);
      method Action put(MemResp#(13) dataIn);
          if(parameterTags.first == Luma)
          if(parameterTags.first == Luma)
             begin
             begin
                deblockfilterluma.mem_client_parameter.response.put(dataIn);
                deblockfilterluma.mem_client_parameter.response.put(dataIn);
                parameterTags.deq;
                parameterTags.deq;
             end
             end
          else
          else
             begin
             begin
                deblockfilterchroma.mem_client_parameter.response.put(dataIn);
                deblockfilterchroma.mem_client_parameter.response.put(dataIn);
                parameterTags.deq;
                parameterTags.deq;
             end
             end
       endmethod
       endmethod
    endinterface
    endinterface
  endinterface
  endinterface
  interface Get ioout = fifoToGet(outputFIFO);
  interface Get ioout = fifoToGet(outputFIFO);
  interface Put ioinchroma;
  interface Put ioinchroma;
     method Action put(EntropyDecOT dataIn);
     method Action put(EntropyDecOT dataIn);
      case (dataIn) matches
      case (dataIn) matches
        tagged  PBoutput .xdata: begin
        tagged  PBoutput .xdata: begin
           match {.chromaFlag, .vec} = xdata;
           match {.chromaFlag, .vec} = xdata;
           if(chromaFlag == Chroma)
           if(chromaFlag == Chroma)
              begin
              begin
                 deblockfilterchroma.ioin.put(dataIn);
                 deblockfilterchroma.ioin.put(dataIn);
              end
              end
           else
           else
              begin
              begin
                 $display("PARDEBLOCK ERROR! passing luma data to chroma filter");
                 $display("PARDEBLOCK ERROR! passing luma data to chroma filter");
              end
              end
        end
        end
         default:   begin
         default:   begin
                       deblockfilterchroma.ioin.put(dataIn);
                       deblockfilterchroma.ioin.put(dataIn);
                    end
                    end
      endcase
      endcase
     endmethod
     endmethod
  endinterface
  endinterface
  interface Put ioinluma;
  interface Put ioinluma;
     method Action put(EntropyDecOT dataIn);
     method Action put(EntropyDecOT dataIn);
      case (dataIn) matches
      case (dataIn) matches
        tagged  PBoutput .xdata: begin
        tagged  PBoutput .xdata: begin
           match {.chromaFlag, .vec} = xdata;
           match {.chromaFlag, .vec} = xdata;
           if(chromaFlag == Luma)
           if(chromaFlag == Luma)
              begin
              begin
                 deblockfilterluma.ioin.put(dataIn);
                 deblockfilterluma.ioin.put(dataIn);
              end
              end
           else
           else
              begin
              begin
                 $display("PARDEBLOCK ERROR! passing chroma data to luma filter");
                 $display("PARDEBLOCK ERROR! passing chroma data to luma filter");
              end
              end
        end
        end
         default:   begin
         default:   begin
                       deblockfilterluma.ioin.put(dataIn);
                       deblockfilterluma.ioin.put(dataIn);
                    end
                    end
      endcase
      endcase
     endmethod
     endmethod
  endinterface
  endinterface
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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