Skip to content

Commit 01e46e4

Browse files
authored
Release v2.0.1 (maintenance)
* Python 3.13, Verilatorv5.036, yosys0.52, cocotbv2.0.1 * Add v2.0.1 to history
1 parent d3145d9 commit 01e46e4

14 files changed

Lines changed: 107 additions & 77 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ on:
1111
- main
1212
jobs:
1313
build_latex:
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-26.04
1515
steps:
1616
- name: Set up Git repository
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v5
1818
- name: Cache documentation build
19-
uses: actions/cache@v4
19+
uses: actions/cache@v5
2020
with:
2121
key: "doc-pdf-v1-${{ hashFiles('docs/**') }}"
2222
restore-keys: "doc-pdf-v1"
@@ -30,13 +30,13 @@ jobs:
3030
root_file: SMAesH.tex
3131
args: -auxdir=build -pdf -file-line-error -halt-on-error -interaction=nonstopmode
3232
- name: Upload PDF file
33-
uses: actions/upload-artifact@v4
33+
uses: actions/upload-artifact@v6
3434
with:
3535
name: docs
3636
path: docs/SMAesH.pdf
3737

3838
sbox:
39-
runs-on: ubuntu-24.04
39+
runs-on: ubuntu-26.04
4040
strategy:
4141
fail-fast: true
4242
matrix:
@@ -45,7 +45,7 @@ jobs:
4545
NSHARES: "${{ matrix.nshares }}"
4646
steps:
4747
- name: Check out repository code
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v5
4949
with:
5050
submodules: true
5151
- name: Get COMPRESS version
@@ -55,21 +55,22 @@ jobs:
5555
shell: bash
5656

5757
- run: sudo apt-get install -y yosys
58+
- run: wget -qO- https://astral.sh/uv/install.sh | sh
5859
- name: Cache COMPRESS Sbox
59-
uses: actions/cache@v4
60+
uses: actions/cache@v5
6061
with:
6162
key: "sbox-compress-v1-d${{ matrix.nshares }}-${{ hashFiles('sboxes-compress/canright_aes_sbox_dual.v') }}-${{ steps.compress-version.outputs.cv }}"
62-
path: work/d${{ matrix.nshares }}/sbox
63+
path: work-python3.13/d${{ matrix.nshares }}/sbox
6364
- run: make sbox DIR_MATCHI_ROOT=.
6465
- name: Upload COMPRESS sbox
65-
uses: actions/upload-artifact@v4
66+
uses: actions/upload-artifact@v6
6667
with:
6768
name: sbox_${{ matrix.nshares }}
68-
path: work/d${{ matrix.nshares }}/sbox/*
69+
path: work-python3.13/d${{ matrix.nshares }}/sbox/*
6970

7071
functest:
7172
needs: [sbox]
72-
runs-on: ubuntu-24.04
73+
runs-on: ubuntu-26.04
7374
strategy:
7475
fail-fast: true
7576
matrix:
@@ -78,71 +79,75 @@ jobs:
7879
NSHARES: "${{ matrix.nshares }}"
7980
steps:
8081
- name: Check out repository code
81-
uses: actions/checkout@v4
82+
uses: actions/checkout@v5
8283
with:
8384
submodules: true
84-
- uses: actions/download-artifact@v4
85+
- uses: actions/download-artifact@v7
8586
with:
8687
name: sbox_${{ matrix.nshares }}
87-
path: work/d${{ matrix.nshares }}/sbox
88-
- run: sudo apt-get install -y yosys verilator iverilog
88+
path: work-python3.13/d${{ matrix.nshares }}/sbox
89+
- run: sudo apt-get install -y yosys iverilog
90+
- run: wget -qO- https://astral.sh/uv/install.sh | sh
91+
- run: (curl -L https://github.com/simple-crypto/hw-devtools/releases/download/v261506/hw-devtools.tar.gz | tar xz; sudo apt install ./hw-devtools/*.deb)
8992
- run: make func-tests DIR_MATCHI_ROOT=.
9093

9194
formal_verif_matchi:
9295
needs: [sbox]
93-
runs-on: ubuntu-24.04
96+
runs-on: ubuntu-26.04
9497
strategy:
9598
fail-fast: true
9699
matrix:
97100
nshares: [2]
98101
steps:
99102
- name: Check out repository code
100-
uses: actions/checkout@v4
103+
uses: actions/checkout@v5
101104
with:
102105
submodules: true
103-
- uses: actions/download-artifact@v4
106+
- uses: actions/download-artifact@v7
104107
with:
105108
name: sbox_${{ matrix.nshares }}
106-
path: work/d${{ matrix.nshares }}/sbox
107-
- run: sudo apt-get install -y yosys iverilog python3.12-venv
109+
path: work-python3.13/d${{ matrix.nshares }}/sbox
110+
- run: sudo apt-get install -y yosys iverilog
111+
- run: wget -qO- https://astral.sh/uv/install.sh | sh
108112
- run: mkdir -p ${{ github.workspace }}/verif-tools
109113
- run: wget https://github.com/cassiersg/matchi/releases/download/v0.1.0/matchi -P ${{ github.workspace }}/verif-tools
110114
- run: chmod +x ${{ github.workspace }}/verif-tools/matchi
111115
- run: (cd ${{ github.workspace }}/verif-tools; curl -L https://github.com/cassiersg/matchi/archive/refs/tags/v0.1.0.tar.gz | tar xz)
112-
- run: (curl -L https://github.com/simple-crypto/hw-devtools/releases/download/v241002-5/hw-devtools.tar.gz | tar xz; sudo apt install ./hw-devtools/*.deb)
113-
- run: mkdir -p work
114-
- run: verilator --version > work/verilator_version
115-
- run: yosys --version > work/yosys_version
116+
- run: (curl -L https://github.com/simple-crypto/hw-devtools/releases/download/v261506/hw-devtools.tar.gz | tar xz; sudo apt install ./hw-devtools/*.deb)
117+
- run: mkdir -p work-python3.13
118+
- run: verilator --version > work-python3.13/verilator_version
119+
- run: yosys --version > work-python3.13/yosys_version
116120
- run: make formal-tests DIR_MATCHI_ROOT=. MATCHI_CELLS=${{ github.workspace }}/verif-tools/matchi-0.1.0/matchi_cells MATCHI_BIN=${{ github.workspace }}/verif-tools/matchi
117121

118122
lint:
119123
needs: [sbox]
120-
runs-on: ubuntu-24.04
124+
runs-on: ubuntu-26.04
121125
strategy:
122126
fail-fast: true
123127
matrix:
124128
nshares: [2]
125129
steps:
126130
- name: Check out repository code
127-
uses: actions/checkout@v4
131+
uses: actions/checkout@v5
128132
with:
129133
submodules: true
130-
- uses: actions/download-artifact@v4
134+
- uses: actions/download-artifact@v7
131135
with:
132136
name: sbox_${{ matrix.nshares }}
133-
path: work/d${{ matrix.nshares }}/sbox
134-
- run: sudo apt-get install -y python3.12-venv
137+
path: work-python3.13/d${{ matrix.nshares }}/sbox
138+
- run: sudo apt-get install -y
139+
- run: wget -qO- https://astral.sh/uv/install.sh | sh
135140
- run: mkdir -p ${{ github.workspace }}/verif-tools
136-
- run: (curl -L https://github.com/simple-crypto/hw-devtools/releases/download/v241002-5/hw-devtools.tar.gz | tar xz; sudo apt install ./hw-devtools/*.deb)
137-
- run: (cd ${{ github.workspace }}/verif-tools; curl -L https://github.com/chipsalliance/verible/releases/download/v0.0-3831-g32b2456e/verible-v0.0-3831-g32b2456e-linux-static-x86_64.tar.gz | tar xz;)
138-
- run: make lint VERIBLE=${{ github.workspace }}/verif-tools/verible-v0.0-3831-g32b2456e/bin/verible-verilog-lint
141+
- run: (curl -L https://github.com/simple-crypto/hw-devtools/releases/download/v261506/hw-devtools.tar.gz | tar xz; sudo apt install ./hw-devtools/*.deb)
142+
- run: (cd ${{ github.workspace }}/verif-tools; curl -L https://github.com/chipsalliance/verible/releases/download/v0.0-4071-g8d9f2c97/verible-v0.0-4071-g8d9f2c97-linux-static-x86_64.tar.gz | tar xz;)
143+
- run: make lint VERIBLE=${{ github.workspace }}/verif-tools/verible-v0.0-4071-g8d9f2c97/bin/verible-verilog-lint
139144

140145
release:
141146
needs: [build_latex, functest, formal_verif_matchi, lint]
142147
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
143148
runs-on: ubuntu-latest
144149
steps:
145-
- uses: actions/download-artifact@v4
150+
- uses: actions/download-artifact@v7
146151
with:
147152
name: docs
148153
path: release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
formal_verif/work
3+
formal_verif/dump.vcd
34
beh_simu/work
45
beh_simu/tvs/generated
56

Makefile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Use in order to use the compress-optimized sbox.
22
NSHARES?=2
3-
WORK?=work/d$(NSHARES)
3+
PYTHON_VERSION?=3.13
4+
UV_EXEC?=uv
5+
WORK?=work-python$(PYTHON_VERSION)/d$(NSHARES)
46
WORKDIR=$(abspath $(WORK))
57

68
# Python Venv
79
SHELL=/bin/bash
8-
VE=$(abspath $(WORKDIR)/ve)
10+
VE=$(abspath $(WORKDIR)/ve-$(PYTHON_VERSION))
911
VE_INSTALLED=$(VE)/installed
10-
PYTHON_VE=source $(VE)/bin/activate
12+
ACTIVATE_VE=$(VE)/bin/activate
1113

1214
### HDL configuration
1315
# Directory created containing all the HDL files
@@ -28,15 +30,13 @@ DIR_SMAESH_HDL=hdl/smaesh_hpc
2830

2931
## Python venv setting
3032
$(VE)/pyvenv.cfg:
31-
mkdir -p $(WORKDIR)
32-
python3 -m venv $(VE)
33+
set -e; (mkdir -p $(WORKDIR) && $(UV_EXEC) venv $(VE) -p $(PYTHON_VERSION)) || exit 1
3334

34-
$(VE_INSTALLED): $(VE)/pyvenv.cfg
35-
${PYTHON_VE}; python -m pip install -r func_tests/requirements.txt
36-
touch $(VE_INSTALLED)
35+
$(VE_INSTALLED): | $(VE)/pyvenv.cfg
36+
set -e; (source ${ACTIVATE_VE} && $(UV_EXEC) pip install -r func_tests/requirements.txt) || exit 1
3737

3838
$(SBOX_FILE): sboxes-compress/canright_aes_sbox_dual.v
39-
cd sboxes-compress; SBOX_FILE=$(SBOX_FILE) WORK=$(COMPRESS_WORKDIR) NSHARES=$(NSHARES) ./compress.sh
39+
cd sboxes-compress; UV_EXEC=$(UV_EXEC) PYTHON_VERSION=$(PYTHON_VERSION) SBOX_FILE=$(SBOX_FILE) WORK=$(COMPRESS_WORKDIR) NSHARES=$(NSHARES) ./compress.sh
4040

4141
sbox: $(SBOX_FILE)
4242

@@ -51,9 +51,9 @@ hdl: $(HDL_DONE)
5151
## Functionnal testing
5252
FUNC_LOG=$(WORKDIR)/functests/simu.log
5353
FUNC_SUCCESS=$(WORKDIR)/functests/success
54-
$(FUNC_LOG): $(VE_INSTALLED) $(HDL_DONE)
54+
$(FUNC_LOG): $(HDL_DONE) | $(VE_INSTALLED)
5555
mkdir -p $(dir $(FUNC_LOG))
56-
$(PYTHON_VE); make -C func_tests NSHARES=$(NSHARES) WORK_CASE=$(WORKDIR)/functests RTL_DIR_HDL=$(DIR_HDL) simu | tee $@
56+
source $(ACTIVATE_VE) && make -C func_tests NSHARES=$(NSHARES) WORK_CASE=$(WORKDIR)/functests RTL_DIR_HDL=$(DIR_HDL) simu | tee $@
5757

5858
# Mark simulation success (simulation always return a zero exit code).
5959
%/success: %/simu.log
@@ -76,11 +76,11 @@ matchi_configured:
7676
@set e; if [ -z $${DIR_MATCHI_ROOT+x} ]; then echo "DIR_MATCHI_ROOT must be set for formal verification" && exit 1; else echo "DIR_MATCHI_ROOT=${DIR_MATCHI_ROOT}"; fi
7777

7878
FORMAL_VERIF_DONE=$(DIR_FORMAL_VERIF)/.formal_verif
79-
$(FORMAL_VERIF_DONE): $(VE_INSTALLED) $(HDL_DONE) matchi_configured
79+
$(FORMAL_VERIF_DONE): $(HDL_DONE) matchi_configured | $(VE_INSTALLED)
8080
# Verify encryption
81-
$(foreach ksize,$(KEY_SIZE),$(PYTHON_VE); make -C ./formal_verif NSHARES=$(NSHARES) KEY_SIZE=$(ksize) INVERSE=0 MATCHI_CELLS=$(MATCHI_CELLS) MATCHI_BIN=$(MATCHI_BIN) WORKDIR=$(DIR_FORMAL_VERIF) HDL_DIR=$(DIR_HDL) matchi-run || exit 1;)
81+
$(foreach ksize,$(KEY_SIZE),source $(ACTIVATE_VE); make -C ./formal_verif NSHARES=$(NSHARES) KEY_SIZE=$(ksize) INVERSE=0 MATCHI_CELLS=$(MATCHI_CELLS) MATCHI_BIN=$(MATCHI_BIN) WORKDIR=$(DIR_FORMAL_VERIF) HDL_DIR=$(DIR_HDL) matchi-run || exit 1;)
8282
# Verify decryption
83-
$(foreach ksize,$(KEY_SIZE),$(PYTHON_VE); make -C ./formal_verif NSHARES=$(NSHARES) KEY_SIZE=$(ksize) INVERSE=1 MATCHI_CELLS=$(MATCHI_CELLS) MATCHI_BIN=$(MATCHI_BIN) WORKDIR=$(DIR_FORMAL_VERIF) HDL_DIR=$(DIR_HDL) matchi-run || exit 1;)
83+
$(foreach ksize,$(KEY_SIZE),source $(ACTIVATE_VE); make -C ./formal_verif NSHARES=$(NSHARES) KEY_SIZE=$(ksize) INVERSE=1 MATCHI_CELLS=$(MATCHI_CELLS) MATCHI_BIN=$(MATCHI_BIN) WORKDIR=$(DIR_FORMAL_VERIF) HDL_DIR=$(DIR_HDL) matchi-run || exit 1;)
8484
touch $(FORMAL_VERIF_DONE)
8585

8686
formal-tests: $(FORMAL_VERIF_DONE)

docs/SMAesH.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ \section{Overview}
5555

5656
\section{History}
5757
\begin{description}
58+
\item[2.0.1 (2026-07-17)] Update to Python3.13, Verilator5.036, Yosys0.52, Cocotb2.0.1 .
5859
\item[2.0.0 (2024-10-08)] Major (breaking API) update: add AES-192, AES-256 and decryption .
5960
\item[1.1.0 (2024-09-02)] 4 cycles Canright S-box (new optimized architecture).
6061
\item[1.0.1 (2023-06-15)] Fix latency in Section 5.4 (documentation change only).

formal_verif/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
__pycache__
22
work
3+
.vcd

formal_verif/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export SIM_BUILD ?= $(WORK_SYNTH)
5151
export VERILOG_INCLUDE_DIRS?= $(HDL_DIR)
5252
export VERILOG_SOURCES ?= $(SYNTH_NETLIST_VERILOG) $(HDL_DIR)/smaesh_hpc.sv
5353
# TOPLEVEL is the name of the toplevel module in your Verilog or VHDL file
54-
export TOPLEVEL ?= smaesh_hpc
54+
export COCOTB_TOPLEVEL ?= smaesh_hpc
5555
# MODULE is the basename of the Python test file
56-
export MODULE ?= matchi_simu
56+
export COCOTB_TEST_MODULES ?= matchi_simu
5757
# Logging level
5858
export COCOTB_LOG_LEVEL ?= INFO
5959
# Results
@@ -90,7 +90,7 @@ $(MATCHI_SUCCESS): $(BEH_SIMU_VCD)
9090
$(MATCHI_BIN) \
9191
--json $(SYNTH_NETLIST_JSON) \
9292
--vcd $(BEH_SIMU_VCD) \
93-
--dut top.smaesh_hpc.aes_core \
93+
--dut smaesh_hpc.aes_core \
9494
--gname $(SYNTH_MAIN_MODULE) \
9595
--output-vcd $(MATCHI_VCD) > $(MATCHI_LOG) 2> $(MATCHI_LOG).error && touch $(MATCHI_SUCCESS) || exit 1
9696

formal_verif/synth.tcl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ yosys hierarchy -check -libdir $IMPLEM_DIR -top $MAIN_MODULE
1515

1616
# Remove verilog high-level constructs, in favor of netlists
1717
yosys proc;
18+
#
19+
yosys pmuxtree
1820
# Map yosys RTL library to yosys Gate library.
1921
yosys techmap
2022
# Map gates to our "matchi_cells" library.
@@ -30,7 +32,7 @@ yosys proc
3032
yosys hierarchy -check -top $MAIN_MODULE
3133

3234
# Output the result in verilog (for simulation) and json (for analysis).
33-
yosys write_json $OUT_DIR/${MAIN_MODULE}_synth.json
35+
yosys write_json -noscopeinfo $OUT_DIR/${MAIN_MODULE}_synth.json
3436

3537
yosys write_verilog -norename $OUT_DIR/${MAIN_MODULE}_synth.v;
3638
yosys write_verilog -noattr -norename $OUT_DIR/${MAIN_MODULE}_synth_noattr.v;

func_tests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export SIM_BUILD ?= $(WORK_CASE)
2121
export VERILOG_INCLUDE_DIRS?= $(RTL_DIR_HDL)
2222
export VERILOG_SOURCES ?= $(RTL_DIR_HDL)/*.v $(RTL_DIR_HDL)/*.sv
2323
# TOPLEVEL is the name of the toplevel module in your Verilog or VHDL file
24-
export TOPLEVEL ?= smaesh_hpc
24+
export COCOTB_TOPLEVEL ?= smaesh_hpc
2525
# MODULE is the basename of the Python test file
26-
export MODULE ?= functionnal_tests
26+
export COCOTB_TEST_MODULES ?= functionnal_tests
2727
# Logging level
2828
export COCOTB_LOG_LEVEL ?= INFO
2929
# Results

func_tests/functionnal_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async def svrs_output_data_transaction(dut):
146146
dut.out_ready.value = 1
147147
# Wait for falling
148148
await wait_signal_asserted(dut,dut.out_valid)
149-
out_shares_data_int = int(dut.out_shares_data)
149+
out_shares_data_int = int(dut.out_shares_data.value)
150150
# End transaction by waiting till the next Rising edged and clearing
151151
# input signal
152152
await RisingEdge(dut.clk)
@@ -243,8 +243,8 @@ async def KSU_features_TEMPLATE(dut, case, inverse:bool, repeat, nshares):
243243
class SyncMonitor:
244244
def __init__(self,
245245
logger,
246-
clk: cocotb.handle.ModifiableObject,
247-
sigs: list[cocotb.handle.ModifiableObject],
246+
clk,
247+
sigs,
248248
description= "Monitor"
249249
):
250250
self.description = description
@@ -271,7 +271,7 @@ async def run(self):
271271
# Generator of clock, with feature to stop the clock generation
272272
# and counter for the clock cycle generated
273273
class ClockGenerator:
274-
def __init__(self, clk: cocotb.handle.ModifiableObject, ncycles=None, units="ns", period=2):
274+
def __init__(self, clk, ncycles=None, units="ns", period=2):
275275
self.clk = clk
276276
self.ncycles = ncycles
277277
self.units=units

func_tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
cocotb
22
numpy
33
cryptography
4+
pytest

0 commit comments

Comments
 (0)