From 096a72b11a6bf2329cb13701c4556331e2fb8166 Mon Sep 17 00:00:00 2001 From: jongsangYoo Date: Fri, 13 Sep 2024 14:21:32 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=BC=EB=8B=A8=20=EC=96=91=EC=88=98?= =?UTF-8?q?=EC=96=91=EC=88=98=20=EB=8D=A7=EC=85=88=EC=9D=80=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/vfrope/ieee754.scala | 4 ++-- src/test/scala/vfrope/ieee754test.scala | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) 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