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

Subversion Repositories mem_ctrl

[/] [mem_ctrl/] [trunk/] [rtl/] [verilog/] [mc_incn_r.v] - Blame information for rev 29

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

Line No. Rev Author Line
1 4 rudi
/////////////////////////////////////////////////////////////////////
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 22 rudi
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
16
////                         www.asics.ws                        ////
17
////                         rudi@asics.ws                       ////
18 4 rudi
////                                                             ////
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 22 rudi
//  $Id: mc_incn_r.v,v 1.2 2002-01-21 13:08:52 rudi Exp $
43 4 rudi
//
44 22 rudi
//  $Date: 2002-01-21 13:08:52 $
45
//  $Revision: 1.2 $
46 4 rudi
//  $Author: rudi $
47
//  $Locker:  $
48
//  $State: Exp $
49
//
50
// Change History:
51
//               $Log: not supported by cvs2svn $
52 22 rudi
//               Revision 1.1  2001/07/29 07:34:41  rudi
53
//
54
//
55
//               1) Changed Directory Structure
56
//               2) Fixed several minor bugs
57
//
58 4 rudi
//               Revision 1.1  2001/06/12 15:18:47  rudi
59
//
60
//
61
//               This is a pipelined primitive incrementor.
62
//
63
//
64
//
65
//
66
//
67
 
68
`include "mc_defines.v"
69
 
70
//
71
// USAGE: incN_r #(<WIDTH>) uN(clk, input, output);
72
//
73
module mc_incn_r(clk, inc_in, inc_out);
74
 
75
parameter       incN_width = 32;
76
 
77
input           clk;
78
input   [incN_width-1:0] inc_in;
79
output  [incN_width-1:0] inc_out;
80
 
81
parameter       incN_center = incN_width / 2;
82
 
83
reg     [incN_center:0]          out_r;
84
wire    [31:0]                   tmp_zeros = 32'h0;
85
wire    [incN_center-1:0]        inc_next;
86
 
87
always @(posedge clk)
88
        out_r <= #1 inc_in[incN_center - 1:0] + {tmp_zeros[incN_center-2:0], 1'h1};
89
 
90
assign inc_out[incN_width-1:incN_center] = inc_in[incN_width-1:incN_center] + inc_next;
91
 
92
assign inc_next = out_r[incN_center] ?
93
                        {tmp_zeros[incN_center-2:0], 1'h1} : tmp_zeros[incN_center-2:0];
94
 
95
assign inc_out[incN_center-1:0]  = out_r;
96
 
97
endmodule
98
 

powered by: WebSVN 2.1.0

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