Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 3 additions and 8 deletions.
  1. +3 −8 migen/fhdl/structure.py
View
11 migen/fhdl/structure.py
@@ -19,9 +19,6 @@ def __str__(self):
return r
class Value:
- def __init__(self, bv):
- self.bv = bv
-
def __add__(self, other):
return Operator("+", [self, other])
def __radd__(self, other):
@@ -75,6 +72,8 @@ def __getitem__(self, key):
elif isinstance(key, slice):
start = key.start or 0
stop = key.stop or self.bv.width
+ if stop > self.bv.width:
+ stop = self.bv.width
if key.step != None:
raise KeyError
return Slice(self, start, stop)
@@ -98,10 +97,7 @@ def __init__(self, *args):
class Constant(Value):
def __init__(self, n, bv=None):
- if bv == None:
- Value.__init__(self, BV(BitsFor(n)))
- else:
- Value.__init__(self, bv)
+ self.bv = bv or BV(BitsFor(n))
self.n = n
def _cst(x):
@@ -112,7 +108,6 @@ def _cst(x):
class Signal(Value):
def __init__(self, bv=BV(), name="anonymous", variable=False, reset=0):
- Value.__init__(self, bv)
self.bv = bv
self.variable = variable
self.name = name

No commit comments for this range

Something went wrong with that request. Please try again.