[source]

Module prim_prince

DataWidthKeyWidthNumRoundsHalfUseOldKeySchedHalfwayDataRegHalfwayKeyRegclk_ilogicrst_nilogicvalid_ilogicdata_i[DataWidth-1:0]logickey_i[KeyWidth-1:0]logicdec_ilogicvalid_ologicdata_ologic[DataWidth-1:0]

Block Diagram of prim_prince

This module is an implementation of the 64bit PRINCE block cipher. It is a fully unrolled combinational implementation with configurable number of rounds. Optionally, registers for the data and key states can be enabled, if this is required. Due to the reflective construction of this cipher, the same circuit can be used for encryption and decryption, as described below. Further, the primitive supports a 32bit block cipher flavor which is not specified in the original paper. It should be noted, however, that the 32bit version is * not * secure and must not be used in a setting where cryptographic cipher strength is required. The 32bit variant is only intended to be used as a lightweight data scrambling device.

See also

prim_present, prim_cipher_pkg

References

Parameters

Name

Default

Description

DataWidth

64

KeyWidth

128

NumRoundsHalf

5

The construction is reflective. Total number of rounds is 2*NumRoundsHalf + 2

UseOldKeySched

1'b0

This primitive uses the new key schedule proposed in https://eprint.iacr.org/2014/656.pdf Setting this parameter to 1 falls back to the original key schedule.

HalfwayDataReg

1'b0

This instantiates a data register halfway in the primitive.

HalfwayKeyReg

1'b0

This instantiates a key register halfway in the primitive.

Ports

Name

Type

Direction

Description

clk_i

wire logic

input

rst_ni

wire logic

input

valid_i

wire logic

input

data_i

wire logic [DataWidth - 1 : 0]

input

key_i

wire logic [KeyWidth - 1 : 0]

input

dec_i

wire logic

input

set to 1 for decryption

valid_o

var logic

output

data_o

var logic [DataWidth - 1 : 0]

output

Assertions

Name

Kind

Description

prim_prince.SupportedWidths_A

immediate assert

////////////// assertions // //////////////

(((DataWidth == 64) && (KeyWidth == 128)) || ((DataWidth == 32) && (KeyWidth == 64)))

prim_prince.SupportedNumRounds_A

immediate assert

((NumRoundsHalf > 0) && (NumRoundsHalf < 6))

Always Blocks

always_comb @()

pre-round XOR

always_comb @()

post-rounds