~ruther/vhdl-spi-2

ref: 83810d3df03d7aa618451ede026ac726be030d64 vhdl-spi-2/hdl_spi/src/spi_pkg.vhd -rw-r--r-- 605 bytes
83810d3d — Rutherther fix: do not pass rx_serial_o from spi_multiplexor when not enabled 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library ieee;
use ieee.std_logic_1164.all;

package spi_pkg is

  type natural_vector is array (natural range <>) of natural;

  function get_max_natural (
    constant divisors : natural_vector)
    return natural;

end package spi_pkg;

package body spi_pkg is

  function get_max_natural (
    constant divisors : natural_vector)
    return natural is
    variable max : natural := divisors(divisors'left);
  begin
    for i in divisors'range loop
      if divisors(i) > max then
        max := divisors(i);
      end if;
    end loop;  -- i

    return max;
  end function;

end package body spi_pkg;