Skip to main content

Module shells_and_benchmarks

Module shells_and_benchmarks 

Source
Expand description

AXI kernel, benchmark engines, register maps, and traffic behavior.

§AXI Shells and Benchmark Logic

The cryptographic core exposes simple ready/valid signals. Vitis needs AXI-Lite control and AXI memory masters, while a focused on-chip benchmark needs a deterministic request generator. The modules here provide those roles; they do not change Ed25519 arithmetic.

§fast64_cached_sign_io_kernel

Source: bench/rhdl/rtl/fast64_cached_sign_io_kernel.sv.

This is the current deployment wrapper around fast64_cached_sign_core. It has one AXI4-Lite slave and four independent 512-bit AXI4 memory masters.

§Parameters

ParameterDefaultMeaning
C_S_AXI_CONTROL_ADDR_WIDTH7AXI-Lite control address width
C_S_AXI_CONTROL_DATA_WIDTH32AXI-Lite data width; the register logic assumes 32 bits
C_M_AXI_GMEM0_ADDR_WIDTH64Message-master address width
C_M_AXI_GMEM0_DATA_WIDTH512Message-master data width; the datapath assumes one 64-byte message per beat
C_M_AXI_GMEM0_ID_WIDTH1Message-master AXI ID width
C_M_AXI_GMEM1_ADDR_WIDTH64Key/command-master address width
C_M_AXI_GMEM1_DATA_WIDTH512Key/command-master data width
C_M_AXI_GMEM1_ID_WIDTH1Key/command-master AXI ID width
C_M_AXI_GMEM2_ADDR_WIDTH64Signature-master address width
C_M_AXI_GMEM2_DATA_WIDTH512Signature-master data width; one signature occupies one beat
C_M_AXI_GMEM2_ID_WIDTH1Signature-master AXI ID width
C_M_AXI_GMEM3_ADDR_WIDTH64Summary-master address width
C_M_AXI_GMEM3_DATA_WIDTH512Summary-master data width; all counters occupy one beat
C_M_AXI_GMEM3_ID_WIDTH1Summary-master AXI ID width

The current RTL drives ARSIZE/AWSIZE=6, meaning 64-byte transfers. Changing a data-width parameter without changing the state machines and size constants is unsupported.

§Clock, reset, and interrupt ports

PortDirectionMeaning
ap_clkinputKernel and core clock
ap_rst_ninputActive-low shell reset, inverted to active-high areset internally
interruptoutputGlobal-enable AND enabled interrupt-status bits

§AXI-Lite control ports

ChannelPortsBehavior
Write addresss_axi_control_AWVALID, AWREADY, AWADDRAddress is retained independently until write data is also present
Write datas_axi_control_WVALID, WREADY, WDATA, WSTRBByte strobes produce a 32-bit write mask
Write responses_axi_control_BVALID, BREADY, BRESPReturns AXI OKAY; protocol errors are not separately encoded here
Read addresss_axi_control_ARVALID, ARREADY, ARADDRAccepts one outstanding register read
Read datas_axi_control_RVALID, RREADY, RDATA, RRESPReturns AXI OKAY; reading control clears the latched done bit

The table omits the repeated s_axi_control_ prefix after the first name but names every signal suffix present in the module.

§AXI memory-master ports

For each m_axi_gmemN master, the complete port contract is:

AXI channelOutputs from kernelInputs to kernel
Write addressAWVALID, AWADDR, AWID, AWLEN, AWSIZE, AWBURST, AWLOCK, AWCACHE, AWPROT, AWQOS, AWREGIONAWREADY
Write dataWVALID, WDATA, WSTRB, WLASTWREADY
Write responseBREADYBVALID, BRESP, BID
Read addressARVALID, ARADDR, ARID, ARLEN, ARSIZE, ARBURST, ARLOCK, ARCACHE, ARPROT, ARQOS, ARREGIONARREADY
Read dataRREADYRVALID, RDATA, RLAST, RID, RRESP

The prefix identifies purpose:

MasterActive directionPurpose
m_axi_gmem0Read onlyRead one 512-bit message at messages + tag*stride_lines*64
m_axi_gmem1Read onlyRead the 32-byte key seed in the low half of one command beat
m_axi_gmem2Write onlyWrite one signature beat at signatures + tag*64
m_axi_gmem3Write onlyWrite one summary beat at the configured summary pointer

Unused channel directions are tied inactive; response/read inputs on those directions are reduced into unused_inputs to suppress lint warnings.

All active transfers are single-beat incrementing bursts with LEN=0, SIZE=6, BURST=INCR, ID zero, cache value 0011, and no protection, QoS, or region override.

§Operation constants

ConstantValueMeaning
OP_SIGN_WARM2Sign batch fixed-64 messages using the cached key
OP_LOAD_CACHED_KEY4Clear the old key, read one seed beat, expand it, and retain the new key
OP_CLEAR_CACHED_KEY5Clear the key without reading memory
DUMMY_TAG0xffffInternal tag for an odd-batch padding request; never written as a signature

§Control register map

Local parameter/addressRegister
ADDR_AP_CTRL / 0x00Start, done, idle, ready, and auto-restart bits
ADDR_GIE / 0x04Global interrupt enable
ADDR_IER / 0x08Interrupt enables
ADDR_ISR / 0x0cToggle-on-write interrupt status
ADDR_MESSAGES_LO, ADDR_MESSAGES_HI / 0x10, 0x1464-bit message base address
ADDR_COMMANDS_LO, ADDR_COMMANDS_HI / 0x1c, 0x2064-bit key/command base address
ADDR_RESULTS_LO, ADDR_RESULTS_HI / 0x28, 0x2c64-bit signature base address
ADDR_COUNTERS_LO, ADDR_COUNTERS_HI / 0x34, 0x3864-bit summary destination
ADDR_STRIDE_LO, ADDR_STRIDE_HI / 0x40, 0x44Message stride measured in 64-byte lines
ADDR_MSG_LEN_LO, ADDR_MSG_LEN_HI / 0x4c, 0x50Message length; warm sign requires exactly 64
ADDR_BATCH / 0x58Number of real signatures requested, limited to 65,535 by 16-bit tags
ADDR_OPERATION / 0x60One of the operation constants above

arg_* registers are software-visible. They are copied into run_* registers when start is accepted so software writes cannot alter an active command.

§Run-state machine

StateFunction
RUN_IDLEAccept a control start
RUN_VALIDATEValidate operation, key availability, message length, stride, and batch
RUN_KEY_CLEARPulse core clear_key; continue to read for load or finish for clear
RUN_KEY_ARIssue one key read address on gmem1
RUN_KEY_RCapture seed and check RLAST/RRESP
RUN_KEY_LOADHold core load-key valid until accepted
RUN_KEY_WAITWait for hardware SHA, scalar clamp, point multiplication, and compression
RUN_SIGNRun message reader, core, completion FIFO, and signature writer concurrently
RUN_SUMMARY_AWIssue summary write address on gmem3
RUN_SUMMARY_WTransfer the 512-bit summary
RUN_SUMMARY_BWait for summary write response
RUN_DONEPulse the Vitis done condition and return idle

The message sub-FSM is MSG_IDLE, MSG_AR, MSG_R, and MSG_HOLD. It issues one read only when fewer than 64 core contexts are reserved, captures the beat, and holds it until the core ready/valid handshake. For odd batches it injects one zero-message dummy so the paired compressor cannot strand a final real point.

The signature writer sub-FSM is WR_IDLE, WR_AW, WR_W, and WR_B. A 64-entry 528-bit completion FIFO stores {tag,signature} because the core has no output backpressure. A context remains reserved until its AXI write response arrives, or until an internal dummy result retires.

§Summary word

BitsField
63:0payload_cycles from command start through final retirement
127:64core_window_cycles from first core input through last real core output
191:128output_span_cycles between first and last real outputs
255:192key_load_cycles
319:256message_read_beats
383:320key_read_beats
447:384signature_write_beats
479:448completed signature write responses
480Core key-loaded flag
481Internal error, including core error
482AXI response error
483Framing/tag/protocol error
484Invalid command argument
491:485Completion FIFO high-water mark
498:492Maximum reserved contexts

§fast64_cached_sign_benchmark_engine

Source: bench/rhdl/rtl/fast64_cached_sign_benchmark_engine.sv.

This parameterless on-chip benchmark loads a fixed seed, generates messages, feeds the cached core, and XORs all signatures. It measures core cycles without AXI message/signature traffic.

§Ports

Inputs clk, rst, start, and 32-bit batch control a run. Outputs busy, done, sent, received, cycle_count, key_load_cycles, first_output_cycle, output_span, public_key, signature_checksum, and internal_error expose progress and validation data.

§deterministic_message

The function accepts 32-bit vector. For each of 64 output bytes it selects one byte of vector according to byte_index mod 4, then adds 3*byte_index modulo 256. Tests reproduce the same mapping in Rust/Dalek.

The engine uses seed bytes 00,01,...,1f in the low-to-high packed order. It records the first cycle at which key_loaded is seen, then continuously offers messages while sent < batch. Every returned signature is XORed into a 512-bit checksum. output_span is last-output cycle minus first-output cycle.

§fast64_benchmark_kernel

Source: bench/rhdl/rtl/fast64_benchmark_kernel.sv.

This AXI-Lite-only Vitis wrapper instantiates fast64_cached_sign_benchmark_engine. It has no external-memory master and is for focused throughput/cycle measurement.

§Parameters and ports

C_S_AXI_CONTROL_ADDR_WIDTH defaults to 8 and sizes AWADDR/ARADDR. C_S_AXI_CONTROL_DATA_WIDTH defaults to 32 and sizes WDATA, WSTRB, and RDATA. Ports are ap_clk, active-low ap_rst_n, interrupt, and the same AXI-Lite channel signals documented for the I/O kernel.

Its address constants are ADDR_AP_CTRL, ADDR_GIE, ADDR_IER, ADDR_ISR, ADDR_BATCH, ADDR_CYCLES, ADDR_SPAN, ADDR_SENT, ADDR_RECEIVED, ADDR_PUBLIC_CHECKSUM, ADDR_SIGNATURE_CHECKSUM, ADDR_KEY_LOAD_CYCLES, and ADDR_INTERNAL_ERROR. The public-key and signature checksums occupy consecutive 32-bit words beginning at their base addresses.

§Legacy fast64_sign_benchmark_engine

Source: bench/rhdl/rtl/fast64_sign_benchmark_engine.sv.

This engine drives fast64_sign_core, not the active cached core.

§Parameters

ParameterDefaultMeaning
CONTEXTS64Context count passed to the legacy signer
CONTEXT_BITS6Context index width passed to the legacy signer
FIXED_KEY0When nonzero, every vector uses seed vector zero; otherwise each tag gets a different deterministic seed

Its ports are clk, rst, start, batch, busy, done, sent, received, cycle_count, first_output_cycle, output_span, public_key_checksum, and signature_checksum.

§Helper functions

§deterministic_seed

Input vector is 32 bits. The function produces 32 bytes; byte i is vector[7:0]*71 + i modulo 256. With FIXED_KEY enabled, the caller supplies zero as vector, so every request receives the same seed.

§deterministic_message

Input vector is 32 bits. This function is identical to the cached benchmark function: it cycles through the four vector bytes and adds three times the byte index. Returned public keys and signatures are XORed into their respective checksums.