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

reconnect MMIO constraints #1388

Open
wants to merge 33 commits into
base: arith-dev
Choose a base branch
from

Conversation

letypequividelespoubelles
Copy link
Collaborator

@letypequividelespoubelles letypequividelespoubelles commented Oct 8, 2024

Partial debugging of reconnecting the MMIO constraints (inner + all lookup touching the MMIO)

Signed-off-by: Francois Bojarski <[email protected]>
@letypequividelespoubelles letypequividelespoubelles linked an issue Oct 8, 2024 that may be closed by this pull request
@letypequividelespoubelles letypequividelespoubelles marked this pull request as ready for review October 10, 2024 13:09
final int sizeToExtract = mmioInst.size() == 0 ? LLARGE : mmioInst.size();
final Bytes16 exoLimb = readBytes(mmuData.exoBytes(), offset, sizeToExtract);
mmioInst.limb(exoLimb);
for (MmuToMmioInstruction mmioInst : mmuData.mmuToMmioInstructions()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a fix

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if the exoBytes is the source, We were extracting the (exo)limb from the SBO which is totally wrong. The exo limb is 16 bytes starting at 16 * SLO? And from this exo limb, we extract from SBO to extract the data. But We weren't reading the right exo(limb) as we were taking 16 bytes from 16*SLO + SBO for the exo bytes

@@ -263,7 +263,9 @@ public MmuData setMicroInstructions(MmuData mmuData) {
middleMicroInstruction(mmuData, sourceLimbOffset, targetLimbOffset);
}

lastMicroInstruction(mmuData);
if (initialTotalNonTrivial > 1) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a fix

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if the nb of non trivial mmio inst is 1, we just have a only mmio inst. We have a last mmio inst only if we have 2 or more non trivial inst. Before the fix, when we had only one non trivial mmio inst, we were writting one only mmio inst and then one last mmio inst.

import org.apache.tuweni.bytes.Bytes;

public class Bytecodes {

public static Bytes16 readBytes(final Bytes data, final long offset, final int sizeToRead) {
if (offset >= data.size()) {
public static Bytes16 readBytes(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a fix

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we weren't doing the left padding before (this comes from the veridise audit, where we didn't use the SBO for one of the mmio inst). I made a mistake last time when I implemented it (and didn't see it because the MMIO constraint weren't plugged)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just update to the latest master. MMIO constraints are still not plugged

Copy link
Collaborator

@OlivierBBB OlivierBBB left a comment

Choose a reason for hiding this comment

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

I still have to understand the changes labeled with ⭐, could you please give a short description of the intended effect ?

import org.apache.tuweni.bytes.Bytes;

public class Bytecodes {

public static Bytes16 readBytes(final Bytes data, final long offset, final int sizeToRead) {
if (offset >= data.size()) {
public static Bytes16 readBytes(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -263,7 +263,9 @@ public MmuData setMicroInstructions(MmuData mmuData) {
middleMicroInstruction(mmuData, sourceLimbOffset, targetLimbOffset);
}

lastMicroInstruction(mmuData);
if (initialTotalNonTrivial > 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

final int sizeToExtract = mmioInst.size() == 0 ? LLARGE : mmioInst.size();
final Bytes16 exoLimb = readBytes(mmuData.exoBytes(), offset, sizeToExtract);
mmioInst.limb(exoLimb);
for (MmuToMmioInstruction mmioInst : mmuData.mmuToMmioInstructions()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Signed-off-by: Francois Bojarski <[email protected]>
Signed-off-by: Francois Bojarski <[email protected]>
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.

Re-connect RAM (MMU/MMIO)
2 participants