diff --git a/lib/VGA_ctrl/src/vga_types.vhd b/lib/VGA_ctrl/src/vga_types.vhd index 80667c2..6ca9520 100644 --- a/lib/VGA_ctrl/src/vga_types.vhd +++ b/lib/VGA_ctrl/src/vga_types.vhd @@ -123,14 +123,6 @@ package vga_types is ); -- Functions - function NextPowerOfTwo(x : natural) return natural; - function NextExpBaseTwo(x : natural) return natural; - function GCD(a, b : natural) return natural; - function LCM(a, b : natural) return natural; - function DCM_PERIOD(f_sys_hz : natural) return real; - function DCM_FREQ_M(f_sys_hz, f_vga_hz : natural) return natural; - function DCM_FREQ_D(f_sys_hz, f_vga_hz : natural) return natural; - function to_color_t(x : unsigned) return color_t; function to_unsigned(x : color_t) return unsigned; @@ -139,81 +131,6 @@ end vga_types; package body vga_types is - function NextExpBaseTwo(x : natural) return natural is - begin - return natural(ceil(log2(real(x)))); - end NextExpBaseTwo; - - function NextPowerOfTwo(x : natural) return natural is - begin - - return 2**NextExpBaseTwo(x); - end NextPowerOfTwo; - - function GCD(a, b : natural) return natural is - variable aa : natural; - variable bb : natural; - begin - aa := a; - bb := b; - while bb /= 0 loop - if aa > bb then - aa := aa - bb; - else - bb := bb - aa; - end if; - end loop; - - return aa; - - end GCD; - - function LCM(a, b : natural) return natural is - begin - - return (a * b)/GCD(a, b); - - end LCM; - - function DCM_FREQ_M(f_sys_hz, f_vga_hz : natural) return natural is - variable f_sys_mhz : natural; - variable f_vga_mhz : natural; - variable m : natural; - begin - f_sys_mhz := f_sys_hz/1E6; - f_vga_mhz := f_vga_hz/1E6; - m := f_vga_mhz/GCD(f_sys_mhz, f_vga_mhz); - - if m = 1 then - m := 2; - end if; - - return m; - - end DCM_FREQ_M; - - function DCM_FREQ_D(f_sys_hz, f_vga_hz : natural) return natural is - variable f_sys_mhz : natural; - variable f_vga_mhz : natural; - variable m : natural; - variable d : natural; - begin - m := DCM_FREQ_M(f_sys_hz, f_vga_hz); - f_sys_mhz := f_sys_hz/1E6; - f_vga_mhz := f_vga_hz/1E6; - d := m*f_sys_mhz/f_vga_mhz; - - return d; - - end DCM_FREQ_D; - - function DCM_PERIOD(f_sys_hz : natural) return real is - begin - - return 1.0E9/real(f_sys_hz); - - end DCM_PERIOD; - function to_color_t(x : unsigned) return color_t is variable result : color_t; begin