Fix fp exception by rounding right after MulRawFN
This commit is contained in:
@@ -62,7 +62,7 @@ class TensorDotProductUnitTest extends AnyFlatSpec with ChiselScalatestTester {
|
||||
c.io.in.bits.b(1).poke(0x4400.U(16.W))
|
||||
c.io.in.bits.b(2).poke(0x4600.U(16.W))
|
||||
c.io.in.bits.b(3).poke(0x4800.U(16.W))
|
||||
c.io.in.bits.c .poke(0x4880.U(16.W))
|
||||
c.io.in.bits.c .poke(0x41100000L.U(32.W))
|
||||
|
||||
c.io.out.valid.expect(false.B)
|
||||
|
||||
@@ -93,6 +93,42 @@ class TensorDotProductUnitTest extends AnyFlatSpec with ChiselScalatestTester {
|
||||
}
|
||||
}
|
||||
|
||||
it should "pass fp16 2" in {
|
||||
test(new TensorDotProductUnit(half = true))
|
||||
.withAnnotations(Seq(VerilatorBackendAnnotation))
|
||||
// .withAnnotations(Seq(WriteVcdAnnotation))
|
||||
{ c =>
|
||||
c.io.in.valid.poke(true.B)
|
||||
c.io.stall.poke(false.B)
|
||||
c.io.in.bits.a(0).poke(0x0000.U(16.W))
|
||||
c.io.in.bits.a(1).poke(0x3c00.U(16.W))
|
||||
c.io.in.bits.a(2).poke(0x4000.U(16.W))
|
||||
c.io.in.bits.a(3).poke(0x4200.U(16.W))
|
||||
c.io.in.bits.b(0).poke(0x0000.U(16.W))
|
||||
c.io.in.bits.b(1).poke(0x4800.U(16.W))
|
||||
c.io.in.bits.b(2).poke(0x4c00.U(16.W))
|
||||
c.io.in.bits.b(3).poke(0x4e00.U(16.W))
|
||||
c.io.in.bits.c .poke(0x00000000.U(32.W))
|
||||
|
||||
c.io.out.valid.expect(false.B)
|
||||
|
||||
c.clock.step()
|
||||
c.io.in.valid.poke(false.B)
|
||||
c.io.out.valid.expect(false.B)
|
||||
|
||||
c.clock.step()
|
||||
c.clock.step()
|
||||
c.clock.step()
|
||||
// 4-cycle latency
|
||||
c.io.out.valid.expect(true.B)
|
||||
c.io.out.bits.data.expect(0x42e00000L.U)
|
||||
|
||||
c.clock.step()
|
||||
|
||||
c.io.out.valid.expect(false.B)
|
||||
}
|
||||
}
|
||||
|
||||
it should "pass fp32" in {
|
||||
test(new TensorDotProductUnit(half = false))
|
||||
// .withAnnotations(Seq(VerilatorBackendAnnotation))
|
||||
|
||||
Reference in New Issue
Block a user