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

ASM: Move latch and operation_id from machine declaration #1251

Closed
leonardoalt opened this issue Apr 4, 2024 · 3 comments
Closed

ASM: Move latch and operation_id from machine declaration #1251

leonardoalt opened this issue Apr 4, 2024 · 3 comments
Assignees
Labels

Comments

@leonardoalt
Copy link
Member

Currently a block machine is written like this:

machine Binary(latch, operation_id) {
    ...
    col witness operation_id;
    col fixed latch(i) { if (i % 4) == 3 { 1 } else { 0 } };
    ...
}

The idea is to remove them from the machine declaration and be an attribute, for example:

machine Binary {
    ...
    #[operation_id]
    col witness operation_id;
    
    #[latch]
    col fixed latch(i) { if (i % 4) == 3 { 1 } else { 0 } };

    ...
}

The reason for that is that we want to be able to pass shared machines to submachines, which would fit better a syntax that occupies that space:

machine Binary(mem: Memory) {
    ...
}
@chriseth
Copy link
Member

chriseth commented Apr 4, 2024

I think adding a annotation mechanism could complicate the whole thing, and while the header might not be an ideal place to put the latch and op id, I could imagine something like the following, just because it is much easier to implement right now:

machine Binary(arg1: int, arg2: MachineSomething) with latch: latch, operation_id: operation_id {
  ...
}

@Schaeff
Copy link
Collaborator

Schaeff commented Apr 12, 2024

This is fine but in the interest of eventually reducing the number of concepts:

What if we could use a special stdlib/corelib function as a marker?

col witness operation_id;
std::link::operation_id(operation_id);

And later deriving that with #[derive(operation_id)]

github-merge-queue bot pushed a commit that referenced this issue Apr 25, 2024
This implements issue #1251.
Basically `machine Foo(a,b) { ... }` is now `machine Foo with latch: a,
operation_id: b { ... }`
@chriseth
Copy link
Member

Can this be closed, @pacheco ?

@pacheco pacheco closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants