GithubHelp home page GithubHelp logo

donn / swiftlog Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 30 KB

An IcarusVerilog VPI bridge for the Swift Programming Language.

License: GNU General Public License v2.0

Swift 85.74% C 8.10% Verilog 6.16%
verilog swift pli vpi

swiftlog's Introduction

Swiftlog

Swiftlog is a Swift bridge for IcarusVerilog's VPI (PLI 2.0).

A Swiftier API is in the works, but ~all~ of your logic can be written in Swift!

Usage

Make a folder with your VPI module's name. Copy all verilog modules inside, and make sure all includes use that folder as root (i.e. `include "Mux.v", not `include "SwiftlogExample/Mux.v").

Create a file called Startup.swift, and use this template:

///@SWIFTLOG: <Verilog File To Simulate Here>
import Swiftlog
import VPIAssistant

@_cdecl("swiftlog_startup")
func startup() {
    //Initialize here...
}

Then set up your procedures where it says initialize here.

An example has been provided, to run it, just write ./simulate SwiftlogExample. If all goes well, you should see.

    Hello from Verilog!
    ...and Hello from Swift!
    Result: 999

Your clock should be coming from Verilog, and you should provide update functions as such.

Requirements

You need Swift 5.0, which you can get from Swift.org, and add it to the PATH. On macOS, that means Xcode and the Xcode commandline tools must be active.

macOS

As a result of the changes to Swift library locations, only macOS 10.15 Catalina is supported. (Sorry.)

You need the latest version of Xcode and IcarusVerilog headers installed to /usr/local/lib. To do that, we just recommend using the Homebrew package manager.

    brew install icarus-verilog

Ubuntu

Other than Swift, you'll just need Clang and IcarusVerilog.

    sudo apt install clang iverilog

License

GNU General Public License v2 or (at your option), any later version. Check 'LICENSE'.

*Please note that this licensing option was not my choice- it's simply because IcarusVerilog (and every free and open source Verilog simulator, for that matter) is under either GPLv2 or GPLv3 and Swiftlog links against them.

References

[1] S. Sutherland. The Verilog PLI Handbook: A User's Guide and Comprehensive Reference on the Verilog Programming Language Interface (2nd ed.) 2002666.

swiftlog's People

Contributors

skyus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.