hdl.ast: rename Slice.end back to Slice.stop.

It used to be called .stop in oMigen, and it's also called .stop in
Python range and slice objects, so keep that.
This commit is contained in:
whitequark 2019-10-12 22:40:30 +00:00
parent 77118fb9c9
commit a7e3b80409
6 changed files with 37 additions and 38 deletions

View file

@ -186,7 +186,7 @@ class _RHSValueCompiler(_ValueCompiler):
shape = value.shape()
arg = self(value.value)
shift = value.start
mask = (1 << (value.end - value.start)) - 1
mask = (1 << (value.stop - value.start)) - 1
return lambda state: normalize((arg(state) >> shift) & mask, shape)
def on_Part(self, value):
@ -265,7 +265,7 @@ class _LHSValueCompiler(_ValueCompiler):
lhs_r = self.rhs_compiler(value.value)
lhs_l = self(value.value)
shift = value.start
mask = (1 << (value.end - value.start)) - 1
mask = (1 << (value.stop - value.start)) - 1
def eval(state, rhs):
lhs_value = lhs_r(state)
lhs_value &= ~(mask << shift)

View file

@ -354,16 +354,16 @@ class _ValueCompiler(xfrm.ValueVisitor):
raise NotImplementedError # :nocov:
def on_Slice(self, value):
if value.start == 0 and value.end == len(value.value):
if value.start == 0 and value.stop == len(value.value):
return self(value.value)
sigspec = self._prepare_value_for_Slice(value.value)
if value.start == value.end:
if value.start == value.stop:
return "{}"
elif value.start + 1 == value.end:
elif value.start + 1 == value.stop:
return "{} [{}]".format(sigspec, value.start)
else:
return "{} [{}:{}]".format(sigspec, value.end - 1, value.start)
return "{} [{}:{}]".format(sigspec, value.stop - 1, value.start)
def on_ArrayProxy(self, value):
index = self.s.expand(value.index)