Skip to content
/ wyre Public

Hardware definition language that compiles to Verilog

License

Notifications You must be signed in to change notification settings

nickmqb/wyre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wyre

An ergonomic hardware definition language that compiles to Verilog.

Features

  • Strongly typed
  • Type inference
  • Inline module instantiations
  • Order independent declarations
  • Minimalistic syntax
  • Newline as statement separator
  • Names before types and compact type notation
  • C-style { block syntax }
  • Compact bit literals
  • match expressions
  • Large data literals (data blocks)
  • Builtin functions for transforming data (e.g. slice, swizzle)
  • Structs
  • Column accurate compile error reporting

Learn more about these features

Example

What does Wyre look like? Here is a basic example design with 2 modules, a clock input, a button and 3 leds.

top(clk $1, button $1) {
	out reg leds $3

	posedge clk {
		if button {
			leds <= '111
		} else {
			leds <= inc(a: leds).o
		}
	}
}

inc(a $3) {
	out o := a + 1
}

Background

A while back I got a Lattice iCE40 FPGA. I've had a lot of fun making designs for it in Verilog and learning more about how computers work at a low level. During the process I kept track of gripes with the toolchain. I ended up with a list of mostly minor things, but nonetheless a list that had a fair amount of items. I felt that there were enough items to justify building some new tooling, and Wyre is the result.

Compared to Verilog, Wyre aims to cut down on verbosity, reduce errors (via strong typing) and improve design iteration speed. Wyre compiles to Verilog, so any design can be fed through an existing Verilog-based toolchain.

Some other hardware definition languages try to abstract away the hardware in some ways, with features like memory inference and various generative constructs. These higher level features are explicit non-goals for Wyre. Instead, Wyre aims to stay close to the hardware.

The Wyre compiler is written in the Muon programming language, of which I am the author and which is my main open source project. Syntactically, Wyre and Muon have a quite a bit in common. So if you like Wyre, be sure to check out Muon too!

Getting started

For a quick summary of features, check out Feature overview (recommended).

For in-depth documentation, have a look at the Language guide.

To learn more about how to install and use the compiler, go to Getting started. Wyre works on Windows and Linux. I haven't tested it on macOS, but it will likely work.

You can also view more examples.

Roadmap

Feedback is welcome! If you have ideas for new features or for improving existing features, let me know by creating an issue.

Twitter

To stay up-to-date on Wyre, consider following me on Twitter.

License

MIT

About

Hardware definition language that compiles to Verilog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published