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

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [LumaChromaParallel/] [mkFrameBuffer.bsv] - Blame information for rev 92

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

Line No. Rev Author Line
1 92 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
//**********************************************************************
23
// Frame Buffer
24
//----------------------------------------------------------------------
25
//
26
//
27
//
28
 
29
package mkFrameBuffer;
30
 
31
import H264Types::*;
32
import IFrameBuffer::*;
33
import RegFile::*;
34
import GetPut::*;
35
import ClientServer::*;
36
import FIFO::*;
37
 
38
 
39
//-----------------------------------------------------------
40
// Register file module
41
//-----------------------------------------------------------
42
 
43
interface FBRFile2;
44
   method Action store( Bit#(FrameBufferSz) addr, Bit#(32) data );
45
   method Bit#(32) load1( Bit#(FrameBufferSz) addr );
46
   method Bit#(32) load2( Bit#(FrameBufferSz) addr );
47
   method Bit#(32) load3( Bit#(FrameBufferSz) addr );
48
endinterface
49
 
50
module mkFBRFile2( FBRFile2 );
51
 
52
   RegFile#(Bit#(FrameBufferSz),Bit#(32)) rfile <- mkRegFile(0,frameBufferSize);
53
 
54
   method Action store( Bit#(FrameBufferSz) addr, Bit#(32) data );
55
      rfile.upd( addr, data );
56
   endmethod
57
 
58
   method Bit#(32) load1( Bit#(FrameBufferSz) addr );
59
      return rfile.sub(addr);
60
   endmethod
61
 
62
   method Bit#(32) load2( Bit#(FrameBufferSz) addr );
63
      return rfile.sub(addr);
64
   endmethod
65
 
66
   method Bit#(32) load3( Bit#(FrameBufferSz) addr );
67
      return rfile.sub(addr);
68
   endmethod
69
 
70
endmodule
71
 
72
 
73
//----------------------------------------------------------------------
74
// Main module
75
//----------------------------------------------------------------------
76
 
77
module mkFrameBuffer( IFrameBuffer );
78
 
79
  //-----------------------------------------------------------
80
  // State
81
 
82
   FBRFile2 rfile2 <- mkFBRFile2;
83
 
84
   FIFO#(FrameBufferLoadReq)  loadReqQ1  <- mkFIFO();
85
   FIFO#(FrameBufferLoadResp) loadRespQ1 <- mkFIFO();
86
   FIFO#(FrameBufferLoadReq)  loadReqQ2  <- mkFIFO();
87
   FIFO#(FrameBufferLoadResp) loadRespQ2 <- mkFIFO();
88
   FIFO#(FrameBufferLoadReq)  loadReqQ3  <- mkFIFO();
89
   FIFO#(FrameBufferLoadResp) loadRespQ3 <- mkFIFO();
90
   FIFO#(FrameBufferStoreReq) storeReqQ  <- mkFIFO();
91
 
92
   rule loading1 ( loadReqQ1.first() matches tagged FBLoadReq .addrt );
93
      if(addrt
94
         begin
95
            loadRespQ1.enq( tagged FBLoadResp rfile2.load1(addrt) );
96
            loadReqQ1.deq();
97
         end
98
      else
99
         $display( "ERROR FrameBuffer: loading1 outside range" );
100
   endrule
101
 
102
   rule loading2 ( loadReqQ2.first() matches tagged FBLoadReq .addrt );
103
      $display("Trace FrameBuffer interLumaReq");
104
      if(addrt
105
         begin
106
            loadRespQ2.enq( tagged FBLoadResp rfile2.load2(addrt) );
107
            loadReqQ2.deq();
108
         end
109
      else
110
         $display( "ERROR FrameBuffer: loading2 outside range" );
111
   endrule
112
 
113
   rule loading3 ( loadReqQ3.first() matches tagged FBLoadReq .addrt );
114
      $display("Trace FrameBuffer interChromaReq");
115
      if(addrt
116
         begin
117
            loadRespQ3.enq( tagged FBLoadResp rfile2.load3(addrt) );
118
            loadReqQ3.deq();
119
         end
120
      else
121
         $display( "ERROR FrameBuffer: loading2 outside range" );
122
   endrule
123
 
124
 
125
   rule storing ( storeReqQ.first() matches tagged FBStoreReq { addr:.addrt,data:.datat} );
126
      if(addrt
127
         begin
128
            rfile2.store(addrt,datat);
129
            storeReqQ.deq();
130
         end
131
      else
132
         $display( "ERROR FrameBuffer: storing outside range" );
133
   endrule
134
 
135
   rule syncing ( loadReqQ1.first() matches tagged FBEndFrameSync &&& loadReqQ2.first() matches tagged FBEndFrameSync &&&
136
                  loadReqQ3.first() matches tagged FBEndFrameSync &&& storeReqQ.first() matches tagged FBEndFrameSync);
137
      $display("Trace FrameBuffer: EndOfFrame Sync");
138
      loadReqQ1.deq();
139
      loadReqQ2.deq();
140
      loadReqQ3.deq();
141
      storeReqQ.deq();
142
   endrule
143
 
144
   rule loadReq1Blocked;
145
     $display("Trace FrameBuffer: check LoadQ1 %h", loadReqQ1.first);
146
   endrule
147
 
148
   rule loadReq2Blocked;
149
     $display("Trace FrameBuffer: check LoadQ2 %h", loadReqQ2.first);
150
   endrule
151
 
152
   rule loadReq3Blocked;
153
     $display("Trace FrameBuffer: check LoadQ3 %h", loadReqQ3.first);
154
   endrule
155
 
156
 
157
 
158
   interface Server server_load1;
159
      interface Put request   = fifoToPut(loadReqQ1);
160
      interface Get response  = fifoToGet(loadRespQ1);
161
   endinterface
162
   interface Server server_load2;
163
      interface Put request   = fifoToPut(loadReqQ2);
164
      interface Get response  = fifoToGet(loadRespQ2);
165
   endinterface
166
 
167
   interface Server server_load3;
168
      interface Put request   = fifoToPut(loadReqQ3);
169
      interface Get response  = fifoToGet(loadRespQ3);
170
   endinterface
171
 
172
   interface Put server_store = fifoToPut(storeReqQ);
173
 
174
endmodule
175
 
176
endpackage

powered by: WebSVN 2.1.0

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