LogIn E-mail
¼³°èÀ̾߱â
[VHDL]type example - package TYPES
# 33 JMJS    06.2.2 11:30

----------------------------------------------------------------------------
--
-- Copyright (c) 1990, 1991 by Synopsys, Inc.  All rights reserved.
--
-- This source file may be used and distributed without restriction
-- provided that this copyright statement is not removed from the file
-- and that any derivative work contains this copyright notice.
--
--        Package name: TYPES
--
--        Purpose: This package defines the types, logic functions,
--                 truth tables, definitions for wired signals, and
--                 conversion functions for the Synopsys Standard Logic library.
--
--        Author: JT, PH, GWH
--
--        Modified with attributes for Synopsys synthesis.
--
--        Also synthesis_off and synthesis_on pairs required because
--        synthesis does not fully support or gives warnings about:
--            1) Multi-dimentional arrays
--            2) aliases  
--            3) assert
--
--
--     Modified by Champaka Ramachandran on Sept 15th 1992
--      
--     Modifications to get rid of the Synopsys specific library and attributes
--    
----------------------------------------------------------------------------
--synopsys translate_off
-- library SYNOPSYS;
-- use SYNOPSYS.ATTRIBUTES.all;
--synopsys translate_on


package TYPES is

        ---------------------------------------------------------------------
        --
        -- Definitions for Standard Logic types
        --
        ---------------------------------------------------------------------

        -- multi-valued logic 7 states:

        type MVL7 is ('X',         -- strong X (strong unknown)
                      '0',         -- strong 0 (strong low)
                      '1',         -- strong 1 (strong high)
                      'Z',         -- tristate X (high impedance)
                      'W',         -- weak X (weak unknown)
                      'L',         -- weak 0 (weak low)
                      'H');         -- weak 1 (weak high)

--       attribute ENUM_ENCODING : STRING;
--       attribute ENUM_ENCODING of MVL7 : type is "D 0 1 Z U 0 1";


        -- vector of MVL7

        type MVL7_VECTOR is array (Natural range <>) of MVL7;
        



        -- output-strength types

        type STRENGTH is (X01, X0H, XL1, X0Z, XZ1, WLH, WLZ, WZH, W0H, WL1);


        
        -----------------------------------------------------------------------
        --
        -- Internal types for table look up
        --
        ----------------------------------------------------------------------

--synopsys synthesis_off
        type MVL7_TAB1D is array (MVL7) of MVL7;        -- one dimensional

        type MVL7_TABLE is array (MVL7, MVL7) of MVL7;  -- two dimensional



        type STRN_MVL7_TABLE is array (MVL7,STRENGTH) of MVL7;

        type MUX_TABLE is array (MVL7 range 'X' to '1',
                                 MVL7 range 'X' to '1',
                                 MVL7 range 'X' to '1') of MVL7;

        type TRISTATE_TABLE is array (STRENGTH,
                                      MVL7 range 'X' to '1',
                                      MVL7 range 'X' to '1') of MVL7;

        type MINOMAX is array (1 to 3) of TIME;

        


        -----------------------------------------------------------------------
        --
        -- Truth tables for output strength --> MVL7 lookup
        --
        -----------------------------------------------------------------------

        -- truth table for output strength --> MVL7 lookup
        constant tbl_STRN_MVL7: STRN_MVL7_TABLE :=
        --  ------------------------------------------------------------------
        --  | X01  X0H  XL1  X0Z  XZ1  WLH  WLZ  WZH  W0H  WL1 | strn/ output|
        --  ------------------------------------------------------------------
            (('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'),  -- |   X   |
             ('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'),  -- |   0   |
             ('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1'),  -- |   1   |
             ('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'),  -- |   Z   |
             ('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'),  -- |   W   |
             ('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'),  -- |   L   |
             ('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1')); -- |   H   |



        -----------------------------------------------------------------------
        --
        -- Truth tables for strength --> MVL7 mapping ('Z' pass through)
        --
        -----------------------------------------------------------------------

        -- truth table for output strength --> MVL7 lookup
        constant tbl_STRN_MVL7_Z: STRN_MVL7_TABLE :=
        --  ------------------------------------------------------------------
        --  | X01  X0H  XL1  X0Z  XZ1  WLH  WLZ  WZH  W0H  WL1 | strn/ output|
        --  ------------------------------------------------------------------
            (('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'),  -- |   X   |
             ('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'),  -- |   0   |
             ('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1'),  -- |   1   |
             ('Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'),  -- |   Z   |
             ('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'),  -- |   W   |
             ('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'),  -- |   L   |
             ('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1')); -- |   H   |



        -----------------------------------------------------------------------
        --
        -- Truth tables for logical operations
        --
        -----------------------------------------------------------------------


        -- truth table for "and" function
        constant tbl_AND: MVL7_TABLE :=
        --  -----------------------------------------------
        --  |  X    0    1    Z    W    L    H |          |
        --  -----------------------------------------------
            (('X', '0', 'X', 'X', 'X', '0', 'X'),  -- | X |
             ('0', '0', '0', '0', '0', '0', '0'),  -- | 0 |
             ('X', '0', '1', 'X', 'X', '0', '1'),  -- | 1 |
             ('X', '0', 'X', 'X', 'X', '0', 'X'),  -- | Z |
             ('X', '0', 'X', 'X', 'X', '0', 'X'),  -- | W |
             ('0', '0', '0', '0', '0', '0', '0'),  -- | L |
             ('X', '0', '1', 'X', 'X', '0', '1')); -- | H |


        -- truth table for "or" function
        constant tbl_OR: MVL7_TABLE :=
        --  -----------------------------------------------
        --  |  X    0    1    Z    W    L    H |          |
        --  -----------------------------------------------
            (('X', 'X', '1', 'X', 'X', 'X', '1'),  -- | X |
             ('X', '0', '1', 'X', 'X', '0', '1'),  -- | 0 |
             ('1', '1', '1', '1', '1', '1', '1'),  -- | 1 |
             ('X', 'X', '1', 'X', 'X', 'X', '1'),  -- | Z |
             ('X', 'X', '1', 'X', 'X', 'X', '1'),  -- | W |
             ('X', '0', '1', 'X', 'X', '0', '1'),  -- | L |
             ('1', '1', '1', '1', '1', '1', '1')); -- | H |


        -- truth table for "xor" function
        constant tbl_XOR: MVL7_TABLE :=
        --  -----------------------------------------------
        --  |  X    0    1    Z    W    L    H |          |
        --  -----------------------------------------------
            (('X', 'X', 'X', 'X', 'X', 'X', 'X'),  -- | X |
             ('X', '0', '1', 'X', 'X', '0', '1'),  -- | 0 |
             ('X', '1', '0', 'X', 'X', '1', '0'),  -- | 1 |
             ('X', 'X', 'X', 'X', 'X', 'X', 'X'),  -- | Z |
             ('X', 'X', 'X', 'X', 'X', 'X', 'X'),  -- | W |
             ('X', '0', '1', 'X', 'X', '0', '1'),  -- | L |
             ('X', '1', '0', 'X', 'X', '1', '0')); -- | H |


        -- truth table for "not" function
        constant tbl_NOT: MVL7_TAB1D :=
        --  -------------------------------------
        --  |  X    0    1    Z    W    L    H  |
        --  -------------------------------------
             ('X', '1', '0', 'X', 'X', '1', '0');


        -- truth table for "buf" function
        constant tbl_BUF: MVL7_TAB1D :=
        --  -------------------------------------
        --  |  X    0    1    Z    W    L    H  |
        --  -------------------------------------
             ('X', '0', '1', 'X', 'X', '0', '1');



        -- truth table for tristate "buf" function (Enable active High)
        constant tbl_BUF3S: TRISTATE_TABLE :=
        --  ----------------------------------------
        --  |  X    0    1       | Enable Strength |
        --  ----------------------------------------
           ((('X', 'X', 'X'),  --|   X       X01   |
             ('Z', 'Z', 'Z'),  --|   0       X01   |
             ('X', '0', '1')), --|   1       X01   |

            (('X', 'X', 'X'),  --|   X       X0H   |
             ('Z', 'Z', 'Z'),  --|   0       X0H   |
             ('X', '0', 'H')), --|   1       X0H   |

            (('X', 'X', 'X'),  --|   X       XL1   |
             ('Z', 'Z', 'Z'),  --|   0       XL1   |
             ('X', 'L', '1')), --|   1       XL1   |

            (('X', 'X', 'Z'),  --|   X       X0Z   |
             ('Z', 'Z', 'Z'),  --|   0       X0Z   |
             ('X', '0', 'Z')), --|   1       X0Z   |

            (('X', 'X', 'X'),  --|   X       XZ1   |
             ('Z', 'Z', 'Z'),  --|   0       XZ1   |
             ('X', 'Z', '1')), --|   1       XZ1   |

            (('W', 'W', 'W'),  --|   X       WLH   |
             ('Z', 'Z', 'Z'),  --|   0       WLH   |
             ('W', 'L', 'H')), --|   1       WLH   |

            (('W', 'W', 'Z'),  --|   X       WLZ   |
             ('Z', 'Z', 'Z'),  --|   0       WLZ   |
             ('W', 'L', 'Z')), --|   1       WLZ   |

            (('W', 'W', 'W'),  --|   X       WZH   |
             ('Z', 'Z', 'Z'),  --|   0       WZH   |
             ('W', 'Z', 'H')), --|   1       WZH   |

            (('W', 'W', 'W'),  --|   X       W0H   |
             ('Z', 'Z', 'Z'),  --|   0       W0H   |
             ('W', '0', 'H')), --|   1       W0H   |

            (('W', 'W', 'W'),  --|   X       WL1   |
             ('Z', 'Z', 'Z'),  --|   0       WL1   |
             ('W', 'L', '1')));--|   1       WL1   |




        -- truth table for tristate "buf" function (Enable active Low)
        constant tbl_BUF3SL: TRISTATE_TABLE :=
        --  ----------------------------------------
        --  |  X    0    1       | Enable Strength |
        --  ----------------------------------------
           ((('X', 'X', 'X'),  --|   X       X01   |
             ('X', '0', '1'),  --|   0       X01   |
             ('Z', 'Z', 'Z')), --|   1       X01   |

            (('X', 'X', 'X'),  --|   X       X0H   |
             ('X', '0', 'H'),  --|   0       X0H   |
             ('Z', 'Z', 'Z')), --|   1       X0H   |

            (('X', 'X', 'X'),  --|   X       XL1   |
             ('X', 'L', '1'),  --|   0       XL1   |
             ('Z', 'Z', 'Z')), --|   1       XL1   |

            (('X', 'X', 'Z'),  --|   X       X0Z   |
             ('X', '0', 'Z'),  --|   0       X0Z   |
             ('Z', 'Z', 'Z')), --|   1       X0Z   |

            (('X', 'X', 'X'),  --|   X       XZ1   |
             ('X', 'Z', '1'),  --|   0       XZ1   |
             ('Z', 'Z', 'Z')), --|   1       XZ1   |

            (('W', 'W', 'W'),  --|   X       WLH   |
             ('W', 'L', 'H'),  --|   0       WLH   |
             ('Z', 'Z', 'Z')), --|   1       WLH   |

            (('W', 'W', 'Z'),  --|   X       WLZ   |
             ('W', 'L', 'Z'),  --|   0       WLZ   |
             ('Z', 'Z', 'Z')), --|   1       WLZ   |

            (('W', 'W', 'W'),  --|   X       WZH   |
             ('W', 'Z', 'H'),  --|   0       WZH   |
             ('Z', 'Z', 'Z')), --|   1       WZH   |

            (('W', 'W', 'W'),  --|   X       W0H   |
             ('W', '0', 'H'),  --|   0       W0H   |
             ('Z', 'Z', 'Z')), --|   1       W0H   |

            (('W', 'W', 'W'),  --|   X       WL1   |
             ('W', 'L', '1'),  --|   0       WL1   |
             ('Z', 'Z', 'Z')));--|   1       WL1   |




        -- truth table for "MUX2x1" function
        constant tbl_MUX2x1: MUX_TABLE :=
        ---------------------------------------
        --| In0  'X'  '0'  '1'      | Sel In1 |
        ---------------------------------------
              ((('X', 'X', 'X'),  --| 'X' 'X' |
                ('X', '0', '1'),  --| '0' 'X' |
                ('X', 'X', 'X')), --| '1' 'X' |
               (('X', '0', 'X'),  --| 'X' '0' |
                ('X', '0', '1'),  --| '0' '0' |
                ('0', '0', '0')), --| '1' '0' |
               (('X', 'X', '1'),  --| 'X' '1' |
                ('X', '0', '1'),  --| '0' '1' |
                ('1', '1', '1')));--| '1' '1' |



        ----------------------------------------------------------------------
        --
        -- Truth tables for resolution functions
        --
        ----------------------------------------------------------------------


        -- truth table for "WiredX" function
        constant tbl_WIREDX: MVL7_TABLE :=
        --  -----------------------------------------------
        --  |  X    0    1    Z    W    L    H |          |
        --  -----------------------------------------------
            (('X', 'X', 'X', 'X', 'X', 'X', 'X'),  -- | X |
             ('X', '0', 'X', '0', '0', '0', '0'),  -- | 0 |
             ('X', 'X', '1', '1', '1', '1', '1'),  -- | 1 |
             ('X', '0', '1', 'Z', 'W', 'L', 'H'),  -- | Z |
             ('X', '0', '1', 'W', 'W', 'W', 'W'),  -- | W |
             ('X', '0', '1', 'L', 'W', 'L', 'W'),  -- | L |
             ('X', '0', '1', 'H', 'W', 'W', 'H')); -- | H |


        -- truth table for "WiredOr" function
        constant tbl_WIREDOR: MVL7_TABLE :=
        --  -----------------------------------------------
        --  |  X    0    1    Z    W    L    H |          |
        --  -----------------------------------------------
            (('X', 'X', '1', 'X', 'X', 'L', 'H'),  -- | X |
             ('X', '0', '1', '0', '0', 'L', 'H'),  -- | 0 |
             ('1', '1', '1', '1', '1', '1', '1'),  -- | 1 |
             ('X', '0', '1', 'Z', 'W', 'L', 'H'),  -- | Z |
             ('X', '0', '1', 'W', 'W', 'W', 'W'),  -- | W |
             ('L', 'L', '1', 'L', 'W', 'L', 'W'),  -- | L |
             ('H', 'H', '1', 'H', 'W', 'W', 'H')); -- | H |


--synopsys synthesis_on


        -----------------------------------------------------------------------
        --
        -- logical functions for scalar type of MVL7
        --
        -----------------------------------------------------------------------

        function "and" (L, R: MVL7) return MVL7;

        function "nand" (L, R: MVL7) return MVL7;

        function "or" (L, R: MVL7) return MVL7;

        function "nor" (L, R: MVL7) return MVL7;

        function "xor" (L, R: MVL7) return MVL7;

        function nxor (L, R: MVL7) return MVL7;

        function "not" (R: MVL7) return MVL7;

        function buf (R: MVL7) return MVL7;



        -----------------------------------------------------------------------
        --
        -- logical functions for composite type of MVL7_VECTOR
        --
        -----------------------------------------------------------------------

        function "and" (L, R: MVL7_VECTOR) return MVL7_VECTOR;

        function "nand" (L, R: MVL7_VECTOR) return MVL7_VECTOR;

        function "or" (L, R: MVL7_VECTOR) return MVL7_VECTOR;

        function "nor" (L, R: MVL7_VECTOR) return MVL7_VECTOR;

        function "xor" (L, R: MVL7_VECTOR) return MVL7_VECTOR;

        function nxor (L, R: MVL7_VECTOR) return MVL7_VECTOR;

        function "not" (R: MVL7_VECTOR) return MVL7_VECTOR;

        function buf (R: MVL7_VECTOR) return MVL7_VECTOR;



        -----------------------------------------------------------------------
        --
        -- resolution functions for wired signals and its attributes
        --
        -----------------------------------------------------------------------

        function WiredX (V: MVL7_VECTOR) return MVL7;

        function WiredOr (V: MVL7_VECTOR) return MVL7;

--synopsys translate_off
--        attribute REFLEXIVE of WiredX: function is TRUE;
--        attribute RESULT_INITIAL_VALUE of WiredX: function is MVL7'POS('Z');
--        attribute TABLE_NAME of WiredX: function is "TYPES.tbl_WIREDX";
--synopsys translate_on




        -----------------------------------------------------------------------
        --
        -- Definitions for wired signals (scalars and vectors)
        --
        -----------------------------------------------------------------------

        subtype DotX is WiredX MVL7;


        type BusX is array (Natural range <>) of DotX;



--synopsys synthesis_off
        -----------------------------------------------------------------------
        --
        -- conversion functions for driving various types
        --
        -----------------------------------------------------------------------

        function Drive (V: MVL7_VECTOR) return BusX;
        function Drive (V: BusX) return MVL7_VECTOR;
--synopsys synthesis_on

--synopsys translate_off
--        attribute CLOSELY_RELATED_TCF of Drive: function is TRUE;
--synopsys translate_on



--synopsys synthesis_off
        -----------------------------------------------------------------------
        --
        -- conversion functions for sensing various types
        -- (the second argument allows the user to specify the value to
        --  be returned when the network is undriven)
        --
        -----------------------------------------------------------------------

        function Sense (V: MVL7; vZ: MVL7) return MVL7;
        function Sense (V: MVL7_VECTOR; vZ: MVL7) return MVL7_VECTOR;
        function Sense (V: BusX; vZ: MVL7) return MVL7_VECTOR;
--synopsys synthesis_on


        -----------------------------------------------------------------------
        --
        --        Function: BVtoMVL7V
        --
        --        Purpose: Conversion function from BIT_VECTOR to MVL7_VECTOR
        --
        --        Mapping:        0 --> 0
        --                        1 --> 1
        --
        -----------------------------------------------------------------------

        function BVtoMVL7V (V: BIT_VECTOR) return MVL7_VECTOR;


        -----------------------------------------------------------------------
        --
        --        Function: MVL7VtoBV
        --
        --        Purpose: Conversion function from MVL7_VECTOR to BIT_VECTOR
        --
        --        Mapping:        0, L --> 0
        --                        1, H --> 1
        --                        X --> vX if Xflag is TRUE
        --                        X --> 0  if Xflag is FALSE
        --                        Z --> vZ if Zflag is TRUE
        --                        Z --> 0  if Zflag is FALSE
        --
        -----------------------------------------------------------------------

        function MVL7VtoBV (V: MVL7_VECTOR
--synopsys synthesis_off
                ; vX, vZ: BIT := '0'; Xflag, Zflag: BOOLEAN := FALSE
--synopsys synthesis_on
                ) return BIT_VECTOR;
        

        -----------------------------------------------------------------------
        --
        --        Function: BITtoMVL7
        --
        --        Purpose: Conversion function from BIT to MVL7
        --
        --        Mapping:        0 --> 0
        --                        1 --> 1
        --
        -----------------------------------------------------------------------

        function BITtoMVL7 (V: BIT) return MVL7;


        -----------------------------------------------------------------------
        --
        --        Function: MVL7toBIT
        --
        --        Purpose: Conversion function from MVL7 to BIT
        --
        --        Mapping:        0, L --> 0
        --                        1, H --> 1
        --                        X --> vX if Xflag is TRUE
        --                        X --> 0  if Xflag is FALSE
        --                        Z --> vZ if Zflag is TRUE
        --                        Z --> 0  if Zflag is FALSE
        --
        -----------------------------------------------------------------------

        function MVL7toBIT (V: MVL7
--synopsys synthesis_off
                ; vX, vZ: BIT := '0'; Xflag, Zflag: BOOLEAN := FALSE
--synopsys synthesis_on
                ) return BIT;



--synopsys synthesis_off
        -----------------------------------------------------------------------
        --
        --        Truth tables for unidirectional transistors
        --
        -----------------------------------------------------------------------


        -- truth table for reduce function
        constant tbl_REDUCE: MVL7_TAB1D :=
        -- ------------------------------------
        -- | X    0    1    Z    W    L    H  |
        -- ------------------------------------
           ('W', 'L', 'H', 'Z', 'W', 'L', 'H');

        constant tbl_NXFER: MVL7_TABLE :=
        ----------------------------------------------------------
        -- | Input  'X'  '0'  '1'  'Z'  'W'  'L'  'H'   |   Enable
        ----------------------------------------------------------
                  (('X', 'X', 'X', 'X', 'X', 'X', 'X'),   -- 'X'
                   ('Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'),   -- '0'
                   ('X', '0', '1', 'Z', 'W', 'L', 'H'),   -- '1'
                   ('X', 'X', 'X', 'X', 'X', 'X', 'X'),   -- 'Z'
                   ('X', 'X', 'X', 'X', 'X', 'X', 'X'),   -- 'W'
                   ('Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'),   -- 'L'
                   ('X', '0', '1', 'Z', 'W', 'L', 'H'));  -- 'H'
   
        constant tbl_PXFER: MVL7_TABLE :=
        ----------------------------------------------------------
        -- | Input  'X'  '0'  '1'  'Z'  'W'  'L'  'H'   |   Enable
        ----------------------------------------------------------
                  (('X', 'X', 'X', 'X', 'X', 'X', 'X'),   -- 'X'
                   ('X', '0', '1', 'Z', 'W', 'L', 'H'),   -- '0'
                   ('Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'),   -- '1'
                   ('X', 'X', 'X', 'X', 'X', 'X', 'X'),   -- 'Z'
                   ('X', 'X', 'X', 'X', 'X', 'X', 'X'),   -- 'W'
                   ('X', '0', '1', 'Z', 'W', 'L', 'H'),   -- 'L'
                   ('Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'));  -- 'H'
--synopsys synthesis_on
   
end TYPES;




package body TYPES is


        -----------------------------------------------------------------------
        --
        -- logical functions for scalar type of MVL7
        --
        -----------------------------------------------------------------------

        function "and" (L, R: MVL7) return MVL7 is
          -- pragma built_in SYN_AND
        begin
--synopsys synthesis_off
                return tbl_AND(L, R);
--synopsys synthesis_on
        end "and";



        function "nand" (L, R: MVL7) return MVL7 is
          -- pragma built_in SYN_NAND
        begin
--synopsys synthesis_off
                return tbl_NOT(tbl_AND(L, R));
--synopsys synthesis_on
        end "nand";



        function "or" (L, R: MVL7) return MVL7 is
          -- pragma built_in SYN_OR
        begin
--synopsys synthesis_off
                return tbl_OR(L, R);
--synopsys synthesis_on
        end "or";



        function "nor" (L, R: MVL7) return MVL7 is
          -- pragma built_in SYN_NOR
        begin
--synopsys synthesis_off
                return tbl_NOT(tbl_OR(L, R));
--synopsys synthesis_on
        end "nor";



        function "xor" (L, R: MVL7) return MVL7 is
          -- pragma built_in SYN_XOR
        begin
--synopsys synthesis_off
                return tbl_XOR(L, R);
--synopsys synthesis_on
        end "xor";


        function nxor (L, R: MVL7) return MVL7 is
          -- pragma built_in SYN_XNOR
        begin
--synopsys synthesis_off
                return tbl_NOT(tbl_XOR(L, R));
--synopsys synthesis_on
        end nxor;


        function "not" (R: MVL7) return MVL7 is
          -- pragma built_in SYN_NOT
        begin
--synopsys synthesis_off
                return tbl_NOT(R);
--synopsys synthesis_on
        end "not";


        function buf (R: MVL7) return MVL7 is
          -- pragma built_in SYN_BUF
        begin
--synopsys synthesis_off
                return tbl_BUF(R);
--synopsys synthesis_on
        end buf;



        -----------------------------------------------------------------------
        --
        -- logical functions for composite type of MVL7_VECTOR
        --
        -----------------------------------------------------------------------

        function "and" (L, R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_AND
--synopsys synthesis_off
                alias LV: MVL7_VECTOR (L'length-1 downto 0) is L;
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (L'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                assert L'length = R'length;
                for i in result'range loop
                        result (i) := tbl_AND(LV (i), RV (i));
                end loop;
                return result;
--synopsys synthesis_on
        end "and";


        function "nand" (L, R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_NAND
--synopsys synthesis_off
                alias LV: MVL7_VECTOR (L'length-1 downto 0) is L;
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (L'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                assert L'length = R'length;
                for i in result'range loop
                        result (i) := tbl_NOT(tbl_AND(LV (i), RV (i)));
                end loop;
                return result;
--synopsys synthesis_on
        end "nand";


        function "or" (L, R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_OR
--synopsys synthesis_off
                alias LV: MVL7_VECTOR (L'length-1 downto 0) is L;
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (L'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                assert L'length = R'length;
                for i in result'range loop
                        result (i) := tbl_OR(LV (i), RV (i));
                end loop;
                return result;
--synopsys synthesis_on
        end "or";


        function "nor" (L, R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_NOR
--synopsys synthesis_off
                alias LV: MVL7_VECTOR (L'length-1 downto 0) is L;
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (L'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                assert L'length = R'length;
                for i in result'range loop
                        result (i) := tbl_NOT(tbl_OR(LV (i), RV (i)));
                end loop;
                return result;
--synopsys synthesis_on
        end "nor";


        function "xor" (L, R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_XOR
--synopsys synthesis_off
                alias LV: MVL7_VECTOR (L'length-1 downto 0) is L;
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (L'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                assert L'length = R'length;
                for i in result'range loop
                        result (i) := tbl_XOR(LV (i), RV (i));
                end loop;
                return result;
--synopsys synthesis_on
        end "xor";


        function nxor (L, R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_XNOR
--synopsys synthesis_off
                alias LV: MVL7_VECTOR (L'length-1 downto 0) is L;
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (L'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                assert L'length = R'length;
                for i in result'range loop
                         result(i) := tbl_NOT(tbl_XOR(LV(i), RV(i)));
                end loop;
                return result;
--synopsys synthesis_on
        end nxor;


        function "not" (R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_NOT
--synopsys synthesis_off
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (R'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                for i in result'range loop
                        result (i) := tbl_NOT( RV(i) );
                end loop;
                return result;
--synopsys synthesis_on
        end "not";


        function buf (R: MVL7_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_BUF
--synopsys synthesis_off
                alias RV: MVL7_VECTOR (R'length-1 downto 0) is R;
                variable result: MVL7_VECTOR (R'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                for i in result'range loop
                          result(i) := tbl_BUF( RV(i) );
                end loop;
                return result;
--synopsys synthesis_on
        end buf;




        -----------------------------------------------------------------------
        --
        -- resolution functions for wired signals
        --
        -----------------------------------------------------------------------


        function WiredX (V: MVL7_VECTOR) return MVL7 is
          -- pragma resolution_method three_state

                variable result: MVL7;
        begin
--synopsys synthesis_off
                result := 'Z';
                for i in V'range loop
                        result := tbl_WIREDX(result, V(i));
                        exit when result = 'X';                
                end loop;
                return result;
--synopsys synthesis_on
        end WiredX;

        function WiredOr (V: MVL7_VECTOR) return MVL7 is

                variable result: MVL7;
        begin
--synopsys synthesis_off
                result := 'Z';
                for i in V'range loop
                        result := tbl_WIREDOr(result, V(i));
                        exit when result = '1';                
                end loop;
                return result;
--synopsys synthesis_on
        end WiredOr;



-- synopsys synthesis_off

        -----------------------------------------------------------------------
        --
        -- conversion functions for driving various types
        --
        -----------------------------------------------------------------------



        function Drive (V: BusX) return MVL7_VECTOR is
        begin
                return MVL7_VECTOR(V);
        end Drive;




        function Drive (V: MVL7_VECTOR) return BusX is
        begin
                return BusX(V);
        end Drive;


        -----------------------------------------------------------------------
        --
        -- conversion functions for sensing various types
        --
        -- (the second argument allows the user to specify the value to
        --  be returned when the network is undriven)
        --
        -----------------------------------------------------------------------

        function Sense (V: MVL7; vZ: MVL7) return MVL7 is
        begin
                if V = 'Z' then
                        return vZ;
                else
                        return V;
                end if;
        end Sense;


        function Sense (V: MVL7_VECTOR; vZ: MVL7) return MVL7_VECTOR is
                alias Value: MVL7_VECTOR (V'length-1 downto 0) is V;
                variable Result: MVL7_VECTOR (V'length-1 downto 0);
        begin
                for i in Value'range loop
                        if ( Value(i) = 'Z' ) then
                                Result(i) := vZ;
                        else
                                Result(i) := Value(i);
                        end if;
                end loop;
                return Result;
        end Sense;


        function Sense (V: BusX; vZ: MVL7) return MVL7_VECTOR is
                alias Value: BusX (V'length-1 downto 0) is V;
                variable Result: MVL7_VECTOR (V'length-1 downto 0);
        begin
                for i in Value'range loop
                        if ( Value(i) = 'Z' ) then
                                Result(i) := vZ;
                        else
                                Result(i) := Value(i);
                        end if;
                end loop;
                return Result;
        end Sense;

-- synopsys synthesis_on

        -----------------------------------------------------------------------
        --
        --        Function: BVtoMVL7V
        --
        --        Purpose: Conversion function from BIT_VECTOR to MVL7_VECTOR
        --
        --        Mapping:        0 --> 0
        --                        1 --> 1
        --
        -----------------------------------------------------------------------

        function BVtoMVL7V (V: BIT_VECTOR) return MVL7_VECTOR is
          -- pragma built_in SYN_FEED_THRU
--synopsys synthesis_off
                alias Value: BIT_VECTOR (V'length-1 downto 0) is V;
                variable Result: MVL7_VECTOR (V'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                for i in Value'range loop
                        if ( Value(i) = '0' ) then
                                Result(i) := '0';
                        else
                                Result(i) := '1';
                        end if;
                end loop;
                return Result;
--synopsys synthesis_on
        end BVtoMVL7V;



        -----------------------------------------------------------------------
        --
        --        Function: MVL7VtoBV
        --
        --        Purpose: Conversion function from MVL7_VECTOR to BIT_VECTOR
        --
        --        Mapping:        0, L --> 0
        --                        1, H --> 1
        --                        X --> vX if Xflag is TRUE
        --                        X --> 0  if Xflag is FALSE
        --                        Z --> vZ if Zflag is TRUE
        --                        Z --> 0  if Zflag is FALSE
        --
        -----------------------------------------------------------------------

        function MVL7VtoBV (V: MVL7_VECTOR
--synopsys synthesis_off
                ; vX, vZ: BIT := '0'; Xflag, Zflag: BOOLEAN := FALSE
--synopsys synthesis_on
                           ) return BIT_VECTOR is
          -- pragma built_in SYN_FEED_THRU
--synopsys synthesis_off
                alias Value: MVL7_VECTOR (V'length-1 downto 0) is V;
                variable Result: BIT_VECTOR (V'length-1 downto 0);
--synopsys synthesis_on
        begin
--synopsys synthesis_off
                for i in Value'range loop
                        case Value(i) is
                                when '0' | 'L' =>
                                        Result(i) := '0';
                                when '1' | 'H' =>
                                        Result(i) := '1';
                                when 'X' | 'W' =>
                                        if ( Xflag ) then
                                                Result(i) := vX;
                                        else
                                                Result(i) := '0';
                                                 assert FALSE
                                                     report "MVL7VtoBV: X --> 0"
                                                     severity WARNING;
                                        end if;
                                when others =>
                                        if ( Zflag ) then
                                                Result(i) := vZ;
                                        else
                                                Result(i) := '0';
                                                assert FALSE
                                                    report "MVL7VtoBV: Z --> 0"
                                                    severity WARNING;
                                        end if;
                        end case;
                end loop;
                return Result;
--synopsys synthesis_on
        end MVL7VtoBV;



        -----------------------------------------------------------------------
        --
        --        Function: BITtoMVL7
        --
        --        Purpose: Conversion function from BIT to MVL7
        --
        --        Mapping:        0 --> 0
        --                        1 --> 1
        --
        -----------------------------------------------------------------------

        function BITtoMVL7 (V: BIT) return MVL7 is
                variable Result: MVL7;
          -- pragma built_in SYN_FEED_THRU
        begin
                if ( V = '0' ) then
                        Result := '0';
                else
                        Result := '1';
                end if;
                return Result;
        end BITtoMVL7;




        -----------------------------------------------------------------------
        --
        --        Function: MVL7toBIT
        --
        --        Purpose: Conversion function from MVL7 to BIT
        --
        --        Mapping:        0, L --> 0
        --                        1, H --> 1
        --                        X --> vX if Xflag is TRUE
        --                        X --> 0  if Xflag is FALSE
        --                        Z --> vZ if Zflag is TRUE
        --                        Z --> 0  if Zflag is FALSE
        --
        -----------------------------------------------------------------------

        function MVL7toBIT (V: MVL7
--synopsys synthesis_off
                ; vX, vZ: BIT := '0'; Xflag, Zflag: BOOLEAN := FALSE
--synopsys synthesis_on
                           ) return BIT is
          -- pragma built_in SYN_FEED_THRU
                variable Result: BIT;
        begin
--synopsys synthesis_off
                case V is
                        when '0' | 'L' =>
                                Result := '0';
                        when '1' | 'H' =>
                                Result := '1';
                        when 'X' | 'W' =>
                                if ( Xflag ) then
                                        Result := vX;
                                else
                                        Result := '0';
                                         assert FALSE
                                             report "MVL7toBIT: X --> 0"
                                             severity WARNING;
                                end if;
                        when others =>
                                if ( Zflag ) then
                                        Result := vZ;
                                else
                                        Result := '0';
                                        assert FALSE
                                            report "MVL7toBIT: Z --> 0"
                                            severity WARNING;
                                end if;
                end case;
                return Result;
--synopsys synthesis_on
        end MVL7toBIT;

end TYPES;

°Ô½Ã¹°: 94 °Ç, ÇöÀç: 1 / 1 ÂÊ
¹øÈ£ Á¦       ¸ñ ÀÛ¼ºÀÚ µî·ÏÀÏ ¹æ¹®
96  color text JMJS 24.7.13 1
95  draw_hexa.v JMJS 10.6.17 2194
94  jmjsxram3.v JMJS 10.4.9 1927
93  Verilog document JMJS 11.1.24 2511
92  [verilog]o=(c1)? (c2)? 0:1 : (c3)? 2:3; JMJS 09.3.31 2070
91  [verilog]forever, repeat, strobe, realtime, ... JMJS 09.7.6 3539
90  gtkwave PC version JMJS 09.3.30 1875
89  ncsim option example JMJS 08.12.1 4246
88  [¿µ»ó]keywords for web search JMJS 08.12.1 1880
87  [Verilog]fdisplay fopen fscanf JMJS 11.1.24 6200
86  ncverilog option example JMJS 10.6.8 7634
85  [Verilog]Latch example JMJS 08.12.1 2483
84  Pad verilog example JMJS 01.3.16 4398
83  [ModelSim] vector JMJS 01.3.16 2085
82  RTL Code ºÐ¼®¼ø¼­ JMJS 09.4.29 2382
81  [temp]PIPE JMJS 08.10.2 1749
80  [temp]always-forever ¹«ÇÑ·çÇÁ JMJS 08.10.2 1835
79  YCbCr2RGB.v JMJS 10.5.12 2033
78  [VHDL]rom64x8 JMJS 09.3.27 1639
77  [function]vector_compare JMJS 02.6.19 1600
76  [function]vector2integer JMJS 02.6.19 1672
75  [VHDL]ram8x4x8 JMJS 08.12.1 1560
74  [¿¹]shift JMJS 02.6.19 1903
73  test JMJS 09.7.20 1703
72  test JMJS 09.7.20 1498
71  test JMJS 09.7.20 1432
70  test JMJS 09.7.20 1533
69  test JMJS 09.7.20 1563
68  test JMJS 09.7.20 1490
67  test JMJS 09.7.20 1420
66  test JMJS 09.7.20 1369
65  test JMJS 09.7.20 1484
64  test JMJS 09.7.20 1729
63  test JMJS 09.7.20 1724
62  test JMJS 09.7.20 1649
61  VHDLÀÇ ¿¬»êÀÚ ¿ì¼±¼øÀ§ JMJS 09.7.20 3437
60  test JMJS 09.7.20 1428
59  test JMJS 09.7.20 1508
58  test JMJS 09.7.20 1502
57  test JMJS 09.7.20 1443
56  test JMJS 09.7.20 1489
55  verilog Çаú »ùÇð­ÀÇ JMJS 16.5.30 2107
54  [verilog]create_generated_clock JMJS 15.4.28 2083
53  [Verilog]JDIFF JMJS 14.7.4 1357
52  [verilog]parameter definition JMJS 14.3.5 1622
51  [verilog]sformat fopen fscanf fwrite fclose JMJS 12.1.31 4579
50  Verilog File I/0,Verilog file handling JMJS 12.1.30 2347
49  Verdi JMJS 10.4.22 2975
48  draw hexa JMJS 10.4.9 1699
47  asfifo - Async FIFO JMJS 10.4.8 1526
46  VHDLÀ» ÀÌ¿ëÇÑ È¸·Î¼³°èÀÇ ÀåÁ¡ JMJS 02.3.14 3170
45  synplify batch JMJS 10.3.8 2283
44  ÀüÀڽðè Type A JMJS 08.11.28 1792
43  I2C Webpage JMJS 08.2.25 1644
42  PC¿¡¼­ °£´ÜÈ÷ Verilog ½ÇÇàÇغ¸±â (Icarus Verilog) JMJS 13.1.14 5793
41  [Verilog]vstring JMJS 17.9.27 1876
40  Riviera Simple Case JMJS 09.4.29 3017
39  [VHDL]DES Example JMJS 07.6.15 2764
38  [verilog]RAM example JMJS 09.6.5 2545
37  ROM example [VerilogHDL, RTL] JMJS 04.5.27 1806
36  Jamie's VHDL Handbook JMJS 08.11.28 2467
35  Dualport RAM example [VerilogHDL, RTL] JMJS 04.5.27 3101
34  RTL Job JMJS 09.4.29 1944
33  [VHDL]type example - package TYPES JMJS 06.2.2 1627
32  [verilog]`define `ifdef `elsif `else `endif ... JMJS 10.5.11 9151
30  [verilog]array_module JMJS 05.12.8 2056
29  [verilog-2001]generate JMJS 05.12.8 3189
28  protected JMJS 05.11.18 1844
27  design¿¡ latch°¡ ÀÖÀ¸¸é ¾ÈµÇ³ª¿ä? JMJS 09.7.20 2649
26  busÀÇ µ¥ÀÌŸ¸¦ °¢ bitº°·Î Ãâ·ÂÇÏ´Â ¹æ¹ýÀº? JMJS 04.11.9 1705
25  component¸¦ »ý¼ºÇؼ­ ´Ù¸¥ °÷¿¡¼­ È£ÃâÇÏ´Â ¹æ¹ý JMJS 04.11.4 2271
23  Array Of Array JMJS 04.8.16 1800
22  dumpfile, dumpvars JMJS 04.7.19 3417
21  Vending Machine Jamie 02.12.16 9880
20  Mini Vending Machine1 Jamie 02.12.10 6716
19  Mini Vending Machine Jamie 02.12.6 9542
18  Key Jamie 02.11.29 4776
17  Stop Watch Jamie 02.11.25 5497
16  Mealy Machine Jamie 02.8.29 6531
15  Moore Machine Jamie 02.8.29 17650
14  Up Down Counter Jamie 02.8.29 3839
13  Up Counter Jamie 02.8.29 2571
12  Edge Detecter Jamie 02.8.29 2763
11  Concept4 Jamie 02.8.28 1911
10  Concept3 Jamie 02.8.28 1866
9  Concept2_1 Jamie 02.8.28 1749
8  Concept2 Jamie 02.8.28 1824
7  Concept1 Jamie 02.8.26 2027
6  Tri State Buffer Jamie 02.8.26 3335
5  8x3 Encoder Jamie 02.8.28 3933
4  3x8 Decoder Jamie 02.8.28 3601
3  4bit Comparator Jamie 02.8.26 3000
2  °¡À§ ¹ÙÀ§ º¸ °ÔÀÓ Jamie 02.8.26 5356
1  Two Input Logic Jamie 02.8.26 2266
[1]