port.hh revision 13771:10d990934f15
14826Ssaidi@eecs.umich.edu/*
24826Ssaidi@eecs.umich.edu * Copyright (c) 2011-2012,2015,2017 ARM Limited
34826Ssaidi@eecs.umich.edu * All rights reserved
44826Ssaidi@eecs.umich.edu *
54826Ssaidi@eecs.umich.edu * The license below extends only to copyright in the software and shall
64826Ssaidi@eecs.umich.edu * not be construed as granting a license to any other intellectual
74826Ssaidi@eecs.umich.edu * property including but not limited to intellectual property relating
84826Ssaidi@eecs.umich.edu * to a hardware implementation of the functionality of the software
94826Ssaidi@eecs.umich.edu * licensed hereunder.  You may use the software subject to the license
104826Ssaidi@eecs.umich.edu * terms below provided that you ensure that this notice is replicated
114826Ssaidi@eecs.umich.edu * unmodified and in its entirety in all distributions of the software,
124826Ssaidi@eecs.umich.edu * modified or unmodified, in source code or in binary form.
134826Ssaidi@eecs.umich.edu *
144826Ssaidi@eecs.umich.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan
154826Ssaidi@eecs.umich.edu * All rights reserved.
164826Ssaidi@eecs.umich.edu *
174826Ssaidi@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
184826Ssaidi@eecs.umich.edu * modification, are permitted provided that the following conditions are
194826Ssaidi@eecs.umich.edu * met: redistributions of source code must retain the above copyright
204826Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
214826Ssaidi@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
224826Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
234826Ssaidi@eecs.umich.edu * documentation and/or other materials provided with the distribution;
244826Ssaidi@eecs.umich.edu * neither the name of the copyright holders nor the names of its
254826Ssaidi@eecs.umich.edu * contributors may be used to endorse or promote products derived from
264826Ssaidi@eecs.umich.edu * this software without specific prior written permission.
274826Ssaidi@eecs.umich.edu *
284826Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
294826Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
304826Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
314826Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
327678Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
334826Ssaidi@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
344826Ssaidi@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
358706Sandreas.hansson@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
364826Ssaidi@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
374826Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
384826Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
394826Ssaidi@eecs.umich.edu *
407741Sgblack@eecs.umich.edu * Authors: Ron Dreslinski
417741Sgblack@eecs.umich.edu *          Andreas Hansson
427741Sgblack@eecs.umich.edu *          William Wang
437741Sgblack@eecs.umich.edu */
447741Sgblack@eecs.umich.edu
457741Sgblack@eecs.umich.edu/**
467707Sgblack@eecs.umich.edu * @file
477707Sgblack@eecs.umich.edu * Port Object Declaration.
487707Sgblack@eecs.umich.edu */
498806Sgblack@eecs.umich.edu
508767Sgblack@eecs.umich.edu#ifndef __SIM_PORT_HH__
518767Sgblack@eecs.umich.edu#define __SIM_PORT_HH__
524826Ssaidi@eecs.umich.edu
538806Sgblack@eecs.umich.edu#include <string>
548806Sgblack@eecs.umich.edu
558806Sgblack@eecs.umich.edu#include "base/types.hh"
568806Sgblack@eecs.umich.edu
578806Sgblack@eecs.umich.edu/**
588806Sgblack@eecs.umich.edu * Ports are used to interface objects to each other.
598852Sandreas.hansson@arm.com */
608852Sandreas.hansson@arm.comclass Port
618806Sgblack@eecs.umich.edu{
628806Sgblack@eecs.umich.edu
638806Sgblack@eecs.umich.edu  private:
644826Ssaidi@eecs.umich.edu
656329Sgblack@eecs.umich.edu    /** Descriptive name (for DPRINTF output) */
666329Sgblack@eecs.umich.edu    std::string portName;
676329Sgblack@eecs.umich.edu
686329Sgblack@eecs.umich.edu  protected:
696329Sgblack@eecs.umich.edu
706329Sgblack@eecs.umich.edu    /**
716329Sgblack@eecs.umich.edu     * A numeric identifier to distinguish ports in a vector, and set
726329Sgblack@eecs.umich.edu     * to InvalidPortID in case this port is not part of a vector.
737741Sgblack@eecs.umich.edu     */
746329Sgblack@eecs.umich.edu    const PortID id;
756329Sgblack@eecs.umich.edu
766329Sgblack@eecs.umich.edu    /**
777741Sgblack@eecs.umich.edu     * Abstract base class for ports
787741Sgblack@eecs.umich.edu     *
797741Sgblack@eecs.umich.edu     * @param _name Port name including the owners name
807741Sgblack@eecs.umich.edu     * @param _id A port identifier for vector ports
817741Sgblack@eecs.umich.edu     */
827741Sgblack@eecs.umich.edu    Port(const std::string& _name, PortID _id);
837741Sgblack@eecs.umich.edu
847741Sgblack@eecs.umich.edu    /**
856329Sgblack@eecs.umich.edu     * Virtual destructor due to inheritance.
866329Sgblack@eecs.umich.edu     */
876329Sgblack@eecs.umich.edu    virtual ~Port();
886329Sgblack@eecs.umich.edu
896329Sgblack@eecs.umich.edu  public:
906329Sgblack@eecs.umich.edu
916329Sgblack@eecs.umich.edu    /** Return port name (for DPRINTF). */
926329Sgblack@eecs.umich.edu    const std::string name() const { return portName; }
937741Sgblack@eecs.umich.edu
947741Sgblack@eecs.umich.edu    /** Get the port id. */
957741Sgblack@eecs.umich.edu    PortID getId() const { return id; }
967741Sgblack@eecs.umich.edu
977741Sgblack@eecs.umich.edu};
987741Sgblack@eecs.umich.edu
997741Sgblack@eecs.umich.edu#endif //__SIM_PORT_HH__
1007741Sgblack@eecs.umich.edu