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 |
|
|
// H264 Test Bench
|
26 |
|
|
//----------------------------------------------------------------------
|
27 |
|
|
//
|
28 |
|
|
//
|
29 |
|
|
|
30 |
|
|
package mkTH;
|
31 |
|
|
|
32 |
|
|
import H264Types::*;
|
33 |
|
|
import IMemED::*;
|
34 |
65 |
jamey.hick |
import IMemEDDecoupled::*;
|
35 |
2 |
jamey.hick |
import IFrameBuffer::*;
|
36 |
|
|
import IInputGen::*;
|
37 |
|
|
import IFinalOutput::*;
|
38 |
65 |
jamey.hick |
import IDecoupledClient::*;
|
39 |
2 |
jamey.hick |
import IH264::*;
|
40 |
|
|
import mkMemED::*;
|
41 |
65 |
jamey.hick |
import mkMemEDDecoupled::*;
|
42 |
2 |
jamey.hick |
import mkFrameBuffer::*;
|
43 |
|
|
import mkInputGen::*;
|
44 |
|
|
import mkFinalOutput::*;
|
45 |
|
|
import mkH264::*;
|
46 |
62 |
jamey.hick |
import MemoryTee::*;
|
47 |
2 |
jamey.hick |
|
48 |
|
|
import Connectable::*;
|
49 |
|
|
import GetPut::*;
|
50 |
|
|
import ClientServer::*;
|
51 |
|
|
|
52 |
|
|
(* synthesize *)
|
53 |
|
|
module mkTH( Empty );
|
54 |
|
|
|
55 |
|
|
// Instantiate the modules
|
56 |
|
|
|
57 |
|
|
IInputGen inputgen <- mkInputGen();
|
58 |
|
|
IH264 h264 <- mkH264();
|
59 |
|
|
IMemED#(TAdd#(PicWidthSz,1),20) memED <- mkMemED();
|
60 |
|
|
IMemED#(TAdd#(PicWidthSz,2),68) memP_intra <- mkMemED();
|
61 |
|
|
IMemED#(TAdd#(PicWidthSz,2),32) memP_inter <- mkMemED();
|
62 |
65 |
jamey.hick |
IMemEDDecoupled#(TAdd#(PicWidthSz,5),32) memD_data <- mkMemEDDecoupled();
|
63 |
2 |
jamey.hick |
IMemED#(PicWidthSz,13) memD_parameter <- mkMemED();
|
64 |
|
|
IFrameBuffer framebuffer <- mkFrameBuffer();
|
65 |
|
|
IFinalOutput finaloutput <- mkFinalOutput();
|
66 |
|
|
|
67 |
|
|
// Cycle counter
|
68 |
|
|
Reg#(Bit#(32)) cyclecount <- mkReg(0);
|
69 |
|
|
|
70 |
|
|
rule countCycles ( True );
|
71 |
|
|
if(cyclecount[4:0]==0) $display( "CCLCycleCount %0d", cyclecount );
|
72 |
|
|
cyclecount <= cyclecount+1;
|
73 |
35 |
jamey.hick |
if(cyclecount > 600000000)
|
74 |
2 |
jamey.hick |
begin
|
75 |
|
|
$display( "ERROR mkTH: time out" );
|
76 |
|
|
$finish(0);
|
77 |
|
|
end
|
78 |
|
|
endrule
|
79 |
|
|
|
80 |
|
|
// Internal connections
|
81 |
|
|
|
82 |
|
|
mkConnection( inputgen.ioout, h264.ioin );
|
83 |
|
|
mkConnection( h264.mem_clientED, memED.mem_server );
|
84 |
|
|
mkConnection( h264.mem_clientP_intra, memP_intra.mem_server );
|
85 |
|
|
mkConnection( h264.mem_clientP_inter, memP_inter.mem_server );
|
86 |
65 |
jamey.hick |
|
87 |
|
|
mkConnection( memD_data.request_store, h264.mem_clientD_data.request_store );
|
88 |
|
|
mkConnection( h264.mem_clientD_data.request_load, memD_data.request_load );
|
89 |
|
|
mkConnection( h264.mem_clientD_data.response, memD_data.response);
|
90 |
|
|
|
91 |
2 |
jamey.hick |
mkConnection( h264.mem_clientD_parameter, memD_parameter.mem_server );
|
92 |
62 |
jamey.hick |
Empty memT1 <- mkMemoryTee( h264.buffer_client_load1, framebuffer.server_load1, "MEMT1" );
|
93 |
2 |
jamey.hick |
mkConnection( h264.buffer_client_load2, framebuffer.server_load2 );
|
94 |
|
|
mkConnection( h264.buffer_client_store, framebuffer.server_store );
|
95 |
|
|
mkConnection( h264.ioout, finaloutput.ioin );
|
96 |
|
|
|
97 |
|
|
endmodule
|
98 |
|
|
|
99 |
|
|
endpackage
|