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

Subversion Repositories bluespec-h264

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 85 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 84 jamey.hick
//**********************************************************************
23
// final output implementation
24
//----------------------------------------------------------------------
25
//
26
//
27
 
28
package mkFinalOutput;
29
 
30
import H264Types::*;
31
import IFinalOutput::*;
32
import FIFO::*;
33
import RegFile::*;
34
 
35
import Connectable::*;
36
import GetPut::*;
37
 
38
//-----------------------------------------------------------
39
// Final Output Module
40
//-----------------------------------------------------------
41
 
42
module mkFinalOutput( IFinalOutput );
43
 
44
   FIFO#(BufferControlOT)  infifo    <- mkFIFO;
45
   Reg#(Bit#(27))    index   <- mkReg(0);
46
 
47
   Reg#(Bit#(32)) tick_counter <- mkReg(0);
48
   Reg#(Bit#(32)) data_seen_counter <- mkReg(0);
49
   Reg#(Bit#(32)) last_f_count <- mkReg(0);
50
   Reg#(Bit#(32)) f_count <- mkReg(0);
51
 
52
   rule tick;
53
     tick_counter <= tick_counter + 1;
54
     if(tick_counter%2000000 == 0)
55
       begin
56
         if(last_f_count == f_count)
57
           begin
58
             $display("mkFinalOutput: Warning: no new frames, stuck at %d", last_f_count);
59
           end
60
         else
61
           begin
62
             $display("mkFinalOutput: Feelin' fine current frames: %d", last_f_count);
63
           end
64
         last_f_count <= f_count;
65
       end
66
   endrule
67
 
68
   //-----------------------------------------------------------
69
   // Rules
70
   rule finalout (True);
71
    //  Bit#(32) data_constant = pack(fromInteger(horizontal_pixels * vertical_pixels))*3/2;
72
      //if(data_seen_counter + 4 > data_constant)
73
       // begin
74
       //   f_count <= f_count + 1;
75
       //   data_seen_counter <= 0;
76
       // end
77
      //else
78
      //  begin
79
      //    data_seen_counter <= data_seen_counter+4;
80
      //  end
81
 
82
      index <= index + 4;
83
      if(infifo.first() matches tagged YUV .xdata)
84
         begin
85
            $display("OUT %h", xdata[7:0]);
86
            $display("OUT %h", xdata[15:8]);
87
            $display("OUT %h", xdata[23:16]);
88
            $display("OUT %h", xdata[31:24]);
89
            infifo.deq();
90
         end
91
      else
92
         $finish(0);
93
   endrule
94
 
95
 
96
   interface Put ioin  = fifoToPut(infifo);
97
 
98
endmodule
99
 
100
endpackage

powered by: WebSVN 2.1.0

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