Skip to content

Commit

Permalink
같은 기호끼리 연산은 가능한것을 확인함
Browse files Browse the repository at this point in the history
  • Loading branch information
js4ngu committed Sep 13, 2024
1 parent 096a72b commit 338d17e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/test/scala/vfrope/ieee754test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ 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)}\n\n")
println(s"1.5 + 2.25 = 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)}")
println(s"-1.5 + 2.25 = 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
// dut.clock.step()
// println(s"expected bf400000 : 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
dut.clock.step()
println(s"1.5 - 2.25 = expected bf400000 : 0x${dut.io.result.peek().litValue.toString(16)}") // 얘 안됨

// dut.io.a.poke(BigInt("bfc00000", 16).U) // -1.5
// dut.io.b.poke(BigInt("c0100000", 16).U) // -2.25
// dut.clock.step()
// println(s"expected c0700000 : 0x${dut.io.result.peek().litValue.toString(16)}")
dut.io.a.poke(BigInt("bfc00000", 16).U) // -1.5
dut.io.b.poke(BigInt("c0100000", 16).U) // -2.25
dut.clock.step()
println(s"-1.5 - 2.25 = expected c0700000 : 0x${dut.io.result.peek().litValue.toString(16)}") //얘도 OK
}
}
}

0 comments on commit 338d17e

Please sign in to comment.