-
Notifications
You must be signed in to change notification settings - Fork 9
Feat/signextend in asm #1253
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
Merged
Merged
Feat/signextend in asm #1253
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aa9d266
feat: logic when msb is zero
amkCha 608ddb3
feat: first_non_null_byte util and first version of signextend with m…
amkCha 1aa2c28
feat: signextend debugged, added to bin, 1000 traces in bin passing
amkCha 862fe62
clean: signextend traces
amkCha a901720
feat: add description to signextend
amkCha fa0c278
feat: rename to first_nonzero_byte and add one trace
amkCha 55c808a
feat: add 250 traces on signextend
amkCha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"first_nonzero_byte": { "word": [255], "res": [31] }} | ||
{"first_nonzero_byte": { "word": [65535], "res": [30] }} | ||
{"first_nonzero_byte": { "word": [4294967295], "res": [28] }} | ||
{"first_nonzero_byte": { "word": [18446744073709551615], "res": [24] }} | ||
{"first_nonzero_byte": { "word": [340282366920938352553754334751646382491], "res": [16] }} | ||
{"first_nonzero_byte": { "word": [115792089237316195423570985008687907853269984665640564039457584007913129639935], "res": [0] }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
;; Find the index of the first non null byte | ||
|
||
fn first_nonzero_byte(word=0 u256) -> (res=31 u5) { | ||
var word_hi, word_lo u128 | ||
var tmp_res u4 | ||
word_hi, word_lo = word | ||
if word_hi != 0 goto high_lab | ||
tmp_res = first_nonzero_byte128(word_lo) | ||
res = 16 + tmp_res | ||
return | ||
high_lab: | ||
res = first_nonzero_byte128(word_hi) | ||
return | ||
} | ||
|
||
fn first_nonzero_byte128(word=0 u128) -> (res=15 u4) { | ||
var word_hi, word_lo u64 | ||
var tmp_res u3 | ||
word_hi, word_lo = word | ||
if word_hi != 0 goto high_lab | ||
tmp_res = first_nonzero_byte64(word_lo) | ||
res = 8 + tmp_res | ||
return | ||
high_lab: | ||
res = first_nonzero_byte64(word_hi) | ||
return | ||
} | ||
|
||
fn first_nonzero_byte64(word=0 u64) -> (res=7 u3) { | ||
var word_hi, word_lo u32 | ||
var tmp_res u2 | ||
word_hi, word_lo = word | ||
if word_hi != 0 goto high_lab | ||
tmp_res = first_nonzero_byte32(word_lo) | ||
res = 4 + tmp_res | ||
return | ||
high_lab: | ||
res = first_nonzero_byte32(word_hi) | ||
return | ||
} | ||
|
||
fn first_nonzero_byte32(word=0 u32) -> (res=3 u2) { | ||
var word_hi, word_lo u16 | ||
var tmp_res u1 | ||
word_hi, word_lo = word | ||
if word_hi != 0 goto high_lab | ||
tmp_res = first_nonzero_byte16(word_lo) | ||
res = 2 + tmp_res | ||
return | ||
high_lab: | ||
res = first_nonzero_byte16(word_hi) | ||
return | ||
} | ||
|
||
fn first_nonzero_byte16(word=0 u16) -> (res=1 u1) { | ||
var word_hi, word_lo u8 | ||
word_hi, word_lo = word | ||
if word_hi != 0 goto high_lab | ||
res = 1 | ||
return | ||
high_lab: | ||
res = 0 | ||
return | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.