diff options
| author | Schuyler Eldridge | 2019-07-17 12:31:14 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2019-09-16 17:48:09 -0400 |
| commit | 0ecf2931329177249ab4b3ef88e28436d06a1c19 (patch) | |
| tree | 4c14ea8ed4ef2682c4f880a32631cf2e4f520ae1 /src/main/scala/firrtl/Utils.scala | |
| parent | a594ccef986c4567730fee729bdea9ed9aefed38 (diff) | |
Deprecate Gender and add implicit Flow conversion
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
| -rw-r--r-- | src/main/scala/firrtl/Utils.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala index 45e611b2..4bf2d14d 100644 --- a/src/main/scala/firrtl/Utils.scala +++ b/src/main/scala/firrtl/Utils.scala @@ -492,6 +492,11 @@ object Utils extends LazyLogging { case SourceFlow => Input case SinkFlow => Output } + @deprecated("Migrate from 'Gender' to 'Flow. This method will be removed in 1.3", "1.2") + def to_gender(d: Direction): Gender = d match { + case Input => MALE + case Output => FEMALE + } def to_flow(d: Direction): Flow = d match { case Input => SourceFlow case Output => SinkFlow @@ -548,6 +553,38 @@ object Utils extends LazyLogging { case ex: WSubAccess => kind(ex.expr) case ex => ExpKind } + @deprecated("Migrate from 'Gender' to 'Flow'. This method will be removed in 1.3", "1.2") + def gender(e: Expression): Gender = e match { + case ex: WRef => ex.gender + case ex: WSubField => ex.gender + case ex: WSubIndex => ex.gender + case ex: WSubAccess => ex.gender + case ex: DoPrim => MALE + case ex: UIntLiteral => MALE + case ex: SIntLiteral => MALE + case ex: Mux => MALE + case ex: ValidIf => MALE + case WInvalid => MALE + case ex => throwInternalError(s"gender: shouldn't be here - $e") + } + @deprecated("Migrate from 'Gender' to 'Flow'. This method will be removed in 1.3", "1.2") + def get_gender(s: Statement): Gender = s match { + case sx: DefWire => BIGENDER + case sx: DefRegister => BIGENDER + case sx: WDefInstance => MALE + case sx: DefNode => MALE + case sx: DefInstance => MALE + case sx: DefMemory => MALE + case sx: Block => UNKNOWNGENDER + case sx: Connect => UNKNOWNGENDER + case sx: PartialConnect => UNKNOWNGENDER + case sx: Stop => UNKNOWNGENDER + case sx: Print => UNKNOWNGENDER + case sx: IsInvalid => UNKNOWNGENDER + case EmptyStmt => UNKNOWNGENDER + } + @deprecated("Migrate from 'Gender' to 'Flow'. This method will be removed in 1.3", "1.2") + def get_gender(p: Port): Gender = if (p.direction == Input) MALE else FEMALE def flow(e: Expression): Flow = e match { case ex: WRef => ex.flow case ex: WSubField => ex.flow |
