Project

General

Profile

Download (2.14 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc
3

    
4
-- This file is part of VESTs (Vhdl tESTs).
5

    
6
-- VESTs is free software; you can redistribute it and/or modify it
7
-- under the terms of the GNU General Public License as published by the
8
-- Free Software Foundation; either version 2 of the License, or (at
9
-- your option) any later version. 
10

    
11
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
12
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
-- for more details. 
15

    
16
-- You should have received a copy of the GNU General Public License
17
-- along with VESTs; if not, write to the Free Software Foundation,
18
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
19

    
20
-- ---------------------------------------------------------------------
21
--
22
-- $Id: ch_11_fg_11_02.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
package MVL4 is
28

    
29
  type MVL4_ulogic is ('X', '0', '1', 'Z');  -- unresolved logic type
30

    
31
  type MVL4_ulogic_vector is array (natural range <>) of MVL4_ulogic;
32

    
33
  function resolve_MVL4 ( contribution : MVL4_ulogic_vector )
34
    return MVL4_ulogic;
35

    
36
  subtype MVL4_logic is resolve_MVL4 MVL4_ulogic;
37

    
38
  -- code from book (in text)
39

    
40
  type MVL4_logic_vector is array (natural range <>) of MVL4_logic;
41

    
42
  -- end code from book
43

    
44
end package MVL4;
45

    
46
--------------------------------------------------
47

    
48
package body MVL4 is
49

    
50
  type table is array (MVL4_ulogic, MVL4_ulogic) of MVL4_ulogic;
51

    
52
  constant resolution_table : table :=
53
    --  'X'  '0'  '1'  'Z'
54
    --  ------------------
55
    ( ( 'X', 'X', 'X', 'X' ),    -- 'X'
56
      ( 'X', '0', 'X', '0' ),    -- '0'
57
      ( 'X', 'X', '1', '1' ),    -- '1'
58
      ( 'X', '0', '1', 'Z' ) );  -- 'Z'
59

    
60
  function resolve_MVL4 ( contribution : MVL4_ulogic_vector )
61
    return MVL4_ulogic is
62
    variable result : MVL4_ulogic := 'Z';
63
  begin
64
    for index in contribution'range loop
65
      result := resolution_table(result, contribution(index));
66
    end loop;
67
    return result;
68
  end function resolve_MVL4;
69

    
70
end package body MVL4;
(177-177/267)