root / usrp2 / sdr_lib / add2_and_round.v @ 4f94819a
History | View | Annotate | Download (997 Bytes)
| 1 | bfaa5d14 | Josh Blum | // |
|---|---|---|---|
| 2 | // Copyright 2011 Ettus Research LLC |
||
| 3 | // |
||
| 4 | // This program is free software: you can redistribute it and/or modify |
||
| 5 | // it under the terms of the GNU General Public License as published by |
||
| 6 | // the Free Software Foundation, either version 3 of the License, or |
||
| 7 | // (at your option) any later version. |
||
| 8 | // |
||
| 9 | // This program is distributed in the hope that it will be useful, |
||
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 12 | // GNU General Public License for more details. |
||
| 13 | // |
||
| 14 | // You should have received a copy of the GNU General Public License |
||
| 15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
| 16 | // |
||
| 17 | |||
| 18 | 61f2f021 | jcorgan | |
| 19 | module add2_and_round |
||
| 20 | #(parameter WIDTH=16) |
||
| 21 | (input [WIDTH-1:0] in1, |
||
| 22 | input [WIDTH-1:0] in2, |
||
| 23 | output [WIDTH-1:0] sum); |
||
| 24 | |||
| 25 | wire [WIDTH:0] sum_int = {in1[WIDTH-1],in1} + {in2[WIDTH-1],in2};
|
||
| 26 | assign sum = sum_int[WIDTH:1] + (sum_int[WIDTH] & sum_int[0]); |
||
| 27 | |||
| 28 | endmodule // add2_and_round |