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

Python myhdl.toVHDL函数代码示例

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

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



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

示例1: _generate_vhdl

def _generate_vhdl(output_dir, width_addr, width_data, top_level_file_name, \
        exp_reset_active):
    toVHDL.std_logic_ports = True
    toVHDL.name = os.path.splitext(top_level_file_name)[0]
    toVHDL.directory = output_dir 
    toVHDL.use_clauses = \
'''
Library UNISIM;
use UNISIM.vcomponents.all;

use work.pck_myhdl_090.all;
'''
    
    spec = ControllerSpec(width_addr, width_data)

    clk = Signal(False)
    reset = ResetSignal(not _RESET_ACTIVE, active=_RESET_ACTIVE, async=False)
    rx = Signal(False)
    tx = Signal(False)
    exp_addr = Signal(intbv(0)[width_addr:0])
    exp_din = Signal(intbv(0)[width_data:0])
    exp_dout = Signal(intbv(0)[width_data:0])
    exp_wen = Signal(False)
    exp_reset = Signal(False)
    exp_clk = Signal(False)
    exp_clk_en = Signal(False)

    toVHDL(BoardComponent, spec=spec, clk=clk, reset=reset,
            rx=rx, tx=tx, exp_addr=exp_addr, exp_data_write=exp_din, 
            exp_data_read=exp_dout, exp_wen=exp_wen, exp_reset=exp_reset, 
            exp_clk=exp_clk, exp_clk_en=exp_clk_en,
            exp_reset_active=exp_reset_active, baudrate=_UART_BAUDRATE)
开发者ID:matthijsbos,项目名称:fpgaedu,代码行数:32,代码来源:generate_vhdl.py


示例2: _generate_nexys4_board_component

def _generate_nexys4_board_component():
    _set_tovhdl_defaults('nexys4boardcomponent')
    toVHDL(nexys4.BoardComponent, spec=_SPEC, clk=_CLK, reset=_RESET,
            rx=_UART_RX, tx=_UART_TX, exp_addr=_EXP_ADDR, 
            exp_data_write=_EXP_DIN, exp_data_read=_EXP_DOUT, 
            exp_wen=_EXP_WEN, exp_reset=_EXP_RESET, exp_clk=_EXP_CLK, 
            exp_reset_active=_EXP_RESET_ACTIVE, baudrate=_UART_BAUDRATE)
开发者ID:matthijsbos,项目名称:fpgaedu,代码行数:7,代码来源:generatevhdl.py


示例3: _getCosimulation

    def _getCosimulation(self, func, **kwargs):
        ''' Returns a co-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
        '''
        vals = {}
        vals['topname'] = func.func_name
        vals['unitname'] = func.func_name.lower()
        hdlsim = self._simulator
        if not hdlsim:
            raise ValueError("No _simulator specified")
        if not self.sim_reg.has_key(hdlsim):
            raise ValueError("Simulator {} is not registered".format(hdlsim))

        hdl, analyze_cmd, elaborate_cmd, simulate_cmd = self.sim_reg[hdlsim]

        # Convert to HDL
        if hdl == "verilog":
            toVerilog(func, **kwargs)
            if self._trace:
                self._enableTracesVerilog("./tb_{topname}.v".format(**vals))
        elif hdl == "vhdl":
            toVHDL(func, **kwargs)

        # Analyze HDL
        os.system(analyze_cmd.format(**vals))
        # Elaborate
        if elaborate_cmd:
            os.system(elaborate_cmd.format(**vals))
        # Simulate
        return Cosimulation(simulate_cmd.format(**vals), **kwargs)
开发者ID:nkavaldj,项目名称:myhdl_lib,代码行数:33,代码来源:_DUTer.py


示例4: convert

def convert():
    q = Signal(intbv(0)[1:0])
    d = Signal(intbv(0)[1:0])
    wr, rst = [Signal(bool(0)) for i in range(2)]

    toVerilog(dff, q, d, wr, rst)
    toVHDL(dff, q, d, wr, rst)
开发者ID:mpflaga,项目名称:ReadWriteFlipFlop.myhdl,代码行数:7,代码来源:dff.py


示例5: _generate_controller

def _generate_controller():
    _set_tovhdl_defaults('controller')
    toVHDL(Controller, spec=_SPEC, clk=_CLK, reset=_RESET, 
            rx_fifo_data_read=_RX_FIFO_DOUT, rx_fifo_dequeue=_RX_FIFO_DEQUEUE,
            rx_fifo_empty=_RX_FIFO_EMPTY, tx_fifo_data_write=_TX_FIFO_DIN,
            tx_fifo_enqueue=_TX_FIFO_ENQUEUE, tx_fifo_full=_TX_FIFO_FULL,
            exp_addr=_EXP_ADDR, exp_data_write=_EXP_DIN, exp_data_read=_EXP_DOUT, 
            exp_wen=_EXP_WEN, exp_reset=_EXP_RESET, exp_clk_en=_EXP_CLK_EN, 
            exp_reset_active=_EXP_RESET_ACTIVE)
开发者ID:matthijsbos,项目名称:fpgaedu,代码行数:9,代码来源:generatevhdl.py


示例6: convert

def convert():

    pins = 10
    t = TristateSignal(intbv(1)[pins:])
    dir = Signal(bool(0))
    wr, rst = [Signal(bool(0)) for i in range(2)]

    toVerilog(ReadWriteFlipFlop, t, dir, wr, rst)
    toVHDL(ReadWriteFlipFlop, t, dir, wr, rst)
开发者ID:mpflaga,项目名称:ReadWriteFlipFlop.myhdl,代码行数:9,代码来源:ReadWriteFlipFlop.py


示例7: convert

def convert():
    Clk = myhdl.Signal(bool(0))
#     Reset = myhdl.ResetSignal(0, active=1, async=True)
    Reset = None
    D = myhdl.Signal(myhdl.intbv(0)[WIDTH_D:])
    Q = myhdl.Signal(myhdl.intbv(0)[WIDTH_Q:])

    myhdl.toVHDL(sumbits, Clk, Reset, D, Q)
    myhdl.toVerilog(sumbits, Clk, Reset, D, Q)
开发者ID:josyb,项目名称:recurse,代码行数:9,代码来源:sumbits.py


示例8: convert

def convert(brd, top=None, name=None, use='verilog', path='.'):
    """ Wrapper around the myhdl conversion functions
    This function will use the _fpga objects get_portmap function
    to map the board definition to the 

    Arguments
      top  : top-level myhld module
      brd  : FPGA board definition (_fpga object)
      name : name to use for the generated (converted) file
      use  : User 'verilog' or 'vhdl' for conversion
      path : path of the output files
    """
    assert isinstance(brd, _fpga)

    name = brd.top_name if name is None else name
    pp = brd.get_portmap(top=top)

    # convert with the ports and parameters        
    if use.lower() == 'verilog':
        if name is not None:
            myhdl.toVerilog.name = name
        myhdl.toVerilog(brd.top, **pp)
        brd.name = name
        brd.vfn = "%s.v"%(name)
    elif use.lower() == 'vhdl':
        if name is not None:
            myhdl.toVHDL.name = name
        myhdl.toVHDL(brd.top, **pp)
        brd.name = name
        brd.vfn = "%s.vhd"%(name)
    else:
        raise ValueError("Incorrect conversion target %s"%(use))

    # make sure the working directory exists
    #assert brd.pathexist(brd.path)
    time.sleep(2)

    # copy files etc to the working directory
    tbfn = 'tb_' + brd.vfn
    ver = myhdl.__version__
    # remove special characters from the version
    for sp in ('.', '-', 'dev'):
        ver = ver.replace(sp,'')
    pckfn = 'pck_myhdl_%s.vhd'%(ver)
    for src in (brd.vfn,tbfn,pckfn):
        dst = os.path.join(path, src)
        print('   checking %s'%(dst))
        if os.path.isfile(dst):
            print('   removing %s'%(dst))
            os.remove(dst)
        if os.path.isfile(src):
            print('   moving %s --> %s'%(src, path))
            try:
                shutil.move(src, path)
            except Exception,err:
                print("skipping %s because %s" % (src, err,))
开发者ID:benallard,项目名称:gizflo,代码行数:56,代码来源:_convert.py


示例9: tb_convert

def tb_convert(toplevel, *ports, **params):
    if not os.path.isdir('output/ver/'):
        os.makedirs('output/ver/')
    myhdl.toVerilog.directory = 'output/ver/'
    myhdl.toVerilog(toplevel, *ports, **params)

    if not os.path.isdir('output/vhd/'):
        os.makedirs('output/vhd/')
    myhdl.toVHDL.directory = 'output/vhd/'
    myhdl.toVHDL(toplevel, *ports, **params)
开发者ID:gbin,项目名称:rhea,代码行数:10,代码来源:test_utils.py


示例10: convert

def convert():
    d = Signal(intbv(0)[8:])
    q = Signal(intbv(0)[8:])
    raddr = Signal(intbv(0)[10:])
    waddr = Signal(intbv(0)[10:])
    clk = Signal(bool(0))
    we = Signal(bool(0))
    HeaderRam(d, waddr, raddr, we, clk, q)
    myhdl.toVHDL.numeric_ports = False
    myhdl.toVHDL(HeaderRam, d, waddr, raddr, we, clk, q)
开发者ID:Vikram9866,项目名称:test_jpeg,代码行数:10,代码来源:header_ram.py


示例11: convert

def convert():
   clk = Signal(bool(False))
   reset = ResetSignal(bool(False), bool(True), async=True)
   en = Signal(bool(True))
   F = Signal(intbv(0b0, 0b0, 0b10000))
   D = Signal(intbv(0b0, 0b0, 0b10000))
   Q = Signal(intbv(0b0, 0b0, 0b10000))
   A = Signal(bool(False))
   B = Signal(bool(False))
   A_latch = Signal(bool(False))
   B_latch = Signal(bool(False))
   LED = Signal(intbv(0b0, 0b0, 0b10000))
   toVerilog.timescale = "100ms/1ms"
   toVerilog(elevator, clk, reset, en, F, D, Q, A, B, A_latch, B_latch, LED)
   toVHDL(elevator, clk, reset, en, F, D, Q, A, B, A_latch, B_latch, LED)
开发者ID:gralco,项目名称:FPGA-Elevator-Project,代码行数:15,代码来源:elevator.py


示例12: testBench

def testBench():

    i_in, pc_in, i_out, pc_out = [Signal(intbv(0)[32:]) for i in range(4)]

    clk, rst, stall = [Signal(intbv(0)[1:]) for i in range(3)]

    latch_inst = toVHDL(latch_if_id, clk, rst, i_in, pc_in, i_out, pc_out, stall)

    @instance
    def stimulus():
        for i in range(10):
            i_in.next, pc_in.next = [Signal(intbv(random.randint(0, 255))[32:]) for i in range(2)]

            if random.random() > 0.10:
                clk.next = 1
            if random.random() > 0.75:
                rst.next = 1
            if random.random() > 0.5:
                stall.next = 1

            yield delay(1)
            print "Inputs: %i %i | clk: %i  rst: %i stall:%i | Output: %i %i" % (i_in, pc_in, clk, rst, stall, i_out, pc_out)
            clk.next = 0
            rst.next = 0
            stall.next = 0
            yield delay(1)

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


示例13: testBench

def testBench():

    branch_adder_in, alu_result_in, data2_in, wr_reg_in = [Signal(intbv(random.randint(-255, 255), min=-(2 ** 31), max=2 ** 31 - 1)) for i in range(4)]
    branch_adder_out, alu_result_out, data2_out, wr_reg_out = [Signal(intbv(0, min=-(2 ** 31), max=2 ** 31 - 1)) for i in range(4)]

    zero_in, zero_out = [Signal(intbv(0)[1:]) for i in range(2)]

    Branch_in, MemRead_in, MemWrite_in = [Signal(intbv(0)[1:]) for i in range(3)]
    RegWrite_in, MemtoReg_in = [Signal(intbv(0)[1:]) for i in range(2)]

    Branch_out, MemRead_out, MemWrite_out = [Signal(intbv(0)[1:]) for i in range(3)]
    RegWrite_out, MemtoReg_out = [Signal(intbv(0)[1:]) for i in range(2)]

    clk = Signal(intbv(0)[1:])
    rst = Signal(intbv(0)[1:])

    latch_inst = toVHDL(latch_ex_mem, clk, rst,
                        branch_adder_in,
                        alu_result_in, zero_in,
                        data2_in, wr_reg_in,
                        Branch_in, MemRead_in, MemWrite_in,  # signals to MEM pipeline stage
                        RegWrite_in, MemtoReg_in,  # signals to WB pipeline stage
                        branch_adder_out,
                        alu_result_out, zero_out,
                        data2_out, wr_reg_out,
                        Branch_out, MemRead_out, MemWrite_out,
                        RegWrite_out, MemtoReg_out,
                        )

    @instance
    def stimulus():
        for i in range(5):

            if random.random() > 0.25:
                clk.next = 1
            if random.random() > 0.75:
                rst.next = 1

            branch_adder_in.next, alu_result_in.next, data2_in.next, wr_reg_in.next = [intbv(random.randint(-255, 255)) for i in range(4)]

            Branch_in.next, MemRead_in.next, MemWrite_in.next, zero_in.next = [random.randint(0, 1) for i in range(4)]
            RegWrite_in.next, MemtoReg_in.next = [random.randint(0, 1) for i in range(2)]

            yield delay(1)
            print "-" * 79
            print "%i %i %i %i | %i | %i  %i  %i  %i  %i " % (branch_adder_in, alu_result_in, data2_in, wr_reg_in, zero_in,
                                                              Branch_in, MemRead_in, MemWrite_in,
                                                              RegWrite_in, MemtoReg_in)
            print "clk: %i  rst: %i " % (clk, rst)

            print "%i %i %i %i | %i | %i  %i  %i  %i  %i " % (branch_adder_out, alu_result_out, data2_out, wr_reg_out, zero_out,
                                                              Branch_out, MemRead_out, MemWrite_out,
                                                              RegWrite_out, MemtoReg_out)

            clk.next = 0
            rst.next = 0
            yield delay(1)

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


示例14: testBench

def testBench():

    if not DEBUG:
        datapath_i = toVHDL(datapath)
    else:
        datapath_i = datapath()

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


示例15: Convert

    def Convert(self, W=None):
        """Convert the HDL description to Verilog and VHDL.
        """
        clk = Signal(False)
        ts  = Signal(False)
        x   = Signal(intbv(0,min=-2**(self.W[0]-1), max=2**(self.W[0]-1)))
        y   = Signal(intbv(0,min=-2**(self.W[0]-1), max=2**(self.W[0]-1)))

        if self.isSos:
            print("Convert IIR SOS to Verilog and VHDL")
            toVerilog(siir_sos_hdl, clk, x, y, ts, A=self.fxa, B=self.fxb, W=self.W)
            toVHDL(siir_sos_hdl, clk, x, y, ts, A=self.fxa, B=self.fxb, W=self.W)
        else:
            # Convert to Verilog and VHDL
            print("Convert IIR to Verilog and VHDL")
            toVerilog(siir_hdl, clk, x, y, ts,  A=self.fxa, B=self.fxb, W=self.W)
            toVHDL(siir_hdl, clk, x, y, ts,  A=self.fxa, B=self.fxb, W=self.W) 
开发者ID:honahursey,项目名称:pyFDA,代码行数:17,代码来源:filter_iir.py


示例16: setUp

    def setUp(self):
        self.Rt_ex, self.Rs_id, self.Rt_id = [Signal(intbv(0)[5:]) for i in range(3)]

        self.MemRead_ex, self.Stall = [Signal(intbv(0)[1:]) for i in range(2)]

        self.detector_ = toVHDL(hazard_detector, self.MemRead_ex, self.Rt_ex,
                                self.Rs_id, self.Rt_id,
                                self.Stall
                                )
开发者ID:bigeagle,项目名称:pymips,代码行数:9,代码来源:hazard_detector.py


示例17: setUp

    def setUp(self):
        self.Rd_mem, self.Rs_ex, self.Rt_ex, self.Rd_wb = [ Signal(intbv(0)[5:]) for i in range(4) ] 

        self.RegWrite_mem, self.RegWrite_wb = [ Signal(intbv(0)[1:]) for i in range(2) ] 

        self.ForwardA, self.ForwardB = [ Signal(intbv(0)[2:]) for i in range(2) ] 

        self.forwarding_ = toVHDL(forwarding, self.RegWrite_mem, self.Rd_mem, self.Rs_ex, self.Rt_ex,   #inputs of EX hazards
                    self.RegWrite_wb, self.Rd_wb,   #left inputs of MEM hazards
                    self.ForwardA, self.ForwardB
                    )
开发者ID:enricmcalvo,项目名称:pymips,代码行数:11,代码来源:forwarding.py


示例18: testBench

def testBench(args):
    global DEBUG
    DEBUG = args.debug

    data_mem = load_data_memory(args.data) if args.data else None
    program = args.program

    Clk = Signal(intbv(0)[1:])  # internal clock

    clk_driver = clock_driver(Clk, 1)

    if args.vcd:
        datapath_i = traceSignals(dlx, Clk, program=program, data_mem=data_mem)  # () #toVHDL(datapath)
    elif args.debug:
        datapath_i = dlx(Clk, program=program, data_mem=data_mem)
    elif args.to_vhdl:
        toVHDL(dlx, Clk, program=program, data_mem=data_mem)
    elif args.to_verilog:
        toVerilog(dlx, Clk, program=program, data_mem=data_mem)

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


示例19: convert

def convert():
    clock = Clock(0, frequency=50e6)
    reset = Reset(0, active=0, async=True)
    lcd_on = Signal(bool(0))
    lcd_resetn = Signal(bool(0))
    lcd_csn = Signal(bool(0))
    lcd_rs = Signal(bool(0))
    lcd_wrn = Signal(bool(0))
    lcd_rdn = Signal(bool(0))
    lcd_data = Signal(intbv(0)[16:])

    myhdl.toVerilog.directory = 'output'
    myhdl.toVerilog(mm_lt24lcdsys, clock, reset,
                    lcd_on, lcd_resetn, lcd_csn, lcd_rs,
                    lcd_wrn, lcd_rdn, lcd_data)

    myhdl.toVHDL.directory = 'output'
    myhdl.toVHDL(mm_lt24lcdsys, clock, reset,
                 lcd_on, lcd_resetn, lcd_csn, lcd_rs,
                 lcd_wrn, lcd_rdn, lcd_data)
    tb_move_generated_files()
开发者ID:Godtec,项目名称:rhea,代码行数:21,代码来源:mm_lt24lcdsys.py


示例20: TestBench

def TestBench(CounterTester):
    count = Signal(intbv(0, min = -2**3, max = 2**3))
    clk = Signal(LOW)
    inc_or_dec = Signal(HIGH)
    wrap_around = Signal(LOW)
    rst_n = Signal(HIGH)

    # instanciate modules
    Counter_inst = toVHDL(Counter, count, clk, inc_or_dec, wrap_around, rst_n)
    CounterTester_inst = CounterTester(count, clk, inc_or_dec, wrap_around, rst_n)
    ClkGen_inst = ClkGen(clk)

    return Counter_inst, CounterTester_inst, ClkGen_inst
开发者ID:chandanpalai,项目名称:hailfire-fpga,代码行数:13,代码来源:test_Counter.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python myhdl.toVerilog函数代码示例发布时间:2022-05-27
下一篇:
Python myhdl.now函数代码示例发布时间: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