Module Definition
dashboard | hierarchy | modlist | groups | tests | asserts



Module Instance : tb.dut.u_prim_ram_1p_scr.gen_addr_scr.u_prim_subst_perm

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
99.53 98.11 100.00 100.00 100.00 u_prim_ram_1p_scr


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
no children



Module Instance : tb.dut.u_prim_ram_1p_scr.gen_diffuse_data[0].u_prim_subst_perm_enc

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
99.53 98.11 100.00 100.00 100.00 u_prim_ram_1p_scr


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
no children



Module Instance : tb.dut.u_prim_ram_1p_scr.gen_diffuse_data[0].u_prim_subst_perm_dec

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
99.53 98.11 100.00 100.00 100.00 u_prim_ram_1p_scr


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
no children

Line Coverage for Module : prim_subst_perm ( parameter DataWidth=15,NumRounds=2,Decrypt=0 )
Line Coverage for Module self-instances :
SCORELINE
100.00 100.00
tb.dut.u_prim_ram_1p_scr.gen_addr_scr.u_prim_subst_perm

Line No.TotalCoveredPercent
TOTAL2222100.00
CONT_ASSIGN3511100.00
ALWAYS641010100.00
ALWAYS641010100.00
CONT_ASSIGN9011100.00

34 // initialize 35 1/1 assign data_state[0] = data_i; Tests: T1 T2 T3  36 37 for (genvar r = 0; r < NumRounds; r++) begin : gen_round 38 logic [DataWidth-1:0] data_state_sbox, data_state_flipped; 39 //////////////////////////////// 40 // decryption pass, performs inverse permutation and sbox 41 if (Decrypt) begin : gen_dec 42 always_comb begin : p_dec 43 data_state_sbox = data_state[r] ^ key_i; 44 // Reverse odd/even grouping 45 data_state_flipped = data_state_sbox; 46 for (int k = 0; k < DataWidth/2; k++) begin 47 data_state_flipped[k * 2] = data_state_sbox[k]; 48 data_state_flipped[k * 2 + 1] = data_state_sbox[k + DataWidth/2]; 49 end 50 // Flip vector 51 for (int k = 0; k < DataWidth; k++) begin 52 data_state_sbox[DataWidth - 1 - k] = data_state_flipped[k]; 53 end 54 // Inverse SBox layer 55 for (int k = 0; k < DataWidth/4; k++) begin 56 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4_INV[data_state_sbox[k*4 +: 4]]; 57 end 58 data_state[r + 1] = data_state_sbox; 59 end 60 //////////////////////////////// 61 // encryption pass 62 end else begin : gen_enc 63 always_comb begin : p_enc 64 1/1 data_state_sbox = data_state[r] ^ key_i; Tests: T1 T2 T3  65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 1/1 for (int k = 0; k < DataWidth/4; k++) begin Tests: T1 T2 T3  69 1/1 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; Tests: T1 T2 T3  70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 1/1 for (int k = 0; k < DataWidth; k++) begin Tests: T1 T2 T3  73 1/1 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; Tests: T1 T2 T3  74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 1/1 data_state_sbox = data_state_flipped; Tests: T1 T2 T3  79 1/1 for (int k = 0; k < DataWidth/2; k++) begin Tests: T1 T2 T3  80 1/1 data_state_sbox[k] = data_state_flipped[k * 2]; Tests: T1 T2 T3  81 1/1 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; Tests: T1 T2 T3  82 end 83 1/1 data_state[r + 1] = data_state_sbox; Tests: T1 T2 T3  ***repeat 1 64 1/1 data_state_sbox = data_state[r] ^ key_i; Tests: T1 T2 T3  65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 1/1 for (int k = 0; k < DataWidth/4; k++) begin Tests: T1 T2 T3  69 1/1 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; Tests: T1 T2 T3  70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 1/1 for (int k = 0; k < DataWidth; k++) begin Tests: T1 T2 T3  73 1/1 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; Tests: T1 T2 T3  74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 1/1 data_state_sbox = data_state_flipped; Tests: T1 T2 T3  79 1/1 for (int k = 0; k < DataWidth/2; k++) begin Tests: T1 T2 T3  80 1/1 data_state_sbox[k] = data_state_flipped[k * 2]; Tests: T1 T2 T3  81 1/1 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; Tests: T1 T2 T3  82 end 83 1/1 data_state[r + 1] = data_state_sbox; Tests: T1 T2 T3  84 end 85 end // gen_enc 86 //////////////////////////////// 87 end // gen_round 88 89 // finalize 90 1/1 assign data_o = data_state[NumRounds] ^ key_i; Tests: T1 T2 T3 

Line Coverage for Module : prim_subst_perm ( parameter DataWidth=39,NumRounds=0,Decrypt=0 + DataWidth=39,NumRounds=0,Decrypt=1 )
Line Coverage for Module self-instances :
SCORELINE
100.00 100.00
tb.dut.u_prim_ram_1p_scr.gen_diffuse_data[0].u_prim_subst_perm_enc

SCORELINE
100.00 100.00
tb.dut.u_prim_ram_1p_scr.gen_diffuse_data[0].u_prim_subst_perm_dec

Line No.TotalCoveredPercent
TOTAL22100.00
CONT_ASSIGN3511100.00
CONT_ASSIGN9011100.00

34 // initialize 35 1/1 assign data_state[0] = data_i; Tests: T1 T2 T3  36 37 for (genvar r = 0; r < NumRounds; r++) begin : gen_round 38 logic [DataWidth-1:0] data_state_sbox, data_state_flipped; 39 //////////////////////////////// 40 // decryption pass, performs inverse permutation and sbox 41 if (Decrypt) begin : gen_dec 42 always_comb begin : p_dec 43 data_state_sbox = data_state[r] ^ key_i; 44 // Reverse odd/even grouping 45 data_state_flipped = data_state_sbox; 46 for (int k = 0; k < DataWidth/2; k++) begin 47 data_state_flipped[k * 2] = data_state_sbox[k]; 48 data_state_flipped[k * 2 + 1] = data_state_sbox[k + DataWidth/2]; 49 end 50 // Flip vector 51 for (int k = 0; k < DataWidth; k++) begin 52 data_state_sbox[DataWidth - 1 - k] = data_state_flipped[k]; 53 end 54 // Inverse SBox layer 55 for (int k = 0; k < DataWidth/4; k++) begin 56 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4_INV[data_state_sbox[k*4 +: 4]]; 57 end 58 data_state[r + 1] = data_state_sbox; 59 end 60 //////////////////////////////// 61 // encryption pass 62 end else begin : gen_enc 63 always_comb begin : p_enc 64 data_state_sbox = data_state[r] ^ key_i; 65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 for (int k = 0; k < DataWidth/4; k++) begin 69 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; 70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 for (int k = 0; k < DataWidth; k++) begin 73 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; 74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 data_state_sbox = data_state_flipped; 79 for (int k = 0; k < DataWidth/2; k++) begin 80 data_state_sbox[k] = data_state_flipped[k * 2]; 81 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; 82 end 83 data_state[r + 1] = data_state_sbox; 84 end 85 end // gen_enc 86 //////////////////////////////// 87 end // gen_round 88 89 // finalize 90 1/1 assign data_o = data_state[NumRounds] ^ key_i; Tests: T1 T2 T3 
Line Coverage for Instance : tb.dut.u_prim_ram_1p_scr.gen_addr_scr.u_prim_subst_perm
Line No.TotalCoveredPercent
TOTAL2222100.00
CONT_ASSIGN3511100.00
ALWAYS641010100.00
ALWAYS641010100.00
CONT_ASSIGN9011100.00

34 // initialize 35 1/1 assign data_state[0] = data_i; Tests: T1 T2 T3  36 37 for (genvar r = 0; r < NumRounds; r++) begin : gen_round 38 logic [DataWidth-1:0] data_state_sbox, data_state_flipped; 39 //////////////////////////////// 40 // decryption pass, performs inverse permutation and sbox 41 if (Decrypt) begin : gen_dec 42 always_comb begin : p_dec 43 data_state_sbox = data_state[r] ^ key_i; 44 // Reverse odd/even grouping 45 data_state_flipped = data_state_sbox; 46 for (int k = 0; k < DataWidth/2; k++) begin 47 data_state_flipped[k * 2] = data_state_sbox[k]; 48 data_state_flipped[k * 2 + 1] = data_state_sbox[k + DataWidth/2]; 49 end 50 // Flip vector 51 for (int k = 0; k < DataWidth; k++) begin 52 data_state_sbox[DataWidth - 1 - k] = data_state_flipped[k]; 53 end 54 // Inverse SBox layer 55 for (int k = 0; k < DataWidth/4; k++) begin 56 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4_INV[data_state_sbox[k*4 +: 4]]; 57 end 58 data_state[r + 1] = data_state_sbox; 59 end 60 //////////////////////////////// 61 // encryption pass 62 end else begin : gen_enc 63 always_comb begin : p_enc 64 1/1 data_state_sbox = data_state[r] ^ key_i; Tests: T1 T2 T3  65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 1/1 for (int k = 0; k < DataWidth/4; k++) begin Tests: T1 T2 T3  69 1/1 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; Tests: T1 T2 T3  70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 1/1 for (int k = 0; k < DataWidth; k++) begin Tests: T1 T2 T3  73 1/1 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; Tests: T1 T2 T3  74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 1/1 data_state_sbox = data_state_flipped; Tests: T1 T2 T3  79 1/1 for (int k = 0; k < DataWidth/2; k++) begin Tests: T1 T2 T3  80 1/1 data_state_sbox[k] = data_state_flipped[k * 2]; Tests: T1 T2 T3  81 1/1 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; Tests: T1 T2 T3  82 end 83 1/1 data_state[r + 1] = data_state_sbox; Tests: T1 T2 T3  ***repeat 1 64 1/1 data_state_sbox = data_state[r] ^ key_i; Tests: T1 T2 T3  65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 1/1 for (int k = 0; k < DataWidth/4; k++) begin Tests: T1 T2 T3  69 1/1 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; Tests: T1 T2 T3  70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 1/1 for (int k = 0; k < DataWidth; k++) begin Tests: T1 T2 T3  73 1/1 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; Tests: T1 T2 T3  74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 1/1 data_state_sbox = data_state_flipped; Tests: T1 T2 T3  79 1/1 for (int k = 0; k < DataWidth/2; k++) begin Tests: T1 T2 T3  80 1/1 data_state_sbox[k] = data_state_flipped[k * 2]; Tests: T1 T2 T3  81 1/1 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; Tests: T1 T2 T3  82 end 83 1/1 data_state[r + 1] = data_state_sbox; Tests: T1 T2 T3  84 end 85 end // gen_enc 86 //////////////////////////////// 87 end // gen_round 88 89 // finalize 90 1/1 assign data_o = data_state[NumRounds] ^ key_i; Tests: T1 T2 T3 
Line Coverage for Instance : tb.dut.u_prim_ram_1p_scr.gen_diffuse_data[0].u_prim_subst_perm_enc
Line No.TotalCoveredPercent
TOTAL22100.00
CONT_ASSIGN3511100.00
CONT_ASSIGN9011100.00

34 // initialize 35 1/1 assign data_state[0] = data_i; Tests: T1 T2 T3  36 37 for (genvar r = 0; r < NumRounds; r++) begin : gen_round 38 logic [DataWidth-1:0] data_state_sbox, data_state_flipped; 39 //////////////////////////////// 40 // decryption pass, performs inverse permutation and sbox 41 if (Decrypt) begin : gen_dec 42 always_comb begin : p_dec 43 data_state_sbox = data_state[r] ^ key_i; 44 // Reverse odd/even grouping 45 data_state_flipped = data_state_sbox; 46 for (int k = 0; k < DataWidth/2; k++) begin 47 data_state_flipped[k * 2] = data_state_sbox[k]; 48 data_state_flipped[k * 2 + 1] = data_state_sbox[k + DataWidth/2]; 49 end 50 // Flip vector 51 for (int k = 0; k < DataWidth; k++) begin 52 data_state_sbox[DataWidth - 1 - k] = data_state_flipped[k]; 53 end 54 // Inverse SBox layer 55 for (int k = 0; k < DataWidth/4; k++) begin 56 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4_INV[data_state_sbox[k*4 +: 4]]; 57 end 58 data_state[r + 1] = data_state_sbox; 59 end 60 //////////////////////////////// 61 // encryption pass 62 end else begin : gen_enc 63 always_comb begin : p_enc 64 data_state_sbox = data_state[r] ^ key_i; 65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 for (int k = 0; k < DataWidth/4; k++) begin 69 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; 70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 for (int k = 0; k < DataWidth; k++) begin 73 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; 74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 data_state_sbox = data_state_flipped; 79 for (int k = 0; k < DataWidth/2; k++) begin 80 data_state_sbox[k] = data_state_flipped[k * 2]; 81 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; 82 end 83 data_state[r + 1] = data_state_sbox; 84 end 85 end // gen_enc 86 //////////////////////////////// 87 end // gen_round 88 89 // finalize 90 1/1 assign data_o = data_state[NumRounds] ^ key_i; Tests: T1 T2 T3 
Line Coverage for Instance : tb.dut.u_prim_ram_1p_scr.gen_diffuse_data[0].u_prim_subst_perm_dec
Line No.TotalCoveredPercent
TOTAL22100.00
CONT_ASSIGN3511100.00
CONT_ASSIGN9011100.00

34 // initialize 35 1/1 assign data_state[0] = data_i; Tests: T1 T2 T3  36 37 for (genvar r = 0; r < NumRounds; r++) begin : gen_round 38 logic [DataWidth-1:0] data_state_sbox, data_state_flipped; 39 //////////////////////////////// 40 // decryption pass, performs inverse permutation and sbox 41 if (Decrypt) begin : gen_dec 42 always_comb begin : p_dec 43 data_state_sbox = data_state[r] ^ key_i; 44 // Reverse odd/even grouping 45 data_state_flipped = data_state_sbox; 46 for (int k = 0; k < DataWidth/2; k++) begin 47 data_state_flipped[k * 2] = data_state_sbox[k]; 48 data_state_flipped[k * 2 + 1] = data_state_sbox[k + DataWidth/2]; 49 end 50 // Flip vector 51 for (int k = 0; k < DataWidth; k++) begin 52 data_state_sbox[DataWidth - 1 - k] = data_state_flipped[k]; 53 end 54 // Inverse SBox layer 55 for (int k = 0; k < DataWidth/4; k++) begin 56 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4_INV[data_state_sbox[k*4 +: 4]]; 57 end 58 data_state[r + 1] = data_state_sbox; 59 end 60 //////////////////////////////// 61 // encryption pass 62 end else begin : gen_enc 63 always_comb begin : p_enc 64 data_state_sbox = data_state[r] ^ key_i; 65 // This SBox layer is aligned to nibbles, so the uppermost bits may not be affected by this. 66 // However, the permutation below ensures that these bits get shuffled to a different 67 // position when performing multiple rounds. 68 for (int k = 0; k < DataWidth/4; k++) begin 69 data_state_sbox[k*4 +: 4] = prim_cipher_pkg::PRESENT_SBOX4[data_state_sbox[k*4 +: 4]]; 70 end 71 // Flip the vector to move the MSB positions into the LSB positions 72 for (int k = 0; k < DataWidth; k++) begin 73 data_state_flipped[DataWidth - 1 - k] = data_state_sbox[k]; 74 end 75 // Regroup bits such that all even indices are stacked up first, followed by all odd 76 // indices. Note that if the Width is odd, this is still ok, since 77 // the uppermost bit just stays in place in that case. 78 data_state_sbox = data_state_flipped; 79 for (int k = 0; k < DataWidth/2; k++) begin 80 data_state_sbox[k] = data_state_flipped[k * 2]; 81 data_state_sbox[k + DataWidth/2] = data_state_flipped[k * 2 + 1]; 82 end 83 data_state[r + 1] = data_state_sbox; 84 end 85 end // gen_enc 86 //////////////////////////////// 87 end // gen_round 88 89 // finalize 90 1/1 assign data_o = data_state[NumRounds] ^ key_i; Tests: T1 T2 T3 
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%