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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [bigadd.v] - Blame information for rev 34

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    bigadd.v
4
//
5
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
//
7
// Purpose:     
8
//
9
// Creator:     Dan Gisselquist, Ph.D.
10
//              Gisselquist Technology, LLC
11
//
12
////////////////////////////////////////////////////////////////////////////////
13
//
14
// Copyright (C) 2016, Gisselquist Technology, LLC
15
//
16
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
module  bigadd(i_clk, i_sync, i_a, i_b, o_r, o_sync);
39 34 dgisselq
        parameter       NCLOCKS = 1;
40 3 dgisselq
        input                   i_clk, i_sync;
41
        input           [63:0]   i_a, i_b;
42 34 dgisselq
        output  wire    [63:0]   o_r;
43
        output  wire    o_sync;
44 3 dgisselq
 
45 34 dgisselq
        generate
46
        if (NCLOCKS == 0)
47
        begin
48
                assign  o_sync= i_sync;
49
                assign  o_r = i_a + i_b;
50
        end else if (NCLOCKS == 1)
51
        begin
52
                reg             r_sync;
53
                reg     [63:0]   r_out;
54
                always @(posedge i_clk)
55
                        r_sync <= i_sync;
56
                always @(posedge i_clk)
57
                        r_out <= i_a+i_b;
58 3 dgisselq
 
59 34 dgisselq
                assign  o_sync = r_sync;
60
                assign  o_r = r_out;
61
        end else // if (NCLOCKS == 2)
62
        begin
63
                reg             r_sync, r_pps;
64
                reg     [31:0]   r_hi, r_low;
65 3 dgisselq
 
66 34 dgisselq
                reg             f_sync;
67
                reg     [63:0]   f_r;
68 3 dgisselq
 
69 34 dgisselq
                initial r_sync = 1'b0;
70
                always @(posedge i_clk)
71
                        r_sync <= i_sync;
72 3 dgisselq
 
73 34 dgisselq
                always @(posedge i_clk)
74
                        { r_pps, r_low } <= i_a[31:0] + i_b[31:0];
75
                always @(posedge i_clk)
76
                        r_hi <= i_a[63:32] + i_b[63:32];
77
 
78
                initial f_sync = 1'b0;
79
                always @(posedge i_clk)
80
                        f_sync <= r_sync;
81
                always @(posedge i_clk)
82
                        f_r[31:0] <= r_low;
83
                always @(posedge i_clk)
84
                        f_r[63:32] <= r_hi + { 31'h00, r_pps };
85
 
86
                assign  o_sync = f_sync;
87
                assign  o_r    = f_r;
88
        end endgenerate
89
 
90 3 dgisselq
endmodule

powered by: WebSVN 2.1.0

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