ClkNetwork::pins(clock)

This commit is contained in:
James Cherry 2020-08-10 18:31:20 -07:00
parent b36d2753d1
commit 990cf46959
4 changed files with 46 additions and 6 deletions

View File

@ -39,9 +39,11 @@ public:
void ensureClkNetwork();
void clear();
bool isClock(const Pin *pin) const;
bool isClock(const Net *net) const;
bool isIdealClock(const Pin *pin) const;
const ClockSet *clocks(const Pin *pin);
const ClockSet *idealClocks(const Pin *pin);
const PinSet *pins(const Clock *clk);
void clkPinsInvalid();
protected:

View File

@ -1146,11 +1146,12 @@ public:
////////////////////////////////////////////////////////////////
void ensureClkNetwork();
// Assumes ensureClkNetwork() has been called.
bool isClock(Pin *pin) const;
// Assumes ensureClkNetwork() has been called.
bool isIdealClock(Pin *pin) const;
void clkPinsInvalid();
// The following functions assume ensureClkNetwork() has been called.
bool isClock(const Pin *pin) const;
bool isClock(const Net *net) const;
bool isIdealClock(const Pin *pin) const;
const PinSet *pins(const Clock *clk);
////////////////////////////////////////////////////////////////

View File

@ -146,6 +146,22 @@ ClkNetwork::isClock(const Pin *pin) const
return pin_clks_map_.hasKey(pin);
}
bool
ClkNetwork::isClock(const Net *net) const
{
bool is_clk = false;
NetConnectedPinIterator *pin_iter = network_->pinIterator(net);
while (pin_iter->hasNext()) {
Pin *pin = pin_iter->next();
if (isClock(pin)) {
is_clk = true;
break;
}
}
delete pin_iter;
return is_clk;
}
bool
ClkNetwork::isIdealClock(const Pin *pin) const
{
@ -170,4 +186,13 @@ ClkNetwork::idealClocks(const Pin *pin)
return nullptr;
}
const PinSet *
ClkNetwork::pins(const Clock *clk)
{
if (clk_pins_map_.hasKey(clk))
return &clk_pins_map_[clk];
else
return nullptr;
}
} // namespace

View File

@ -5272,17 +5272,29 @@ Sta::ensureClkNetwork()
}
bool
Sta::isClock(Pin *pin) const
Sta::isClock(const Pin *pin) const
{
return clk_network_->isClock(pin);
}
bool
Sta::isIdealClock(Pin *pin) const
Sta::isClock(const Net *net) const
{
return clk_network_->isClock(net);
}
bool
Sta::isIdealClock(const Pin *pin) const
{
return clk_network_->isIdealClock(pin);
}
const PinSet *
Sta::pins(const Clock *clk)
{
return clk_network_->pins(clk);
}
void
Sta::clkPinsInvalid()
{