Git Product home page Git Product logo

uhdl's Introduction

UHDL: Python Hardware Description for Humans.

Travis Docs PyPI

UHDL is a BSD Licensed library which simplifies the process of designing digital hardware with MyHDL.

UHDL provides utilities to simplify constructing myhdl objects, A uniform simulation API, and more.

To compile the cosimulation vpis, simply:

    $ uhdl vpi init

Usage Example:

    from myhdl import always_seq, instance, StopSimulation
    from uhdl import Clock, Reset, Sig, randbits, HW, run

    def inc(clk, rst, en, count):
        @always_seq(clk.posedge, rst)
        def logic():
            if en:
                count.next = count + 1
        return logic

    #Simulation(test_inc()).run()
    @run
    def test_inc(backend):
        clk = Clock()
        rst = Reset(async=False)
        en = Sig(False)
        count = Sig(8) #Signal(intbv()[8:])
        top = HW(inc, clk, rst, en, count)
        dut = top.sim(backend=backend)

        @instance
        def stim():
            for i in range(20):
                en.next = randbits(1)
            raise StopSimulation

        @instance
        def mon():
            while True:
                yield clk.posedge
                yield delay(1)
                print rst, en, count

        #If the function was not decorated with @run, 
        #run(clk.gen(), rst.pulse(), dut, stim, mon) would do the trick.
        return clk.gen(), rst.pulse(5), dut, stim, mon

    #run with myhdl
    test_inc()
    #run with icarus
    test_inc('icarus')
    #run with modelsim
    test_inc('modelsim')

Features

  • Helper functions to simplify the common cases of Signal creation.
  • Consistent simulation and conversion API with sane default arguments.
  • Automatic HDL Simulator detection and VPI Compilation(icarus/modelsim).

Installation

To install UHDL, simply:

    $ mkvirtualenv uhdl
    $ pip install uhdl

Documentation

Documentation is avaliable at http://uhdl.readthedocs.org/en/latest/api.html

uhdl's People

Contributors

jck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rowhit

uhdl's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.