c75ef74116d650df4354f8fc509b47c799594a18
1 from nmigen
import Module
, Signal
2 from nmigen
.back
.pysim
import Simulator
, Passive
3 from nmigen
.test
.utils
import FHDLTestCase
4 from nmigen
.cli
import rtlil
5 from sfpy
import Float32
7 from ieee754
.cordic
.fp_pipeline
import FPCordicBasePipe
8 from ieee754
.cordic
.fp_pipe_data
import FPCordicPipeSpec
14 class SinCosTestCase(FHDLTestCase
):
15 def run_test(self
, inputs
):
17 pspec
= FPCordicPipeSpec(width
=32, rounds_per_stage
=4, num_rows
=1)
18 m
.submodules
.dut
= dut
= FPCordicBasePipe(pspec
)
20 for port
in dut
.ports():
23 # vl = rtlil.convert(dut, ports=dut.ports())
24 # with open("test_cordic_pipe_sin_cos.il", "w") as f:
27 z
= Signal(dut
.p
.data_i
.a
.shape())
33 dut
.p
.valid_i
.eq(z_valid
),
34 dut
.n
.ready_i
.eq(ready
),
48 sim
.add_sync_process(writer_process
)
49 with sim
.write_vcd("fp_pipeline.vcd", "fp_pipeline.gtkw", traces
=[
56 ZMAX
= int(round(M
* math
.pi
/2))
59 inputs
.append(Float32(1.0*i
))
60 self
.run_test(iter(inputs
))
63 if __name__
== "__main__":