114270Sgabeblack@google.com# Copyright 2019 Google, Inc.
214270Sgabeblack@google.com#
314270Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without
414270Sgabeblack@google.com# modification, are permitted provided that the following conditions are
514270Sgabeblack@google.com# met: redistributions of source code must retain the above copyright
614270Sgabeblack@google.com# notice, this list of conditions and the following disclaimer;
714270Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright
814270Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the
914270Sgabeblack@google.com# documentation and/or other materials provided with the distribution;
1014270Sgabeblack@google.com# neither the name of the copyright holders nor the names of its
1114270Sgabeblack@google.com# contributors may be used to endorse or promote products derived from
1214270Sgabeblack@google.com# this software without specific prior written permission.
1314270Sgabeblack@google.com#
1414270Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1514270Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1614270Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1714270Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1814270Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1914270Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2014270Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2114270Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2214270Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2314270Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2414270Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2514270Sgabeblack@google.com#
2614270Sgabeblack@google.com# Authors: Gabe Black
2714270Sgabeblack@google.com
2814270Sgabeblack@google.comfrom m5.params import Port, VectorPort
2914270Sgabeblack@google.com
3014270Sgabeblack@google.comINT_SOURCE_ROLE = 'Int Source Pin'
3114270Sgabeblack@google.comINT_SINK_ROLE = 'Int Sink Pin'
3214270Sgabeblack@google.comPort.compat(INT_SOURCE_ROLE, INT_SINK_ROLE)
3314270Sgabeblack@google.com
3414270Sgabeblack@google.com# A source pin generally represents a single pin which might connect to
3514270Sgabeblack@google.com# multiple sinks.
3614270Sgabeblack@google.comclass IntSourcePin(VectorPort):
3714270Sgabeblack@google.com    def __init__(self, desc):
3814270Sgabeblack@google.com        super(IntSourcePin, self).__init__(
3914270Sgabeblack@google.com                INT_SOURCE_ROLE, desc, is_source=True)
4014270Sgabeblack@google.com
4114270Sgabeblack@google.com# Each "physical" pin can be driven by a single source pin since there are no
4214270Sgabeblack@google.com# provisions for resolving competing signals running to the same pin.
4314270Sgabeblack@google.comclass IntSinkPin(Port):
4414270Sgabeblack@google.com    def __init__(self, desc):
4514270Sgabeblack@google.com        super(IntSinkPin, self).__init__(INT_SINK_ROLE, desc)
4614270Sgabeblack@google.com
4714270Sgabeblack@google.com# A vector of sink pins represents a bank of physical pins. For instance, an
4814270Sgabeblack@google.com# interrupt controller with many numbered input interrupts could represent them
4914270Sgabeblack@google.com# as a VectorIntSinkPin.
5014270Sgabeblack@google.comclass VectorIntSinkPin(VectorPort):
5114270Sgabeblack@google.com    def __init__(self, desc):
5214270Sgabeblack@google.com        super(VectorIntSinkPin, self).__init__(INT_SINK_ROLE, desc)
53