• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python myhdl.traceSignals函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中myhdl.traceSignals函数的典型用法代码示例。如果您正苦于以下问题:Python traceSignals函数的具体用法?Python traceSignals怎么用?Python traceSignals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了traceSignals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_simulate

    def test_simulate(self):
        import myhdl
        duration=1

        def _sim():
            pix = Add_shift_top(duration=duration)
            pix_presetn = pix.presetn
            pix_pclk = pix.pclk
            pix_paddr = pix.paddr
            pix_psel = pix.psel
            pix_penable = pix.penable
            pix_pwrite = pix.pwrite
            pix_pwdata = pix.pwdata
            pix_pready = pix.pready
            pix_prdata = pix.prdata
            pix_pslverr = pix.pslverr

            @myhdl.instance
            def __sim():
                yield pix.reset()
                yield pix.transmit(0x4000, 0x0110)
            return __sim

        s = myhdl.Simulation(myhdl.traceSignals(_sim))
        s.run(10000)
开发者ID:develone,项目名称:jpeg-2000-test,代码行数:25,代码来源:jpeg_utils.py


示例2: TestBench

def TestBench(MCP3008Tester):

    ch1 = Signal(intbv(0)[10:])
    ch2 = Signal(intbv(0)[10:])
    ch3 = Signal(intbv(0)[10:])
    ch4 = Signal(intbv(0)[10:])
    ch5 = Signal(intbv(0)[10:])
    ch6 = Signal(intbv(0)[10:])
    ch7 = Signal(intbv(0)[10:])
    ch8 = Signal(intbv(0)[10:])
    spi_clk = Signal(LOW)
    spi_ss_n = Signal(HIGH)
    spi_miso = Signal(LOW)
    spi_mosi = Signal(LOW)
    clk = Signal(LOW)
    rst_n = Signal(HIGH)

    MCP3008Driver_inst = traceSignals(MCP3008Driver,
        ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8,
        spi_clk, spi_ss_n, spi_miso, spi_mosi, clk, rst_n)

    MCP3008Tester_inst = MCP3008Tester(
        ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8,
        spi_clk, spi_ss_n, spi_miso, spi_mosi, clk, rst_n)

    ClkGen_inst = ClkGen(clk)

    return MCP3008Driver_inst, MCP3008Tester_inst, ClkGen_inst
开发者ID:chandanpalai,项目名称:hailfire-fpga,代码行数:28,代码来源:test_MCP3008.py


示例3: main_simulate

def main_simulate():
    resetn = Signal(bool(1))
    system_clock = Signal(bool(0))
    paddr = Signal(intbv(0, 0, 2**32))
    psel = Signal(bool(0))
    penable = Signal(bool(0))
    pwrite = Signal(bool(1))
    pwdata = Signal(intbv(0, 0, 2**32))
    pready = Signal(bool(0))
    prdata = Signal(intbv(0, 0, 2**32))
    pslverr = Signal(bool(0))
    apb3_bus_signals = [system_clock, resetn, paddr, psel, penable, pwrite,
                        pwdata, pready, prdata, pslverr]

    SYSTEM_CLOCK_FREQ = 10e6
    SYSTEM_CLOCK_PERIOD_IN_NS = int(1.0 / SYSTEM_CLOCK_FREQ * 1e9)

    def testbench():
        clock = drive_system_clock(system_clock, SYSTEM_CLOCK_PERIOD_IN_NS)
        reset = drive_reset(resetn)
        master = apb3_master_mock([(0x40050400, 0xffffffff),
                                   (0x40050400, 0xffff7fff)],
                                  *apb3_bus_signals)
        slave = fluidsp_controller(*(apb3_bus_signals))
        return clock, reset, slave, master

    traced_testbench = traceSignals(testbench)
    sim = Simulation(traced_testbench)
    sim.run(SYSTEM_CLOCK_PERIOD_IN_NS * 100)
开发者ID:develone,项目名称:whitebox,代码行数:29,代码来源:fluidsp_controller.py


示例4: test_simulate

    def test_simulate(self):
        import myhdl
        duration=1

        def _sim():
            bus = Apb3Bus(duration=duration)
            bus_presetn = bus.presetn
            bus_pclk = bus.pclk
            bus_paddr = bus.paddr
            bus_psel = bus.psel
            bus_penable = bus.penable
            bus_pwrite = bus.pwrite
            bus_pwdata = bus.pwdata
            bus_pready = bus.pready
            bus_prdata = bus.prdata
            bus_pslverr = bus.pslverr
            
            @myhdl.instance
            def __sim():
                yield bus.reset() 
                yield bus.transmit(0x4000, 0x0110)
            return __sim

        s = myhdl.Simulation(myhdl.traceSignals(_sim))
        s.run(10000)
开发者ID:develone,项目名称:whitebox,代码行数:25,代码来源:apb3_utils.py


示例5: testBench

def testBench():

    if not DEBUG:
        datapath_i = traceSignals(pipeline)  # () #toVHDL(datapath)
    else:
        datapath_i = pipeline()

    return instances()
开发者ID:bigeagle,项目名称:pymips,代码行数:8,代码来源:pipeline.py


示例6: sim

def sim():
    insts = []
    insts.append(traceSignals(gen, *args))
    insts.append(stimuli())
    sim = Simulation(insts)
    sim.run(duration)
    print
    sys.stdout.flush()
开发者ID:wingel,项目名称:sds7102,代码行数:8,代码来源:test_renderer.py


示例7: __call__

    def __call__(self):
        if self.trace:
            #traceSignals.timescale = toMyHDL.timescale
            traceSignals.name = self.name
            gen = traceSignals(self.top, *self.args, **self.kwargs)
        else:
            gen = self.top(*self.args, **self.kwargs)

        return gen
开发者ID:jck,项目名称:uhdl,代码行数:9,代码来源:hw.py


示例8: sim

def sim():
    from myhdl import Simulation, traceSignals
    import sys

    test_inst = traceSignals(create_test)

    sim = Simulation(test_inst)
    sim.run(20000)
    print
    sys.stdout.flush()
开发者ID:trigrass2,项目名称:sds7102,代码行数:10,代码来源:test_wb.py


示例9: sim

    def sim(self):
        insts = []

        insts.append(traceSignals(self.gen, *self.args))
        insts += self.stimuli

        sim = Simulation(insts)
        sim.run(self.duration)
        print
        sys.stdout.flush()
开发者ID:wingel,项目名称:sds7102,代码行数:10,代码来源:test_frontpanel.py


示例10: testBench

def testBench():


    if not DEBUG:
        datapath_i = traceSignals(dlx)  #() #toVHDL(datapath)
    else:
        datapath_i = dlx()

    

    return instances()
开发者ID:enricmcalvo,项目名称:pymips,代码行数:11,代码来源:dlx.py


示例11: test_memory

def test_memory():
    """
    Memory: Test load and R/W operations.
    """
    gen_test_file()
    trace = False
    if trace:
        sim = Simulation(traceSignals(_testbench))
    else:
        sim = Simulation(_testbench())
    sim.run()
开发者ID:AngelTerrones,项目名称:Algol,代码行数:11,代码来源:test_memory.py


示例12: test_core

def test_core(hex_file, vcd):
    """
    Core: Behavioral test for the RISCV core.
    """
    if vcd:
        vcd = traceSignals(core_testbench, hex_file,)
        sim = Simulation(vcd)
    else:
        sim = Simulation(core_testbench(hex_file))

    sim.run()
开发者ID:AngelTerrones,项目名称:Algol,代码行数:11,代码来源:test_core.py


示例13: test_cache

def test_cache():
    """
    Cache: Test loading from memory
    """
    gen_test_file()
    trace = False
    if trace:
        sim = Simulation(traceSignals(_testbench))
    else:
        sim = Simulation(_testbench())
    sim.run()
开发者ID:AngelTerrones,项目名称:Algol,代码行数:11,代码来源:test_icache.py


示例14: sim

def sim(visu = False):
  try:
    os.remove('_bench.vcd')
  except Exception as e:
    pass # just ignore, the file is probably not here.

  fsm = traceSignals(testbench())
  sim = Simulation(fsm)
  sim.run()
  if visu:
    call(['gtkwave', '_bench.vcd'])
开发者ID:gbin,项目名称:mojo-myhdl,代码行数:11,代码来源:snow.py


示例15: main

def main():
    args = cliparse()
    if args.trace:
        mosi, miso, sck, ss = Signals(bool(0), 4)
        led = Signal(bool(0))
        clock=Clock(0, frequency=50e6)
        tb_fsm = traceSignals(tb,led, clock, mosi, miso, sck, ss, reset=None)
        sim = Simulation(tb_fsm)
        sim.run()  
    if args.build:
        build(args)    
开发者ID:develone,项目名称:fpga_development,代码行数:11,代码来源:catboard_spi_slave.py


示例16: simulate

    def simulate(self, stimulus, whitebox, **kwargs):
        """Acturally run the cosimulation with iverilog.
        
        :param stimulus: A callable that returns the cosim object.
        :param whitebox: A whitebox peripheral object.
        :param record_tx: Record the passed in number of valid samples.
        :param auto_stop: Raise ``StopSimulation`` when the correct number of samples have been recorded.
        :param sample_rate: Samples per second.
        """
        record_tx = kwargs.get('record_tx', None)
        auto_stop = kwargs.get('auto_stop', False)
        self.sample_rate = kwargs.get('sample_rate', 10e6)
        DAC2X_DURATION = int(1e9 / (self.sample_rate * 2))
        DAC_DURATION = int(1e9 / self.sample_rate)

        @instance
        def dac2x_clock():
            while True:
                self.dac2x_clock.next = not self.dac2x_clock
                yield delay(DAC2X_DURATION // 2)

        @instance
        def dac_clock():
            yield delay(DAC2X_DURATION // 4)
            while True:
                self.dac_clock.next = not self.dac_clock
                yield delay(DAC_DURATION // 2)

        @always(self.dac_clock.posedge,
                self.dac_clock.negedge,
                self.bus.presetn.negedge)
        def tx_recorder():
            if not self.bus.presetn:
                self.tx_q = []
                self.tx_i = []
                self.tx_n = []
            elif len(self.tx_i) == len(self.tx_q) and len(self.tx_i) == record_tx:
                if auto_stop:
                    raise StopSimulation
            elif self.dac_en:
                if self.dac_clock:
                    self.tx_q.append(int(self.dac_data[:]))
                    self.tx_n.append(now())
                else:
                    self.tx_i.append(int(self.dac_data[:]))

        traced = traceSignals(whitebox)
        ss = [dac_clock, dac2x_clock, stimulus, traced]
        if 'record_tx' in kwargs:
            ss.append(tx_recorder)
        s = Simulation(ss)
        s.run()
开发者ID:n8ohu,项目名称:whitebox,代码行数:52,代码来源:test_whitebox.py


示例17: simulate_quadrature

    def simulate_quadrature(self, in_i, in_q, dspflow, **kwargs):
        """Actually run the simulation, with separate i and q inputs.

        :param in_i: The input i sequence.
        :param in_q: The input q sequence.
        :param dspflow: The MyHDL module representing the dsp flow.
        :param interp: How many samples to zero-stuff.
        :returns: The valid i and q sequences as a tuple.
        """
        interp = kwargs.get('interp', 1)
        loader = kwargs.get('loader', None)
        @instance
        def stimulus():
            self.t = 0

            if loader:
                yield loader()

            self.clearn.next = self.clearn.active
            yield self.delay(1)
            self.clearn.next = not self.clearn.active

            while self.t < len(in_i):
                yield self.produce(self.input.myhdl(in_i[self.t]),
                        self.input.myhdl(in_q[self.t]), interp)
                self.t = self.t + 1
            self.input.valid.next = False
            yield self.delay(1)
            while self.output.valid:
                self.consume()
                yield self.delay(1)
            raise StopSimulation

        # Show the input
        #f_chain_in = figure_discrete_quadrature("chain in", 223, f, self.input, in_n, in_i, in_q)

        traced = traceSignals(dspflow)

        recordings = [s.record(self.clearn, self.clock) for s in self.recording]

        s = Simulation(stimulus, recordings, traced)
        s.run()

        final_i, final_q = (np.array(self.results_i, dtype=self.output.numpy_dtype()),
                np.array(self.results_q, dtype=self.output.numpy_dtype()))
        assert len(final_i) == len(final_q)
        final_n = np.arange(final_i.shape[0])

        #f_chain_out = figure_discrete_quadrature("chain out", 224, f, self.output, final_n, final_i, final_q)
        return final_i, final_q
开发者ID:n8ohu,项目名称:whitebox,代码行数:50,代码来源:test_dsp.py


示例18: sim

def sim():
    from myhdl import Simulation, traceSignals

    insts, test_gen, test_args = setup()

    test_inst = traceSignals(test_gen, *test_args)
    insts.append(test_inst)

    if 1:
        reader_inst = reader(test_args[0], test_args[1], 64, 123 * nsec)
        insts.append(reader_inst)

    sim = Simulation(*insts)
    sim.run(5 * usec)
开发者ID:trigrass2,项目名称:sds7102,代码行数:14,代码来源:test_ddr.py


示例19: testBench

def testBench(width):
    
    B = Signal(intbv(0))
    G = Signal(intbv(0))
    
    dut = traceSignals(bin2gray, B, G, width)

    @instance
    def stimulus():
        for i in range(2**width):
            B.next = intbv(i)
            yield delay(10)
            print "B: " + bin(B, width) + "| G: " + bin(G, width)

    return dut, stimulus
开发者ID:Alisa-lisa,项目名称:uni-stuff,代码行数:15,代码来源:bin2gray.py


示例20: _getDut

    def _getDut(self, func, **kwargs):
        ''' Returns a simulation instance of func. 
            Uses the simulator specified by self._simulator. 
            Enables traces if self._trace is True
                func - MyHDL function to be simulated
                kwargs - dict of func interface assignments: for signals and parameters
        '''
        if self._simulator=="myhdl":
            if not self._trace:
                sim_dut = func(**kwargs)
            else:
                sim_dut = traceSignals(func, **kwargs)
        else:
            sim_dut = self._getCosimulation(func, **kwargs)

        return sim_dut
开发者ID:nkavaldj,项目名称:myhdl_lib,代码行数:16,代码来源:_DUTer.py



注:本文中的myhdl.traceSignals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python myhdl.Signal类代码示例发布时间:2022-05-27
下一篇:
Python myhdl.toVerilog函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap