----==============================================================----
|
----==============================================================----
|
---- ----
|
---- ----
|
---- Filename: add_dw.vhd ----
|
---- Filename: add_dw.vhd ----
|
---- Module description: Generic DW-bit binary adder ----
|
---- Module description: Generic DW-bit binary adder ----
|
---- ----
|
---- ----
|
---- Author: Nikolaos Kavvadias ----
|
---- Author: Nikolaos Kavvadias ----
|
---- nkavv@skiathos.physics.auth.gr ----
|
---- nkavv@skiathos.physics.auth.gr ----
|
---- ----
|
---- ----
|
---- ----
|
---- ----
|
---- Downloaded from: http://wwww.opencores.org/cores/hwlu ----
|
---- Downloaded from: http://wwww.opencores.org/cores/hwlu ----
|
---- ----
|
---- ----
|
---- To Do: ----
|
---- To Do: ----
|
---- Probably remains as current ----
|
---- Probably remains as current ----
|
---- (to promote as stable version) ----
|
---- (to promote as stable version) ----
|
---- ----
|
---- ----
|
---- Author: Nikolaos Kavvadias ----
|
---- Author: Nikolaos Kavvadias ----
|
---- nkavv@skiathos.physics.auth.gr ----
|
---- nkavv@skiathos.physics.auth.gr ----
|
---- ----
|
---- ----
|
----==============================================================----
|
----==============================================================----
|
---- ----
|
---- ----
|
---- Copyright (C) 2004 Nikolaos Kavvadias ----
|
---- Copyright (C) 2004 Nikolaos Kavvadias ----
|
---- nick-kavi.8m.com ----
|
---- nick-kavi.8m.com ----
|
---- nkavv@skiathos.physics.auth.gr ----
|
---- nkavv@skiathos.physics.auth.gr ----
|
---- nick_ka_vi@hotmail.com ----
|
---- nick_ka_vi@hotmail.com ----
|
---- ----
|
---- ----
|
---- This source file may be used and distributed without ----
|
---- This source file may be used and distributed without ----
|
---- restriction provided that this copyright statement is not ----
|
---- restriction provided that this copyright statement is not ----
|
---- removed from the file and that any derivative work contains ----
|
---- removed from the file and that any derivative work contains ----
|
---- the original copyright notice and the associated disclaimer. ----
|
---- the original copyright notice and the associated disclaimer. ----
|
---- ----
|
---- ----
|
---- This source file is free software; you can redistribute it ----
|
---- This source file is free software; you can redistribute it ----
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
---- Public License as published by the Free Software Foundation; ----
|
---- Public License as published by the Free Software Foundation; ----
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- later version. ----
|
---- later version. ----
|
---- ----
|
---- ----
|
---- This source is distributed in the hope that it will be ----
|
---- This source is distributed in the hope that it will be ----
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
---- details. ----
|
---- details. ----
|
---- ----
|
---- ----
|
---- You should have received a copy of the GNU Lesser General ----
|
---- You should have received a copy of the GNU Lesser General ----
|
---- Public License along with this source; if not, download it ----
|
---- Public License along with this source; if not, download it ----
|
---- from <http://www.opencores.org/lgpl.shtml> ----
|
---- from <http://www.opencores.org/lgpl.shtml> ----
|
---- ----
|
---- ----
|
----==============================================================----
|
----==============================================================----
|
--
|
--
|
-- CVS Revision History
|
-- CVS Revision History
|
--
|
--
|
|
|
library IEEE;
|
library IEEE;
|
use IEEE.std_logic_1164.all;
|
use IEEE.std_logic_1164.all;
|
use IEEE.std_logic_unsigned.all;
|
use IEEE.std_logic_unsigned.all;
|
|
|
|
|
entity add is
|
entity add is
|
generic (
|
generic (
|
DW : integer := 8
|
DW : integer := 8
|
);
|
);
|
port (
|
port (
|
a : in std_logic_vector(DW-1 downto 0);
|
a : in std_logic_vector(DW-1 downto 0);
|
b : in std_logic_vector(DW-1 downto 0);
|
b : in std_logic_vector(DW-1 downto 0);
|
sum : out std_logic_vector(DW-1 downto 0)
|
sum : out std_logic_vector(DW-1 downto 0)
|
);
|
);
|
end add;
|
end add;
|
|
|
|
|
architecture structural of add is
|
architecture structural of add is
|
signal temp_sum : std_logic_vector(DW downto 0);
|
signal temp_sum : std_logic_vector(DW downto 0);
|
begin
|
begin
|
--
|
--
|
temp_sum <= (a(DW-1) & a) + (b(DW-1) & b);
|
temp_sum <= (a(DW-1) & a) + (b(DW-1) & b);
|
sum <= temp_sum(DW-1 downto 0);
|
sum <= temp_sum(DW-1 downto 0);
|
--
|
--
|
end structural;
|
end structural;
|
|
|
|
|
|
|