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

CopyCircuit hi-lo changes #1060

Draft
wants to merge 6 commits into
base: word_hi_lo
Choose a base branch
from
Draft

CopyCircuit hi-lo changes #1060

wants to merge 6 commits into from

Conversation

lightsing
Copy link
Member

@lightsing lightsing commented Dec 11, 2023

Layout Changes

CopyCircuitConfig

Dream's design: https://hackmd.io/geYBzdKjRdmO948KCGnh-Q?view

Changes

  • is_front_mask: Advice => [LtChip; 16], LtGadget compares address < addr_copy_start.
    is_front_mask implies a byte cell has address < addr_copy_start, which means it's a masked byte and won't be accumlated in the rlc value.

Adds

  • value_limbs: [Advice; 16], holds the half word bytes value.
  • is_not_back_mask: [LtChip; 16], LtGadget compare address < addr_copy_end.
    This strange naming is for disambiguation, since result needs to be opposite.
    !is_not_back_mask implies a byte cell has address >= address_copy_end, which means it's a masked byte and won't be accumlated in the rlc value.
  • is_inbound_read: [LtChip; 16], compare src_addr_end > address.
    The addr_copy_end might be larger than src_addr_end.
    !is_inbound_read implies a byte cell has address >= src_addr_end, which means it's a out-of-bound read, it's value should be 0.

Removes

  • value: replaced by value_limbs
  • value_prev: no longer used
  • word_index: no longer used
  • mask: replaced by is_front_mask || !is_not_back_mask
  • is_pad: replaced by !is_inbound_read
  • is_src_end: replaced by is_inbound_read
  • is_word_end: no longer used

CopyTable

Adds

  • addr_copy_start: The start of the src/dest address for the copy event. Might not aligned by 32 bytes, indicating masked bytes.
  • addr_copy_end: The end of the src/dest address for the copy event. Might not aligned by 32 bytes, indicating masked bytes.

Changes

  • address: holds current half-word address, always aligned and increase by 16

Constraint Changes

CopyCircuitConfig

  • value_acc == value_acc' + sum(value_i * !(is_front_mask || !is_not_back_mask))
  • !is_inbound_read implies value == 0

@lightsing lightsing changed the base branch from develop to feat/hi-lo January 9, 2024 03:11
@lightsing lightsing changed the base branch from feat/hi-lo to word_hi_lo January 9, 2024 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant