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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [lsu/] [lsu_dc_parity_gen.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== 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
 
26
module lsu_dc_parity_gen (parity_out, data_in);
27
 
28
// Changed the default to match that of dcache width
29
parameter WIDTH = 8 ;
30
parameter NUM = 16 ;
31
 
32
input   [WIDTH * NUM - 1 : 0]    data_in ; // data in
33
 
34
output  [NUM - 1 : 0]            parity_out ; // parity output
35
reg     [NUM - 1 : 0]            parity ; // parity output
36
 
37
integer i ;
38
integer j ;
39
 
40
always @(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
 
48
assign parity_out[NUM - 1 : 0] = parity[NUM - 1 : 0];
49
 
50
endmodule

powered by: WebSVN 2.1.0

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