Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PyCDE][Handshake] Add bindings for Handshake functions #7849

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

teqdruid
Copy link
Contributor

@teqdruid teqdruid commented Nov 19, 2024

Exposes the Handshake dialect's FuncOp in the same style as an HWModuleOp:

class TestFunc(Func):
  a = Input(Bits(8))
  x = Output(Bits(8))

  @generator
  def build(ports):
    ports.x = ports.a & Bits(8)(0xF)

And instantiates them via ESI channels:

class Top(Module):
  clk = Clock()
  rst = Input(Bits(1))

  a = Input(Channel(Bits(8)))
  x = Output(Channel(Bits(8)))

  @generator
  def build(ports):
    test = TestFunc(clk=ports.clk, rst=ports.rst, a=ports.a)
    ports.x = test.x

@teqdruid teqdruid added Handshake PyCDE Python CIRCT Design Entry API labels Nov 19, 2024
@teqdruid teqdruid force-pushed the teqdruid/pycde/handshake branch 2 times, most recently from 358b677 to 8720c4a Compare November 19, 2024 23:33
Base automatically changed from teqdruid/handshake-python to main November 21, 2024 19:32
@teqdruid teqdruid marked this pull request as ready for review November 27, 2024 03:50
@teqdruid
Copy link
Contributor Author

@mikeurbach You might be interested in this.

@mikeurbach
Copy link
Contributor

Very cool!

Copy link
Contributor

@mortbopet mortbopet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo "locking things down" and only allowing comb and handshake operations inside the Func (... for now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Handshake PyCDE Python CIRCT Design Entry API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants