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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [basal/] [src/] [PRBS/] [prbs_23_to_64.v] - Blame information for rev 34

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
//-----------------------------------------------------------------------------
2
// Copyright (C) 2009 OutputLogic.com 
3
// This source file may be used and distributed without restriction 
4
// provided that this copyright statement is not removed from the file 
5
// and that any derivative work contains the original copyright notice 
6
// and the associated disclaimer. 
7
// 
8
// THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS 
9
// OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 
10
// WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
11
//-----------------------------------------------------------------------------
12
// scrambler module for data[63:0],   lfsr[22:0]=1+x^18+x^23;
13
//-----------------------------------------------------------------------------
14
module prbs_23_to_64(
15
  input [63:0] data_in,
16
  input scram_en,
17
  input scram_rst,
18
  output reg [63:0] data_out,
19
  input rst,
20
  input clk);
21
 
22
  reg [22:0] lfsr_q,lfsr_c;
23
  reg [63:0] data_c;
24
 
25
  always @(*) begin
26
    lfsr_c[0] = lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[19] ^ lfsr_q[22];
27
    lfsr_c[1] = lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[20];
28
    lfsr_c[2] = lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[21];
29
    lfsr_c[3] = lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[22];
30
    lfsr_c[4] = lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[18];
31
    lfsr_c[5] = lfsr_q[4] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[19];
32
    lfsr_c[6] = lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[20];
33
    lfsr_c[7] = lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[21];
34
    lfsr_c[8] = lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[22];
35
    lfsr_c[9] = lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[21];
36
    lfsr_c[10] = lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[22];
37
    lfsr_c[11] = lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[20] ^ lfsr_q[21];
38
    lfsr_c[12] = lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[21] ^ lfsr_q[22];
39
    lfsr_c[13] = lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[22];
40
    lfsr_c[14] = lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[19];
41
    lfsr_c[15] = lfsr_q[4] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[20];
42
    lfsr_c[16] = lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[21];
43
    lfsr_c[17] = lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[19] ^ lfsr_q[21] ^ lfsr_q[22];
44
    lfsr_c[18] = lfsr_q[0] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[20];
45
    lfsr_c[19] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[21];
46
    lfsr_c[20] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[19] ^ lfsr_q[21] ^ lfsr_q[22];
47
    lfsr_c[21] = lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[20] ^ lfsr_q[22];
48
    lfsr_c[22] = lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[18] ^ lfsr_q[21];
49
 
50
    data_c[0] = data_in[0] ^ lfsr_q[22];
51
    data_c[1] = data_in[1] ^ lfsr_q[21];
52
    data_c[2] = data_in[2] ^ lfsr_q[20];
53
    data_c[3] = data_in[3] ^ lfsr_q[19];
54
    data_c[4] = data_in[4] ^ lfsr_q[18];
55
    data_c[5] = data_in[5] ^ lfsr_q[17] ^ lfsr_q[22];
56
    data_c[6] = data_in[6] ^ lfsr_q[16] ^ lfsr_q[21];
57
    data_c[7] = data_in[7] ^ lfsr_q[15] ^ lfsr_q[20];
58
    data_c[8] = data_in[8] ^ lfsr_q[14] ^ lfsr_q[19];
59
    data_c[9] = data_in[9] ^ lfsr_q[13] ^ lfsr_q[18];
60
    data_c[10] = data_in[10] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[22];
61
    data_c[11] = data_in[11] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[21];
62
    data_c[12] = data_in[12] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[20];
63
    data_c[13] = data_in[13] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[19];
64
    data_c[14] = data_in[14] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[18];
65
    data_c[15] = data_in[15] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[22];
66
    data_c[16] = data_in[16] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[21];
67
    data_c[17] = data_in[17] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[20];
68
    data_c[18] = data_in[18] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[19];
69
    data_c[19] = data_in[19] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[18];
70
    data_c[20] = data_in[20] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[22];
71
    data_c[21] = data_in[21] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[21];
72
    data_c[22] = data_in[22] ^ lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[20];
73
    data_c[23] = data_in[23] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[19] ^ lfsr_q[22];
74
    data_c[24] = data_in[24] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[18] ^ lfsr_q[21];
75
    data_c[25] = data_in[25] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[20] ^ lfsr_q[22];
76
    data_c[26] = data_in[26] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[19] ^ lfsr_q[21];
77
    data_c[27] = data_in[27] ^ lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[18] ^ lfsr_q[20];
78
    data_c[28] = data_in[28] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[17] ^ lfsr_q[19];
79
    data_c[29] = data_in[29] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[16] ^ lfsr_q[18];
80
    data_c[30] = data_in[30] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[22];
81
    data_c[31] = data_in[31] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[21];
82
    data_c[32] = data_in[32] ^ lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[20];
83
    data_c[33] = data_in[33] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[19] ^ lfsr_q[22];
84
    data_c[34] = data_in[34] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[18] ^ lfsr_q[21];
85
    data_c[35] = data_in[35] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[20] ^ lfsr_q[22];
86
    data_c[36] = data_in[36] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[19] ^ lfsr_q[21];
87
    data_c[37] = data_in[37] ^ lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[18] ^ lfsr_q[20];
88
    data_c[38] = data_in[38] ^ lfsr_q[4] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[17] ^ lfsr_q[19];
89
    data_c[39] = data_in[39] ^ lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[16] ^ lfsr_q[18];
90
    data_c[40] = data_in[40] ^ lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[22];
91
    data_c[41] = data_in[41] ^ lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[21];
92
    data_c[42] = data_in[42] ^ lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[20];
93
    data_c[43] = data_in[43] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[19] ^ lfsr_q[22];
94
    data_c[44] = data_in[44] ^ lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[18] ^ lfsr_q[21];
95
    data_c[45] = data_in[45] ^ lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[20] ^ lfsr_q[22];
96
    data_c[46] = data_in[46] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[16] ^ lfsr_q[19] ^ lfsr_q[21] ^ lfsr_q[22];
97
    data_c[47] = data_in[47] ^ lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[21];
98
    data_c[48] = data_in[48] ^ lfsr_q[4] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[14] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[20];
99
    data_c[49] = data_in[49] ^ lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[13] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[19];
100
    data_c[50] = data_in[50] ^ lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[12] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[22];
101
    data_c[51] = data_in[51] ^ lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[11] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[21] ^ lfsr_q[22];
102
    data_c[52] = data_in[52] ^ lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[20] ^ lfsr_q[21];
103
    data_c[53] = data_in[53] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[22];
104
    data_c[54] = data_in[54] ^ lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[21];
105
    data_c[55] = data_in[55] ^ lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[22];
106
    data_c[56] = data_in[56] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[21];
107
    data_c[57] = data_in[57] ^ lfsr_q[0] ^ lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[20];
108
    data_c[58] = data_in[58] ^ lfsr_q[4] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[19];
109
    data_c[59] = data_in[59] ^ lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[18];
110
    data_c[60] = data_in[60] ^ lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[22];
111
    data_c[61] = data_in[61] ^ lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[21];
112
    data_c[62] = data_in[62] ^ lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[20];
113
    data_c[63] = data_in[63] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[19] ^ lfsr_q[22];
114
  end // always
115
 
116
  always @(posedge clk, posedge rst) begin
117
    if(rst) begin
118
      lfsr_q <= {23{1'b1}};
119
      data_out <= {64{1'b0}};
120
    end
121
    else begin
122
      lfsr_q <= scram_rst ? {23{1'b1}} : scram_en ? lfsr_c : lfsr_q;
123
      data_out <= scram_en ? data_c : data_out;
124
    end
125
  end // always
126
endmodule // scrambler

powered by: WebSVN 2.1.0

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