soc/cores/xadc: define analog_layout and simplify analog_pads connections
This commit is contained in:
parent
87d456cae2
commit
378722a7ef
|
@ -9,6 +9,8 @@ from litex.soc.interconnect.csr import *
|
||||||
|
|
||||||
# XADC ---------------------------------------------------------------------------------------------
|
# XADC ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
analog_layout = [("vauxp", 16), ("vauxn", 16), ("vp", 1), ("vn", 1)]
|
||||||
|
|
||||||
class XADC(Module, AutoCSR):
|
class XADC(Module, AutoCSR):
|
||||||
def __init__(self, analog_pads=None):
|
def __init__(self, analog_pads=None):
|
||||||
# Temperature(°C) = adc_value*503.975/4096 - 273.15
|
# Temperature(°C) = adc_value*503.975/4096 - 273.15
|
||||||
|
@ -27,12 +29,6 @@ class XADC(Module, AutoCSR):
|
||||||
self.alarm = Signal(8)
|
self.alarm = Signal(8)
|
||||||
self.ot = Signal()
|
self.ot = Signal()
|
||||||
|
|
||||||
# Analog
|
|
||||||
if analog_pads == None:
|
|
||||||
self.analog = Record([("vauxp", 16), ("vauxn", 16), ("vp", 1), ("vn", 1)])
|
|
||||||
else:
|
|
||||||
self.analog = analog_pads
|
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
busy = Signal()
|
busy = Signal()
|
||||||
|
@ -65,10 +61,10 @@ class XADC(Module, AutoCSR):
|
||||||
o_CHANNEL = channel,
|
o_CHANNEL = channel,
|
||||||
o_EOC = eoc,
|
o_EOC = eoc,
|
||||||
o_EOS = eos,
|
o_EOS = eos,
|
||||||
i_VAUXN = self.analog.vauxn,
|
i_VAUXP = 0 if analog_pads is None else analog_pads.vauxp,
|
||||||
i_VAUXP = self.analog.vauxp,
|
i_VAUXN = 0 if analog_pads is None else analog_pads.vauxn,
|
||||||
i_VN = self.analog.vn,
|
i_VP = 0 if analog_pads is None else analog_pads.vp,
|
||||||
i_VP = self.analog.vp,
|
i_VN = 0 if analog_pads is None else analog_pads.vn,
|
||||||
i_CONVST = 0,
|
i_CONVST = 0,
|
||||||
i_CONVSTCLK = 0,
|
i_CONVSTCLK = 0,
|
||||||
i_RESET = ResetSignal(),
|
i_RESET = ResetSignal(),
|
||||||
|
|
Loading…
Reference in New Issue