source: XOpenSparcT1/trunk/T1-CPU/lsu/lsu_dc_parity_gen.v @ 6

Revision 6, 1.7 KB checked in by pntsvt00, 14 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: lsu_dc_parity_gen.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_dc_parity_gen.v
24//  Description: Parity Generator based on odd parity
25
26module lsu_dc_parity_gen (parity_out, data_in);
27
28// Changed the default to match that of dcache width
29parameter WIDTH = 8 ;
30parameter NUM = 16 ;
31
32input   [WIDTH * NUM - 1 : 0]   data_in ; // data in
33
34output  [NUM - 1 : 0]           parity_out ; // parity output
35reg     [NUM - 1 : 0]           parity ; // parity output
36
37integer i ;
38integer j ;
39
40always @(data_in)
41    for (i = 0; i <= NUM - 1 ; i = i + 1) begin
42            parity[i] = 1'b0 ;
43        for (j = WIDTH * i; j <= WIDTH * (i + 1) - 1 ; j = j + 1) begin
44            parity[i] = parity[i] ^ data_in[j] ;
45        end
46    end
47
48assign parity_out[NUM - 1 : 0] = parity[NUM - 1 : 0];
49
50endmodule
Note: See TracBrowser for help on using the repository browser.