Skip to content

Commit

Permalink
adds encoded block value variable
Browse files Browse the repository at this point in the history
  • Loading branch information
huettenhain committed Dec 10, 2024
1 parent c5cc68b commit af0ff60
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions refinery/units/blockwise/alu.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class alu(ArithmeticUnit):
- the variable `A`: same as `V[0]`
- the variable `B`: current block
- the variable `E`: block value of encoded input (not changed after update)
- the variable `N`: number of bytes in the input
- the variable `K`: current index in the input
- the variable `S`: the internal state value
Expand Down Expand Up @@ -116,7 +117,7 @@ def process(self, data):
self._index.init(self.fmask)

def _expression(definition: str):
return PythonExpression(definition, *'IBASMNVRLX', all_variables_allowed=True, mask=fmask)
return PythonExpression(definition, *'IBEASMNVRLX', all_variables_allowed=True, mask=fmask)

prologue = _expression(self.args.prologue).expression
epilogue = _expression(self.args.epilogue).expression
Expand Down Expand Up @@ -157,7 +158,7 @@ def mask_to_bits(x, b):
)

def operate(block, index, *args):
context.update(K=index, B=block, V=args)
context.update(K=index, B=block, E=block, V=args)
if args:
context['A'] = args[0]
context['S'] = eval(prologue, None, context)
Expand Down

0 comments on commit af0ff60

Please sign in to comment.