The previous behavior was semantically incorrect.
def get_input(self, pin, port, extras):
self._check_feature("single-ended input", pin, extras,
- valid_xdrs=(1,), valid_extras=None)
+ valid_xdrs=(0,), valid_extras=None)
m = Module()
m.d.comb += pin.i.eq(port)
def get_output(self, pin, port, extras):
self._check_feature("single-ended output", pin, extras,
- valid_xdrs=(1,), valid_extras=None)
+ valid_xdrs=(0,), valid_extras=None)
m = Module()
m.d.comb += port.eq(pin.o)
def get_tristate(self, pin, port, extras):
self._check_feature("single-ended tristate", pin, extras,
- valid_xdrs=(1,), valid_extras=None)
+ valid_xdrs=(0,), valid_extras=None)
m = Module()
m.submodules += Instance("$tribuf",
if dir is None:
dir = subsignal.io[0].dir
if xdr is None:
- xdr = 1
+ xdr = 0
if dir not in ("i", "o", "io", "-"):
raise TypeError("Direction must be one of \"i\", \"o\", \"io\", or \"-\", "
"not {!r}"
"direction can be changed from \"io\" to \"i\", from \"io\""
"to \"o\", or from anything to \"-\""
.format(subsignal.io[0], subsignal.io[0].dir, dir))
- if not isinstance(xdr, int) or xdr < 1:
- raise ValueError("Data rate of {!r} must be a positive integer, not {!r}"
+ if not isinstance(xdr, int) or xdr < 0:
+ raise ValueError("Data rate of {!r} must be a non-negative integer, not {!r}"
.format(subsignal.io[0], xdr))
return dir, xdr
def test_wrong_request_with_wrong_xdr(self):
with self.assertRaises(ValueError,
- msg="Data rate of (pins o A0) must be a positive integer, not 0"):
- user_led = self.cm.request("user_led", 0, xdr=0)
+ msg="Data rate of (pins o A0) must be a non-negative integer, not -1"):
+ user_led = self.cm.request("user_led", 0, xdr=-1)
def test_wrong_request_with_xdr_dict(self):
with self.assertRaises(TypeError,
return m
def get_input(self, pin, port, extras):
+ self._check_feature("single-ended input", pin, extras,
+ valid_xdrs=(0,), valid_extras=True)
return self._get_io_buffer(port, extras, lambda bit: [
# PIN_NO_OUTPUT|PIN_INPUT
("p", "PIN_TYPE", 0b0000_01),
])
def get_output(self, pin, port, extras):
+ self._check_feature("single-ended output", pin, extras,
+ valid_xdrs=(0,), valid_extras=True)
return self._get_io_buffer(port, extras, lambda bit: [
# PIN_OUTPUT|PIN_INPUT_REGISTERED
("p", "PIN_TYPE", 0b0110_00),
])
def get_tristate(self, pin, port, extras):
+ self._check_feature("single-ended tristate", pin, extras,
+ valid_xdrs=(0,), valid_extras=True)
return self._get_io_buffer(port, extras, lambda bit: [
# PIN_OUTPUT_TRISTATE|PIN_INPUT_REGISTERED
("p", "PIN_TYPE", 0b1010_00),