1 |
3 |
kfleming |
//----------------------------------------------------------------------//
|
2 |
|
|
// The MIT License
|
3 |
|
|
//
|
4 |
|
|
// Copyright (c) 2008 Alfred Man Cheuk Ng, mcn02@mit.edu
|
5 |
|
|
//
|
6 |
|
|
// Permission is hereby granted, free of charge, to any person
|
7 |
|
|
// obtaining a copy of this software and associated documentation
|
8 |
|
|
// files (the "Software"), to deal in the Software without
|
9 |
|
|
// restriction, including without limitation the rights to use,
|
10 |
|
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
|
|
// copies of the Software, and to permit persons to whom the
|
12 |
|
|
// Software is furnished to do so, subject to the following conditions:
|
13 |
|
|
//
|
14 |
|
|
// The above copyright notice and this permission notice shall be
|
15 |
|
|
// included in all copies or substantial portions of the Software.
|
16 |
|
|
//
|
17 |
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18 |
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
19 |
|
|
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20 |
|
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21 |
|
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22 |
|
|
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
23 |
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
24 |
|
|
// OTHER DEALINGS IN THE SOFTWARE.
|
25 |
|
|
//----------------------------------------------------------------------//
|
26 |
|
|
|
27 |
|
|
// import standard librarys
|
28 |
|
|
import Connectable::*;
|
29 |
|
|
import GetPut::*;
|
30 |
|
|
import FIFO::*;
|
31 |
|
|
import StmtFSM::*;
|
32 |
|
|
import Vector::*;
|
33 |
|
|
|
34 |
|
|
// import self-made library
|
35 |
|
|
import BRAMVLevelFIFO::*;
|
36 |
|
|
import EHRReg::*;
|
37 |
|
|
import VLevelFIFO::*;
|
38 |
|
|
import Sort::*;
|
39 |
|
|
|
40 |
|
|
import BRAMLevel8Merger::*;
|
41 |
|
|
import BRAMLevel7Merger::*;
|
42 |
|
|
import BRAMLevel6Merger::*;
|
43 |
|
|
import BRAMLevel5Merger::*;
|
44 |
|
|
import BRAMLevel4Merger::*;
|
45 |
|
|
import BRAMLevel3Merger::*;
|
46 |
|
|
import BRAMLevel2Merger::*;
|
47 |
|
|
import Level1Merger::*;
|
48 |
|
|
|
49 |
|
|
(* synthesize *)
|
50 |
|
|
module mkSortTree256 (SortTree#(256,Bit#(5),Maybe#(Bit#(128))));
|
51 |
|
|
|
52 |
|
|
let level8Merger <- mkBRAMLevel8MergerInstance();
|
53 |
|
|
let level7Merger <- mkBRAMLevel7MergerInstance();
|
54 |
|
|
let level6Merger <- mkBRAMLevel6MergerInstance();
|
55 |
|
|
let level5Merger <- mkBRAMLevel5MergerInstance();
|
56 |
|
|
let level4Merger <- mkBRAMLevel4MergerInstance();
|
57 |
|
|
let level3Merger <- mkBRAMLevel3MergerInstance();
|
58 |
|
|
let level2Merger <- mkBRAMLevel2MergerInstance();
|
59 |
|
|
let level1Merger <- mkLevel1MergerInstance();
|
60 |
|
|
|
61 |
|
|
mkConnection(level8Merger.outStream,level7Merger.inStream);
|
62 |
|
|
mkConnection(level7Merger.outStream,level6Merger.inStream);
|
63 |
|
|
mkConnection(level6Merger.outStream,level5Merger.inStream);
|
64 |
|
|
mkConnection(level5Merger.outStream,level4Merger.inStream);
|
65 |
|
|
mkConnection(level4Merger.outStream,level3Merger.inStream);
|
66 |
|
|
mkConnection(level3Merger.outStream,level2Merger.inStream);
|
67 |
|
|
mkConnection(level2Merger.outStream,level1Merger.inStream);
|
68 |
|
|
|
69 |
|
|
interface inStream = level8Merger.inStream;
|
70 |
|
|
method getRecord = level1Merger.getRecord;
|
71 |
|
|
|
72 |
|
|
endmodule
|