Files
iverilog/ivtest/ivltests/work14_pkg.vhd
T
Stephen Williams cea237b407 Add ivtest to the iverilog source tree
By adding ivtest to the iverilog source tree, it is easier to keep
the regression test synchronized with the source that is being tested.
This should be especially helpful for PRs that add a new feature, and
have a matching ivtest PR with the regression test for that feature.
2022-01-15 10:18:50 -08:00

34 lines
667 B
VHDL

library ieee;
use ieee.std_logic_1164.all;
package work14_pkg is
function f_log2_size (
A : natural)
return natural;
component work14_comp
generic (
max_out_val : natural;
sample_parm : string);
port (
clk_i : in std_logic;
val : out std_logic_vector(f_log2_size(max_out_val)-1 downto 0));
end component;
end work14_pkg;
package body work14_pkg is
function f_log2_size (A : natural) return natural is
begin
for I in 1 to 64 loop -- Works for up to 64 bits
if (2**I >= A) then
return(I);
end if;
end loop;
return(63);
end function f_log2_size;
end work14_pkg;