Livt packages
Livt.Math
Version 1.7.2
Reusable integer and fixed-point arithmetic, complex numbers, trigonometry, and statistics for FPGA applications written in Livt.
Published files (90)
tests/fixedpoint/ReciprocalSqrtQ15Test.lvt
namespace Livt.Math.Tests.FixedPoint
using Livt.Math.FixedPoint
/**
* Exercises ReciprocalSqrtQ15 with a shared fixture instance. Each scenario establishes
* the inputs and state it needs.
*/
@Test
component ReciprocalSqrtQ15Test
{
// Shared fixture instances, signals, and observation state.
dut: ReciprocalSqrtQ15
/**
* Creates the shared fixture instances (ReciprocalSqrtQ15). Tests initialize the state
* required by their scenario.
*/
new()
{
this.dut = new ReciprocalSqrtQ15()
}
/**
* Checks that Compute s scaled reciprocal roots.
*/
@Test
fn ComputesScaledReciprocalRoots()
{
assert this.dut.Compute(0) == 0
assert this.dut.Compute(1) == 32768
assert this.dut.Compute(2) == 32768
assert this.dut.Compute(3) == 32768
assert this.dut.Compute(4) == 16384
assert this.dut.Compute(15) == 10923
assert this.dut.Compute(16) == 8192
assert this.dut.Compute(17) == 8192
assert this.dut.Compute(10000) == 328
assert this.dut.Compute(2147483647) == 1
}
}