back.pysim: implement Part.

This commit is contained in:
whitequark 2018-12-15 20:58:06 +00:00
parent 1adf58f561
commit 20a04bca88
3 changed files with 12 additions and 2 deletions

View file

@ -118,7 +118,11 @@ class _RHSValueCompiler(ValueTransformer):
return lambda state: normalize((arg(state) >> shift) & mask, shape)
def on_Part(self, value):
raise NotImplementedError
shape = value.shape()
arg = self(value.value)
shift = self(value.offset)
mask = (1 << value.width) - 1
return lambda state: normalize((arg(state) >> shift(state)) & mask, shape)
def on_Cat(self, value):
shape = value.shape()