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/approximation/TanhQ15Test.lvt
namespace Livt.Math.Tests.Approximation
using Livt.Math.Approximation
/**
* Exercises TanhQ15 with a shared fixture instance. Each scenario establishes the inputs
* and state it needs.
*/
@Test
component TanhQ15Test
{
// Shared fixture instances, signals, and observation state.
dut: TanhQ15
/**
* Creates the shared fixture instances (TanhQ15). Tests initialize the state required by
* their scenario.
*/
new()
{
this.dut = new TanhQ15()
}
/**
* Checks that the component is odd and monotonic at reference points.
*/
@Test
fn IsOddAndMonotonicAtReferencePoints()
{
assert this.dut.Apply(0) == 0
assert this.dut.Apply(64) == 8025
assert this.dut.Apply(128) == 15142
assert this.dut.Apply(-128) == -15142
assert this.dut.Apply(1024) == 32745
assert this.dut.Apply(2048) == 32745
}
/**
* Checks the interpolates between entries case.
*/
@Test
fn InterpolatesBetweenEntries()
{
assert this.dut.Apply(32) == 4012
assert this.dut.Apply(-32) == -4012
}
}