1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: lsu_dcache_lfsr.v |
---|
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
---|
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
---|
6 | // |
---|
7 | // The above named program is free software; you can redistribute it and/or |
---|
8 | // modify it under the terms of the GNU General Public |
---|
9 | // License version 2 as published by the Free Software Foundation. |
---|
10 | // |
---|
11 | // The above named program is distributed in the hope that it will be |
---|
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | // General Public License for more details. |
---|
15 | // |
---|
16 | // You should have received a copy of the GNU General Public |
---|
17 | // License along with this work; if not, write to the Free Software |
---|
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
19 | // |
---|
20 | // ========== Copyright Header End ============================================ |
---|
21 | //////////////////////////////////////////////////////////////////////// |
---|
22 | /* |
---|
23 | // Module Name: lsu_dcache_lfsr |
---|
24 | */ |
---|
25 | //////////////////////////////////////////////////////////////////////// |
---|
26 | |
---|
27 | module lsu_dcache_lfsr (/*AUTOARG*/ |
---|
28 | // Outputs |
---|
29 | out, |
---|
30 | // Inputs |
---|
31 | advance, clk, se, si, so, reset |
---|
32 | ); |
---|
33 | |
---|
34 | input advance; |
---|
35 | |
---|
36 | input clk, se, si, so, reset; |
---|
37 | |
---|
38 | output [1:0] out; |
---|
39 | |
---|
40 | reg [4:0] q_next; |
---|
41 | wire [4:0] q; |
---|
42 | |
---|
43 | |
---|
44 | /* |
---|
45 | always @ (posedge clk) |
---|
46 | begin |
---|
47 | out = $random; |
---|
48 | end // always @ posedge |
---|
49 | */ |
---|
50 | |
---|
51 | // always @ (posedge clk) |
---|
52 | // begin |
---|
53 | // q[4:0] <= q_next[4:0]; |
---|
54 | // end |
---|
55 | |
---|
56 | always @ (/*AUTOSENSE*/advance or q or reset) |
---|
57 | begin |
---|
58 | if (reset) |
---|
59 | q_next = 5'b11111; |
---|
60 | else if (advance) |
---|
61 | begin |
---|
62 | // lfsr -- stable at 000000, period of 63 |
---|
63 | q_next[1] = q[0]; |
---|
64 | q_next[2] = q[1]; |
---|
65 | q_next[3] = q[2]; |
---|
66 | q_next[4] = q[3]; |
---|
67 | q_next[0] = q[1] ^ q[4]; |
---|
68 | end |
---|
69 | else |
---|
70 | q_next = q; |
---|
71 | end // always @ (... |
---|
72 | |
---|
73 | assign out = {q[0], q[2]}; |
---|
74 | |
---|
75 | dff_s #(5) lfsr_reg(.din (q_next), |
---|
76 | .q (q), |
---|
77 | .clk (clk), .se(se), .si(), .so()); |
---|
78 | |
---|
79 | endmodule // lsu_dcache_lfsr |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|