From 87d456cae2e1b0abac82d8a88f325e93aa7c3da6 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 6 Jan 2020 21:47:58 +0800 Subject: [PATCH] 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? --- litex/soc/cores/xadc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/litex/soc/cores/xadc.py b/litex/soc/cores/xadc.py index 551738ac6..49977e3fe 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 # # #