rtps-fpga/syn/test.vhd
Greek b47d409f13 Make codebase Quartus synthesizable
Remove non-Quartus-supported VHDL 2008 features.
Remove inferred Latches.
Add test Entities to see resulting hw synthesis of various code
segments.
2021-12-07 13:05:24 +01:00

38 lines
885 B
VHDL

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.math_pkg.all;
use work.rtps_package.all;
-- Test synthesis of SLV bit counter
entity test is
port (
clk : in std_logic;
reset : in std_logic;
input : in std_logic_vector(31 downto 0);
output : out std_logic_vector(31 downto 0)
);
end entity;
architecture arch of test is
function bitmap_converter(input : std_logic_vector) return natural is
variable ret : natural := 0;
begin
for i in 0 to input'length-1 loop
ret := ret + 1;
if (input(i) = '1') then
exit;
end if;
end loop;
return ret;
end function;
begin
output <= std_logic_vector(to_unsigned(bitmap_converter(input), output'length));
end architecture;