1 |
4 |
issei |
//===================================================================
|
2 |
|
|
// Module Name : RsDecodeMult
|
3 |
|
|
// File Name : RsDecodeMult.v
|
4 |
|
|
// Function : Rs Decoder Multiplier Module
|
5 |
|
|
//
|
6 |
|
|
// Revision History:
|
7 |
|
|
// Date By Version Change Description
|
8 |
|
|
//===================================================================
|
9 |
|
|
// 2009/02/03 Gael Sapience 1.0 Original
|
10 |
|
|
//
|
11 |
|
|
//===================================================================
|
12 |
|
|
// (C) COPYRIGHT 2009 SYSTEM LSI CO., Ltd.
|
13 |
|
|
//
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
module RsDecodeMult(
|
17 |
|
|
A, // input A
|
18 |
|
|
B, // input B
|
19 |
|
|
P // output P = A*B in Galois Field
|
20 |
|
|
);
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
input [7:0] A; // input A
|
24 |
|
|
input [7:0] B; // input B
|
25 |
|
|
output [7:0] P; // output P = A*B in Galois Field
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
//------------------------------------------------------------------------
|
30 |
|
|
// + M
|
31 |
|
|
//-
|
32 |
|
|
//------------------------------------------------------------------------
|
33 |
|
|
wire [14:0] M;
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
assign M[0] = (A[0] & B[0]);
|
38 |
|
|
assign M[1] = (A[0] & B[1]) ^ (A[1] & B[0]);
|
39 |
|
|
assign M[2] = (A[0] & B[2]) ^ (A[1] & B[1]) ^ (A[2] & B[0]);
|
40 |
|
|
assign M[3] = (A[0] & B[3]) ^ (A[1] & B[2]) ^ (A[2] & B[1]) ^ (A[3] & B[0]);
|
41 |
|
|
assign M[4] = (A[0] & B[4]) ^ (A[1] & B[3]) ^ (A[2] & B[2]) ^ (A[3] & B[1]) ^ (A[4] & B[0]);
|
42 |
|
|
assign M[5] = (A[0] & B[5]) ^ (A[1] & B[4]) ^ (A[2] & B[3]) ^ (A[3] & B[2]) ^ (A[4] & B[1]) ^ (A[5] & B[0]);
|
43 |
|
|
assign M[6] = (A[0] & B[6]) ^ (A[1] & B[5]) ^ (A[2] & B[4]) ^ (A[3] & B[3]) ^ (A[4] & B[2]) ^ (A[5] & B[1]) ^ (A[6] & B[0]);
|
44 |
|
|
assign M[7] = (A[0] & B[7]) ^ (A[1] & B[6]) ^ (A[2] & B[5]) ^ (A[3] & B[4]) ^ (A[4] & B[3]) ^ (A[5] & B[2]) ^ (A[6] & B[1]) ^ (A[7] & B[0]);
|
45 |
|
|
assign M[8] = (A[1] & B[7]) ^ (A[2] & B[6]) ^ (A[3] & B[5]) ^ (A[4] & B[4]) ^ (A[5] & B[3]) ^ (A[6] & B[2]) ^ (A[7] & B[1]);
|
46 |
|
|
assign M[9] = (A[2] & B[7]) ^ (A[3] & B[6]) ^ (A[4] & B[5]) ^ (A[5] & B[4]) ^ (A[6] & B[3]) ^ (A[7] & B[2]);
|
47 |
|
|
assign M[10] = (A[3] & B[7]) ^ (A[4] & B[6]) ^ (A[5] & B[5]) ^ (A[6] & B[4]) ^ (A[7] & B[3]);
|
48 |
|
|
assign M[11] = (A[4] & B[7]) ^ (A[5] & B[6]) ^ (A[6] & B[5]) ^ (A[7] & B[4]);
|
49 |
|
|
assign M[12] = (A[5] & B[7]) ^ (A[6] & B[6]) ^ (A[7] & B[5]);
|
50 |
|
|
assign M[13] = (A[6] & B[7]) ^ (A[7] & B[6]);
|
51 |
|
|
assign M[14] = (A[7] & B[7]);
|
52 |
|
|
//------------------------------------------------------------------------
|
53 |
|
|
// + P
|
54 |
|
|
//-
|
55 |
|
|
//------------------------------------------------------------------------
|
56 |
|
|
assign P[0] = M[0] ^ M[8] ^ M[12] ^ M[13] ^ M[14];
|
57 |
|
|
assign P[1] = M[1] ^ M[9] ^ M[13] ^ M[14];
|
58 |
|
|
assign P[2] = M[2] ^ M[8] ^ M[10] ^ M[12] ^ M[13];
|
59 |
|
|
assign P[3] = M[3] ^ M[8] ^ M[9] ^ M[11] ^ M[12];
|
60 |
|
|
assign P[4] = M[4] ^ M[8] ^ M[9] ^ M[10] ^ M[14];
|
61 |
|
|
assign P[5] = M[5] ^ M[9] ^ M[10] ^ M[11];
|
62 |
|
|
assign P[6] = M[6] ^ M[10] ^ M[11] ^ M[12];
|
63 |
|
|
assign P[7] = M[7] ^ M[11] ^ M[12] ^ M[13];
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
endmodule
|