In VHDL, I'm Looking for a way to take two integer parameters of an entity, divide one against the the other as a floating point number, and then find both the floor and ceiling of this floating point ratio, and then store it as a vhdl integer constant.
library ieee;
use ieee.std_logic_1164.all;
entity something is
generic(
N: natural := 4;
M: natural := 150
);
port(
sys_clk :in std_logic;
sys_rst :in std_logic;
datai :in std_logic_vector(M-1 downto 0);
datao :out std_logic_vector(N-1 downto 0)
);
end entity;
architecture rtl is something is
--how to calculate ceiling of M / N?
constant ratio_ceiling :integer := integer(real(M)/real(N));
--how to calculate floor of M / N?
constant ratio_floor :integer := integer(real(M)/real(N));
begin
end architecture;