diff --git a/src/main/scala/vfrope/ieee754.scala b/src/main/scala/vfrope/ieee754.scala index f7cab1e..63fa16c 100644 --- a/src/main/scala/vfrope/ieee754.scala +++ b/src/main/scala/vfrope/ieee754.scala @@ -118,8 +118,8 @@ class FP32Adder extends Module { val mantissaSumExtended = Cat(mantissaSum, 0.U(2.W)) // Add two guard bits val normalizationNeeded = mantissaSumExtended(25) // 24th 비트에서 overflow 확인 val normalizedMantissa = Mux(normalizationNeeded, mantissaSumExtended(24, 2), mantissaSumExtended(23, 1)) - val finalExponentNormalized = Mux(normalizationNeeded, finalExponent + 1.U, finalExponent) - + val finalExponentNormalized = finalExponent // 지수는 그대로 유지 + // Debug: Print normalization-related values printf(p"\nmantissaSumExtended: $mantissaSumExtended\n") printf(p"Normalization Needed: $normalizationNeeded\n") diff --git a/src/test/scala/vfrope/ieee754test.scala b/src/test/scala/vfrope/ieee754test.scala index c571306..168da85 100644 --- a/src/test/scala/vfrope/ieee754test.scala +++ b/src/test/scala/vfrope/ieee754test.scala @@ -49,13 +49,13 @@ class FP32AdderTest extends AnyFlatSpec with ChiselScalatestTester { dut.io.a.poke(0x3fc00000.U) // 1.5 dut.io.b.poke(0x40100000.U) // 2.25 dut.clock.step() - println(s"expected 40700000 : 0x${dut.io.result.peek().litValue.toString(16)}") + println(s"expected 40700000 : 0x${dut.io.result.peek().litValue.toString(16)}\n\n") // For negative numbers, use BigInt to handle UInt interpretation correctly - // dut.io.a.poke(BigInt("bfc00000", 16).U) // -1.5 - // dut.io.b.poke(0x40100000.U) // 2.25 - // dut.clock.step() - // println(s"expected 3f400000 : 0x${dut.io.result.peek().litValue.toString(16)}") + dut.io.a.poke(BigInt("bfc00000", 16).U) // -1.5 + dut.io.b.poke(0x40100000.U) // 2.25 + dut.clock.step() + println(s"expected 3f400000 : 0x${dut.io.result.peek().litValue.toString(16)}") // dut.io.a.poke(0x3fc00000.U) // 1.5 // dut.io.b.poke(BigInt("c0100000", 16).U) // -2.25