Skip to content

Commit

Permalink
merged in master
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Jul 5, 2023
2 parents 6b2c1b5 + 1b751fe commit c7c5d50
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions spinn_front_end_common/utilities/report_functions/drift_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import struct
import logging
from spinn_utilities.progress_bar import ProgressBar
from spinnman.messages.spinnaker_boot import SystemVariableDefinition
from spinn_utilities.config_holder import get_config_bool
from spinn_utilities.log import FormatAdapter
from spinn_front_end_common.data import FecDataView

# The fixed point position for drift readings
DRIFT_FP = 1 << 17
CLOCK_DRIFT_REPORT = "clock_drift.csv"

logger = FormatAdapter(logging.getLogger(__name__))
Expand Down Expand Up @@ -63,13 +60,15 @@ def drift_report():
with open(directory_name, "a", encoding="utf-8") as writer:
for eth_chip in eth_chips:
if ethernet_only:
__write_drift(txrx, eth_chip, writer)
drift = txrx.get_clock_drift(eth_chip.x, eth_chip.y)
writer.write(f'"{drift}",')
progress.update()
else:
last_drift = None
for chip in machine.get_chips_by_ethernet(
eth_chip.x, eth_chip.y):
drift = __write_drift(txrx, chip, writer)
drift = txrx.get_clock_drift(chip.x, chip.y)
writer.write(f'"{drift}",')
if last_drift is None:
last_drift = drift
elif last_drift != drift:
Expand All @@ -80,13 +79,3 @@ def drift_report():
drift, last_drift)
progress.update()
writer.write("\n")


def __write_drift(txrx, chip, writer):
# pylint: disable=protected-access
drift = txrx._get_sv_data(
chip.x, chip.y, SystemVariableDefinition.clock_drift)
drift = struct.unpack("<i", struct.pack("<I", drift))[0]
drift = drift / (1 << 17)
writer.write(f'"{drift}",')
return drift

0 comments on commit c7c5d50

Please sign in to comment.