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



Module Instance : tb.dut.u_lc_ctrl_kmac_if

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
100.00 100.00 100.00 100.00 100.00 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
99.37 99.10 100.00 100.00 97.73 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
93.32 100.00 82.35 99.89 100.00 84.38 dut


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
u_prim_flop_2sync 100.00 100.00 100.00
u_prim_sync_reqack_data_in 98.41 98.18 100.00 95.45 100.00
u_state_regs 100.00 100.00 100.00 100.00


Since this is the module's only instance, the coverage report is the same as for the module.
Line Coverage for Module : lc_ctrl_kmac_if
Line No.TotalCoveredPercent
TOTAL4141100.00
CONT_ASSIGN4411100.00
CONT_ASSIGN8111100.00
ALWAYS8888100.00
CONT_ASSIGN10211100.00
CONT_ASSIGN10311100.00
CONT_ASSIGN10411100.00
CONT_ASSIGN10711100.00
ALWAYS1592121100.00
ALWAYS20333100.00
ALWAYS20633100.00

43 lc_token_t kmac_transition_token; 44 1/1 assign kmac_transition_token = transition_token_i; Tests: T1 T2 T3  45 46 // SRC domain cannot change data while waiting for ACK. 47 `ASSERT(DataStable_A, token_hash_req_i && !token_hash_ack_o |-> $stable(transition_token_i)) 48 49 // Second synchronizer instance for handshake and return data synchronization. 50 logic kmac_req, kmac_ack; 51 logic token_hash_req; 52 logic token_hash_ack_d, token_hash_ack_q; 53 logic token_hash_err_q, token_hash_err_d; 54 lc_token_t hashed_token_q, hashed_token_d; 55 prim_sync_reqack_data #( 56 // Token + Error bit 57 .Width (LcTokenWidth + 1), 58 .DataSrc2Dst(1'b0), 59 // This instantiates a data register 60 // on the destination side. 61 .DataReg (1'b1) 62 ) u_prim_sync_reqack_data_in ( 63 .clk_src_i ( clk_i ), 64 .rst_src_ni ( rst_ni ), 65 .clk_dst_i ( clk_kmac_i ), 66 .rst_dst_ni ( rst_kmac_ni ), 67 .req_chk_i ( token_hash_req_chk_i ), 68 .src_req_i ( token_hash_req ), 69 .src_ack_o ( token_hash_ack_d ), 70 .dst_req_o ( kmac_req ), 71 .dst_ack_i ( kmac_ack ), 72 // Truncate hash to 128bit and remove masking (not required here). 73 .data_i ( {kmac_data_i.error, 74 kmac_data_i.digest_share0[LcTokenWidth-1:0] ^ 75 kmac_data_i.digest_share1[LcTokenWidth-1:0]} ), 76 .data_o ( {token_hash_err_d, 77 hashed_token_d} ) 78 ); 79 80 logic unused_sigs; 81 1/1 assign unused_sigs = ^{ Tests: T1 T2 T3  82 kmac_data_i.digest_share0[LcTokenWidth +: (kmac_pkg::AppDigestW - LcTokenWidth)], 83 kmac_data_i.digest_share1[LcTokenWidth +: (kmac_pkg::AppDigestW - LcTokenWidth)] 84 }; 85 86 // Hashed Token Register Running on LC Clock 87 always_ff @(posedge clk_i or negedge rst_ni) begin : p_lc_regs 88 1/1 if (!rst_ni) begin Tests: T1 T2 T3  89 1/1 token_hash_ack_q <= 1'b0; Tests: T1 T2 T3  90 1/1 token_hash_err_q <= 1'b0; Tests: T1 T2 T3  91 1/1 hashed_token_q <= {LcTokenWidth{1'b1}}; Tests: T1 T2 T3  92 end else begin 93 1/1 token_hash_ack_q <= token_hash_ack_d; Tests: T1 T2 T3  94 // Latch synchronized token and error bit 95 1/1 if (token_hash_req_i && token_hash_ack_d) begin Tests: T1 T2 T3  96 1/1 token_hash_err_q <= token_hash_err_d; Tests: T1 T2 T3  97 1/1 hashed_token_q <= hashed_token_d; Tests: T1 T2 T3  98 end MISSING_ELSE 99 end 100 end 101 102 1/1 assign token_hash_ack_o = token_hash_ack_q; Tests: T1 T2 T3  103 1/1 assign token_hash_err_o = token_hash_err_q; Tests: T1 T2 T3  104 1/1 assign hashed_token_o = hashed_token_q; Tests: T1 T2 T3  105 106 // Stop requesting tokens upon latching on LC side. 107 1/1 assign token_hash_req = token_hash_req_i & ~token_hash_ack_q; Tests: T1 T2 T3  108 109 // Need to synchronize this error signal separately. 110 logic kmac_fsm_err_d, kmac_fsm_err_q; 111 prim_flop_2sync #( 112 .Width(1), 113 .ResetValue(0) 114 ) u_prim_flop_2sync ( 115 .clk_i, 116 .rst_ni, 117 .d_i(kmac_fsm_err_q), 118 .q_o(token_if_fsm_err_o) 119 ); 120 121 ///////////////////////////////////////////// 122 // Serialization FSM Running on KMAC Clock // 123 ///////////////////////////////////////////// 124 125 // SEC_CM: KMAC.FSM.SPARSE 126 // Encoding generated with: 127 // $ ./util/design/sparse-fsm-encode.py -d 5 -m 4 -n 8 \ 128 // -s 3343913945 --language=sv 129 // 130 // Hamming distance histogram: 131 // 132 // 0: -- 133 // 1: -- 134 // 2: -- 135 // 3: -- 136 // 4: -- 137 // 5: |||||||||||||||||||| (66.67%) 138 // 6: |||||||||| (33.33%) 139 // 7: -- 140 // 8: -- 141 // 142 // Minimum Hamming distance: 5 143 // Maximum Hamming distance: 6 144 // Minimum Hamming weight: 2 145 // Maximum Hamming weight: 6 146 // 147 localparam int StateWidth = 8; 148 typedef enum logic [StateWidth-1:0] { 149 FirstSt = 8'b01011011, 150 SecondSt = 8'b10010100, 151 WaitSt = 8'b11100111, 152 DoneSt = 8'b00101000 153 } state_e; 154 155 state_e state_d, state_q; 156 157 // Serialize the 128bit token into two 64bit beats. 158 always_comb begin : p_kmac 159 1/1 state_d = state_q; Tests: T1 T2 T3  160 1/1 kmac_data_o = '0; Tests: T1 T2 T3  161 1/1 kmac_ack = 1'b0; Tests: T1 T2 T3  162 1/1 kmac_fsm_err_d = 1'b0; Tests: T1 T2 T3  163 164 1/1 unique case (state_q) Tests: T1 T2 T3  165 // Wait for request and transfer first half of 166 // LC token. 167 FirstSt: begin 168 1/1 if (kmac_req) begin Tests: T1 T2 T3  169 1/1 kmac_data_o.valid = 1'b1; Tests: T1 T2 T3  170 1/1 kmac_data_o.strb = 8'hFF; Tests: T1 T2 T3  171 1/1 kmac_data_o.data = kmac_transition_token[0 +: 64]; Tests: T1 T2 T3  172 1/1 if (kmac_data_i.ready) begin Tests: T1 T2 T3  173 1/1 state_d = SecondSt; Tests: T1 T2 T3  174 end MISSING_ELSE 175 end MISSING_ELSE 176 end 177 // Transfer second half of LC token. 178 SecondSt: begin 179 1/1 kmac_data_o.valid = 1'b1; Tests: T1 T2 T3  180 1/1 kmac_data_o.strb = 8'hFF; Tests: T1 T2 T3  181 1/1 kmac_data_o.last = 1'b1; Tests: T1 T2 T3  182 1/1 kmac_data_o.data = kmac_transition_token[64 +: 64]; Tests: T1 T2 T3  183 1/1 if (kmac_data_i.ready) begin Tests: T1 T2 T3  184 1/1 state_d = WaitSt; Tests: T1 T2 T3  185 end MISSING_ELSE 186 end 187 // Wait for hashed token response and go to terminal state. 188 WaitSt: begin 189 1/1 if (kmac_data_i.done) begin Tests: T1 T2 T3  190 1/1 kmac_ack = 1'b1; Tests: T1 T2 T3  191 1/1 state_d = DoneSt; Tests: T1 T2 T3  192 end MISSING_ELSE 193 end 194 // Terminal state (by design we can only perform 195 // one token hashing operation per reset cycle). 196 1/1 DoneSt: ; Tests: T1 T2 T3  197 default: begin 198 kmac_fsm_err_d = 1'b1; 199 end 200 endcase // state_q 201 end 202 203 3/3 `PRIM_FLOP_SPARSE_FSM(u_state_regs, state_d, state_q, state_e, FirstSt, clk_kmac_i, rst_kmac_ni) Tests: T1 T2 T3  | T1 T2 T3  | T1 T2 T3 
PRIM_FLOP_SPARSE_FSM(u_state_regs, state_d, state_q, state_e, FirstSt, clk_kmac_i, rst_kmac_ni): 203.1 `ifdef SIMULATION 203.2 prim_sparse_fsm_flop #( 203.3 .StateEnumT(state_e), 203.4 .Width($bits(state_e)), 203.5 .ResetValue($bits(state_e)'(FirstSt)), 203.6 .EnableAlertTriggerSVA(1), 203.7 .CustomForceName("state_q") 203.8 ) u_state_regs ( 203.9 .clk_i ( clk_kmac_i ), 203.10 .rst_ni ( rst_kmac_ni ), 203.11 .state_i ( state_d ), 203.12 .state_o ( ) 203.13 ); 203.14 always_ff @(posedge clk_kmac_i or negedge rst_kmac_ni) begin 203.15 1/1 if (!rst_kmac_ni) begin Tests: T1 T2 T3  203.16 1/1 state_q <= FirstSt; Tests: T1 T2 T3  203.17 end else begin 203.18 1/1 state_q <= state_d; Tests: T1 T2 T3  203.19 end 203.20 end 203.21 u_state_regs_A: assert property (@(posedge clk_i) disable iff ((!rst_ni) !== '0) (state_q === u_state_regs.state_o)) 203.22 else begin 203.23 `ifdef UVM 203.24 uvm_pkg::uvm_report_error("ASSERT FAILED", "u_state_regs_A", uvm_pkg::UVM_NONE, 203.25 "../src/lowrisc_ip_lc_ctrl_0.1/rtl/lc_ctrl_kmac_if.sv", 203, "", 1); 203.26 `else 203.27 $error("%0t: (%0s:%0d) [%m] [ASSERT FAILED] %0s", $time, `__FILE__, `__LINE__, 203.28 `PRIM_STRINGIFY(u_state_regs_A)); 203.29 `endif 203.30 end 203.31 `else 203.32 prim_sparse_fsm_flop #( 203.33 .StateEnumT(state_e), 203.34 .Width($bits(state_e)), 203.35 .ResetValue($bits(state_e)'(FirstSt)), 203.36 .EnableAlertTriggerSVA(1) 203.37 ) u_state_regs ( 203.38 .clk_i ( clk_kmac_i ), 203.39 .rst_ni ( rst_kmac_ni ), 203.40 .state_i ( state_d ), 203.41 .state_o ( state_q ) 203.42 ); 203.43 `endif204 205 always_ff @(posedge clk_kmac_i or negedge rst_kmac_ni) begin : p_kmac_fsm_err 206 1/1 if (!rst_kmac_ni) begin Tests: T1 T2 T3  207 1/1 kmac_fsm_err_q <= 1'b0; Tests: T1 T2 T3  208 end else begin 209 1/1 kmac_fsm_err_q <= kmac_fsm_err_d; Tests: T1 T2 T3 

Cond Coverage for Module : lc_ctrl_kmac_if
TotalCoveredPercent
Conditions66100.00
Logical66100.00
Non-Logical00
Event00

 LINE       95
 EXPRESSION (token_hash_req_i && token_hash_ack_d)
             --------1-------    --------2-------
-1--2-StatusTests
01CoveredT56,T58,T105
10CoveredT1,T2,T3
11CoveredT1,T2,T3

 LINE       107
 EXPRESSION (token_hash_req_i & ((~token_hash_ack_q)))
             --------1-------   ----------2----------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT1,T2,T3
11CoveredT1,T2,T3

FSM Coverage for Module : lc_ctrl_kmac_if
Summary for FSM :: state_q
TotalCoveredPercent
States 4 4 100.00 (Not included in score)
Transitions 6 6 100.00
Sequences 0 0

State, Transition and Sequence Details for FSM :: state_q
statesLine No.CoveredTests
DoneSt 191 Covered T1,T2,T3
FirstSt 203 Covered T1,T2,T3
SecondSt 173 Covered T1,T2,T3
WaitSt 184 Covered T1,T2,T3


transitionsLine No.CoveredTests
DoneSt->FirstSt 203 Covered T2,T3,T13
FirstSt->SecondSt 173 Covered T1,T2,T3
SecondSt->FirstSt 203 Covered T170
SecondSt->WaitSt 184 Covered T1,T2,T3
WaitSt->DoneSt 191 Covered T1,T2,T3
WaitSt->FirstSt 203 Covered T146,T171,T172



Branch Coverage for Module : lc_ctrl_kmac_if
Line No.TotalCoveredPercent
Branches 16 16 100.00
IF 88 3 3 100.00
CASE 164 9 9 100.00
IF 203 2 2 100.00
IF 206 2 2 100.00


88 if (!rst_ni) begin -1- 89 token_hash_ack_q <= 1'b0; ==> 90 token_hash_err_q <= 1'b0; 91 hashed_token_q <= {LcTokenWidth{1'b1}}; 92 end else begin 93 token_hash_ack_q <= token_hash_ack_d; 94 // Latch synchronized token and error bit 95 if (token_hash_req_i && token_hash_ack_d) begin -2- 96 token_hash_err_q <= token_hash_err_d; ==> 97 hashed_token_q <= hashed_token_d; 98 end MISSING_ELSE ==>

Branches:
-1--2-StatusTests
1 - Covered T1,T2,T3
0 1 Covered T1,T2,T3
0 0 Covered T1,T2,T3


164 unique case (state_q) -1- 165 // Wait for request and transfer first half of 166 // LC token. 167 FirstSt: begin 168 if (kmac_req) begin -2- 169 kmac_data_o.valid = 1'b1; 170 kmac_data_o.strb = 8'hFF; 171 kmac_data_o.data = kmac_transition_token[0 +: 64]; 172 if (kmac_data_i.ready) begin -3- 173 state_d = SecondSt; ==> 174 end MISSING_ELSE ==> 175 end MISSING_ELSE ==> 176 end 177 // Transfer second half of LC token. 178 SecondSt: begin 179 kmac_data_o.valid = 1'b1; 180 kmac_data_o.strb = 8'hFF; 181 kmac_data_o.last = 1'b1; 182 kmac_data_o.data = kmac_transition_token[64 +: 64]; 183 if (kmac_data_i.ready) begin -4- 184 state_d = WaitSt; ==> 185 end MISSING_ELSE ==> 186 end 187 // Wait for hashed token response and go to terminal state. 188 WaitSt: begin 189 if (kmac_data_i.done) begin -5- 190 kmac_ack = 1'b1; ==> 191 state_d = DoneSt; 192 end MISSING_ELSE ==> 193 end 194 // Terminal state (by design we can only perform 195 // one token hashing operation per reset cycle). 196 DoneSt: ; ==> 197 default: begin 198 kmac_fsm_err_d = 1'b1; ==>

Branches:
-1--2--3--4--5-StatusTests
FirstSt 1 1 - - Covered T1,T2,T3
FirstSt 1 0 - - Covered T2,T3,T15
FirstSt 0 - - - Covered T1,T2,T3
SecondSt - - 1 - Covered T1,T2,T3
SecondSt - - 0 - Covered T2,T3,T15
WaitSt - - - 1 Covered T1,T2,T3
WaitSt - - - 0 Covered T1,T2,T3
DoneSt - - - - Covered T1,T2,T3
default - - - - Covered T4,T54,T41


203 `PRIM_FLOP_SPARSE_FSM(u_state_regs, state_d, state_q, state_e, FirstSt, clk_kmac_i, rst_kmac_ni) -1- ==> ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T1,T2,T3


206 if (!rst_kmac_ni) begin -1- 207 kmac_fsm_err_q <= 1'b0; ==> 208 end else begin 209 kmac_fsm_err_q <= kmac_fsm_err_d; ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T1,T2,T3


Assert Coverage for Module : lc_ctrl_kmac_if
TotalAttemptedPercentSucceeded/MatchedPercent
Assertions 2 2 100.00 2 100.00
Cover properties 0 0 0
Cover sequences 0 0 0
Total 2 2 100.00 2 100.00




Assertion Details

NameAttemptsReal SuccessesFailuresIncomplete
DataStable_A 56980985 14730566 0 0
u_state_regs_A 55310490 52283290 0 0


DataStable_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 56980985 14730566 0 0
T1 869 15 0 0
T2 2842 304 0 0
T3 7257 994 0 0
T4 14078 0 0 0
T5 9088 1217 0 0
T11 0 181 0 0
T12 7388 0 0 0
T13 18958 716 0 0
T14 1050 0 0 0
T15 19722 18026 0 0
T16 62844 20608 0 0
T20 0 30478 0 0
T21 0 79181 0 0

u_state_regs_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 55310490 52283290 0 0
T1 869 816 0 0
T2 2842 2078 0 0
T3 7257 6067 0 0
T4 11941 8085 0 0
T5 9088 8883 0 0
T12 7388 5982 0 0
T13 18958 14932 0 0
T14 1050 953 0 0
T15 19722 19325 0 0
T16 62844 57400 0 0

0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%