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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [dbg_if/] [dbg_crc32_d1.v] - Blame information for rev 517

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 julius
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  dbg_crc32_d1.v                                              ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC Debug Interface.               ////
7
////  http://www.opencores.org/projects/DebugInterface/           ////
8
////                                                              ////
9
////  Author(s):                                                  ////
10
////       Igor Mohor (igorm@opencores.org)                       ////
11
////                                                              ////
12
////                                                              ////
13
////  All additional information is avaliable in the README.txt   ////
14
////  file.                                                       ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2000 - 2004 Authors                            ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
// File:  CRC32_D1.v                             
43
// Date:  Thu Nov 27 13:56:49 2003                                                      
44
//                                                                     
45
// Copyright (C) 1999-2003 Easics NV.                 
46
// This source file may be used and distributed without restriction    
47
// provided that this copyright statement is not removed from the file 
48
// and that any derivative work contains the original copyright notice
49
// and the associated disclaimer.
50
//
51
// THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
52
// OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
53
// WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
54
//
55
// Purpose: Verilog module containing a synthesizable CRC function
56
//   * polynomial: (0 1 2 4 5 7 8 10 11 12 16 22 23 26 32)
57
//   * data width: 1
58
//                                                                     
59
// Info: janz@easics.be (Jan Zegers)                           
60
//       http://www.easics.com                                  
61
///////////////////////////////////////////////////////////////////////
62
//
63
// CVS Revision History
64
//
65
// $Log: dbg_crc32_d1.v,v $
66
// Revision 1.3  2004/03/28 20:27:02  igorm
67
// New release of the debug interface (3rd. release).
68
//
69
// Revision 1.2  2003/12/23 15:26:26  mohor
70
// Small fix.
71
//
72
// Revision 1.1  2003/12/23 15:09:04  mohor
73
// New directory structure. New version of the debug interface.
74
//
75
//
76
//
77
//
78
 
79
// synopsys translate_off
80
`include "timescale.v"
81
// synopsys translate_on
82
 
83
module dbg_crc32_d1 (data, enable, shift, rst, sync_rst, crc_out, clk, crc_match);
84
 
85
input         data;
86
input         enable;
87
input         shift;
88
input         rst;
89
input         sync_rst;
90
input         clk;
91
 
92
 
93
output        crc_out;
94
output        crc_match;
95
 
96
reg    [31:0] crc;
97
 
98
wire   [31:0] new_crc;
99
 
100
 
101
assign new_crc[0] = data          ^ crc[31];
102
assign new_crc[1] = data          ^ crc[0]  ^ crc[31];
103
assign new_crc[2] = data          ^ crc[1]  ^ crc[31];
104
assign new_crc[3] = crc[2];
105
assign new_crc[4] = data          ^ crc[3]  ^ crc[31];
106
assign new_crc[5] = data          ^ crc[4]  ^ crc[31];
107
assign new_crc[6] = crc[5];
108
assign new_crc[7] = data          ^ crc[6]  ^ crc[31];
109
assign new_crc[8] = data          ^ crc[7]  ^ crc[31];
110
assign new_crc[9] = crc[8];
111
assign new_crc[10] = data         ^ crc[9]  ^ crc[31];
112
assign new_crc[11] = data         ^ crc[10] ^ crc[31];
113
assign new_crc[12] = data         ^ crc[11] ^ crc[31];
114
assign new_crc[13] = crc[12];
115
assign new_crc[14] = crc[13];
116
assign new_crc[15] = crc[14];
117
assign new_crc[16] = data         ^ crc[15] ^ crc[31];
118
assign new_crc[17] = crc[16];
119
assign new_crc[18] = crc[17];
120
assign new_crc[19] = crc[18];
121
assign new_crc[20] = crc[19];
122
assign new_crc[21] = crc[20];
123
assign new_crc[22] = data         ^ crc[21] ^ crc[31];
124
assign new_crc[23] = data         ^ crc[22] ^ crc[31];
125
assign new_crc[24] = crc[23];
126
assign new_crc[25] = crc[24];
127
assign new_crc[26] = data         ^ crc[25] ^ crc[31];
128
assign new_crc[27] = crc[26];
129
assign new_crc[28] = crc[27];
130
assign new_crc[29] = crc[28];
131
assign new_crc[30] = crc[29];
132
assign new_crc[31] = crc[30];
133
 
134
 
135
always @ (posedge clk or posedge rst)
136
begin
137
  if(rst)
138 360 julius
    crc[31:0] <=  32'hffffffff;
139 6 julius
  else if(sync_rst)
140 360 julius
    crc[31:0] <=  32'hffffffff;
141 6 julius
  else if(enable)
142 360 julius
    crc[31:0] <=  new_crc;
143 6 julius
  else if (shift)
144 360 julius
    crc[31:0] <=  {crc[30:0], 1'b0};
145 6 julius
end
146
 
147
 
148
assign crc_match = (crc == 32'h0);
149
assign crc_out = crc[31];
150
 
151
endmodule

powered by: WebSVN 2.1.0

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