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

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [src/] [mkFinalOutput.bsv] - Blame information for rev 100

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 83 jamey.hick
 
2
// The MIT License
3
 
4
// Copyright (c) 2006-2007 Massachusetts Institute of Technology
5
 
6
// Permission is hereby granted, free of charge, to any person obtaining a copy
7
// of this software and associated documentation files (the "Software"), to deal
8
// in the Software without restriction, including without limitation the rights
9
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
// copies of the Software, and to permit persons to whom the Software is
11
// furnished to do so, subject to the following conditions:
12
 
13
// The above copyright notice and this permission notice shall be included in
14
// all copies or substantial portions of the Software.
15
 
16
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
// THE SOFTWARE.
23
 
24 2 jamey.hick
//**********************************************************************
25
// final output implementation
26
//----------------------------------------------------------------------
27
//
28
//
29
 
30
package mkFinalOutput;
31
 
32
import H264Types::*;
33
import IFinalOutput::*;
34
import FIFO::*;
35 6 jamey.hick
import RegFile::*;
36 2 jamey.hick
 
37
import Connectable::*;
38
import GetPut::*;
39
 
40
//-----------------------------------------------------------
41
// Final Output Module
42
//-----------------------------------------------------------
43
 
44
module mkFinalOutput( IFinalOutput );
45
 
46 19 jamey.hick
   FIFO#(BufferControlOT)  infifo    <- mkFIFO;
47 6 jamey.hick
   Reg#(Bit#(27))    index   <- mkReg(0);
48 2 jamey.hick
 
49 6 jamey.hick
   Reg#(Bit#(32)) tick_counter <- mkReg(0);
50
   Reg#(Bit#(32)) data_seen_counter <- mkReg(0);
51
   Reg#(Bit#(32)) last_f_count <- mkReg(0);
52
   Reg#(Bit#(32)) f_count <- mkReg(0);
53
 
54
   rule tick;
55
     tick_counter <= tick_counter + 1;
56
     if(tick_counter%2000000 == 0)
57
       begin
58
         if(last_f_count == f_count)
59
           begin
60
             $display("mkFinalOutput: Warning: no new frames, stuck at %d", last_f_count);
61
           end
62
         else
63
           begin
64
             $display("mkFinalOutput: Feelin' fine current frames: %d", last_f_count);
65
           end
66
         last_f_count <= f_count;
67
       end
68
   endrule
69
 
70 2 jamey.hick
   //-----------------------------------------------------------
71
   // Rules
72 6 jamey.hick
   rule finalout (True);
73 19 jamey.hick
    //  Bit#(32) data_constant = pack(fromInteger(horizontal_pixels * vertical_pixels))*3/2;
74
      //if(data_seen_counter + 4 > data_constant)
75
       // begin
76
       //   f_count <= f_count + 1;
77
       //   data_seen_counter <= 0;
78
       // end
79
      //else
80
      //  begin
81
      //    data_seen_counter <= data_seen_counter+4;
82
      //  end
83 6 jamey.hick
 
84
      index <= index + 4;
85 2 jamey.hick
      if(infifo.first() matches tagged YUV .xdata)
86
         begin
87 19 jamey.hick
            $display("OUT %h", xdata[7:0]);
88
            $display("OUT %h", xdata[15:8]);
89
            $display("OUT %h", xdata[23:16]);
90 9 jamey.hick
            $display("OUT %h", xdata[31:24]);
91 2 jamey.hick
            infifo.deq();
92
         end
93
      else
94
         $finish(0);
95
   endrule
96
 
97
 
98
   interface Put ioin  = fifoToPut(infifo);
99
 
100
endmodule
101
 
102
endpackage

powered by: WebSVN 2.1.0

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