Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: {Johann Heyszl} <[email protected]>
  • Loading branch information
johannheyszl committed Oct 11, 2023
1 parent bd10b1d commit b1878a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 11 additions & 8 deletions cw/simple_capture_aes_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from Crypto.Cipher import AES
from tqdm import tqdm

from util import device, plot, trace_util
from waverunner import WaveRunner
from util import device, plot, trace_util


def abort_handler_during_loop(project, sig, frame):
Expand Down Expand Up @@ -110,17 +110,23 @@ def abort_handler_during_loop(project, sig, frame):
# Main loop for measurements with progress bar
for _ in tqdm(range(cfg["capture"]["num_traces"]), desc='Capturing', ncols=80):

# Generate and load new text for this iteration
text = bytearray(cipher_gen.encrypt(text))
cwfpgahusky.target.simpleserial_write('p', text)

# TODO: Useful code line for batch capture
# cwfpgahusky..simpleserial_write("s", capture_cfg["batch_prng_seed"].to_bytes(4, "little"))

if USE_HUSKY:
# Arm Husky scope
cwfpgahusky.scope.arm()

if USE_WAVERUNNER:
# Arm Waverunner scope
waverunner.arm()

# Generate new text for this iteration
text = bytearray(cipher_gen.encrypt(text))
# Load text and trigger execution
cwfpgahusky.target.simpleserial_write('p', text)

if USE_HUSKY:
# Capture Husky trace
ret = cwfpgahusky.scope.capture(poll_done=False)
i = 0
Expand All @@ -136,9 +142,6 @@ def abort_handler_during_loop(project, sig, frame):
wave = cwfpgahusky.scope.get_last_trace(as_int=True)

if USE_WAVERUNNER:
# Arm Waverunner scope
waverunner.arm()

# Capture and get Waverunner trace
waves = waverunner.capture_and_transfer_waves()
assert waves.shape[0] == cfg["waverunner"]["num_segments"]
Expand Down
3 changes: 1 addition & 2 deletions cw/waverunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ def capture_and_transfer_waves(self):
"""
# Don't process commands until the acqu is complete and wait until
# processing is complete.
# Previously contained WAIT but did not work properly res = self._ask("WAIT 10;*OPC?")
res = self._ask("*OPC?")
res = self._ask("WAIT 10;*OPC?")
assert res == "*OPC 1"
# Transfer and parse waveform data.
if self.acqu_channel == "C1":
Expand Down

0 comments on commit b1878a5

Please sign in to comment.