Skip to content
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

Strong enums #892

Merged
merged 16 commits into from
Oct 12, 2018
Merged

Strong enums #892

merged 16 commits into from
Oct 12, 2018

Commits on Sep 17, 2018

  1. Added new strongly-typed enum construct called "StrongEnum". "StrongE…

    …num" will automatically generate annotations that HDL backends can use to mark components as enums
    
    Removed "override val width" constructor parameter from "Element" so that classes with variable widths, like the new strong enums, can inherit from it
    
    Changed the parameter types of certain functions, such as "switch", "is", and "LitArg.bindLitArg" from "Bits" to "Element", so that they can take the new strong enums as arguments
    hngenc committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    df343a3 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2018

  1. Configuration menu
    Copy the full SHA
    6feccd9 View commit details
    Browse the repository at this point in the history
  2. Changed StrongEnum exception names and made sure in StrongEnum tests …

    …that the correct types of exceptions are thrown
    hngenc committed Sep 18, 2018
    Configuration menu
    Copy the full SHA
    192d471 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2018

  1. Configuration menu
    Copy the full SHA
    93ab047 View commit details
    Browse the repository at this point in the history
  2. Fixed bug where an enum's global annotation would not be set if it wa…

    …s used in multiple circuits
    
    Made styling changes to StrongEnum.scala
    hngenc committed Sep 19, 2018
    Configuration menu
    Copy the full SHA
    300fbc9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    863409f View commit details
    Browse the repository at this point in the history
  4. Changed the API for casting non-literal UInts to enums

    Added an isValid function that checks whether or not enums have valid values
    
    Calling getWidth on an enum's companion object now returns a BigInt instead of an Int
    hngenc committed Sep 19, 2018
    Configuration menu
    Copy the full SHA
    8999553 View commit details
    Browse the repository at this point in the history
  5. Casting a literal to an enum using the StrongEnum.castFromNonLit(n) f…

    …unction is now simply a wrapper for StrongEnum.apply(n)
    hngenc committed Sep 19, 2018
    Configuration menu
    Copy the full SHA
    6c0793b View commit details
    Browse the repository at this point in the history
  6. Fixed compilation bug

    hngenc committed Sep 19, 2018
    Configuration menu
    Copy the full SHA
    f67ffb6 View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2018

  1. * Added "next" method to EnumType

    * Renamed "castFromNonLit" to "fromBits"
    hngenc committed Sep 21, 2018
    Configuration menu
    Copy the full SHA
    50e3ffd View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2018

  1. Configuration menu
    Copy the full SHA
    cd903d6 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2018

  1. * Changed strong enum API, so that users no longer have to declare bo…

    …th a class and a companion object for each strong enum
    
    * Strong enums do not have to be static any longer
    hngenc committed Sep 24, 2018
    Configuration menu
    Copy the full SHA
    6537628 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2018

  1. * Merge branch 'master' of https://github.com/freechipsproject/chisel3

    …into strong-enums
    
    * Renamed ChiselEnum.E to ChiselEnum.Value to better match Scala enums
    hngenc committed Sep 25, 2018
    Configuration menu
    Copy the full SHA
    1aa99d0 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2018

  1. * Added scope protections to ChiselEnum.Value so that users cannot ca…

    …ll it
    
    outside of a ChiselEnum definition
    
    * Renamed ChiselEnum.Value type to ChiselEnum.Type so that we can give
    it a companion object just like UInt and Bool do
    hngenc committed Sep 28, 2018
    Configuration menu
    Copy the full SHA
    323c20c View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2018

  1. * Moved strong enums into experimental package

    * Non-literal UInts can now be cast to enums with apply() rather than
    fromBits()
    * Reduced code-duplication by moving some functions from EnumType and
    Bits to Element
    hngenc committed Oct 12, 2018
    Configuration menu
    Copy the full SHA
    8e1344d View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' of https://github.com/freechipsproject/chisel3

    …into strong-enums
    hngenc committed Oct 12, 2018
    Configuration menu
    Copy the full SHA
    4464037 View commit details
    Browse the repository at this point in the history