Skip to content

feat: replace wcp with assembly implementation #651

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DavePearce
Copy link
Collaborator

@DavePearce DavePearce commented May 21, 2025

This replaces the WCP module with an assembly implementation. The assembly implementation implements identical functionality, but in a rather more compact form.

NOTE: should not be merged until corresponding linea-tracer PR is ready, and updated release of go-corset is available.

@DavePearce DavePearce linked an issue May 21, 2025 that may be closed by this pull request
@DavePearce DavePearce force-pushed the 650-feat-replace-wcp-modules-with-assembly-implementation branch 6 times, most recently from 9474e22 to 2034915 Compare May 21, 2025 03:03
@DavePearce DavePearce marked this pull request as draft May 21, 2025 03:11
@DavePearce DavePearce force-pushed the 650-feat-replace-wcp-modules-with-assembly-implementation branch from 2034915 to 772df62 Compare May 21, 2025 03:22
if ARGUMENT_1==ARGUMENT_2 goto exit_1
goto exit_0
isz:
if ARGUMENT_1==0 goto exit_1
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if ARGUMENT_1 is not zero ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Then we fall through to exit_0 and we have RESULT=0. An interesting question here is whether we should do anything with ARGUMENT_2. In fact, in the current wcp implementation the ISZERO instruction is handled simply as an equality ARGUMENT_1 == ARGUMENT_2 under the assumption that ARGUMENT_2==0 whenever wcp(ISZERO,...) is called.

if borrow!=0 goto exit_1
goto exit_0
slt:
arg1sign,arg1bits = ARGUMENT_1
Copy link
Contributor

Choose a reason for hiding this comment

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

Assembly just knows how to split due to the types ? That's nice

Copy link
Collaborator Author

@DavePearce DavePearce May 22, 2025

Choose a reason for hiding this comment

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

Yes, that's the field agnosticity part. It uses the stuff from my report to make it work, adding carry lines and so forth.

Sorry, I misunderstood what you were saying. Yes, it can rely on the width of a register as the type of all registers is proven. Therefore, yeah, it can figure out how to split ARGUMENT_1 here based on the widths. In fact, if you provide an incorrect width for the left-hand side then it will complain. Also, it reads with the most significant bits on the left. So, in the above, arg1sign gets bit 31 of ARGUMENT_1 and arg1bits gets bits 30 .. 0.

This replaces the WCP module with an assembly implementation.  The
assembly implementation implements identical functionality, but in a
rather more compact form.
@DavePearce DavePearce force-pushed the 650-feat-replace-wcp-modules-with-assembly-implementation branch from 772df62 to f6d3ce7 Compare May 21, 2025 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: replace WCP modules with assembly implementation
2 participants