Skip to content

Commit

Permalink
Add Converter rate calcs to JESD tables
Browse files Browse the repository at this point in the history
Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Jun 6, 2024
1 parent efe318f commit 4ee2482
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 0 additions & 2 deletions webapp/app/src/pages/clockconfigurator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import streamlit as st

st.set_page_config(layout="wide")

from ..utils import Page

# import pandas as pd
Expand Down
34 changes: 34 additions & 0 deletions webapp/app/src/pages/jesdmodeselector.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ def write(self):

converter = eval(f"adijif.{sb}()")

if hasattr(converter, "decimation_available"):
decimation = st.selectbox(
"Decimation",
options=converter.decimation_available,
format_func=lambda x: str(x),
)
converter.decimation = decimation

converter_rate = st.number_input("Converter Rate (Hz)", value=1e9)
converter.sample_clock = converter_rate / converter.decimation
print(converter.sample_clock)

# Pick the first subclass and mode of that subclass to key list of possible settings
all_modes = converter.quick_configuration_modes
subclass = list(all_modes.keys())[0]
Expand All @@ -62,6 +74,7 @@ def write(self):
continue
options[setting].append(data)


# Make sure options only contain unique values
for option in options:
options[option] = list(set(options[option]))
Expand Down Expand Up @@ -94,6 +107,27 @@ def write(self):
for option in options_to_skip:
modes_all_info[mode["mode"]].pop(option, None)

# For each mode calculate the clocks and if valid
for mode in modes_all_info:
rate = converter.sample_clock
print("A", converter.sample_clock)
converter.set_quick_configuration_mode(mode, modes_all_info[mode]['jesd_class'])
print("B", converter.sample_clock)
converter.sample_clock = rate

clocks = {"Sample Rate (MSPS)": converter.sample_clock/1e6, "Lane Rate (GSPS)": converter.bit_clock/1e9}

for clock in clocks:
modes_all_info[mode][clock] = clocks[clock]

try:
converter.validate_config()
modes_all_info[mode]["Valid"] = "Yes"
except Exception as e:
print(e)
modes_all_info[mode]["Valid"] = "No"


# Convert to DataFrame so we can change orientation
df = pd.DataFrame(modes_all_info).T

Expand Down
1 change: 1 addition & 0 deletions webapp/app/src/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import streamlit as st
from abc import ABC, abstractmethod

st.set_page_config(layout="wide")

class Page(ABC):
@abstractmethod
Expand Down

0 comments on commit 4ee2482

Please sign in to comment.