<commit_before>#-----------------------------------------------------------------------------
# Title      : Xilinx IBERT Interface Class
# Project    :
#-----------------------------------------------------------------------------
# File       : pyIBERT.py
# Author     : <NAME>
# Company    :
# Created    : 2017-07-12
# Last update: 2017-07-12
# Standard   : Python 3.4
#-----------------------------------------------------------------------------
# Description:
#
# Implements a interface to communicate with Xilinx IBERT
#
#-----------------------------------------------------------------------------
# Copyright (c) 2017 <NAME>
#-----------------------------------------------------------------------------
# Revisions  :
# Date        Version  Author          Description
# 2017-Jul-12 1.0      vfinotti        Created
#-----------------------------------------------------------------------------


from XilinxTCL import XilinxTCL
import time

class pyIBERT(XilinxTCL):
  def __init__(self, server_addr, server_port, target_name, target_freq):
    XilinxTCL.__init__(self)
    self.server_url = server_addr + ":" + server_port
    self.target_name = target_name
    self.target_freq = target_freq
    self.connect()

  def connect(self):
    self.create()

    self.sendCommand("open_hw")
    self.sendCommand("connect_hw_server -url " + self.server_url)
    time.sleep(3) # required delay to refresh information (xilinx bug)
    self.sendCommand("disconnect_hw_server " + self.server_url)
    self.sendCommand("connect_hw_server -url "+ self.server_url)
    self.sendCommand("current_hw_target [get_hw_targets */xilinx_tcf/*"
                     + self.target_name + "*]")
    self.sendCommand("set_property PARAM.FREQUENCY " + self.target_freq
                     + " [get_hw_targets */xilinx_tcf/*"
                     + self.target_name + "*]")
    self.sendCommand("open_hw_target")
    self.sendCommand("current_hw_device [lindex [get_hw_devices] 0]")
    self.sendCommand("refresh_hw_device -update_hw_probes false [lindex [get_hw_devices] 0]")

  def source(self, path):
    self.sendCommand("source " + path)

  def scan_create(self, name, obj):
    self.sendCommand("set " + name + " [create_hw_sio_scan -description {" + name + "} 2d_full_eye  [lindex [" + obj + "] 0 ]]")

  def scan_set_all(self, vert_align, hor_align, dwell):
    self.sendCommand("set_property VERTICAL_INCREMENT " + str(vert_align) + " [get_hw_sio_scans]")
    self.sendCommand("set_property HORIZONTAL_INCREMENT " + str(hor_align) + " [get_hw_sio_scans]")
    self.sendCommand("set_property DWELL_BER " + str(dwell) + " [get_hw_sio_scans]")

  def scan_run_all(self):
    self.sendCommand("foreach s [get_hw_sio_scans] {\n    run_hw_sio_scan $s \n    wait_on_hw_sio_scan $s}")

  def scan_remove_all(self):
    self.sendCommand("remove_hw_sio_scan [get_hw_sio_scans]")

  def set_property(self, prop, value, obj):
    self.sendCommand("set_property " + prop + " {" + str(value) + "} [" + obj + "]")
    self.sendCommand("commit_hw_sio" + " [" + obj + "]")

  def get_property(self, prop, obj):
    return self.sendQuery("get_property " + prop + " [" + obj + "]")

  def reset_sio_link_error(self, obj):
    self.set_property("LOGIC.MGT_ERRCNT_RESET_CTRL", "1", obj)
    self.set_property("LOGIC.MGT_ERRCNT_RESET_CTRL", "0", obj)

  def refresh_hw_sio(self, obj):
    self.sendCommand("refresh_hw_sio [" + obj + "]")
<commit_msg>Fixing "import XilinxTCL" of pyIBERT<commit_after>#-----------------------------------------------------------------------------
# Title      : Xilinx IBERT Interface Class
# Project    :
#-----------------------------------------------------------------------------
# File       : pyIBERT.py
# Author     : <NAME>
# Company    :
# Created    : 2017-07-12
# Last update: 2017-07-12
# Standard   : Python 3.4
#-----------------------------------------------------------------------------
# Description:
#
# Implements a interface to communicate with Xilinx IBERT
#
#-----------------------------------------------------------------------------
# Copyright (c) 2017 <NAME>
#-----------------------------------------------------------------------------
# Revisions  :
# Date        Version  Author          Description
# 2017-Jul-12 1.0      vfinotti        Created
#-----------------------------------------------------------------------------


from classes.XilinxTCL import XilinxTCL
import time

class pyIBERT(XilinxTCL):
  def __init__(self, server_addr, server_port, target_name, target_freq):
    XilinxTCL.__init__(self)
    self.server_url = server_addr + ":" + server_port
    self.target_name = target_name
    self.target_freq = target_freq
    self.connect()

  def connect(self):
    self.create()

    self.sendCommand("open_hw")
    self.sendCommand("connect_hw_server -url " + self.server_url)
    time.sleep(3) # required delay to refresh information (xilinx bug)
    self.sendCommand("disconnect_hw_server " + self.server_url)
    self.sendCommand("connect_hw_server -url "+ self.server_url)
    self.sendCommand("current_hw_target [get_hw_targets */xilinx_tcf/*"
                     + self.target_name + "*]")
    self.sendCommand("set_property PARAM.FREQUENCY " + self.target_freq
                     + " [get_hw_targets */xilinx_tcf/*"
                     + self.target_name + "*]")
    self.sendCommand("open_hw_target")
    self.sendCommand("current_hw_device [lindex [get_hw_devices] 0]")
    self.sendCommand("refresh_hw_device -update_hw_probes false [lindex [get_hw_devices] 0]")

  def source(self, path):
    self.sendCommand("source " + path)

  def scan_create(self, name, obj):
    self.sendCommand("set " + name + " [create_hw_sio_scan -description {" + name + "} 2d_full_eye  [lindex [" + obj + "] 0 ]]")

  def scan_set_all(self, vert_align, hor_align, dwell):
    self.sendCommand("set_property VERTICAL_INCREMENT " + str(vert_align) + " [get_hw_sio_scans]")
    self.sendCommand("set_property HORIZONTAL_INCREMENT " + str(hor_align) + " [get_hw_sio_scans]")
    self.sendCommand("set_property DWELL_BER " + str(dwell) + " [get_hw_sio_scans]")

  def scan_run_all(self):
    self.sendCommand("foreach s [get_hw_sio_scans] {\n    run_hw_sio_scan $s \n    wait_on_hw_sio_scan $s}")

  def scan_remove_all(self):
    self.sendCommand("remove_hw_sio_scan [get_hw_sio_scans]")

  def set_property(self, prop, value, obj):
    self.sendCommand("set_property " + prop + " {" + str(value) + "} [" + obj + "]")
    self.sendCommand("commit_hw_sio" + " [" + obj + "]")

  def get_property(self, prop, obj):
    return self.sendQuery("get_property " + prop + " [" + obj + "]")

  def reset_sio_link_error(self, obj):
    self.set_property("LOGIC.MGT_ERRCNT_RESET_CTRL", "1", obj)
    self.set_property("LOGIC.MGT_ERRCNT_RESET_CTRL", "0", obj)

  def refresh_hw_sio(self, obj):
    self.sendCommand("refresh_hw_sio [" + obj + "]")

{'fraction_non_alphanumeric': 0.24952768492951605, 'fraction_numerical': 0.010754250835634355, 'mean_word_length': 2.136736554238833, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7123262', 'n_tokens_mistral': 2258, 'n_tokens_neox': 2155, 'n_words': 382}