Skip to content

Commit

Permalink
Use asUInt and asSInt rather than toUInt and toSInt (chisel3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Waterman committed Jul 31, 2016
1 parent 45f3466 commit a07029b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/MulAddRecFN.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class MulAddRecFN_preMul(expWidth: Int, sigWidth: Int) extends Module
val negSigC = Mux(doSubMags, ~sigC, sigC)
// *** FINAL CLIPPING NOT NEEDED?:
val alignedNegSigC =
Cat(Cat(doSubMags, negSigC, Fill(normSize, doSubMags)).toSInt>>
Cat(Cat(doSubMags, negSigC, Fill(normSize, doSubMags)).asSInt>>
CAlignDist,
(sigC & CExtraMask).orR ^ doSubMags
)(sigSumSize - 1, 0)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/resizeRawFN.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object resizeRawFN
Cat(Fill(expWidth - 1, Bits(1, 1)), Bits(0, 2)),
sNewExp(expWidth, 0)
)
).toSInt
).asSInt
})
out.sig :=
(if (sigWidth >= in.sigWidth) {
Expand Down
5 changes: 2 additions & 3 deletions src/main/scala/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ import Chisel._
object equivRecFN
{
def apply(expWidth: Int, sigWidth: Int, a: UInt, b: UInt) = {
//*** NEED `.toUInt'?:
val top4A = a(expWidth + sigWidth, expWidth + sigWidth - 3).toUInt
val top4B = b(expWidth + sigWidth, expWidth + sigWidth - 3).toUInt
val top4A = a(expWidth + sigWidth, expWidth + sigWidth - 3)
val top4B = b(expWidth + sigWidth, expWidth + sigWidth - 3)
Mux((top4A(2, 0) === UInt(0)) || (top4A(2, 0) === UInt(7)),
(top4A === top4B) && (a(sigWidth - 2, 0) === b(sigWidth - 2, 0)),
Mux((top4A(2, 0) === UInt(6)), (top4A === top4B), (a === b))
Expand Down

0 comments on commit a07029b

Please sign in to comment.