当前位置: 首页>>代码示例>>Python>>正文


Python generic.Simulator类代码示例

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


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

示例1: main

def main():
	dut = Counter()
	# We do not specify a top-level nor runner object, and use the defaults.
	sim = Simulator(dut.get_fragment())
	# Since we do not use sim.interrupt, limit the simulation
	# to some number of cycles.
	sim.run(20)
开发者ID:danfengzi,项目名称:migen,代码行数:7,代码来源:basic1.py

示例2: main

def main():
	# Compute filter coefficients with SciPy.
	coef = signal.remez(80, [0, 0.1, 0.1, 0.5], [1, 0])
	fir = FIR(coef)
	
	# Simulate for different frequencies and concatenate
	# the results.
	in_signals = []
	out_signals = []
	for frequency in [0.05, 0.07, 0.1, 0.15, 0.2]:
		tb = TB(fir, frequency)
		fragment = autofragment.from_local()
		sim = Simulator(fragment, Runner())
		sim.run(100)
		in_signals += tb.inputs
		out_signals += tb.outputs
	
	# Plot data from the input and output waveforms.
	plt.plot(in_signals)
	plt.plot(out_signals)
	plt.show()
	
	# Print the Verilog source for the filter.
	print(verilog.convert(fir.get_fragment(),
		ios={fir.i, fir.o}))
开发者ID:gyezhz,项目名称:migen,代码行数:25,代码来源:fir.py

示例3: SDRAMHostReadTest

class SDRAMHostReadTest(sim.sdram_test_util.SDRAMUTFramework, unittest.TestCase):
#    def setUp(self):

    def _run(self, dummy_data, dummy_idle, max_burst_length, host_burst_length):
        self.tb = TestBench("mt48lc16m16a2", dummy_data, dummy_idle, max_burst_length, host_burst_length)
        # Verify that all necessary files are present
        files = gather_files(self.tb)
        for i in files:
            if not os.path.exists(i):
                raise FileNotFoundError("Please download and save the vendor "
                                        "SDRAM model in %s (not redistributable)"
                                        % i)

        runner = icarus.Runner(extra_files=files)
        vcd = "test_%s.vcd" % self.__class__.__name__
        self.sim = Simulator(self.tb, TopLevel(vcd), sim_runner=runner) 
        with self.sim:
            self.sim.run(10000)
    
    def test_sdram_host_read(self):
        self._run(300, 1000, 256, 16)

    def test_sdram_host_read_2(self):
        self._run(300, 10, 256, 256)

    def test_sdram_host_read_3(self):
        self._run(300, 1000, 16, 17)

    def test_sdram_host_read_4(self):
        self._run(300, 10, 32, 64)
开发者ID:Goddard,项目名称:ov_ftdi,代码行数:30,代码来源:test_sdramhostread.py

示例4: main

def main():
	dut = Refresher(13, 2, tRP=3, tREFI=100, tRFC=5)
	logger = CommandLogger(dut.cmd)
	granter = Granter(dut.req, dut.ack)
	fragment = dut.get_fragment() + logger.get_fragment() + granter.get_fragment()
	sim = Simulator(fragment)
	sim.run(400)
开发者ID:skristiansson,项目名称:milkymist-ng-mor1kx,代码行数:7,代码来源:refresher.py

示例5: main

def main():
	# Create graph
	g = DataFlowGraph()
	gen1 = ComposableSource(g, NumberGen())
	gen2 = ComposableSource(g, NumberGen())
	
	ps = gen1 + gen2
	result = ps*gen1 + ps*gen2
	
	g.add_connection(result.actor_node, ActorNode(Dumper()))

	gen1.actor_node.actor.name = "gen1"
	gen2.actor_node.actor.name = "gen2"
	result.actor_node.name = "result"
	
	# Elaborate
	print("is_abstract before elaboration: " + str(g.is_abstract()))
	draw(g)
	g.elaborate()
	print("is_abstract after elaboration : " + str(g.is_abstract()))
	draw(g)

	# Simulate
	c = CompositeActor(g)
	fragment = c.get_fragment()
	sim = Simulator(fragment, Runner())
	sim.run(100)
开发者ID:ross1909,项目名称:migen,代码行数:27,代码来源:arithmetic.py

示例6: main

def main():
	nbits = 32
	
	# See:
	# http://www.csse.monash.edu.au/~damian/Idioms/Topics/12.1.DataFlow/html/text.html
	g = DataFlowGraph()
	
	adder = ActorNode(Add(BV(nbits)))
	bufadd = ActorNode(plumbing.Buffer) # TODO FIXME: deadlocks without this buffer
	init1 = ActorNode(Init(nbits))
	buf1 = ActorNode(plumbing.Buffer)
	init2 = ActorNode(Init(nbits))
	buf2 = ActorNode(plumbing.Buffer)
	
	g.add_connection(adder, bufadd)
	g.add_connection(bufadd, init1)
	g.add_connection(init1, buf1)
	g.add_connection(buf1, adder, sink_subr="a")
	g.add_connection(buf1, init2)
	g.add_connection(init2, buf2)
	g.add_connection(buf2, adder, sink_subr="b")
	
	g.add_connection(bufadd, ActorNode(Dumper(nbits)))
	
	c = CompositeActor(g)
	fragment = c.get_fragment()
	sim = Simulator(fragment, Runner())
	sim.run(100)
开发者ID:ross1909,项目名称:migen,代码行数:28,代码来源:fibonacci.py

示例7: main

def main():
	base_layout = [("value", 32)]
	packed_layout = structuring.pack_layout(base_layout, pack_factor)
	rawbits_layout = [("value", 32*pack_factor)]
	
	source = SimActor(source_gen(), ("source", Source, base_layout))
	sink = SimActor(sink_gen(), ("sink", Sink, base_layout))
	
	# A tortuous way of passing integer tokens.
	packer = structuring.Pack(base_layout, pack_factor)
	to_raw = structuring.Cast(packed_layout, rawbits_layout)
	from_raw = structuring.Cast(rawbits_layout, packed_layout)
	unpacker = structuring.Unpack(pack_factor, base_layout)
	
	g = DataFlowGraph()
	g.add_connection(source, packer)
	g.add_connection(packer, to_raw)
	g.add_connection(to_raw, from_raw)
	g.add_connection(from_raw, unpacker)
	g.add_connection(unpacker, sink)
	comp = CompositeActor(g)
	reporter = perftools.DFGReporter(g)
	
	fragment = comp.get_fragment() + reporter.get_fragment()
	sim = Simulator(fragment, Runner())
	sim.run(1000)
	
	g_layout = nx.spectral_layout(g)
	nx.draw(g, g_layout)
	nx.draw_networkx_edge_labels(g, g_layout, reporter.get_edge_labels())
	plt.show()
开发者ID:Jwomers,项目名称:migen,代码行数:31,代码来源:structuring.py

示例8: main

def main():
	hub = asmibus.Hub(16, 128)
	port = hub.get_port()
	hub.finalize()
	
	dut = Framebuffer(1, port, True)
	
	fragment = hub.get_fragment() + dut.get_fragment()
	sim = Simulator(fragment)
	
	sim.run(1)
	def csr_w(addr, d):
		sim.wr(dut.bank.description[addr].field.storage, d)
		
	hres = 4
	vres = 4
	
	csr_w(1, hres) # hres
	csr_w(2, hres+3) # hsync_start
	csr_w(3, hres+5) # hsync_stop
	csr_w(4, hres+10) # hscan
	csr_w(5, vres) # vres
	csr_w(6, vres+3) # vsync_start
	csr_w(7, vres+5) # vsync_stop
	csr_w(8, vres+10) # vscan
	csr_w(10, hres*vres*4) # length
	csr_w(0, 1) # enable
	
	sim.run(1000)
开发者ID:shuckc,项目名称:misoc,代码行数:29,代码来源:framebuffer.py

示例9: test_writer

def test_writer():
    print("*** Testing writer")
    trgen = SimActor(trgen_gen(), ("address_data", Source, [("a", BV(30)), ("d", BV(32))]))
    writer = dma_wishbone.Writer()
    g = DataFlowGraph()
    g.add_connection(trgen, writer)
    comp = CompositeActor(g)

    peripheral = MyPeripheral()
    tap = wishbone.Tap(peripheral.bus)
    interconnect = wishbone.InterconnectPointToPoint(writer.bus, peripheral.bus)

    def end_simulation(s):
        s.interrupt = trgen.done and not s.rd(comp.busy)

    fragment = (
        comp.get_fragment()
        + peripheral.get_fragment()
        + tap.get_fragment()
        + interconnect.get_fragment()
        + Fragment(sim=[end_simulation])
    )

    sim = Simulator(fragment, Runner())
    sim.run()
开发者ID:gyezhz,项目名称:migen,代码行数:25,代码来源:dataflow_dma.py

示例10: run_sim

def run_sim(ng):
	g = DataFlowGraph()
	d = Dumper(layout)
	g.add_connection(ng, d)
	
	c = CompositeActor(g)
	sim = Simulator(c)
	sim.run(30)
	del sim
开发者ID:danfengzi,项目名称:migen,代码行数:9,代码来源:basic.py

示例11: run_sim

def run_sim(ng):
	g = DataFlowGraph()
	d = Dumper(layout)
	g.add_connection(ng, d)
	
	c = CompositeActor(g)
	fragment = c.get_fragment()
	sim = Simulator(fragment, Runner())
	sim.run(30)
	del sim
开发者ID:Jwomers,项目名称:migen,代码行数:10,代码来源:basic.py

示例12: main

def main():
	source = SimSource()
	loop = misc.IntSequence(32)
	sink = SimSink()
	g = DataFlowGraph()
	g.add_connection(source, loop)
	g.add_connection(loop, sink)
	comp = CompositeActor(g)
	sim = Simulator(comp)
	sim.run(500)
开发者ID:danfengzi,项目名称:migen,代码行数:10,代码来源:misc.py

示例13: main

def main():
	g = DataFlowGraph()
	g.add_connection(DataGen(), PE43602Driver(PE43602()))
	c = CompositeActor(g)
	
	def end_simulation(s):
		s.interrupt = s.cycle_counter > 5 and not s.rd(c.busy)
	f = c.get_fragment() + Fragment(sim=[end_simulation])
	sim = Simulator(f, TopLevel(vcd_name="pe43602.vcd"))
	sim.run()
开发者ID:brandonhamilton,项目名称:rhino-gateware,代码行数:10,代码来源:pe43602.py

示例14: main

def main():
	source = ActorNode(SimActor(source_gen(), ("source", Source, [("value", BV(32))])))
	loop = ActorNode(control.For(32))
	sink = ActorNode(SimActor(sink_gen(), ("sink", Sink, [("value", BV(32))])))
	g = DataFlowGraph()
	g.add_connection(source, loop)
	g.add_connection(loop, sink)
	comp = CompositeActor(g)
	fragment = comp.get_fragment()
	sim = Simulator(fragment, Runner())
	sim.run(500)
开发者ID:ross1909,项目名称:migen,代码行数:11,代码来源:control.py

示例15: main

def main():
	source = SimActor(source_gen(), ("source", Source, [("value", 32)]))
	sink = SimActor(sink_gen(), ("sink", Sink, [("value", 32)]))
	g = DataFlowGraph()
	g.add_connection(source, sink)
	comp = CompositeActor(g)
	def end_simulation(s):
		s.interrupt = source.token_exchanger.done
	fragment = comp.get_fragment() + Fragment(sim=[end_simulation])
	sim = Simulator(fragment, Runner())
	sim.run()
开发者ID:Jwomers,项目名称:migen,代码行数:11,代码来源:dataflow.py


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