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

Importing dsptools.numbers._ now includes implicits by default #102

Merged
merged 1 commit into from
Sep 18, 2017

Conversation

grebe
Copy link
Contributor

@grebe grebe commented Sep 12, 2017

This exposed some interesting little weird things. I'll add some inline comments.

Closes #22

@@ -107,6 +107,14 @@ class DspReal(lit: Option[BigInt] = None) extends Bundle {
oneOperandOperator(Module(new BBFCeil()))
}

def round(): DspReal = (this + DspReal(0.5)).floor()
Copy link
Contributor Author

@grebe grebe Sep 12, 2017

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 = {
Copy link
Contributor Author

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
Copy link
Contributor Author

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?

@grebe grebe merged commit 0924b6e into master Sep 18, 2017
@grebe grebe deleted the addImplicitsToPackage branch September 19, 2017 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant