From: bunnie Date: Mon, 6 Jan 2020 13:47:58 +0000 (+0800) Subject: bring back analog_pads specifier, remove reset conditions on VP X-Git-Tag: 24jan2021_ls180~772^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87d456cae2e1b0abac82d8a88f325e93aa7c3da6;p=litex.git 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? --- diff --git a/litex/soc/cores/xadc.py b/litex/soc/cores/xadc.py index 551738ac..49977e3f 100644 --- a/litex/soc/cores/xadc.py +++ b/litex/soc/cores/xadc.py @@ -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 # # #