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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [verilog/] [minsoc/] [mc/] [mc_incn_r.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE Memory Controller                                 ////
4
////  Parametarized, Pipelined Incrementer                       ////
5
////                                                             ////
6
////                                                             ////
7
////  Author: Rudolf Usselmann                                   ////
8
////          rudi@asics.ws                                      ////
9
////                                                             ////
10
////                                                             ////
11
////  Downloaded from: http://www.opencores.org/cores/mem_ctrl/  ////
12
////                                                             ////
13
/////////////////////////////////////////////////////////////////////
14
////                                                             ////
15
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
16
////                         www.asics.ws                        ////
17
////                         rudi@asics.ws                       ////
18
////                                                             ////
19
//// This source file may be used and distributed without        ////
20
//// restriction provided that this copyright statement is not   ////
21
//// removed from the file and that any derivative work contains ////
22
//// the original copyright notice and the associated disclaimer.////
23
////                                                             ////
24
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
25
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
26
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
27
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
28
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
29
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
30
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
31
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
32
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
33
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
34
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
35
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
36
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
37
////                                                             ////
38
/////////////////////////////////////////////////////////////////////
39
 
40
//  CVS Log
41
//
42
//  $Id: mc_incn_r.v,v 1.2 2002/01/21 13:08:52 rudi Exp $
43
//
44
//  $Date: 2002/01/21 13:08:52 $
45
//  $Revision: 1.2 $
46
//  $Author: rudi $
47
//  $Locker:  $
48
//  $State: Exp $
49
//
50
// Change History:
51
//               $Log: mc_incn_r.v,v $
52
//               Revision 1.2  2002/01/21 13:08:52  rudi
53
//
54
//               Fixed several minor bugs, cleaned up the code further ...
55
//
56
//               Revision 1.1  2001/07/29 07:34:41  rudi
57
//
58
//
59
//               1) Changed Directory Structure
60
//               2) Fixed several minor bugs
61
//
62
//               Revision 1.1  2001/06/12 15:18:47  rudi
63
//
64
//
65
//               This is a pipelined primitive incrementor.
66
//
67
//
68
//
69
//
70
//
71
 
72
`include "mc_defines.v"
73
 
74
//
75
// USAGE: incN_r #(<WIDTH>) uN(clk, input, output);
76
//
77
module mc_incn_r(clk, inc_in, inc_out);
78
 
79
parameter       incN_width = 32;
80
 
81
input           clk;
82
input   [incN_width-1:0] inc_in;
83
output  [incN_width-1:0] inc_out;
84
 
85
parameter       incN_center = incN_width / 2;
86
 
87
reg     [incN_center:0]          out_r;
88
wire    [31:0]                   tmp_zeros = 32'h0;
89
wire    [incN_center-1:0]        inc_next;
90
 
91
always @(posedge clk)
92
        out_r <= #1 inc_in[incN_center - 1:0] + {tmp_zeros[incN_center-2:0], 1'h1};
93
 
94
assign inc_out[incN_width-1:incN_center] = inc_in[incN_width-1:incN_center] + inc_next;
95
 
96
assign inc_next = out_r[incN_center] ?
97
                        {tmp_zeros[incN_center-2:0], 1'h1} : tmp_zeros[incN_center-2:0];
98
 
99
assign inc_out[incN_center-1:0]  = out_r;
100
 
101
endmodule
102
 

powered by: WebSVN 2.1.0

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