Skip to content

Commit

Permalink
Merge pull request #485 from newaetech/fpga-updates
Browse files Browse the repository at this point in the history
Fix #481
  • Loading branch information
jpcrypt authored Apr 17, 2024
2 parents 7333445 + d920b79 commit d460865
Show file tree
Hide file tree
Showing 18 changed files with 332 additions and 161 deletions.
Binary file modified hardware/capture/chipwhisperer-cw1200/cw1200_firmware.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion hardware/capture/chipwhisperer-cw1200/hdl/cw1200.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ setup.v = Setup File
../../../common/hdl/clockglitch/clockglitch_s6.v
../../../common/hdl/clockglitch/reg_clockglitch.v
../../../common/hdl/clockglitch/trigger_resync.v
../../../common/hdl/io_trigger/reg_iotrigger.v
../../../common/hdl/io_trigger/trigger_system.v
../../../common/hdl/reg_chipwhisperer.v
../../../common/hdl/reconfig/reg_reconfig.v
../../../common/hdl/fifo_stream/fifo_top_stream.v
../../../common/hdl/sad_trigger/sad_auto.v
../../../common/hdl/sad_trigger/reg_sad.v
../../../common/hdl/io_decode_trigger/reg_decodeiotrigger.v
../../../common/hdl/io_decode_trigger/spi_decoder.v
../../../common/hdl/serialtarget/targ_async_receiver.v

[CoreGen Files]
#Add XCO files. You can just list the filename, OR have the CoreGen files be
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ module cw1200_interface(

wire enable_output_nrst;
wire output_nrst;
wire nrst_ignore_highz;
wire enable_output_pdid;
wire output_pdid;
wire enable_output_pdic;
Expand Down Expand Up @@ -360,6 +361,7 @@ module cw1200_interface(

.enable_output_nrst(enable_output_nrst),
.output_nrst(output_nrst),
.nrst_ignore_highz(nrst_ignore_highz),
.enable_output_pdid(enable_output_pdid),
.output_pdid(output_pdid),
.enable_output_pdic(enable_output_pdic),
Expand Down Expand Up @@ -461,7 +463,7 @@ module cw1200_interface(

wire target_highz = target_npower;

assign target_nRST = (target_highz) ? 1'bZ :
assign target_nRST = (target_highz && ~nrst_ignore_highz) ? 1'bZ :
(enable_avrprog) ? USB_spare2 :
(enable_output_nrst) ? output_nrst :
1'bZ;
Expand Down
Binary file modified hardware/capture/chipwhisperer-husky/cwhusky_top.bit
Binary file not shown.
Binary file modified hardware/capture/chipwhisperer-husky/husky_firmware.zip
Binary file not shown.
Binary file modified hardware/capture/chipwhisperer-lite/cwlite_firmware.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ module cwlite_interface(

wire enable_output_nrst;
wire output_nrst;
wire nrst_ignore_highz;
wire enable_output_pdid;
wire output_pdid;
wire enable_output_pdic;
Expand Down Expand Up @@ -236,6 +237,7 @@ module cwlite_interface(

.enable_output_nrst(enable_output_nrst),
.output_nrst(output_nrst),
.nrst_ignore_highz(nrst_ignore_highz),
.enable_output_pdid(enable_output_pdid),
.output_pdid(output_pdid),
.enable_output_pdic(enable_output_pdic),
Expand Down Expand Up @@ -304,7 +306,7 @@ module cwlite_interface(
(enable_output_pdic) ? output_pdic :
1'bZ;

assign target_nRST = (target_highz) ? 1'bZ :
assign target_nRST = (target_highz && ~nrst_ignore_highz) ? 1'bZ :
(enable_avrprog) ? USB_treset_i :
(enable_output_nrst) ? output_nrst :
1'bZ;
Expand Down
14 changes: 0 additions & 14 deletions hardware/capture/chipwhisperer-lite/hdl/cwlite_ise/setup.v

This file was deleted.

1 change: 0 additions & 1 deletion hardware/common/hdl/reconfig/reg_reconfig.v
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ module reg_reconfig(
`ifndef __ICARUS__
// ICAP_SPARTAN6: Internal Configuration Access Port
// Spartan-6
`ifndef __ICARUS__
ICAP_SPARTAN6 #(

//'h04004093
Expand Down
7 changes: 3 additions & 4 deletions hardware/common/hdl/reg_chipwhisperer.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
77777`include "includes.v"
`include "includes.v"
//`define CHIPSCOPE

/***********************************************************************
Expand All @@ -19,7 +19,6 @@ Author: Colin O'Flynn <[email protected]>
GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with chipwhisperer. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/
module reg_chipwhisperer(
Expand Down Expand Up @@ -78,6 +77,7 @@ module reg_chipwhisperer(

output enable_output_nrst,
output output_nrst,
output nrst_ignore_highz,
output enable_output_pdid,
output output_pdid,
output enable_output_pdic,
Expand Down Expand Up @@ -322,7 +322,6 @@ module reg_chipwhisperer(
.D1(1'b0), // 1-bit data input (associated with C1)
.R(~registers_cwextclk[6]), // 1-bit reset input
.S(1'b0) // 1-bit set input
);
*/

Expand Down Expand Up @@ -371,7 +370,6 @@ module reg_chipwhisperer(
.D1(1'b0), // 1-bit data input (associated with C1)
.R(~registers_iorouting[33]), // 1-bit reset input
.S(1'b0) // 1-bit set input

);
`endif

Expand Down Expand Up @@ -579,6 +577,7 @@ module reg_chipwhisperer(

assign enable_output_nrst = registers_iorouting[48];
assign output_nrst = registers_iorouting[49];
assign nrst_ignore_highz = registers_iorouting[54];
assign enable_output_pdid = registers_iorouting[50];
assign output_pdid = registers_iorouting[51];
assign enable_output_pdic = registers_iorouting[52];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,10 @@ def nrst_mode(self):
def nrst(self):
"""The state of the NRST pin.
See pdic for more information."""
See pdic for more information.
See also :class:`nrst_drive_poweroff` for behaviour with :class:`target_pwr`.
"""
return self._get_xio_str(self.GPIO_PIN_NRST)

@nrst.setter
Expand All @@ -1038,6 +1041,26 @@ def nrst_state(self):
"""
return self._read_xio_pin(self.cwe.PIN_READ_NRST)

@property
def nrst_drive_poweroff(self):
"""Control how the nRST pin is driven when :class:`target_pwr` is
False. If set, nRST is driven (or not) as per :class:`nrst` (i.e.
:class:`target_pwr` has no effect on how nRST is driven). Otherwise,
nRST is tristated.
.. NOTE:: our target boards pull up nRST to `target_pwr`; if
`nrst_drive_poweroff` is False and nRST is driven low, then setting
`target_pwr` to False will cause nRST to pulse as it gets tristated
and pulled up for a brief moment until the target power gets
sufficiently low to return it to low.
"""
return self.cwe.test_ioroute_mask(6, 2**6)

@nrst_drive_poweroff.setter
def nrst_drive_poweroff(self, mode):
self.cwe.upd_ioroute_mask(6, 2**6, mode)

@property
def miso_state(self):
""" Reads the logic level of the MISO pin. Supported by Husky only.
Expand Down Expand Up @@ -1242,8 +1265,9 @@ def target_pwr(self):
If the target board is powered through an external supply, this setting
may have no effect.
.. NOTE:: Setting this value to False/0 also sets TIO1-4/HS2 to high-z
until power is reenabled.
.. NOTE:: Setting this value to False/0 also sets the following to high-z
until power is reenabled: TIO1-4, HS2, PDID, PDIC, MOSI, SCK.
nRST is also tristated if :class:`nrst_drive_poweroff` is False.
:Getter: Return the current power state of the target (True or False)
Expand Down
10 changes: 5 additions & 5 deletions software/chipwhisperer/hardware/firmware/cw1200.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions software/chipwhisperer/hardware/firmware/cwhusky.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions software/chipwhisperer/hardware/firmware/cwlite.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

cw1200_v = [1, 62]
cw1200_files = [("cw1200_firmware.zip", os.path.join(hwdir, r"capture/chipwhisperer-cw1200/cw1200_firmware.zip")),
("CW1200_SAM3UFW.bin", os.path.join(hwdir, r"capture/chipwhisperer-cw1200/ChipWhisperer-Pro.bin")),
("CW1200_SAM3UFW.bin", os.path.join(hwdir, r"capture/chipwhisperer-cw1200/CW1200_SAM3UFW.bin")),
("version", os.path.join(hwdir, r"capture/chipwhisperer-cw1200/version.txt"))
]

Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def pytest_addoption(parser):
parser.addoption("--swo_trace", action="store_true", default=False, help="Enable trace tests.")
parser.addoption("--xadc", action="store_true", default=False, help="Report XADC temp and status after each test")
parser.addoption("--log", action="store_true", default=False, help="Log XADC stats to file")
parser.addoption("--loose", action="store_true", default=False, help="Loosen test margins for test_s6_glitch.py")
parser.addoption("--target", action="store", default="Lite", help="Target name for test_s6_glitch.py (Lite/Pro)")

@pytest.fixture
def fulltest(request):
Expand All @@ -28,3 +30,11 @@ def xadc(request):
def log(request):
return int(request.config.getoption("--log"))

@pytest.fixture
def loose(request):
return int(request.config.getoption("--loose"))

@pytest.fixture
def target(request):
return request.config.getoption("--target")

Loading

0 comments on commit d460865

Please sign in to comment.