110976Sdavid.hashe@amd.com# Copyright (c) 2013 Advanced Micro Devices, Inc.
210976Sdavid.hashe@amd.com# All rights reserved.
310976Sdavid.hashe@amd.com#
410976Sdavid.hashe@amd.com# Redistribution and use in source and binary forms, with or without
510976Sdavid.hashe@amd.com# modification, are permitted provided that the following conditions are
610976Sdavid.hashe@amd.com# met: redistributions of source code must retain the above copyright
710976Sdavid.hashe@amd.com# notice, this list of conditions and the following disclaimer;
810976Sdavid.hashe@amd.com# redistributions in binary form must reproduce the above copyright
910976Sdavid.hashe@amd.com# notice, this list of conditions and the following disclaimer in the
1010976Sdavid.hashe@amd.com# documentation and/or other materials provided with the distribution;
1110976Sdavid.hashe@amd.com# neither the name of the copyright holders nor the names of its
1210976Sdavid.hashe@amd.com# contributors may be used to endorse or promote products derived from
1310976Sdavid.hashe@amd.com# this software without specific prior written permission.
1410976Sdavid.hashe@amd.com#
1510976Sdavid.hashe@amd.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1610976Sdavid.hashe@amd.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1710976Sdavid.hashe@amd.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1810976Sdavid.hashe@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1910976Sdavid.hashe@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2010976Sdavid.hashe@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2110976Sdavid.hashe@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2210976Sdavid.hashe@amd.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2310976Sdavid.hashe@amd.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2410976Sdavid.hashe@amd.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2510976Sdavid.hashe@amd.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2610976Sdavid.hashe@amd.com#
2710976Sdavid.hashe@amd.com# Authors: Derek Hower
2810976Sdavid.hashe@amd.com
2910976Sdavid.hashe@amd.comclass CntrlBase:
3010976Sdavid.hashe@amd.com    _seqs = 0
3110976Sdavid.hashe@amd.com    @classmethod
3210976Sdavid.hashe@amd.com    def seqCount(cls):
3310976Sdavid.hashe@amd.com        # Use SeqCount not class since we need global count
3410976Sdavid.hashe@amd.com        CntrlBase._seqs += 1
3510976Sdavid.hashe@amd.com        return CntrlBase._seqs - 1
3610976Sdavid.hashe@amd.com
3710976Sdavid.hashe@amd.com    _cntrls = 0
3810976Sdavid.hashe@amd.com    @classmethod
3910976Sdavid.hashe@amd.com    def cntrlCount(cls):
4010976Sdavid.hashe@amd.com        # Use CntlCount not class since we need global count
4110976Sdavid.hashe@amd.com        CntrlBase._cntrls += 1
4210976Sdavid.hashe@amd.com        return CntrlBase._cntrls - 1
4310976Sdavid.hashe@amd.com
4410976Sdavid.hashe@amd.com    _version = 0
4510976Sdavid.hashe@amd.com    @classmethod
4610976Sdavid.hashe@amd.com    def versionCount(cls):
4710976Sdavid.hashe@amd.com        cls._version += 1 # Use count for this particular type
4810976Sdavid.hashe@amd.com        return cls._version - 1
49