Skip to content

Commit

Permalink
Fix lint issues from PR
Browse files Browse the repository at this point in the history
Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Sep 27, 2024
1 parent 77961f7 commit 43adee0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 41 deletions.
9 changes: 5 additions & 4 deletions adijif/clocks/ad9528.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ def _get_clock_constraint(
return self.vcxo / self.config["r1"] * self.config["n2"] / od

def set_requested_clocks(
self, vcxo: int, out_freqs: List, clk_names: List[str],
self,
vcxo: int,
out_freqs: List,
clk_names: List[str],
) -> None:
"""Define necessary clocks to be generated in model.
Expand All @@ -410,9 +413,7 @@ def set_requested_clocks(
else:
sysref_src = self.vcxo / self.config["r1"]

self._add_equation(
[sysref_src / (2 * self.config["k"]) == self._sysref]
)
self._add_equation([sysref_src / (2 * self.config["k"]) == self._sysref])

# Add requested clocks to output constraints
for out_freq, name in zip(out_freqs, clk_names):
Expand Down
8 changes: 2 additions & 6 deletions adijif/converters/ad9081.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,7 @@ def _converter_clock_config(self) -> None:
"""
dac_clk = self.interpolation * self.sample_clock
self.config["dac_clk"] = self._convert_input(dac_clk)
self.config["converter_clk"] = self._add_intermediate(
self.config["dac_clk"]
)
self.config["converter_clk"] = self._add_intermediate(self.config["dac_clk"])


class ad9081(ad9081_core):
Expand Down Expand Up @@ -550,9 +548,7 @@ def _converter_clock_config(self) -> None:

self.config["dac_clk"] = self._convert_input(dac_clk)
self.config["adc_clk"] = self._convert_input(adc_clk)
self.config["converter_clk"] = self._add_intermediate(
self.config["dac_clk"]
)
self.config["converter_clk"] = self._add_intermediate(self.config["dac_clk"])

# Add single PLL constraint
# JESD204B/C transmitter is a power of 2 divisor of the lane rate of
Expand Down
12 changes: 8 additions & 4 deletions adijif/converters/adrv9009.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class adrv9009_core(converter, metaclass=ABCMeta):
name = "ADRV9009"

# JESD configurations
quick_configuration_modes = None # FIXME
quick_configuration_modes = None # FIXME
available_jesd_modes = ["jesd204b"]
M_available = [1, 2, 4]
L_available = [1, 2, 3, 4, 6, 8]
N_available = [12, 16]
Np_available = [12, 16, 24]
F_available = [1, 2, 3, 4, 8]
S_available = [1] # FIXME?
S_available = [1] # FIXME?
K_available = [*np.arange(1, 32 + 1)]
CS_available = [0]
CF_available = [0]
Expand Down Expand Up @@ -105,6 +105,7 @@ def get_config(self, solution: CpoSolveResult = None) -> Dict:
self.solution = solution
return {}


class adrv9009_clock_common(adrv9009_core, adrv9009_bf):
"""ADRV9009 class managing common singleton (Rx,Tx) methods."""

Expand Down Expand Up @@ -358,5 +359,8 @@ def get_required_clocks(self) -> List[Dict]:
]
)

return [self.config["device_clock"], self.config["sysref_adc"],
self.config["sysref_dac"]]
return [
self.config["device_clock"],
self.config["sysref_adc"],
self.config["sysref_dac"],
]
12 changes: 6 additions & 6 deletions adijif/jesd.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ def validate_clocks(self) -> None:
for name in ["bit", "sample"]:
clk = getattr(self, name + "_clock")
lim = getattr(self, name + "_clock_max")
assert (
clk <= lim
), name + f" clock too fast for device {clk} (limit: {lim})"
assert clk <= lim, (
name + f" clock too fast for device {clk} (limit: {lim})"
)
lim = getattr(self, name + "_clock_min")
assert (
clk >= lim
), name + f" clock too slow for device {clk} (limit: {lim})"
assert clk >= lim, (
name + f" clock too slow for device {clk} (limit: {lim})"
)

@property
def bit_clock_min(self) -> Union[int, float]:
Expand Down
1 change: 0 additions & 1 deletion adijif/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ def solve(self) -> Dict:
sys_refs = []

for conv in convs:

if conv._nested: # MxFE, Transceivers
for name in conv._nested:
serdes_used += getattr(conv, name).L
Expand Down
28 changes: 14 additions & 14 deletions tests/test_bf.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,21 +534,21 @@ def test_system_daq2_rx_ad9528():
"Converter": np.array(1000000000),
"ClockChip": [
{
'm1': 4,
'vco': 4000000000.0,
'n2': 8,
'r1': 1,
'required_output_divs': 1.0,
'fpga_pll_config': {
'vco': 10000000000.0,
'band': 1,
'd': 1,
'm': 1,
'n': 20,
'qty4_full_rate': 0,
'type': 'QPLL',
"m1": 4,
"vco": 4000000000.0,
"n2": 8,
"r1": 1,
"required_output_divs": 1.0,
"fpga_pll_config": {
"vco": 10000000000.0,
"band": 1,
"d": 1,
"m": 1,
"n": 20,
"qty4_full_rate": 0,
"type": "QPLL",
},
'sysref_rate': 7812500.0,
"sysref_rate": 7812500.0,
},
{
"m1": 4,
Expand Down
5 changes: 1 addition & 4 deletions tests/test_clocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def test_ad9545_fail_no_solver():

@pytest.mark.parametrize("solver", ["gekko", "CPLEX"])
def test_ad9523_1_daq2_validate(solver):

vcxo = 125000000
n2 = 24

Expand Down Expand Up @@ -249,7 +248,6 @@ def test_ltc6953_validate():

@pytest.mark.parametrize("solver", ["gekko", "CPLEX"])
def test_ad9528_validate(solver):

n2 = 10
vcxo = 122.88e6

Expand Down Expand Up @@ -280,14 +278,13 @@ def test_ad9528_validate(solver):

@pytest.mark.parametrize("solver", ["gekko", "CPLEX"])
def test_ad9528_sysref(solver):

n2 = 10
vcxo = 122.88e6

clk = adijif.ad9528(solver=solver)

clk.n2 = n2
clk.k = [*range(500, 600)] # FIXME gekko fails to find a solution without this.
clk.k = [*range(500, 600)] # FIXME gekko fails to find a solution without this.
clk.use_vcxo_double = False

clk.sysref = 120e3
Expand Down
6 changes: 4 additions & 2 deletions tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_nested_converter_lane_count_exceeds_fpga_lane_count():
sys = adijif.system("adrv9009", "ad9528", "xilinx", 122.88e6)

sys.fpga.setup_by_dev_kit_name("zcu102")
sys.fpga.max_serdes_lanes = fpga_L # Force it to break
sys.fpga.max_serdes_lanes = fpga_L # Force it to break

sys.converter.adc.sample_clock = 122.88e6
sys.converter.dac.sample_clock = 122.88e6
Expand All @@ -80,5 +80,7 @@ def test_nested_converter_lane_count_exceeds_fpga_lane_count():
sys.converter.adc.set_quick_configuration_mode(mode_rx, "jesd204b")
sys.converter.dac.set_quick_configuration_mode(mode_tx, "jesd204b")

with pytest.raises(Exception, match=f"Max SERDES lanes exceeded. {fpga_L} only available"):
with pytest.raises(
Exception, match=f"Max SERDES lanes exceeded. {fpga_L} only available"
):
cfg = sys.solve()

0 comments on commit 43adee0

Please sign in to comment.