aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue2177/vlm5030_pack.vhd
blob: a048b67c14258d96e30cb046fc283588245be05e (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
----------------------------------------------------------------------
--                           VLM5030
--                      www.fpgaarcade.com
--                     All rights reserved.
--
--                     admin@fpgaarcade.com
--
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
----------------------------------------------------------------------
--
-- Copyright (c) 2021, Arnim Laeuger  arnim.laeuger@gmx.net
-- All rights reserved.
--


library ieee;
use ieee.std_logic_1164.all;

package vlm5030_pack is

  -----------------------------------------------------------------------------
  -- Verctorized NOR and OR functions
  -----------------------------------------------------------------------------
  function  norf(i : std_logic_vector) return std_logic;
  function  norf(wl, vec : std_logic_vector) return std_logic;
  function norif(wl, vec : std_logic_vector) return std_logic;
  function   orf(wl, vec : std_logic_vector) return std_logic;

end;

package body vlm5030_pack is

  function norf(i : std_logic_vector) return std_logic is
    variable lorf : std_logic;
  begin
    lorf := '0';
    for idx in i'range loop
      lorf := lorf or i(idx);
    end loop;
    return not lorf;
  end;

  function norf(wl, vec : std_logic_vector) return std_logic is
    variable lorf : std_logic;
  begin
    lorf := '0';
    for idx in wl'range loop
      lorf := lorf or (wl(idx) and vec(idx));
    end loop;
    return not lorf;
  end;

  function norif(wl, vec : std_logic_vector) return std_logic is
    variable lorf : std_logic;
  begin
    lorf := '0';
    for idx in wl'range loop
      lorf := lorf or (wl(idx) and not vec(idx));
    end loop;
    return not lorf;
  end;

  function orf(wl, vec : std_logic_vector) return std_logic is
  begin
    return not norf(wl, vec);
  end;

end;