Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SamKarkache committed Apr 17, 2024
1 parent a4e75a0 commit 706ed83
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 12 deletions.
19 changes: 9 additions & 10 deletions WPI_SCA_LIBRARY/LecroyScope.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LecroyScope(object):
def __init__(self, scope_ip='TCPIP0::192.168.1.79::inst0::INSTR'):
"""
Initialize LecroyScope object.
:param scope_ip: The scope IP of the Lecroy scope
:param scope_ip: The IP of the scope that you want to connect to
"""
self.scope = None
self.rm = None
Expand All @@ -25,13 +25,18 @@ def __init__(self, scope_ip='TCPIP0::192.168.1.79::inst0::INSTR'):
self.valid_trigger_states = ['AUTO', 'NORM', 'SINGLE', 'STOP']

def __del__(self):
"""
Close the scope on object deletion.
:return: None
"""
self.close()

def open(self, scope_ip, scope_timeout=5000):
"""
Opens a Lecroy scope using the PyVisa library
:param scope_ip: The ip of the Lecroy scope
:param scope_timeout: The amount of time to wait for the Lecroy until timeout
:return: None
"""
self.rm = visa.ResourceManager()
try:
Expand All @@ -47,7 +52,7 @@ def open(self, scope_ip, scope_timeout=5000):
def close(self):
"""
Closes the Lecroy scope using the PyVisa library
:return:
:return: None
"""
try:
if self.scope is not None:
Expand All @@ -66,6 +71,7 @@ def setup(self, v_div, timebase, samplerate, duration, v_offset, channel):
:param duration: the duration of capture
:param v_offset: the voltage offset for the measurement
:param channel: the channel to capture the traces on
:return: None
"""
if self.scope:
self.scope.write("{}:TRA ON".format(channel))
Expand All @@ -84,6 +90,7 @@ def set_trigger(self, delay, level, channel='C1'):
:param delay: the trigger delay
:param level: the trigger level
:param channel: the trigger channel
:return: None
"""
if self.scope is None:
self.open(self.scope_ip)
Expand Down Expand Up @@ -289,14 +296,6 @@ def capture_cw305(scope, target, num_of_samples=600, short=False, channel='C3',


def capture_nopt(scope, num_of_samples=600, short=False, channel='C3'):
"""
Captures traces with no input
:param scope: the configured LecroyScope object
:param num_of_samples: The number of samples to capture
:param short:
:param channel: The channel to collect traces on
:return: The resulting trace
"""
if scope.start_trigger() is not False:
if scope.wait_for_trigger() is False:
return
Expand Down
3 changes: 2 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ Library Features
cwscope.rst
metrics.rst
leakagemodels.rst
dpa.rst
dpa.rst
lecroy.rst
119 changes: 118 additions & 1 deletion doc/lecroy.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,119 @@
Lecroy Oscilloscope Interface
=============================
=============================

.. class:: LecroyScope

.. method:: __init__(self, scope_ip='TCPIP0::192.168.1.79::inst0::INSTR'):

Create a LecroyScope object

:param scope_ip: The IP of the scope that you want to connect to

.. method:: __del__(self):

Close the scope on object deletion.

:return: None

.. method:: open(self, scope_ip, scope_timeout=5000):

Opens a Lecroy scope using the PyVisa library

:param scope_ip: The ip of the Lecroy scope
:param scope_timeout: The amount of time to wait for the Lecroy until timeout
:return: None

.. method:: close(self):

Closes the Lecroy scope using the PyVisa library

:return: None

.. method:: setup(self, v_div, timebase, samplerate, duration, v_offset, channel):

Sets up the Lecroy scope for trace capture

:param v_div: voltage scale per division
:param timebase: the timescale for the scope
:param samplerate: the rate in which measurements are sampled
:param duration: the duration of capture
:param v_offset: the voltage offset for the measurement
:param channel: the channel to capture the traces on
:return: None

.. method:: set_trigger(self, delay, level, channel='C1'):

Set the trigger for the trace capture

:param delay: the trigger delay
:param level: the trigger level
:param channel: the trigger channel
:return: None


.. method:: start_trigger(self)

Tells the LecroyScope to start the trigger based on the parameters set in LecroyScope.set_trigger


.. method:: get_trigger(self):

Returns the trigger status

:return: A string representing the trigger status

.. method:: wait_for_trigger(self):

Waits for the Lecroy trigger

:return: True if successful, False if the trigger timeout

.. method:: get_channel(self, samples, short, channel='C3'):

Get the measurement data from the Lecroy from specified channel

:param samples: The number of samples to record
:param short:
:param channel: The channel to collect data from
:return: The data from the scope

.. method:: reset(self):

Resets the scope

.. method:: scope_setup(channel='C3', trig_channel='C1', num_of_samples=200, sample_rate=500E6, short=False, v_div=2.5E-3, trg_delay="0", trg_level="1.65V", v_offset='0'):

Higher level setup function. Sets up a Lecroy Scope object for power trace collection.

:param channel: the channel that records power trace measurements
:param trig_channel: the trigger channel
:param num_of_samples: the number of samples to capture
:param sample_rate: the rate in which samples are captured
:param short:
:param v_div: the voltage scale per division
:param trg_delay: the trigger delay
:param trg_level: the trigger level
:param v_offset: the voltage offset
:return: the fully configured scope object

.. method:: dut_setup(board="CW305", fpga_id='100t', bitfile=None)

Sets up a target board for trace capture
:param board: The DUT type (CW305 or pico)
:param fpga_id: the FPGA id for CW305 target
:param bitfile: the bitfile for CW305 target
:return: The configured target


.. method:: capture_cw305(scope, target, num_of_samples=600, short=False, channel='C3', plaintext=None, key=None):

Captures traces on the CW305 target board

:param scope: The configured LecroyScope object
:param target: The configured CW305 target board
:param num_of_samples: The number of samples to capture
:param short:
:param channel: The channel to collect traces on
:param plaintext: The plaintext for the encryption algorithm
:param key: The key for the encryption algorithm
:return: the recorded trace and algorithm output

0 comments on commit 706ed83

Please sign in to comment.