Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:newaetech/chipwhisperer into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
alex-dewar committed Jul 27, 2023
2 parents 99f9112 + 9e87c50 commit 1c8058c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 60 deletions.
4 changes: 2 additions & 2 deletions hardware/victims/cw308_ufo_target/xc7a35/vivado/ss2.xpr
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
</FileSet>
<FileSet Name="utils_1" Type="Utils" RelSrcDir="$PSRCDIR/utils_1" RelGenDir="$PGENDIR/utils_1">
<Filter Type="Utils"/>
<File Path="$PSRCDIR/utils_1/imports/synth_1/ss2.dcp">
<File Path="$PSRCDIR/utils_1/imports/synth_1/ss2_wrapper.dcp">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
Expand Down Expand Up @@ -217,7 +217,7 @@
</Simulator>
</Simulators>
<Runs Version="1" Minor="19">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_1/ss2.dcp" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_1/ss2_wrapper.dcp" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/>
<Step Id="synth_design"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,6 @@
</FileSet>
<FileSet Name="utils_1" Type="Utils" RelSrcDir="$PSRCDIR/utils_1" RelGenDir="$PGENDIR/utils_1">
<Filter Type="Utils"/>
<File Path="$PSRCDIR/utils_1/imports/synth_1/ss2.dcp">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedInSteps" Val="synth_1"/>
<Attr Name="AutoDcp" Val="1"/>
</FileInfo>
</File>
<Config>
<Option Name="TopAutoSet" Val="TRUE"/>
</Config>
Expand Down Expand Up @@ -267,7 +259,7 @@
</Simulator>
</Simulators>
<Runs Version="1" Minor="19">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_1/ss2.dcp" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/>
<Step Id="synth_design"/>
Expand Down
19 changes: 4 additions & 15 deletions hardware/victims/cw308_ufo_target/xc7a35/vivado/ss2_cw305_ecc.xpr
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@
</Config>
</FileSet>
<FileSet Name="sim_1" Type="SimulationSrcs" RelSrcDir="$PSRCDIR/sim_1" RelGenDir="$PGENDIR/sim_1">
<Filter Type="Srcs"/>
<Config>
<Option Name="DesignMode" Val="RTL"/>
<Option Name="TopModule" Val="ss2_ecc_wrapper"/>
Expand All @@ -467,14 +468,6 @@
</FileSet>
<FileSet Name="utils_1" Type="Utils" RelSrcDir="$PSRCDIR/utils_1" RelGenDir="$PGENDIR/utils_1">
<Filter Type="Utils"/>
<File Path="$PSRCDIR/utils_1/imports/synth_1/ss2_ecc_wrapper.dcp">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedInSteps" Val="synth_1"/>
<Attr Name="AutoDcp" Val="1"/>
</FileInfo>
</File>
<Config>
<Option Name="TopAutoSet" Val="TRUE"/>
</Config>
Expand Down Expand Up @@ -502,11 +495,9 @@
</Simulator>
</Simulators>
<Runs Version="1" Minor="19">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_1/ss2_ecc_wrapper.dcp" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022">
<Desc>Vivado Synthesis Defaults</Desc>
</StratHandle>
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/>
<Step Id="synth_design"/>
</Strategy>
<GeneratedRun Dir="$PRUNDIR" File="gen_run.xml"/>
Expand All @@ -516,9 +507,7 @@
</Run>
<Run Id="impl_1" Type="Ft2:EntireDesign" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Default settings for Implementation." AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/impl_1" SynthRun="synth_1" IncludeInArchive="true" IsChild="false" GenFullBitstream="true" AutoIncrementalDir="$PSRCDIR/utils_1/imports/impl_1" AutoRQSDir="$PSRCDIR/utils_1/imports/impl_1">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2022">
<Desc>Default settings for Implementation.</Desc>
</StratHandle>
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2022"/>
<Step Id="init_design"/>
<Step Id="opt_design"/>
<Step Id="power_opt_design"/>
Expand Down
45 changes: 16 additions & 29 deletions hardware/victims/cw308_ufo_target/xc7a35/vivado/ss_aes.xpr
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
<Attr Name="UsedIn" Val="simulation"/>
</FileInfo>
</File>
<File Path="$PPRDIR/../../../cw305_artixtarget/fpga/cryptosrc/aes_newae/aes_sbox_lut.v">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedIn" Val="simulation"/>
</FileInfo>
</File>
<File Path="$PPRDIR/../hdl/cw312_aes_ss.v">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
Expand Down Expand Up @@ -168,30 +175,6 @@
</FileSet>
<FileSet Name="utils_1" Type="Utils" RelSrcDir="$PSRCDIR/utils_1" RelGenDir="$PGENDIR/utils_1">
<Filter Type="Utils"/>
<File Path="$PSRCDIR/utils_1/imports/synth_1/SimpleSerial.dcp">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedInSteps" Val="synth_1"/>
<Attr Name="AutoDcp" Val="1"/>
</FileInfo>
</File>
<File Path="$PSRCDIR/utils_1/imports/synth_4/cw312_aes_ss.dcp">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedInSteps" Val="synth_4"/>
<Attr Name="AutoDcp" Val="1"/>
</FileInfo>
</File>
<File Path="$PSRCDIR/utils_1/imports/synth_8/cw312_aes_ss.dcp">
<FileInfo>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedInSteps" Val="synth_8"/>
<Attr Name="AutoDcp" Val="1"/>
</FileInfo>
</File>
<Config>
<Option Name="TopAutoSet" Val="TRUE"/>
</Config>
Expand Down Expand Up @@ -219,7 +202,7 @@
</Simulator>
</Simulators>
<Runs Version="1" Minor="19">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_1/SimpleSerial.dcp" WriteIncrSynthDcp="false" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" WriteIncrSynthDcp="false" Dir="$PRUNDIR/synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_1">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/>
<Step Id="synth_design"/>
Expand All @@ -229,7 +212,7 @@
<Report Name="ROUTE_DESIGN.REPORT_METHODOLOGY" Enabled="1"/>
<RQSFiles/>
</Run>
<Run Id="synth_4" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_4/cw312_aes_ss.dcp" WriteIncrSynthDcp="false" Dir="$PRUNDIR/synth_4" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_4" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_4">
<Run Id="synth_4" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" WriteIncrSynthDcp="false" Dir="$PRUNDIR/synth_4" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_4" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_4">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/>
<Step Id="synth_design"/>
Expand All @@ -239,9 +222,11 @@
<Report Name="ROUTE_DESIGN.REPORT_METHODOLOGY" Enabled="1"/>
<RQSFiles/>
</Run>
<Run Id="synth_8" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="true" IncrementalCheckpoint="$PSRCDIR/utils_1/imports/synth_8/cw312_aes_ss.dcp" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_8" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_8" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_8">
<Run Id="synth_8" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_8" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/synth_8" AutoRQSDir="$PSRCDIR/utils_1/imports/synth_8">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/>
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022">
<Desc>Vivado Synthesis Defaults</Desc>
</StratHandle>
<Step Id="synth_design"/>
</Strategy>
<GeneratedRun Dir="$PRUNDIR" File="gen_run.xml"/>
Expand Down Expand Up @@ -287,7 +272,9 @@
</Run>
<Run Id="impl_8" Type="Ft2:EntireDesign" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Default settings for Implementation." AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/impl_8" SynthRun="synth_8" IncludeInArchive="true" IsChild="false" GenFullBitstream="true" AutoIncrementalDir="$PSRCDIR/utils_1/imports/impl_8" AutoRQSDir="$PSRCDIR/utils_1/imports/impl_8">
<Strategy Version="1" Minor="2">
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2022"/>
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2022">
<Desc>Default settings for Implementation.</Desc>
</StratHandle>
<Step Id="init_design"/>
<Step Id="opt_design"/>
<Step Id="power_opt_design"/>
Expand Down
4 changes: 2 additions & 2 deletions software/chipwhisperer/capture/scopes/OpenADC.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,9 @@ def con(self, sn=None, idProduct=None, bitstream=None, force=False, prog_speed=1
self.glitch_mmcm1 = XilinxMMCMDRP(self.glitch_drp1)
self.glitch_mmcm2 = XilinxMMCMDRP(self.glitch_drp2)
self.la_mmcm = XilinxMMCMDRP(self.la_drp)
self.clock = ChipWhispererHuskyClock.ChipWhispererHuskyClock(self.sc, \
self._fpga_clk, self.glitch_mmcm1, self.glitch_mmcm2)
self.ADS4128 = ADS4128Settings(self.sc)
self.clock = ChipWhispererHuskyClock.ChipWhispererHuskyClock(self.sc, \
self._fpga_clk, self.glitch_mmcm1, self.glitch_mmcm2, self.ADS4128)
self.XADC = XADCSettings(self.sc)
self.LEDs = LEDSettings(self.sc)
self.LA = LASettings(oaiface=self.sc, mmcm=self.la_mmcm, scope=self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from ....logging import *
import numpy as np
from .._OpenADCInterface import OpenADCInterface, ClockSettings
from ..cwhardware.ChipWhispererHuskyMisc import ADS4128Settings

import time

ADDR_EXTCLK = 38
Expand Down Expand Up @@ -778,7 +780,7 @@ def inner(self, *args, **kwargs) :
self._adc_error_enabled(True)
return inner

def __init__(self, oaiface : OpenADCInterface, fpga_clk_settings : ClockSettings, mmcm1, mmcm2):
def __init__(self, oaiface : OpenADCInterface, fpga_clk_settings : ClockSettings, mmcm1, mmcm2, adc: ADS4128Settings):
super().__init__()

# cache ADC freq to improve capture speed
Expand All @@ -787,6 +789,7 @@ def __init__(self, oaiface : OpenADCInterface, fpga_clk_settings : ClockSettings
self.oa = oaiface
self.naeusb = oaiface.serial
self.pll = CDCI6214(self.naeusb, mmcm1, mmcm2)
self.adc = adc
self.fpga_clk_settings = fpga_clk_settings
self.fpga_clk_settings.freq_ctr_src = "extclk"
self.adc_phase = 0
Expand Down Expand Up @@ -865,6 +868,16 @@ def clkgen_src(self, clk_src):
else:
raise ValueError("Invalid src settings! Must be 'internal', 'system', 'extclk' or 'extclk_aux_io', not {}".format(clk_src))

def _update_adc_speed_mode(self, mul, freq):
"""Husky's ADC has a high speed / low speed mode bit.
When the ADC clock is changed, this automatically sets the appropriate
speed mode.
"""
if mul * freq < 80e6:
self.adc.low_speed = True
else:
self.adc.low_speed = False

@property
def clkgen_freq(self):
"""The target clock frequency in Hz.
Expand Down Expand Up @@ -908,9 +921,9 @@ def clkgen_freq(self, freq):
self.pll._fpga_clk_freq = self.fpga_clk_settings.freq_ctr
if self.clkgen_src == "test":
self.pll._fpga_clk_freq = freq

self.pll.target_freq = freq
self.extclk_error = None
self._update_adc_speed_mode(self.adc_mul, freq)

@property
def adc_mul(self):
Expand All @@ -935,6 +948,7 @@ def adc_mul(self):
def adc_mul(self, mul):
self._cached_adc_freq = None
self.pll.adc_mul = mul
self._update_adc_speed_mode(mul, self.clkgen_freq)

@property
def adc_freq(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_husky.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def reset_target():
if scope._is_husky_plus:
MAXCLOCK = 250e6
OVERCLOCK1 = 255e6
OVERCLOCK2 = 255e6
OVERCLOCK2 = 300e6
MAXSAMPLES = 327828
MAXSEGMENTSAMPLES = 295056
else:
Expand Down

0 comments on commit 1c8058c

Please sign in to comment.