nmutil.test package¶
Submodules¶
nmutil.test.example_buf_pipe module¶
Pipeline and BufferedHandshake examples
-
class
nmutil.test.example_buf_pipe.ExampleAddStage¶ Bases:
nmutil.stageapi.StageClsan example of how to use the buffered pipeline, as a class instance
-
ispec()¶ returns a tuple of input signals which will be the incoming data
-
ospec()¶ returns an output signal which will happen to contain the sum of the two inputs
-
process(i)¶ process the input data (sums the values in the tuple) and returns it
-
-
class
nmutil.test.example_buf_pipe.ExampleBufPipe¶ Bases:
nmutil.singlepipe.BufferedHandshakean example of how to use the buffered pipeline.
-
class
nmutil.test.example_buf_pipe.ExampleBufPipeAdd¶ Bases:
nmutil.singlepipe.BufferedHandshakean example of how to use the buffered pipeline, using a class instance
-
class
nmutil.test.example_buf_pipe.ExamplePipeline¶ Bases:
nmutil.singlepipe.UnbufferedPipelinean example of how to use the unbuffered pipeline.
-
class
nmutil.test.example_buf_pipe.ExampleStage¶ Bases:
nmutil.stageapi.Stagean example of how to use the buffered pipeline, in a static class fashion
-
ispec()¶
-
ospec()¶
-
process()¶ process the input data and returns it (adds 1)
-
-
class
nmutil.test.example_buf_pipe.ExampleStageCls¶ Bases:
nmutil.stageapi.StageClsan example of how to use the buffered pipeline, in a static class fashion
-
ispec()¶
-
ospec()¶
-
process(i)¶ process the input data and returns it (adds 1)
-
nmutil.test.example_gtkwave module¶
Generation of GTKWave documents with nmutil.gtkw
-
class
nmutil.test.example_gtkwave.Shifter(width)¶ Bases:
nmigen.hdl.ir.ElaboratableSimple sequential shifter
“Prev” port:
p_data_i: value to be shiftedp_shift_i: shift amountop__sdir: shift direction (0 = left, 1 = right)p_valid_iandp_ready_o: handshake
“Next” port:
n_data_o: shifted valuen_valid_oandn_ready_i: handshake
-
elaborate(_)¶
-
ports()¶
-
width= None¶ data width
-
nmutil.test.example_gtkwave.test_shifter()¶ Simulate the Shifter to generate some traces, as well as the GTKWave documents
-
nmutil.test.example_gtkwave.write_gtkw_direct()¶ Write a formatted GTKWave “save” file, using vcd.gtkw directly
nmutil.test.test_buf_pipe module¶
Unit tests for Buffered and Unbuffered pipelines
contains useful worked examples of how to use the Pipeline API, including:
- Combinatorial Stage “Chaining”
- class-based data stages
- nmigen module-based data stages
- special nmigen module-based data stage, where the stage is the module
- Record-based data stages
- static-class data stages
- multi-stage pipelines (and how to connect them)
- how to use the pipelines (see Test5) - how to get data in and out
-
class
nmutil.test.test_buf_pipe.Example2OpClass¶ Bases:
objectan example of a class used to store 2 operands. requires an eq function, to conform with the pipeline stage API
-
eq(i)¶
-
-
class
nmutil.test.test_buf_pipe.Example2OpRecord¶
-
class
nmutil.test.test_buf_pipe.ExampleAddClassStage¶ Bases:
nmutil.stageapi.StageClsan example of how to use the buffered pipeline, as a class instance
-
ispec()¶ returns an instance of an Example2OpClass.
-
ospec()¶ returns an output signal which will happen to contain the sum of the two inputs
-
process(i)¶ process the input data (sums the values in the tuple) and returns it
-
-
class
nmutil.test.test_buf_pipe.ExampleAddRecordObjectStage¶ Bases:
nmutil.stageapi.StageCls-
ispec()¶ returns an instance of an Example2OpRecord.
-
ospec()¶ returns an output signal which will happen to contain the sum of the two inputs
-
process(i)¶ process the input data (sums the values in the tuple) and returns it
-
-
class
nmutil.test.test_buf_pipe.ExampleAddRecordPipe¶ Bases:
nmutil.singlepipe.UnbufferedPipelinean example of how to use the combinatorial pipeline.
-
class
nmutil.test.test_buf_pipe.ExampleAddRecordPlaceHolderPipe¶ Bases:
nmutil.singlepipe.UnbufferedPipelinean example of how to use the combinatorial pipeline.
-
class
nmutil.test.test_buf_pipe.ExampleAddRecordPlaceHolderStage¶ Bases:
nmutil.stageapi.StageClsexample use of a Record, with a placeholder as the processing result
-
ispec()¶ returns a Record using the specification
-
ospec()¶
-
process(i)¶ process the input data, returning a PlaceHolder class instance with attributes that exactly match those of the Record.
-
record_spec= [('src1', 16), ('src2', 16)]¶
-
-
class
nmutil.test.test_buf_pipe.ExampleAddRecordStage¶ Bases:
nmutil.stageapi.StageClsexample use of a Record
-
ispec()¶ returns a Record using the specification
-
ospec()¶
-
process(i)¶ process the input data, returning a dictionary with key names that exactly match the Record’s attributes.
-
record_spec= [('src1', 16), ('src2', 16)]¶
-
-
class
nmutil.test.test_buf_pipe.ExampleBufAdd1Pipe¶
-
class
nmutil.test.test_buf_pipe.ExampleBufDelayedPipe¶ Bases:
nmutil.singlepipe.BufferedHandshake-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleBufModeAdd1Pipe¶
-
class
nmutil.test.test_buf_pipe.ExampleBufModeUnBufPipe(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleBufPassThruPipe(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleBufPassThruPipe2(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleBufPipe2(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBaseExample of how to do chained pipeline stages.
-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleBufPipe3(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBaseExample of how to do delayed pipeline, where the stage signals whether it is ready.
-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleBufPipeAddClass¶ Bases:
nmutil.singlepipe.BufferedHandshakean example of how to use the buffered pipeline, using a class instance
-
class
nmutil.test.test_buf_pipe.ExampleBufPipeChain2¶ Bases:
nmutil.singlepipe.BufferedHandshakeconnects two stages together as a single combinatorial stage.
-
class
nmutil.test.test_buf_pipe.ExampleBufUnBufPipe(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleFIFOAdd2Pipe(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleFIFOPassThruPipe1(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleFIFORecordObjectPipe(stage=None, in_multi=None, stage_ctl=False, maskwid=0)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.ExampleLTBufferedPipeDerived¶ Bases:
nmutil.singlepipe.BufferedHandshakean example of how to use the buffered pipeline.
-
class
nmutil.test.test_buf_pipe.ExampleLTPipeline¶ Bases:
nmutil.singlepipe.UnbufferedPipelinean example of how to use the unbuffered pipeline.
-
class
nmutil.test.test_buf_pipe.ExampleMaskCancellable¶ Bases:
nmutil.stageapi.StageCls-
ispec()¶ returns an instance of an ExampleMaskRecord.
-
ospec()¶ returns the same
-
process(i)¶ process the input data: increase op1 and op2
-
-
class
nmutil.test.test_buf_pipe.ExampleMaskRecord¶ Bases:
nmutil.iocontrol.RecordObjectan example of a class used to store 2 operands. requires an eq function, to conform with the pipeline stage API
-
class
nmutil.test.test_buf_pipe.ExamplePassAdd1Pipe¶
-
class
nmutil.test.test_buf_pipe.ExampleRecordHandshakeAddClass¶
-
class
nmutil.test.test_buf_pipe.ExampleStageDelayCls(valid_trigger=2)¶ Bases:
nmutil.stageapi.StageCls,nmigen.hdl.ir.Elaboratablean example of how to use the buffered pipeline, in a static class fashion
-
d_ready¶ data is ready to be accepted when this is true
-
d_valid(ready_i)¶ data is valid at output when this is true
-
elaborate(platform)¶
-
ispec()¶
-
ospec()¶
-
process(i)¶ process the input data and returns it (adds 1)
-
-
class
nmutil.test.test_buf_pipe.ExampleUnBufAdd1Pipe¶
-
class
nmutil.test.test_buf_pipe.ExampleUnBufAdd1Pipe2¶
-
class
nmutil.test.test_buf_pipe.ExampleUnBufDelayedPipe¶ Bases:
nmutil.singlepipe.BufferedHandshake-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.FIFOTest16¶
-
class
nmutil.test.test_buf_pipe.FIFOTest2x16¶
-
class
nmutil.test.test_buf_pipe.FIFOTestAdd16¶
-
class
nmutil.test.test_buf_pipe.FIFOTestRecordAddStageControl¶
-
class
nmutil.test.test_buf_pipe.FIFOTestRecordControl¶
-
class
nmutil.test.test_buf_pipe.LTStage¶ Bases:
nmutil.stageapi.StageClsmodule-based stage example
-
ispec(name)¶
-
ospec(name)¶
-
process(i)¶
-
setup(m, i)¶
-
-
class
nmutil.test.test_buf_pipe.LTStageDerived¶ Bases:
nmutil.test.test_buf_pipe.SetLessThan,nmutil.stageapi.StageClsspecial version of a nmigen module where the module is also a stage
shows that you don’t actually need to combinatorially connect to the outputs, or add the module as a submodule: just return the module output parameter(s) from the Stage.process() function
-
ispec()¶
-
ospec()¶
-
process(i)¶
-
setup(m, i)¶
-
-
class
nmutil.test.test_buf_pipe.MaskCancellableDynamic(maskwid)¶ Bases:
nmutil.singlepipe.ControlBase-
elaborate(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
class
nmutil.test.test_buf_pipe.MaskCancellablePipe(dynamic=False, maskwid=16)¶ Bases:
nmutil.singlepipe.MaskCancellableconnects two stages together as a single combinatorial stage.
-
class
nmutil.test.test_buf_pipe.MaskCancellablePipe1(dynamic=True, maskwid=16)¶ Bases:
nmutil.singlepipe.MaskCancellableconnects a stage to a cancellable pipe with “dynamic” mode on.
-
class
nmutil.test.test_buf_pipe.PassThroughTest¶ Bases:
nmutil.singlepipe.PassThroughHandshake-
iospecfn()¶
-
-
class
nmutil.test.test_buf_pipe.SetLessThan(width, signed)¶ Bases:
nmigen.hdl.ir.Elaboratable-
elaborate(platform)¶
-
-
class
nmutil.test.test_buf_pipe.Test5(dut, resultfn, data=None, stage_ctl=False)¶ Bases:
object-
rcv()¶
-
send()¶
-
-
class
nmutil.test.test_buf_pipe.TestInputAdd(op1, op2)¶ Bases:
objectthe eq function, called by set_input, needs an incoming object that conforms to the Example2OpClass.eq function requirements easiest way to do that is to create a class that has the exact same member layout (self.op1, self.op2) as Example2OpClass
-
class
nmutil.test.test_buf_pipe.TestInputMask(src1, src2)¶ Bases:
objectthe eq function, called by set_input, needs an incoming object that conforms to the Example2OpClass.eq function requirements easiest way to do that is to create a class that has the exact same member layout (self.op1, self.op2) as Example2OpClass
-
class
nmutil.test.test_buf_pipe.TestMask(dut, resultfn, maskwid, data=None, stage_ctl=False, latching=False)¶ Bases:
object-
rcv()¶
-
send()¶
-
-
nmutil.test.test_buf_pipe.check_o_n_valid(dut, val)¶
-
nmutil.test.test_buf_pipe.check_o_n_valid2(dut, val)¶
-
nmutil.test.test_buf_pipe.data_2op()¶
-
nmutil.test.test_buf_pipe.data_chain0(n_tests)¶
-
nmutil.test.test_buf_pipe.data_chain1()¶
-
nmutil.test.test_buf_pipe.data_chain2()¶
-
nmutil.test.test_buf_pipe.data_dict()¶
-
nmutil.test.test_buf_pipe.data_placeholder()¶
-
nmutil.test.test_buf_pipe.iospecfn()¶
-
nmutil.test.test_buf_pipe.iospecfn24()¶
-
nmutil.test.test_buf_pipe.iospecfnrecord()¶
-
nmutil.test.test_buf_pipe.notworking1()¶
-
nmutil.test.test_buf_pipe.notworking2()¶
-
nmutil.test.test_buf_pipe.resultfn_0(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_11(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_12(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_3(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_5(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_6(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_7(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_8(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_9(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.resultfn_identical(data_o, expected, i, o)¶
-
nmutil.test.test_buf_pipe.tbench(dut)¶
-
nmutil.test.test_buf_pipe.tbench2(dut)¶
-
nmutil.test.test_buf_pipe.tbench4(dut)¶
-
nmutil.test.test_buf_pipe.test0()¶
-
nmutil.test.test_buf_pipe.test0_1()¶
-
nmutil.test.test_buf_pipe.test10()¶
-
nmutil.test.test_buf_pipe.test11()¶
-
nmutil.test.test_buf_pipe.test12()¶
-
nmutil.test.test_buf_pipe.test13()¶
-
nmutil.test.test_buf_pipe.test15()¶
-
nmutil.test.test_buf_pipe.test16()¶
-
nmutil.test.test_buf_pipe.test17()¶
-
nmutil.test.test_buf_pipe.test18()¶
-
nmutil.test.test_buf_pipe.test19()¶
-
nmutil.test.test_buf_pipe.test20()¶
-
nmutil.test.test_buf_pipe.test21()¶
-
nmutil.test.test_buf_pipe.test22()¶
-
nmutil.test.test_buf_pipe.test23()¶
-
nmutil.test.test_buf_pipe.test24()¶
-
nmutil.test.test_buf_pipe.test25()¶
-
nmutil.test.test_buf_pipe.test3()¶
-
nmutil.test.test_buf_pipe.test3_5()¶
-
nmutil.test.test_buf_pipe.test4()¶
-
nmutil.test.test_buf_pipe.test5()¶
-
nmutil.test.test_buf_pipe.test6()¶
-
nmutil.test.test_buf_pipe.test7()¶
-
nmutil.test.test_buf_pipe.test8()¶
-
nmutil.test.test_buf_pipe.test9()¶
-
nmutil.test.test_buf_pipe.test997()¶
-
nmutil.test.test_buf_pipe.test998()¶
-
nmutil.test.test_buf_pipe.test999()¶
nmutil.test.test_clz module¶
nmutil.test.test_inout_feedback_pipe module¶
key strategic example showing how to do multi-input fan-in into a multi-stage pipeline, then multi-output fanout, with an unary muxid and cancellation
the multiplex ID from the fan-in is passed in to the pipeline, preserved, and used as a routing ID on the fanout.
-
class
nmutil.test.test_inout_feedback_pipe.DecisionPipe(maskwid)¶
-
class
nmutil.test.test_inout_feedback_pipe.InputTest(dut, tlen)¶ Bases:
object-
rcv(muxid)¶
-
send(muxid)¶
-
-
class
nmutil.test.test_inout_feedback_pipe.MergeRoutePipe¶ Bases:
nmutil.multipipe.PriorityCombMuxInPipemerges data coming from end of pipe (with operator now == 1)
-
class
nmutil.test.test_inout_feedback_pipe.PassData¶ Bases:
nmutil.iocontrol.Object
-
class
nmutil.test.test_inout_feedback_pipe.PassThroughPipe(maskwid)¶
-
class
nmutil.test.test_inout_feedback_pipe.PassThroughStage¶ Bases:
object-
ispec()¶
-
ospec()¶
-
process(i)¶
-
-
class
nmutil.test.test_inout_feedback_pipe.RouteBackPipe¶ Bases:
nmutil.multipipe.CombMuxOutPiperoutes data back to start of pipeline
-
class
nmutil.test.test_inout_feedback_pipe.SplitRouteStage¶ Bases:
object-
ispec()¶
-
ospec()¶
-
process(i)¶
-
setup(m, i)¶
-
-
class
nmutil.test.test_inout_feedback_pipe.TestInOutPipe(num_rows=4)¶ Bases:
nmigen.hdl.ir.Elaboratable-
elaborate(platform)¶
-
ports()¶
-
-
class
nmutil.test.test_inout_feedback_pipe.TestMuxOutPipe(num_rows)¶
-
class
nmutil.test.test_inout_feedback_pipe.TestPriorityMuxPipe(num_rows)¶
-
nmutil.test.test_inout_feedback_pipe.test1()¶
nmutil.test.test_inout_mux_pipe module¶
key strategic example showing how to do multi-input fan-in into a multi-stage pipeline, then multi-output fanout.
the multiplex ID from the fan-in is passed in to the pipeline, preserved, and used as a routing ID on the fanout.
-
class
nmutil.test.test_inout_mux_pipe.PassData¶ Bases:
nmutil.iocontrol.Object
-
class
nmutil.test.test_inout_mux_pipe.PassData2¶
-
class
nmutil.test.test_inout_mux_pipe.PassThroughPipe¶
-
class
nmutil.test.test_inout_mux_pipe.TestInOutPipe(num_rows=4)¶ Bases:
nmigen.hdl.ir.Elaboratable-
elaborate(platform)¶
-
ports()¶
-
-
class
nmutil.test.test_inout_mux_pipe.TestMuxOutPipe(num_rows)¶
-
class
nmutil.test.test_inout_mux_pipe.TestPriorityMuxPipe(num_rows)¶
-
nmutil.test.test_inout_mux_pipe.test1()¶
nmutil.test.test_inout_unary_mux_cancel_pipe module¶
key strategic example showing how to do multi-input fan-in into a multi-stage pipeline, then multi-output fanout, with an unary muxid and cancellation
the multiplex ID from the fan-in is passed in to the pipeline, preserved, and used as a routing ID on the fanout.
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.InputTest(dut, tlen)¶ Bases:
object-
rcv(muxid)¶
-
send(muxid)¶
-
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.PassData¶ Bases:
nmutil.iocontrol.Object
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.PassData2¶
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.PassThroughPipe(maskwid)¶
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.PassThroughStage¶ Bases:
object-
ispec()¶
-
ospec()¶
-
process(i)¶
-
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.TestInOutPipe(num_rows=4)¶ Bases:
nmigen.hdl.ir.Elaboratable-
elaborate(platform)¶
-
ports()¶
-
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.TestMuxOutPipe(num_rows)¶
-
class
nmutil.test.test_inout_unary_mux_cancel_pipe.TestPriorityMuxPipe(num_rows)¶
-
nmutil.test.test_inout_unary_mux_cancel_pipe.test1()¶
nmutil.test.test_outmux_pipe module¶
-
class
nmutil.test.test_outmux_pipe.PassInData¶
-
class
nmutil.test.test_outmux_pipe.PassThroughDataStage¶ Bases:
object-
ispec()¶
-
ospec()¶
-
process(i)¶
-
-
class
nmutil.test.test_outmux_pipe.PassThroughPipe¶
-
class
nmutil.test.test_outmux_pipe.PassThroughStage¶ Bases:
object-
ispec()¶
-
ospec(name)¶
-
process(i)¶
-
-
class
nmutil.test.test_outmux_pipe.TestPriorityMuxPipe(num_rows)¶
-
class
nmutil.test.test_outmux_pipe.TestSyncToPriorityPipe¶ Bases:
nmigen.hdl.ir.Elaboratable-
elaborate(platform)¶
-
ports()¶
-
-
nmutil.test.test_outmux_pipe.test1()¶