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


Python verilog.convert函数代码示例

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


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

示例1: export_one

def export_one(config, filename='top.v'):

    m = UnCore(config)

    verilog.convert(m,
                    name="top",
                    ios={m.start, m.done, m.cycle_count}
                    ).write(filename)
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:8,代码来源:tkb_top.py

示例2: export

def export(config, filename='top.v'):

    m = UnCore(config)
    m.clock_domains.cd_sys = ClockDomain(reset_less=True)

    verilog.convert(m,
                    name="top",
                    ios={m.start, m.done, m.cycle_count, m.total_num_messages, m.cd_sys.clk}
                    ).write(filename)
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:9,代码来源:top_minimal.py

示例3: test_instance_module

def test_instance_module():
    sub = ChildModule()
    convert(sub, sub.io, name="ChildModule").write("ChildModule.v")

    im = ParentModule()
    convert(im, im.io, name="ParentModule").write("ParentModule.v")

    subprocess.check_call(["iverilog", "-W", "all",
                           "ParentModule.v", "ChildModule.v"])
开发者ID:32bitmicro,项目名称:migen,代码行数:9,代码来源:instance.py

示例4: export

def export(config, filename='top.v'):

    m = UnCore(config)
    m.clock_domains.cd_sys = ClockDomain(reset_less=True)

    ios = {m.start, m.done, m.cycle_count, m.total_num_messages, m.cd_sys.clk, m.kernel_error}
    if config.use_ddr:
        ios |= m.cores[0].portsharer.get_ios()

    verilog.convert(m,
                    name="top",
                    ios=ios
                    ).write(filename)

    with open("address_mapping.txt", 'w') as adrmap:
        word_offset = m.cores[0].bramio.word_offset
        addr_spacing = m.cores[0].bramio.addr_spacing
        start_addr = m.cores[0].config.start_addr
        if config.init_nodedata:
            for pe_id, data in enumerate(config.init_nodedata):
                fname = "init_nodedata{}.data".format(pe_id)
                with open(fname, 'wb') as f:
                    adrmap.write("{}\t{}\n".format(hex(start_addr), fname))
                    for x in data:
                        for _ in range(512//32):
                            f.write(struct.pack('=I', x & (2**32 - 1)))
                            x >>= 32
                start_addr += addr_spacing
        else:
            start_addr += config.addresslayout.num_pe * addr_spacing
        for pe_id, adj_idx in enumerate(config.adj_idx):
            fname = "adj_idx{}.data".format(pe_id)
            with open(fname, 'wb') as f:
                adrmap.write("{}\t{}\n".format(hex(start_addr), fname))
                for index, length in adj_idx:
                    data = convert_record_to_int([("index", config.addresslayout.edgeidsize), ("length", config.addresslayout.edgeidsize)], index=index, length=length)
                    print(hex(index), hex(length), hex(data))
                    for _ in range(512//32):
                        print(hex(data & (2**32 - 1)))
                        f.write(struct.pack('=I', data & (2**32 - 1)))
                        data = data >> 32
            start_addr += addr_spacing
        if config.use_ddr:
            with open("adj_val.data", 'wb') as f:
                adrmap.write("0x000000000\tadj_val.data\n")
                for x in config.adj_val:
                    f.write(struct.pack('=I', x))
        else:
            fname = "adj_val{}.data".format(pe_id)
            with open(fname, 'wb') as f:
                adrmap.write("{}\t{}\n".format(hex(start_addr), fname))
                for x in data:
                    f.write(struct.pack('=I', x))
            start_addr += addr_spacing
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:54,代码来源:top_ddr.py

示例5: main

def main():
    pico = PicoPlatform(1, bus_width=32, stream_width=128)

    m = Top(pico)

    so = dict(migen.build.xilinx.common.xilinx_special_overrides)
    verilog.convert(m,
                    name="echo",
                    ios=pico.get_ios(),
                    special_overrides=so,
                    create_clock_domains=False
                    ).write("top.v")
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:12,代码来源:hmc_backed_fifo_test_top.py

示例6: export

def export(filename='echo.v'):

    platform = PicoPlatform(bus_width=32, stream_width=128)

    m = Top(platform)

    so = dict(migen.build.xilinx.common.xilinx_special_overrides)
    verilog.convert(m,
                    name="echo",
                    ios=platform.get_ios(),
                    special_overrides=so,
                    create_clock_domains=False
                    ).write(filename)
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:13,代码来源:core_neighbors_hmc_tb.py

示例7: export

def export(config, filename='top.v'):
    config.platform = PicoPlatform(0 if config.memtype == "BRAM" else config.addresslayout.num_pe_per_fpga, create_hmc_ios=True, bus_width=32, stream_width=128)

    m = Top(config)

    so = dict(migen.build.xilinx.common.xilinx_special_overrides)
    verilog.convert(m,
                    name="top",
                    ios=config.platform.get_ios(),
                    special_overrides=so,
                    create_clock_domains=False
                    ).write(filename)
    if config.memtype != "BRAM":
        export_data(config.adj_val, "adj_val.data", backup=config.alt_adj_val_data_name)
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:14,代码来源:inverted_top_pico.py

示例8: export

def export(config, filename='top'):

    m = [Core(config, i*config.addresslayout.num_pe_per_fpga, min((i+1)*config.addresslayout.num_pe_per_fpga, config.addresslayout.num_pe)) for i in range(config.addresslayout.num_fpga)]

    for i in range(config.addresslayout.num_fpga):
        iname = filename + "_" + str(i)
        os.makedirs(iname, exist_ok=True)
        with cd(iname):
            ios={m[i].start, m[i].done, m[i].cycle_count}
            ios |= m[i].network.ios
            verilog.convert(m[i],
                            name="top",
                            ios=ios
                            ).write(iname + ".v")
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:14,代码来源:tkb_top.py

示例9: create_bench

def create_bench(ports):
    radix = clog2(ports)
    width = radix * 2
    print("Generating butterfly with radix == {}".format(radix))
    bf = sdlib.sd_butterfly(radix=radix, width=width)
    convert(bf, bf.io, name="butterfly{}".format(ports), asic_syntax=True).write("butterfly{}.v".format(ports))
    senders = sender(width=width, targets=ports)
    convert(senders, senders.io, name="sender{}".format(ports), asic_syntax=True).write("sender{}.v".format(ports))
    rcvr = receiver(width=width, sources=ports)
    convert(rcvr, rcvr.io, name="receiver{}".format(ports), asic_syntax=True).write("receiver{}.v".format(ports))
    se = harness(ports=ports, width=width)
    convert(se, se.io, name="harness{}".format(ports), asic_syntax=True).write("harness{}.v".format(ports))
    tb = harness_tb(ports=ports)
    convert(tb, name="harness_tb{}".format(ports)).write("harness_tb{}.v".format(ports))
开发者ID:hutch31,项目名称:sdlib,代码行数:14,代码来源:test_bf.py

示例10: export_one

def export_one(config, filename='top'):
    logger = logging.getLogger('config')
    config.platform = PicoPlatform(0 if config.memtype == "BRAM" else config.addresslayout.num_pe_per_fpga, create_hmc_ios=True, bus_width=32, stream_width=128)

    m = Top(config)
    logger.info("Exporting design to file {}".format(filename + '.v'))

    so = dict(migen.build.xilinx.common.xilinx_special_overrides)
    verilog.convert(m,
                    name=filename,
                    ios=config.platform.get_ios(),
                    special_overrides=so,
                    create_clock_domains=False
                    ).write(filename + '.v')
    if not config.memtype == "BRAM":
        export_data(config.adj_val, "adj_val.data")
开发者ID:nakengelhardt,项目名称:fpgagraphlib,代码行数:16,代码来源:inverted_top_pico_multi.py

示例11: main

def main():
	m = RiffAverage(c_pci_data_width=128)
	m.cd_sys.clk.name_override="clk"
	m.cd_sys.rst.name_override="rst"
	for name in "ack", "last", "len", "off", "data", "data_valid", "data_ren":
		getattr(m.chnl_rx, name).name_override="chnl_rx_{}".format(name)
		getattr(m.chnl_tx, name).name_override="chnl_tx_{}".format(name)
	m.chnl_rx.start.name_override="chnl_rx"
	m.chnl_tx.start.name_override="chnl_tx"

	print(verilog.convert(m, name="top", ios={
		m.chnl_rx_clk,
		m.chnl_rx.start,
		m.chnl_rx.ack,
		m.chnl_rx.last,
		m.chnl_rx.len,
		m.chnl_rx.off,
		m.chnl_rx.data,
		m.chnl_rx.data_valid,
		m.chnl_rx.data_ren,
		m.chnl_tx_clk,
		m.chnl_tx.start,
		m.chnl_tx.ack,
		m.chnl_tx.last,
		m.chnl_tx.len,
		m.chnl_tx.off,
		m.chnl_tx.data,
		m.chnl_tx.data_valid,
		m.chnl_tx.data_ren,
		m.cd_sys.clk,
		m.cd_sys.rst}))
开发者ID:nakengelhardt,项目名称:kc705_riffa,代码行数:31,代码来源:movingaverage.py

示例12: get_verilog

	def get_verilog(self, fragment, **kwargs):
		if not isinstance(fragment, Fragment):
			fragment = fragment.get_fragment()
		# We may create a temporary clock/reset generator that would request pins.
		# Save the constraint manager state so that such pin requests disappear
		# at the end of this function.
		backup = self.constraint_manager.save()
		try:
			# if none exists, create a default clock domain and drive it
			if not fragment.clock_domains:
				if self.default_crg_factory is None:
					raise NotImplementedError("No clock/reset generator defined by either platform or user")
				crg = self.default_crg_factory(self)
				frag = fragment + crg.get_fragment()
			else:
				frag = fragment
			# generate Verilog
			src, vns = verilog.convert(frag, self.constraint_manager.get_io_signals(),
				return_ns=True, create_clock_domains=False, **kwargs)
			# resolve signal names in constraints
			sc = self.constraint_manager.get_sig_constraints()
			named_sc = [(vns.get_name(sig), pins, others, resource) for sig, pins, others, resource in sc]
			# resolve signal names in platform commands
			pc = self.constraint_manager.get_platform_commands()
			named_pc = []
			for template, args in pc:
				name_dict = dict((k, vns.get_name(sig)) for k, sig in args.items())
				named_pc.append(template.format(**name_dict))
		finally:
			self.constraint_manager.restore(backup)
		return src, named_sc, named_pc
开发者ID:brandonhamilton,项目名称:mibuild,代码行数:31,代码来源:generic_platform.py

示例13: __init__

	def __init__(self, fragment, top_level=None, sim_runner=None, sockaddr="simsocket", **vopts):
		if not isinstance(fragment, Fragment):
			fragment = fragment.get_fragment()
		if top_level is None:
			top_level = TopLevel()
		if sim_runner is None:
			sim_runner = icarus.Runner()		
		self.fragment = fragment + Fragment(clock_domains=top_level.clock_domains)
		self.top_level = top_level
		self.ipc = Initiator(sockaddr)
		self.sim_runner = sim_runner
		
		c_top = self.top_level.get(sockaddr)
		
		c_fragment, self.namespace = verilog.convert(self.fragment,
			ios=self.top_level.ios,
			name=self.top_level.dut_type,
			return_ns=True,
			**vopts)
		
		self.cycle_counter = -1
		self.interrupt = False

		self.sim_runner = sim_runner
		self.sim_runner.start(c_top, c_fragment)
		self.ipc.accept()
		reply = self.ipc.recv()
		assert(isinstance(reply, MessageTick))
		_call_sim(self.fragment, self)
开发者ID:vic0,项目名称:migen,代码行数:29,代码来源:generic.py

示例14: 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

示例15: main

def main():
	c_pci_data_width = 128 # PCIe lane width
	ptrsize = 64 # pointer size of the host system, 32 bit or 64 bit
	wordsize = 32 # width of data port to design (any power of 2)
	
	num_chnls = 4 # Virtmem takes 2 channels, add more for direct use, plus last one for loopback "are you there?" test
	combined_interface_tx = riffa.Interface(data_width=c_pci_data_width, num_chnls=num_chnls)
	combined_interface_rx = riffa.Interface(data_width=c_pci_data_width, num_chnls=num_chnls)

	m = DesignTemplate(combined_interface_rx=combined_interface_rx, combined_interface_tx=combined_interface_tx, c_pci_data_width=c_pci_data_width, wordsize=wordsize, ptrsize=ptrsize)

	# add a loopback to test responsiveness
	test_rx, test_tx = m.get_channel(num_chnls - 1)
	m.comb += test_rx.connect(test_tx)

	m.cd_sys.clk.name_override="clk"
	m.cd_sys.rst.name_override="rst"
	for name in "ack", "last", "len", "off", "data", "data_valid", "data_ren":
		getattr(combined_interface_rx, name).name_override="chnl_rx_{}".format(name)
		getattr(combined_interface_tx, name).name_override="chnl_tx_{}".format(name)
	combined_interface_rx.start.name_override="chnl_rx"
	combined_interface_tx.start.name_override="chnl_tx"
	m.rx_clk.name_override="chnl_rx_clk"
	m.tx_clk.name_override="chnl_tx_clk"
	print(verilog.convert(m, name="top", ios={getattr(combined_interface_rx, name) for name in ["start", "ack", "last", "len", "off", "data", "data_valid", "data_ren"]} | {getattr(combined_interface_tx, name) for name in ["start", "ack", "last", "len", "off", "data", "data_valid", "data_ren"]} | {m.rx_clk, m.tx_clk, m.cd_sys.clk, m.cd_sys.rst} ))
开发者ID:nakengelhardt,项目名称:kc705_riffa,代码行数:25,代码来源:designtemplate.py


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