1 |
35 |
csantifort |
//////////////////////////////////////////////////////////////////
|
2 |
|
|
// //
|
3 |
|
|
// Functions for Amber 2 System //
|
4 |
|
|
// //
|
5 |
|
|
// This file is part of the Amber project //
|
6 |
|
|
// http://www.opencores.org/project,amber //
|
7 |
|
|
// //
|
8 |
|
|
// Description //
|
9 |
|
|
// Functions used in more than one module //
|
10 |
|
|
// //
|
11 |
|
|
// Author(s): //
|
12 |
|
|
// - Conor Santifort, csantifort.amber@gmail.com //
|
13 |
|
|
// //
|
14 |
|
|
//////////////////////////////////////////////////////////////////
|
15 |
|
|
// //
|
16 |
|
|
// Copyright (C) 2010 Authors and OPENCORES.ORG //
|
17 |
|
|
// //
|
18 |
|
|
// This source file may be used and distributed without //
|
19 |
|
|
// restriction provided that this copyright statement is not //
|
20 |
|
|
// removed from the file and that any derivative work contains //
|
21 |
|
|
// the original copyright notice and the associated disclaimer. //
|
22 |
|
|
// //
|
23 |
|
|
// This source file is free software; you can redistribute it //
|
24 |
|
|
// and/or modify it under the terms of the GNU Lesser General //
|
25 |
|
|
// Public License as published by the Free Software Foundation; //
|
26 |
|
|
// either version 2.1 of the License, or (at your option) any //
|
27 |
|
|
// later version. //
|
28 |
|
|
// //
|
29 |
|
|
// This source is distributed in the hope that it will be //
|
30 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied //
|
31 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
|
32 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more //
|
33 |
|
|
// details. //
|
34 |
|
|
// //
|
35 |
|
|
// You should have received a copy of the GNU Lesser General //
|
36 |
|
|
// Public License along with this source; if not, download it //
|
37 |
|
|
// from http://www.opencores.org/lgpl.shtml //
|
38 |
|
|
// //
|
39 |
|
|
//////////////////////////////////////////////////////////////////
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
// ========================================================
|
43 |
|
|
// 32-bit Endian switch
|
44 |
|
|
// ========================================================
|
45 |
|
|
function [31:0] endian_x32;
|
46 |
|
|
input [31:0] data;
|
47 |
|
|
begin
|
48 |
|
|
endian_x32 = {data[7:0], data[15:8], data[23:16], data[31:24]};
|
49 |
|
|
end
|
50 |
|
|
endfunction
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
// ========================================================
|
54 |
|
|
// 4-bit Endian switch
|
55 |
|
|
// ========================================================
|
56 |
|
|
function [3:0] endian_x4;
|
57 |
|
|
input [3:0] data;
|
58 |
|
|
begin
|
59 |
|
|
endian_x4 = {data[0], data[1], data[2], data[3]};
|
60 |
|
|
end
|
61 |
|
|
endfunction
|