2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2020-03-07 03:50:37 +01:00
|
|
|
// Copyright (c) 2020, Parallax Software, Inc.
|
2018-09-28 17:54:21 +02:00
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "PortDirection.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
|
|
|
|
PortDirection *PortDirection::input_;
|
|
|
|
|
PortDirection *PortDirection::output_;
|
|
|
|
|
PortDirection *PortDirection::tristate_;
|
|
|
|
|
PortDirection *PortDirection::bidirect_;
|
|
|
|
|
PortDirection *PortDirection::internal_;
|
|
|
|
|
PortDirection *PortDirection::ground_;
|
|
|
|
|
PortDirection *PortDirection::power_;
|
|
|
|
|
PortDirection *PortDirection::unknown_;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PortDirection::init()
|
|
|
|
|
{
|
|
|
|
|
input_ = new PortDirection("input", 0);
|
|
|
|
|
output_ = new PortDirection("output", 1);
|
|
|
|
|
tristate_ = new PortDirection("tristate", 2);
|
|
|
|
|
bidirect_ = new PortDirection("bidirect", 3);
|
|
|
|
|
internal_ = new PortDirection("internal", 4);
|
|
|
|
|
ground_ = new PortDirection("ground", 5);
|
|
|
|
|
power_ = new PortDirection("power", 6);
|
|
|
|
|
unknown_ = new PortDirection("unknown", 7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PortDirection::destroy()
|
|
|
|
|
{
|
|
|
|
|
delete input_;
|
2019-03-13 01:25:53 +01:00
|
|
|
input_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete output_;
|
2019-03-13 01:25:53 +01:00
|
|
|
output_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete tristate_;
|
2019-03-13 01:25:53 +01:00
|
|
|
tristate_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete bidirect_;
|
2019-03-13 01:25:53 +01:00
|
|
|
bidirect_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete internal_;
|
2019-03-13 01:25:53 +01:00
|
|
|
internal_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete ground_;
|
2019-03-13 01:25:53 +01:00
|
|
|
ground_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete power_;
|
2019-03-13 01:25:53 +01:00
|
|
|
power_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
delete unknown_;
|
2019-03-13 01:25:53 +01:00
|
|
|
unknown_ = nullptr;
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PortDirection::PortDirection(const char *name,
|
|
|
|
|
int index) :
|
|
|
|
|
name_(name),
|
|
|
|
|
index_(index)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
PortDirection::isAnyInput() const
|
|
|
|
|
{
|
|
|
|
|
return this == input_
|
|
|
|
|
|| this == bidirect_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
PortDirection::isAnyOutput() const
|
|
|
|
|
{
|
|
|
|
|
return this == output_
|
|
|
|
|
|| this == tristate_
|
|
|
|
|
|| this == bidirect_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
PortDirection::isAnyTristate() const
|
|
|
|
|
{
|
|
|
|
|
return this == tristate_
|
|
|
|
|
|| this == bidirect_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
PortDirection::isPowerGround() const
|
|
|
|
|
{
|
|
|
|
|
return this == ground_
|
|
|
|
|
|| this == power_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|