From 3fe81229b38c98ae14529a5d41998b010174b67b Mon Sep 17 00:00:00 2001 From: ducky Date: Fri, 30 Oct 2015 16:36:23 -0700 Subject: [PATCH] Add Scalastyle rule to check lines ending with a ;, fix some instances --- scalastyle-config.xml | 6 ++++++ scalastyle-test-config.xml | 6 ++++++ src/main/scala/Chisel/Bits.scala | 24 ++++++++++++------------ src/main/scala/Chisel/util/Mux.scala | 8 ++++---- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/scalastyle-config.xml b/scalastyle-config.xml index ab6b43b..57ef60a 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -59,6 +59,12 @@ + + + + + No lines ending with a ; + diff --git a/scalastyle-test-config.xml b/scalastyle-test-config.xml index 6004b8d..bf32aac 100644 --- a/scalastyle-test-config.xml +++ b/scalastyle-test-config.xml @@ -58,6 +58,12 @@ + + + + + No lines ending with a ; + diff --git a/src/main/scala/Chisel/Bits.scala b/src/main/scala/Chisel/Bits.scala index ddef760..20136be 100644 --- a/src/main/scala/Chisel/Bits.scala +++ b/src/main/scala/Chisel/Bits.scala @@ -200,16 +200,16 @@ object Bits extends UIntFactory * types. */ abstract trait Num[T <: Data] { - // def << (b: T): T; - // def >> (b: T): T; - //def unary_-(): T; + // def << (b: T): T + // def >> (b: T): T + //def unary_-(): T // REVIEW TODO: double check ops conventions against FIRRTL /** Outputs the sum of `this` and `b`. The resulting width is the max of the * operands plus 1 (should not overflow). */ - def + (b: T): T; + def + (b: T): T /** Outputs the product of `this` and `b`. The resulting width is the sum of * the operands. @@ -217,36 +217,36 @@ abstract trait Num[T <: Data] { * @note can generate a single-cycle multiplier, which can result in * significant cycle time and area costs */ - def * (b: T): T; + def * (b: T): T /** Outputs the quotient of `this` and `b`. * * TODO: full rules */ - def / (b: T): T; + def / (b: T): T - def % (b: T): T; + def % (b: T): T /** Outputs the difference of `this` and `b`. The resulting width is the max * of the operands plus 1 (should not overflow). */ - def - (b: T): T; + def - (b: T): T /** Outputs true if `this` < `b`. */ - def < (b: T): Bool; + def < (b: T): Bool /** Outputs true if `this` <= `b`. */ - def <= (b: T): Bool; + def <= (b: T): Bool /** Outputs true if `this` > `b`. */ - def > (b: T): Bool; + def > (b: T): Bool /** Outputs true if `this` >= `b`. */ - def >= (b: T): Bool; + def >= (b: T): Bool /** Outputs the minimum of `this` and `b`. The resulting width is the max of * the operands. Generates a comparison followed by a mux. diff --git a/src/main/scala/Chisel/util/Mux.scala b/src/main/scala/Chisel/util/Mux.scala index 18b5dd5..c283310 100644 --- a/src/main/scala/Chisel/util/Mux.scala +++ b/src/main/scala/Chisel/util/Mux.scala @@ -52,9 +52,9 @@ object MuxLookup { * @return the value found or the default if not */ def apply[S <: UInt, T <: Bits] (key: S, default: T, mapping: Seq[(S, T)]): T = { - var res = default; + var res = default for ((k, v) <- mapping.reverse) - res = Mux(k === key, v, res); + res = Mux(k === key, v, res) res } @@ -66,9 +66,9 @@ object MuxCase { * @param mapping a set of data values with associated enables * @return the first value in mapping that is enabled */ def apply[T <: Bits] (default: T, mapping: Seq[(Bool, T)]): T = { - var res = default; + var res = default for ((t, v) <- mapping.reverse){ - res = Mux(t, v, res); + res = Mux(t, v, res) } res }