-
Notifications
You must be signed in to change notification settings - Fork 58
[LibertyClk] Support for Liberty file defined generated clock #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
021e343
541116a
96bf1d7
3ada6ae
7e2df0c
d33b31d
7257c45
ae7bc70
8608b9b
5f855ad
3afa445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #pragma once | ||
|
|
||
| #include "LibertyClass.hh" | ||
| #include "SdcClass.hh" | ||
|
|
||
| namespace sta { | ||
|
|
||
| class GeneratedClock | ||
| { | ||
| public: | ||
| ~GeneratedClock(); | ||
| const char *name() const { return name_; } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use std::string |
||
| const char *clockPin() const { return clock_pin_; } | ||
| const char *masterPin() const { return master_pin_; } | ||
| int dividedBy() const { return divided_by_; } | ||
| int multipliedBy() const { return multiplied_by_; } | ||
| float dutyCycle() const { return duty_cycle_; } | ||
| bool invert() const { return invert_; } | ||
| IntSeq *edges() const { return edges_; } | ||
| FloatSeq *edgeShifts() const { return edge_shifts_; } | ||
|
|
||
| protected: | ||
| GeneratedClock(const char *name, | ||
| const char *clock_pin, | ||
| const char *master_pin, | ||
| int divided_by, | ||
| int multiplied_by, | ||
| float duty_cycle, | ||
| bool invert, | ||
| IntSeq *edges, | ||
| FloatSeq *edge_shifts); | ||
|
|
||
| const char *name_; | ||
| const char *clock_pin_; | ||
| const char *master_pin_; | ||
| int divided_by_; | ||
| int multiplied_by_; | ||
| float duty_cycle_; | ||
| bool invert_; | ||
| IntSeq *edges_; | ||
| FloatSeq *edge_shifts_; | ||
|
|
||
| friend class LibertyCell; | ||
| }; | ||
|
|
||
| } // namespace | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| #include "Transition.hh" | ||
| #include "Delay.hh" | ||
| #include "LibertyClass.hh" | ||
| #include "SdcClass.hh" | ||
|
|
||
| namespace sta { | ||
|
|
||
|
|
@@ -483,6 +484,8 @@ public: | |
| const SequentialSeq &sequentials() const { return sequentials_; } | ||
| // Find the sequential with the output connected to an (internal) port. | ||
| Sequential *outputPortSequential(LibertyPort *port); | ||
| // Generated clocks. | ||
| const GeneratedClockSeq &generatedClocks() const { return generated_clocks_; } | ||
| const Statetable *statetable() const { return statetable_; } | ||
|
|
||
| // Find bus declaration local to this cell. | ||
|
|
@@ -509,6 +512,15 @@ public: | |
| OcvDerate *findOcvDerate(const char *derate_name); | ||
|
|
||
| // Build helpers. | ||
| void makeGeneratedClock(const char *name, | ||
| const char *clock_pin, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use spaces for indentation (this changed with rel 3.0) |
||
| const char *master_pin, | ||
| int divided_by, | ||
| int multiplied_by, | ||
| float duty_cycle, | ||
| bool invert, | ||
| IntSeq *edges, | ||
| FloatSeq *edge_shifts); | ||
| void makeSequential(int size, | ||
| bool is_register, | ||
| FuncExpr *clk, | ||
|
|
@@ -621,6 +633,7 @@ protected: | |
| PortInternalPowerSeq port_internal_powers_; | ||
| InternalPowerAttrsSeq internal_power_attrs_; | ||
| LeakagePowerSeq leakage_powers_; | ||
| GeneratedClockSeq generated_clocks_; | ||
| SequentialSeq sequentials_; | ||
| PortToSequentialMap port_to_seq_map_; | ||
| Statetable *statetable_; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,6 +376,7 @@ public: | |
| float fanout); | ||
| void setMaxArea(float area); | ||
| float maxArea() const; | ||
| void createLibertyGeneratedClocks(Clock *clk); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use make instead of create for naming consistency with the rest of the code |
||
| Clock *makeClock(const char *name, | ||
| PinSet *pins, | ||
| bool add_to_pins, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #include "GeneratedClock.hh" | ||
|
|
||
| #include "Liberty.hh" | ||
| #include "StringUtil.hh" | ||
|
|
||
| namespace sta { | ||
|
|
||
| GeneratedClock::GeneratedClock(const char *name, | ||
| const char *clock_pin, | ||
| const char *master_pin, | ||
| int divided_by, | ||
| int multiplied_by, | ||
| float duty_cycle, | ||
| bool invert, | ||
| IntSeq *edges, | ||
| FloatSeq *edge_shifts) : | ||
| name_(name ? stringCopy(name) : nullptr), | ||
| clock_pin_(clock_pin ? stringCopy(clock_pin) : nullptr), | ||
| master_pin_(master_pin ? stringCopy(master_pin) : nullptr), | ||
| divided_by_(divided_by), | ||
| multiplied_by_(multiplied_by), | ||
| duty_cycle_(duty_cycle), | ||
| invert_(invert), | ||
| edges_(edges), | ||
| edge_shifts_(edge_shifts) | ||
| { | ||
| } | ||
|
|
||
| GeneratedClock::~GeneratedClock() | ||
| { | ||
| if (name_) | ||
| stringDelete(name_); | ||
| if (clock_pin_) | ||
| stringDelete(clock_pin_); | ||
| if (master_pin_) | ||
| stringDelete(master_pin_); | ||
| if (edges_) | ||
| delete edges_; | ||
| if (edge_shifts_) | ||
| delete edge_shifts_; | ||
| } | ||
|
|
||
| } // namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name GeneratedClock is too generic, since there are already generated clocks in sdc.
I suggest LibertyGenClk. The other functions names should be updated to be consistent.