Skip to content

Commit

Permalink
fix(mmio): use TBO for ramToLimb inst
Browse files Browse the repository at this point in the history
Signed-off-by: Francois Bojarski <[email protected]>
  • Loading branch information
letypequividelespoubelles committed Sep 20, 2024
1 parent 29d44b3 commit 6b347e7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,16 @@ public void onePartialToTwo(
}

public void oneToOnePadded(
final Bytes16 sourceBytes, final short sourceOffsetTrigger, final short size) {
final Bytes16 sourceBytes,
final short sourceOffsetTrigger,
final short targetByteOffsetTrigger,
final short size) {

for (short ct = 0; ct < LLARGE; ct++) {

bit1.add(ct, plateau(sourceOffsetTrigger, ct));
bit2.add(ct, plateau(sourceOffsetTrigger + size, ct));
bit3.add(ct, plateau(size, ct));
bit3.add(ct, plateau(targetByteOffsetTrigger + size, ct));
}
acc1 = isolateChunk(sourceBytes, bit1, bit2);
pow2561 = power(bit3);
Expand All @@ -241,13 +244,14 @@ public void twoToOnePadded(
final Bytes16 sourceBytes1,
final Bytes16 sourceBytes2,
final short sourceOffsetTrigger,
final short targetOffsetTrigger,
final short size) {

for (short ct = 0; ct < LLARGE; ct++) {
bit1.add(ct, plateau(sourceOffsetTrigger, ct));
bit2.add(ct, plateau(sourceOffsetTrigger + size - LLARGE, ct));
bit3.add(ct, plateau(LLARGE - sourceOffsetTrigger, ct));
bit4.add(ct, plateau(size, ct));
bit3.add(ct, plateau(targetOffsetTrigger + LLARGE - sourceOffsetTrigger, ct));
bit4.add(ct, plateau(targetOffsetTrigger + size, ct));
}
acc1 = isolateSuffix(sourceBytes1, bit1);
acc2 = isolatePrefix(sourceBytes2, bit2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,6 @@ public static Bytes16 onePartialToTwoOutputTwo(
LLARGE - numberOfBytesFromSourceToSecondTarget)));
}

public static Bytes16 oneToOnePadded(
final Bytes16 source, final short sourceByteoffset, final short size) {
return Bytes16.leftPad(source.slice(sourceByteoffset, size));
}

public static Bytes16 twoToOnePadded(
final Bytes16 source1,
final Bytes16 source2,
final short sourceByteOffset,
final short size) {
final short numberOfBytesFromFirstSource = (short) (LLARGE - sourceByteOffset);

return Bytes16.leftPad(
Bytes.concatenate(
source1.slice(sourceByteOffset, numberOfBytesFromFirstSource),
source2.slice(0, size - numberOfBytesFromFirstSource)));
}

public static Bytes16 twoPartialToOne(
final Bytes16 source1,
final Bytes16 source2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public MmioData execute() {
mmioData.valBNew(Bytes16.ZERO);
mmioData.valCNew(Bytes16.ZERO);

mmioData.oneToOnePadded(mmioData.valA(), mmioData.sourceByteOffset(), mmioData.size());
mmioData.oneToOnePadded(
mmioData.valA(), mmioData.sourceByteOffset(), mmioData.targetByteOffset(), mmioData.size());
return mmioData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public MmioData execute() {
mmioData.valCNew(Bytes16.ZERO);

mmioData.twoToOnePadded(
mmioData.valA(), mmioData.valB(), mmioData.sourceByteOffset(), mmioData.size());
mmioData.valA(),
mmioData.valB(),
mmioData.sourceByteOffset(),
mmioData.targetByteOffset(),
mmioData.size());
return mmioData;
}
}
2 changes: 1 addition & 1 deletion linea-constraints

0 comments on commit 6b347e7

Please sign in to comment.