~ruther/vhdl-spi-2

ref: 98fdc2a71b1659c3d65e838503aa607502a8bb09 vhdl-spi-2/hdl_spi/src/spi_pkg.vhd -rw-r--r-- 605 bytes
98fdc2a7 — Rutherther tests: add proper checks for clock polarity before and after csn 3 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;
Do not follow this link