Skip to content

An HDL based on Swift Macros that turns regular Swift code into Hardware Generators.

License

Notifications You must be signed in to change notification settings

yliu-hashed/shimmers-hdl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift 6.2 Build Status

SHIMMERS HDL Logo

Shimmers (Synthesize Hardware In Modular Macro Expansions and Runtime in Swift) is a functional framework for creating circuits. The principles behind Shimmers are to use functional code in Swift to describe hardware. In other words, you specify what a circuit does, instead of what it looks like. Shimmers allows you to describe the behavior of your circuit using regular Swift structs and functions. Then, Shimmers macros turn them into hardware generators automatically.

For example, the following is a resettable counter:

@HardwareWire
struct Counter {
    var count: UInt8 = 0

    @TopLevel(name: "counter", isSequential: true)
    mutating func clock(reset: Bool) -> UInt8 {
        let lastCount = count
        count = reset ? 0 : count &+ amount
        return lastCount
    }
}

Documentation

Documentations for Shimmers can be accessed on Swift Package Index. Here is the links for the documentation of each of Shimmers components:

Release

Since Shimmers uses Swift Macro through swift-syntax, you should use the Exact version Shimmers supports.

Currently, Shimmers only supports Swift 6.2.X.

To use Shimmers in a SwiftPM project, add shimmers-hdl as a dependency. Specifically, add the following to your Package.swift.

dependencies: [
  .package(url: "https://github.com/yliu-hashed/shimmers-hdl.git", from: "<#latest-shimmers-version#>"),
],

License

Please see LICENSE for more information.

About

An HDL based on Swift Macros that turns regular Swift code into Hardware Generators.

Topics

Resources

License

Stars

Watchers

Forks

Languages