-
Notifications
You must be signed in to change notification settings - Fork 598
fix(avm): alu interface #13115
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
fix(avm): alu interface #13115
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,12 +14,16 @@ enum class AluOperation { | |
|
|
||
| struct AluEvent { | ||
| AluOperation operation; | ||
| MemoryAddress a_addr; | ||
| MemoryAddress b_addr; | ||
| MemoryAddress dst_addr; | ||
| MemoryValue a; | ||
| MemoryValue b; | ||
| MemoryValue res; | ||
| MemoryValue c; | ||
| // Only need single tag info here (check this for MOV or CAST ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tag checking in the caller will be fun |
||
| // For operations that have a specific output tag (e.g., EQ/LT), the output tag is unambiguous | ||
| // We still might prefer to include tags per operands to simply tracegen... | ||
| MemoryTag tag; | ||
| // To be used with deduplicating event emitters. | ||
| using Key = std::tuple<AluOperation, MemoryValue, MemoryValue, MemoryValue, MemoryTag>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it works, these should be all |
||
| Key get_key() const { return { operation, a, b, c, tag }; } | ||
| }; | ||
IlyasRidhuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| } // namespace bb::avm2::simulation | ||
| } // namespace bb::avm2::simulation | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,11 @@ namespace bb::avm2::simulation { | |
|
|
||
| void Execution::add(ContextInterface& context, MemoryAddress a_addr, MemoryAddress b_addr, MemoryAddress dst_addr) | ||
| { | ||
| alu.add(context, a_addr, b_addr, dst_addr); | ||
| auto& memory = context.get_memory(); | ||
| ValueRefAndTag a = memory.get(a_addr); | ||
| ValueRefAndTag b = memory.get(b_addr); | ||
|
Comment on lines
+18
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So leaving ia ib ic for later I guess :) |
||
| FF c = alu.add(a, b); | ||
| memory.set(dst_addr, c, a.tag); | ||
| } | ||
|
|
||
| // TODO: My dispatch system makes me have a uint8_t tag. Rethink. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ namespace bb::avm2::simulation { | |
| struct ValueRefAndTag { | ||
| const MemoryValue& value; | ||
| MemoryTag tag; | ||
|
|
||
| bool operator==(const ValueRefAndTag& other) const { return value == other.value && tag == other.tag; } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't the default work?
|
||
| }; | ||
|
|
||
| using SliceWithTags = std::pair<std::vector<MemoryValue>, std::vector<MemoryTag>>; | ||
|
|
@@ -54,4 +56,4 @@ class Memory : public MemoryInterface { | |
| EventEmitterInterface<MemoryEvent>& events; | ||
| }; | ||
|
|
||
| } // namespace bb::avm2::simulation | ||
| } // namespace bb::avm2::simulation | ||
Uh oh!
There was an error while loading. Please reload this page.