bring back analog_pads specifier, remove reset conditions on VP

For the "P" side of the analog channels, actually, connecting
a digital line to them has "no meaning". The docs say that
either you connect an analog pin to a pad, or vivado "ties it off
appropriately". I wish it were the case that tying a pin to 0 or 1
would actually connect it to a power or ground, because it means
that even in unipolar mode you have to burn two pins to break out
the signal of interest *and* the ground reference analog pad
(I thought I could just connect it to "0" and the pin would be
grounded, but that doesn't happen -- it's just ignored if it's
not wired to a pad).

For the pad specifier, is it OK to leave it with an optional
argument of analog_pads=None? I tried assigning to the
self.analog property after instantiation, but this doesn't
seem to work, the default values are preferred. It looks like
if you don't want to do the analog_pads= optional argument
the other way to do it would be to add code on the instiating
module that tampers with the properties of the instance directly,
but I think that's sort of ugly.

Also, I noticed you stripped out the layout specifier for
the analog_pads. I thought it would be nice to provide that
in the file, so the caller doesn't have to infer what the
pad layout is by reading the code...what's the motivation for
removing that?
This commit is contained in:
bunnie 2020-01-06 21:47:58 +08:00
parent 4dc0a61428
commit 87d456cae2
1 changed files with 5 additions and 4 deletions

View File

@ -10,7 +10,7 @@ from litex.soc.interconnect.csr import *
# XADC ---------------------------------------------------------------------------------------------
class XADC(Module, AutoCSR):
def __init__(self):
def __init__(self, analog_pads=None):
# Temperature(°C) = adc_value*503.975/4096 - 273.15
self.temperature = CSRStatus(12)
@ -28,9 +28,10 @@ class XADC(Module, AutoCSR):
self.ot = Signal()
# Analog
self.analog = Record([("vauxp", 16), ("vauxn", 16), ("vp", 1), ("vn", 1)])
self.analog.vauxp.reset = 1
self.analog.vp.reset = 1
if analog_pads == None:
self.analog = Record([("vauxp", 16), ("vauxn", 16), ("vp", 1), ("vn", 1)])
else:
self.analog = analog_pads
# # #