1 |
4 |
issei |
//===================================================================
|
2 |
|
|
// Module Name : RsDecodeDegree
|
3 |
|
|
// File Name : RsDecodeDegree.v
|
4 |
|
|
// Function : Rs Decoder Degree 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 RsDecodeDegree(
|
17 |
|
|
polynom_0,
|
18 |
|
|
polynom_1,
|
19 |
|
|
polynom_2,
|
20 |
|
|
polynom_3,
|
21 |
|
|
polynom_4,
|
22 |
|
|
polynom_5,
|
23 |
|
|
polynom_6,
|
24 |
|
|
polynom_7,
|
25 |
|
|
polynom_8,
|
26 |
|
|
polynom_9,
|
27 |
|
|
polynom_10,
|
28 |
|
|
polynom_11,
|
29 |
|
|
polynom_12,
|
30 |
|
|
polynom_13,
|
31 |
|
|
polynom_14,
|
32 |
|
|
polynom_15,
|
33 |
|
|
polynom_16,
|
34 |
|
|
polynom_17,
|
35 |
|
|
polynom_18,
|
36 |
|
|
polynom_19,
|
37 |
|
|
polynom_20,
|
38 |
|
|
polynom_21,
|
39 |
|
|
degree
|
40 |
|
|
);
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
input [7:0] polynom_0; // polynom 0
|
44 |
|
|
input [7:0] polynom_1; // polynom 1
|
45 |
|
|
input [7:0] polynom_2; // polynom 2
|
46 |
|
|
input [7:0] polynom_3; // polynom 3
|
47 |
|
|
input [7:0] polynom_4; // polynom 4
|
48 |
|
|
input [7:0] polynom_5; // polynom 5
|
49 |
|
|
input [7:0] polynom_6; // polynom 6
|
50 |
|
|
input [7:0] polynom_7; // polynom 7
|
51 |
|
|
input [7:0] polynom_8; // polynom 8
|
52 |
|
|
input [7:0] polynom_9; // polynom 9
|
53 |
|
|
input [7:0] polynom_10; // polynom 10
|
54 |
|
|
input [7:0] polynom_11; // polynom 11
|
55 |
|
|
input [7:0] polynom_12; // polynom 12
|
56 |
|
|
input [7:0] polynom_13; // polynom 13
|
57 |
|
|
input [7:0] polynom_14; // polynom 14
|
58 |
|
|
input [7:0] polynom_15; // polynom 15
|
59 |
|
|
input [7:0] polynom_16; // polynom 16
|
60 |
|
|
input [7:0] polynom_17; // polynom 17
|
61 |
|
|
input [7:0] polynom_18; // polynom 18
|
62 |
|
|
input [7:0] polynom_19; // polynom 19
|
63 |
|
|
input [7:0] polynom_20; // polynom 20
|
64 |
|
|
input [7:0] polynom_21; // polynom 21
|
65 |
|
|
output [4:0] degree; // polynom degree
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
//------------------------------------------------------------------------
|
70 |
|
|
//- registers
|
71 |
|
|
//------------------------------------------------------------------------
|
72 |
|
|
//---------------------------------------------------------------
|
73 |
|
|
//- step 0
|
74 |
|
|
//---------------------------------------------------------------
|
75 |
|
|
wire [4:0] winner0Step0;
|
76 |
|
|
assign winner0Step0 =(polynom_1 [7:0] == 8'd0) ? ((polynom_0 [7:0] == 8'd0) ? 5'd0 : 5'd0): 5'd1;
|
77 |
|
|
wire [4:0] winner1Step0;
|
78 |
|
|
assign winner1Step0 =(polynom_3 [7:0] == 8'd0) ? ((polynom_2 [7:0] == 8'd0) ? 5'd0 : 5'd2): 5'd3;
|
79 |
|
|
wire [4:0] winner2Step0;
|
80 |
|
|
assign winner2Step0 =(polynom_5 [7:0] == 8'd0) ? ((polynom_4 [7:0] == 8'd0) ? 5'd0 : 5'd4): 5'd5;
|
81 |
|
|
wire [4:0] winner3Step0;
|
82 |
|
|
assign winner3Step0 =(polynom_7 [7:0] == 8'd0) ? ((polynom_6 [7:0] == 8'd0) ? 5'd0 : 5'd6): 5'd7;
|
83 |
|
|
wire [4:0] winner4Step0;
|
84 |
|
|
assign winner4Step0 =(polynom_9 [7:0] == 8'd0) ? ((polynom_8 [7:0] == 8'd0) ? 5'd0 : 5'd8): 5'd9;
|
85 |
|
|
wire [4:0] winner5Step0;
|
86 |
|
|
assign winner5Step0 =(polynom_11 [7:0] == 8'd0) ? ((polynom_10 [7:0] == 8'd0) ? 5'd0 : 5'd10): 5'd11;
|
87 |
|
|
wire [4:0] winner6Step0;
|
88 |
|
|
assign winner6Step0 =(polynom_13 [7:0] == 8'd0) ? ((polynom_12 [7:0] == 8'd0) ? 5'd0 : 5'd12): 5'd13;
|
89 |
|
|
wire [4:0] winner7Step0;
|
90 |
|
|
assign winner7Step0 =(polynom_15 [7:0] == 8'd0) ? ((polynom_14 [7:0] == 8'd0) ? 5'd0 : 5'd14): 5'd15;
|
91 |
|
|
wire [4:0] winner8Step0;
|
92 |
|
|
assign winner8Step0 =(polynom_17 [7:0] == 8'd0) ? ((polynom_16 [7:0] == 8'd0) ? 5'd0 : 5'd16): 5'd17;
|
93 |
|
|
wire [4:0] winner9Step0;
|
94 |
|
|
assign winner9Step0 =(polynom_19 [7:0] == 8'd0) ? ((polynom_18 [7:0] == 8'd0) ? 5'd0 : 5'd18): 5'd19;
|
95 |
|
|
wire [4:0] winner10Step0;
|
96 |
|
|
assign winner10Step0 =(polynom_21 [7:0] == 8'd0) ? ((polynom_20 [7:0] == 8'd0) ? 5'd0 : 5'd20): 5'd21;
|
97 |
|
|
//---------------------------------------------------------------
|
98 |
|
|
//- step 1
|
99 |
|
|
//---------------------------------------------------------------
|
100 |
|
|
wire [4:0] winner0Step1;
|
101 |
|
|
assign winner0Step1 =( winner1Step0 [4:0] < winner0Step0 [4:0]) ? winner0Step0 [4:0]: winner1Step0 [4:0];
|
102 |
|
|
wire [4:0] winner1Step1;
|
103 |
|
|
assign winner1Step1 =( winner3Step0 [4:0] < winner2Step0 [4:0]) ? winner2Step0 [4:0]: winner3Step0 [4:0];
|
104 |
|
|
wire [4:0] winner2Step1;
|
105 |
|
|
assign winner2Step1 =( winner5Step0 [4:0] < winner4Step0 [4:0]) ? winner4Step0 [4:0]: winner5Step0 [4:0];
|
106 |
|
|
wire [4:0] winner3Step1;
|
107 |
|
|
assign winner3Step1 =( winner7Step0 [4:0] < winner6Step0 [4:0]) ? winner6Step0 [4:0]: winner7Step0 [4:0];
|
108 |
|
|
wire [4:0] winner4Step1;
|
109 |
|
|
assign winner4Step1 =( winner9Step0 [4:0] < winner8Step0 [4:0]) ? winner8Step0 [4:0]: winner9Step0 [4:0];
|
110 |
|
|
//---------------------------------------------------------------
|
111 |
|
|
//- step 2
|
112 |
|
|
//---------------------------------------------------------------
|
113 |
|
|
wire [4:0] winner0Step2;
|
114 |
|
|
assign winner0Step2 =( winner1Step1 [4:0] < winner0Step1 [4:0]) ? winner0Step1 [4:0]: winner1Step1 [4:0];
|
115 |
|
|
wire [4:0] winner1Step2;
|
116 |
|
|
assign winner1Step2 =( winner3Step1 [4:0] < winner2Step1 [4:0]) ? winner2Step1 [4:0]: winner3Step1 [4:0];
|
117 |
|
|
wire [4:0] winner2Step2;
|
118 |
|
|
assign winner2Step2 =( winner10Step0 [4:0] < winner4Step1 [4:0]) ? winner4Step1 [4:0]: winner10Step0 [4:0];
|
119 |
|
|
//---------------------------------------------------------------
|
120 |
|
|
//- step 3
|
121 |
|
|
//---------------------------------------------------------------
|
122 |
|
|
wire [4:0] winner0Step3;
|
123 |
|
|
assign winner0Step3 =( winner1Step2 [4:0] < winner0Step2 [4:0]) ? winner0Step2 [4:0]: winner1Step2 [4:0];
|
124 |
|
|
//---------------------------------------------------------------
|
125 |
|
|
//- step 4
|
126 |
|
|
//---------------------------------------------------------------
|
127 |
|
|
wire [4:0] winner0Step4;
|
128 |
|
|
assign winner0Step4 =( winner2Step2 [4:0] < winner0Step3 [4:0]) ? winner0Step3 [4:0]: winner2Step2 [4:0];
|
129 |
|
|
//---------------------------------------------------------------
|
130 |
|
|
//---------------------------------------------------------------
|
131 |
|
|
assign degree [4:0] = winner0Step4 [4:0] ;
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
endmodule
|