Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: mgrlm_sm.v | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | /*%W% %G%*/ | |
36 | ||
37 | /************************************************************************* | |
38 | * | |
39 | * File Name : mgrlm_sm | |
40 | * Author Name : John Lo | |
41 | * Description : | |
42 | * Parent Module: rx_mii_gmii | |
43 | * Child Module: | |
44 | * Interface Mod: | |
45 | * Date Created : 10/4/00 | |
46 | * | |
47 | * Copyright (c) 2002, Sun Microsystems, Inc. | |
48 | * Sun Proprietary and Confidential | |
49 | * | |
50 | * Modification : | |
51 | * | |
52 | * Synthesis Notes: | |
53 | * | |
54 | *************************************************************************/ | |
55 | ||
56 | module mgrlm_sm ( | |
57 | rx_nbclk, | |
58 | rx_reset_nbclk, | |
59 | rx_enable_nbclk, | |
60 | rx_det_sfd, // ipg_done and rx_det_S are level signals. | |
61 | rx_det_eop_lv, // rx_det_sfd is level signals. | |
62 | rx_heart_beat, | |
63 | rxfifo_full_nbclk, | |
64 | // outputs | |
65 | load_ok_state, | |
66 | adjust_rx_heart_beat, // should be a pulse | |
67 | mgrlm_state | |
68 | ); | |
69 | input rx_nbclk; | |
70 | input rx_reset_nbclk; | |
71 | input rx_enable_nbclk; | |
72 | input rx_det_sfd; | |
73 | input rx_det_eop_lv; | |
74 | input rx_heart_beat; | |
75 | input rxfifo_full_nbclk; | |
76 | output load_ok_state; | |
77 | output adjust_rx_heart_beat; // should be a pulse | |
78 | output mgrlm_state; | |
79 | ||
80 | reg adjust_rx_heart_beat; | |
81 | reg nx_mgrlm_state; | |
82 | wire mgrlm_state; | |
83 | wire load_ok_state; | |
84 | ||
85 | parameter IDLE = 1'b0, | |
86 | PAYLOAD = 1'b1; | |
87 | ||
88 | assign load_ok_state = (mgrlm_state == PAYLOAD); | |
89 | ||
90 | // comb part | |
91 | always @ (mgrlm_state or rx_det_sfd or rx_enable_nbclk or | |
92 | rxfifo_full_nbclk or rx_det_eop_lv or rx_heart_beat) | |
93 | begin | |
94 | nx_mgrlm_state = IDLE; | |
95 | adjust_rx_heart_beat = 0; // should be a pulse | |
96 | ||
97 | casex(mgrlm_state) | |
98 | IDLE: if (rx_det_sfd & rx_enable_nbclk & (~rxfifo_full_nbclk)) | |
99 | begin | |
100 | nx_mgrlm_state = PAYLOAD; | |
101 | adjust_rx_heart_beat = 1; | |
102 | end | |
103 | else nx_mgrlm_state = mgrlm_state; // stay | |
104 | ||
105 | PAYLOAD: if ((rx_det_eop_lv & rx_heart_beat) | rxfifo_full_nbclk) | |
106 | nx_mgrlm_state = IDLE; | |
107 | else nx_mgrlm_state = mgrlm_state; // stay | |
108 | endcase // casex(mgrlm_state) | |
109 | end | |
110 | ||
111 | // seq part | |
112 | RegRst #(1) mgrlm_state_RegRst(.clk(rx_nbclk), | |
113 | .reset(rx_reset_nbclk), | |
114 | .din(nx_mgrlm_state), | |
115 | .qout(mgrlm_state)); | |
116 | ||
117 | endmodule // mgrlm_sm |