source: XOpenSparcT1/trunk/T1-CPU/spu/spu_mald.v @ 6

Revision 6, 6.9 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: spu_mald.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//      Description:    state machine for load requests to L2.
24*/
25////////////////////////////////////////////////////////////////////////
26// Global header file includes
27////////////////////////////////////////////////////////////////////////
28
29module spu_mald (
30
31/*outputs*/
32spu_mald_rstln,
33spu_mald_maaddr_addrinc,
34spu_mald_memwen,
35spu_mald_mpa_addrinc,
36spu_mald_ldreq,
37spu_mald_done,
38spu_mald_force_mpa_add16,
39
40spu_mald_done_set,
41
42/*inputs*/
43ld_inprog,
44ldreq_ack,
45ln_received,
46len_neqz,
47mactl_ldop,
48spu_maaddr_mpa1maddr0,
49spu_mactl_iss_pulse_dly,
50
51spu_wen_ma_unc_err_pulse,
52
53spu_mactl_stxa_force_abort,
54
55se,
56reset,
57rclk);
58
59// ---------------------------------------------------------
60input reset;
61input rclk;
62input se;
63
64input ld_inprog;
65input ldreq_ack;
66input ln_received;
67input len_neqz;
68input mactl_ldop;
69input spu_maaddr_mpa1maddr0;
70input spu_mactl_iss_pulse_dly;
71
72input spu_wen_ma_unc_err_pulse;
73
74input spu_mactl_stxa_force_abort;
75// ---------------------------------------------------------
76output spu_mald_rstln;
77output spu_mald_maaddr_addrinc;
78output spu_mald_memwen;
79output spu_mald_mpa_addrinc;
80
81output spu_mald_ldreq;
82output spu_mald_done;
83output spu_mald_force_mpa_add16;
84
85output spu_mald_done_set;
86
87// ---------------------------------------------------------
88
89wire tr2wait4ln_frm_ldreq;
90
91// ---------------------------------------------------------
92/*******************************
93
94there are 8 states:
95
96000001       idle
97000010       ld1_req
98000100       ld2_req
99001000       wait_4ln1
100010000       wait_4ln2
101100000       mamem_wr
102
103********************************/
104wire local_stxa_abort;
105// ------------------------------------------------------
106// we need a state set to indcate ld is done, and when an
107// masync gets issued later, then the load asi is returned.
108wire spu_mald_done_wen = (spu_mald_done | spu_wen_ma_unc_err_pulse | local_stxa_abort) & 
109                                        mactl_ldop;
110wire spu_mald_done_rst = reset | spu_mactl_iss_pulse_dly;
111
112dffre_s    #(1) spu_mald_done_ff (
113        .din(1'b1) , 
114        .q(spu_mald_done_set),
115        .en(spu_mald_done_wen),
116        .rst(spu_mald_done_rst), .clk (rclk), .se(se), .si(), .so()); 
117
118// ------------------------------------------------------
119// ------------------------------------------------------
120// ------------------------------------------------------
121// ------------------------------------------------------
122// ------------------------------------------------------
123
124wire state_reset = reset | spu_mald_done | spu_wen_ma_unc_err_pulse |
125                                        local_stxa_abort; 
126
127// ------------------------------------------------------
128dff_s    #(1) idle_state_ff (
129        .din(nxt_idle_state) , 
130        .q(cur_idle_state),
131        .clk (rclk), .se(se), .si(), .so()); 
132
133dffr_s  #(1) ldreq_state_ff (
134        .din(nxt_ldreq_state) , 
135        .q(cur_ldreq_state),
136        .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); 
137
138dffr_s  #(1) wait4ln_state_ff (
139        .din(nxt_wait4ln_state) , 
140        .q(cur_wait4ln_state),
141        .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); 
142
143dffr_s  #(1) mamemwr_state_ff (
144        .din(nxt_mamemwr_state) , 
145        .q(cur_mamemwr_state),
146        .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); 
147
148dffr_s  #(1) chk4mpa1maddr0_state_ff (
149        .din(nxt_chk4mpa1maddr0_state) , 
150        .q(cur_chk4mpa1maddr0_state),
151        .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); 
152
153// ------------------------------------------------------
154// ------------------------------------------------------
155
156wire start_ldop = spu_mactl_iss_pulse_dly & mactl_ldop;
157
158// --------------------------------------------------------------
159//  transition to idle state.
160
161assign spu_mald_done = cur_chk4mpa1maddr0_state & ~len_neqz;
162
163assign  nxt_idle_state = (
164                         state_reset |
165                         (spu_mald_done) |
166                         (cur_idle_state & ~start_ldop));
167
168// --------------------------------------------------------------
169//  transition to ldreq state.
170
171
172assign  nxt_ldreq_state = (
173                        (cur_chk4mpa1maddr0_state & ~spu_maaddr_mpa1maddr0 & len_neqz) |
174                        (cur_idle_state & start_ldop) |
175                        (cur_ldreq_state & ~ldreq_ack));
176
177assign spu_mald_rstln = (cur_mamemwr_state & ld_inprog & len_neqz) | local_stxa_abort |
178                                                spu_wen_ma_unc_err_pulse;
179
180// --------------------------------------------------------------
181//  transition to wait4ln state.
182
183//assign tr2wait4ln_frm_ldreq = cur_ldreq_state & ldreq_ack & ln_received;
184assign tr2wait4ln_frm_ldreq = cur_ldreq_state & ldreq_ack ;
185
186assign nxt_wait4ln_state = (
187                        (tr2wait4ln_frm_ldreq) |
188                        (cur_wait4ln_state & ~ln_received));
189
190// --------------------------------------------------------------
191//  transition to mamemwr state.
192
193wire tr2mamemwr_frm_wait4ln = cur_wait4ln_state & ln_received;
194wire tr2mamemwr_frm_chk4mpa1maddr0 = cur_chk4mpa1maddr0_state & spu_maaddr_mpa1maddr0 & len_neqz;
195
196wire mald_memwen = ( tr2mamemwr_frm_wait4ln |
197                     tr2mamemwr_frm_chk4mpa1maddr0) & len_neqz;
198
199// added this delay for the Parity Gen. added extra cycle.
200wire mald_memwen_dly;
201dffr_s    #(1) wen_dly_ff (
202        .din(mald_memwen) ,
203        .q(mald_memwen_dly),
204        .rst(state_reset), .clk (rclk), .se(se), .si(), .so());
205
206
207assign nxt_mamemwr_state = ( mald_memwen_dly );
208
209assign local_stxa_abort = mald_memwen_dly & spu_mactl_stxa_force_abort;
210
211// --------------------------------------------------------------
212//  transition to chk4mpa1maddr0 state.
213
214assign nxt_chk4mpa1maddr0_state = (
215                        (cur_mamemwr_state) );
216
217
218// --------------------------------------------------------------
219// **************************************************************
220// --------------------------------------------------------------
221assign spu_mald_memwen = nxt_mamemwr_state;
222
223assign spu_mald_maaddr_addrinc = cur_mamemwr_state;
224
225assign spu_mald_mpa_addrinc = cur_mamemwr_state ;
226
227assign spu_mald_force_mpa_add16 = 1'b0 ;
228
229assign spu_mald_ldreq = cur_ldreq_state ;
230
231
232
233endmodule
Note: See TracBrowser for help on using the repository browser.