Acest cod foloseste algoritmul "Shift Add-3"
O sa adaug mai multe comentari umpic mai tarziu, dar s-ar putea sa ajute foarte mult pe cineva
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity bcd16 is
Port ( number : in STD_LOGIC_VECTOR (15 downto 0);
bcd : out STD_LOGIC_VECTOR (15 downto 0));
end bcd16;
architecture Behavioral of bcd16 is
begin
process(number)
variable z: std_logic_vector(32 downto 0);
begin
--initialize
z:=(others=>'0');
--set number