Skip to content

Commit

Permalink
Removed the commented iexp code
Browse files Browse the repository at this point in the history
  • Loading branch information
vikramjain236 committed Jul 12, 2024
1 parent 555b07b commit 7676382
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/main/scala/gemmini/AccumulatorScale.scala
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ object AccumulatorScale {
}

def iexp[T <: Data](q: T, qln2: T, qln2_inv: T, qb: T, qc: T)(implicit ev: Arithmetic[T]): T = {
/*
import ev._

val zero = q.zero
Expand All @@ -403,18 +402,6 @@ object AccumulatorScale {
val q_poly_iexp = qc.mac(qp_iexp + qb, qp_iexp + qb).withWidthOf(q)
// we dont want a rounding shift
// TODO: z overflow
(q_poly_iexp.asUInt.do_>>(z_iexp_saturated.asUInt)).asTypeOf(q) */
import ev._

val zero = q.zero
val one = q.identity
def neg(x: T) = zero-x

val q_sign = Mux(q.zero > q, neg(one), one)
val q_abs = Mux(q.zero > q, neg(q), q)
val q_clipped = Mux(q_abs > neg(qb), neg(qb), q_abs)
val q_poly = qc.mac(q_clipped + qb, q_clipped + qb).withWidthOf(q)
val q_erf = (q_sign * q_poly).withWidthOf(q)
(q * (q_erf + qc)).withWidthOf(q)
(q_poly_iexp.asUInt.do_>>(z_iexp_saturated.asUInt)).asTypeOf(q)
}}

0 comments on commit 7676382

Please sign in to comment.