OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v7/] [rtl/] [common/] [FT64_BMM.v] - Blame information for rev 60

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 60 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2017  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
//      FT64_BMM.v
9
//              
10
// This source file is free software: you can redistribute it and/or modify 
11
// it under the terms of the GNU Lesser General Public License as published 
12
// by the Free Software Foundation, either version 3 of the License, or     
13
// (at your option) any later version.                                      
14
//                                                                          
15
// This source file is distributed in the hope that it will be useful,      
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
18
// GNU General Public License for more details.                             
19
//                                                                          
20
// You should have received a copy of the GNU General Public License        
21
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
22
//
23
// ============================================================================
24
//
25
module FT64_BMM(op,a,b,o);
26
parameter DBW=64;
27
parameter N=7;
28
input op;       // 0 = MOR, 1 = MXOR
29
input [DBW-1:0] a;
30
input [DBW-1:0] b;
31
output reg [DBW-1:0] o;
32
 
33
integer n,i,j;
34
reg omor[0:N][0:N];
35
reg omxor[0:N][0:N];
36
reg am[0:N][0:N];
37
reg bm[0:N][0:N];
38
 
39
always @*
40
for (i = 0; i <= N; i = i + 1) begin
41
        for (j = 0; j <= N; j = j + 1) begin
42
                am[i][j] = a[(N-i)*(N+1)+(N-j)];
43
                bm[i][j] = b[(N-i)*(N+1)+(N-j)];
44
        end
45
end
46
 
47
always @*
48
for (i = 0; i <= N; i = i + 1) begin
49
        for (j = 0; j <= N; j = j + 1) begin
50
                omor[i][j] =
51
                                 (am[i][0]&bm[0][j])
52
                                |(am[i][1]&bm[1][j])
53
                                |(am[i][2]&bm[2][j])
54
                                |(am[i][3]&bm[3][j])
55
                                |(am[i][4]&bm[4][j])
56
                                |(am[i][5]&bm[5][j])
57
                                |(am[i][6]&bm[6][j])
58
                                |(am[i][7]&bm[7][j]);
59
                omxor[i][j] =
60
                                 (am[i][0]&bm[0][j])
61
                                ^(am[i][1]&bm[1][j])
62
                                ^(am[i][2]&bm[2][j])
63
                                ^(am[i][3]&bm[3][j])
64
                                ^(am[i][4]&bm[4][j])
65
                                ^(am[i][5]&bm[5][j])
66
                                ^(am[i][6]&bm[6][j])
67
                                ^(am[i][7]&bm[7][j]);
68
        end
69
end
70
 
71
always @*
72
case (op)
73
1'b0:   begin
74
                for (i = 0; i <= N; i = i + 1)
75
                for (j = 0; j <= N; j = j + 1)
76
                        o[(N-i)*(N+1)+(N-j)] = omor[i][j];
77
        end
78
1'b1:   begin
79
                for (i = 0; i <= N; i = i + 1)
80
                for (j = 0; j <= N; j = j + 1)
81
                        o[(N-i)*(N+1)+(N-j)] = omxor[i][j];
82
        end
83
endcase
84
 
85
endmodule

powered by: WebSVN 2.1.0

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