-
Notifications
You must be signed in to change notification settings - Fork 38
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
Importing dsptools.numbers._ now includes implicits by default #102
Conversation
@@ -107,6 +107,14 @@ class DspReal(lit: Option[BigInt] = None) extends Bundle { | |||
oneOperandOperator(Module(new BBFCeil())) | |||
} | |||
|
|||
def round(): DspReal = (this + DspReal(0.5)).floor() |
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.
@shunshou, DspReal has some things that call the typeclass, especially truncate. That seemed bad. This may change the current behavior, though, because the implementation of truncate here doesn't have pipeline registers.
@@ -71,7 +71,7 @@ trait DspRealIsReal extends Any with IsReal[DspReal] with DspRealOrder with DspR | |||
def isWhole(a: DspReal): Bool = a === round(a) | |||
// Round *half up* -- Different from System Verilog definition! (where half is rounded away from zero) | |||
// according to 5.7.2 (http://www.ece.uah.edu/~gaede/cpe526/2012%20System%20Verilog%20Language%20Reference%20Manual.pdf) | |||
def round(a: DspReal): DspReal = floor(a + DspReal(0.5)) | |||
def round(a: DspReal): DspReal = a.round() | |||
def truncate(a: DspReal): DspReal = { |
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.
Should this be called context_truncate
?
@@ -0,0 +1,14 @@ | |||
package dsptools | |||
|
|||
package object numbers extends AllSyntax with AllImpl with spire.syntax.RingSyntax |
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.
I read somewhere that sometimes people will have a lowercase package (I think) without the implicit and an uppercase version of the package (I think) with the implicits. Is that something we should think about doing?
This exposed some interesting little weird things. I'll add some inline comments.
Closes #22