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



Module Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_in_pe

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
96.31 98.32 96.49 90.91 95.83 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
96.31 98.32 96.49 90.91 95.83 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
100.00 100.00 100.00 100.00 u_usb_fs_nb_pe


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
no children

Line Coverage for Module : usb_fs_nb_in_pe
Line No.TotalCoveredPercent
TOTAL12011797.50
CONT_ASSIGN11811100.00
CONT_ASSIGN13211100.00
CONT_ASSIGN13311100.00
CONT_ASSIGN13511100.00
CONT_ASSIGN14111100.00
CONT_ASSIGN14511100.00
CONT_ASSIGN14911100.00
CONT_ASSIGN15411100.00
CONT_ASSIGN16011100.00
CONT_ASSIGN16111100.00
CONT_ASSIGN16811100.00
CONT_ASSIGN16911100.00
CONT_ASSIGN17211100.00
CONT_ASSIGN17811100.00
CONT_ASSIGN18011100.00
CONT_ASSIGN18611100.00
CONT_ASSIGN18811100.00
CONT_ASSIGN18911100.00
ALWAYS199494693.88
ALWAYS30333100.00
ALWAYS31133100.00
ALWAYS31988100.00
ALWAYS33266100.00
ALWAYS34499100.00
ALWAYS36177100.00
CONT_ASSIGN37511100.00
ALWAYS37855100.00
ALWAYS38855100.00
CONT_ASSIGN40511100.00
CONT_ASSIGN41211100.00
ALWAYS42233100.00
CONT_ASSIGN42511100.00

117 118 1/1 assign in_ep_xact_end_o = in_xact_end; Tests: T1 T2 T3  119 120 // data toggle state 121 logic [NumInEps-1:0] data_toggle_q, data_toggle_d; 122 123 // endpoint data buffer 124 logic token_received, setup_token_received, in_token_received, ack_received, nak_received; 125 logic more_data_to_send; 126 logic ep_in_hw, ep_active; 127 logic [3:0] in_ep_current_d; 128 129 // More syntax so can compare with enum 130 usb_pid_type_e rx_pid_type; 131 usb_pid_e rx_pid; 132 1/1 assign rx_pid_type = usb_pid_type_e'(rx_pid_i[1:0]); Tests: T1 T2 T3  133 1/1 assign rx_pid = usb_pid_e'(rx_pid_i); Tests: T1 T2 T3  134 135 1/1 assign token_received = Tests: T1 T2 T3  136 rx_pkt_end_i && 137 rx_pkt_valid_i && 138 rx_pid_type == UsbPidTypeToken && 139 rx_addr_i == dev_addr_i; 140 141 1/1 assign setup_token_received = Tests: T1 T2 T3  142 token_received && 143 rx_pid == UsbPidSetup; 144 145 1/1 assign in_token_received = Tests: T1 T2 T3  146 token_received && 147 rx_pid == UsbPidIn; 148 149 1/1 assign ack_received = Tests: T1 T2 T3  150 rx_pkt_end_i && 151 rx_pkt_valid_i && 152 rx_pid == UsbPidAck; 153 154 1/1 assign nak_received = Tests: T1 T2 T3  155 rx_pkt_end_i && 156 rx_pkt_valid_i && 157 rx_pid == UsbPidNak; 158 159 // Is the specified endpoint actually implemented in hardware? 160 1/1 assign ep_in_hw = {1'b0, rx_endp_i} < NumInEps; Tests: T1 T2 T3  161 1/1 assign in_ep_current_d = ep_in_hw ? rx_endp_i : '0; Tests: T1 T2 T3  162 163 // Make widths work - in_ep_current_d/in_ep_current_o only hold implemented endpoint IDs. 164 // These signals can be used to index signals of NumInEps width. 165 // They are only valid if ep_active is set, i.e., if the specified endpoint is implemented. 166 logic [InEpW-1:0] in_ep_index; 167 logic [InEpW-1:0] in_ep_index_d; 168 1/1 assign in_ep_index = in_ep_current_o[0 +: InEpW]; Tests: T1 T2 T3  169 1/1 assign in_ep_index_d = in_ep_current_d[0 +: InEpW]; Tests: T1 T2 T3  170 171 // Is the endpoint active? 172 1/1 assign ep_active = in_ep_enabled_i[in_ep_index_d] & ep_in_hw; Tests: T1 T2 T3  173 174 // Retain whether the current IN transmission has associated data; an Isochronous transaction 175 // for which there was no packet data available must not raise a 'pkt_sent' interrupt. 176 logic has_data_q; 177 178 1/1 assign more_data_to_send = has_data_q & ~in_ep_data_done_i[in_ep_index]; Tests: T1 T2 T3  179 180 1/1 assign tx_data_avail_o = logic'(in_xact_state == StSendData) & more_data_to_send; Tests: T1 T2 T3  181 182 //////////////////////////////////////////////////////////////////////////////// 183 // Transaction is starting on this IN endpoint; capture the packet details. 184 //////////////////////////////////////////////////////////////////////////////// 185 logic in_starting; 186 1/1 assign in_starting = (in_xact_state == StIdle || in_xact_state == StWaitAck) && in_token_received; Tests: T1 T2 T3  187 188 1/1 assign in_xact_starting_o = in_starting & ep_active; Tests: T1 T2 T3  189 1/1 assign in_xact_start_ep_o = in_ep_current_d; Tests: T1 T2 T3  190 191 //////////////////////////////////////////////////////////////////////////////// 192 // in transaction state machine 193 //////////////////////////////////////////////////////////////////////////////// 194 195 logic [AckTimeoutCntW-1:0] timeout_cntdown_d, timeout_cntdown_q; 196 logic rollback_in_xact; 197 198 always_comb begin 199 1/1 in_xact_state_next = in_xact_state; Tests: T1 T2 T3  200 1/1 in_xact_end = 1'b0; Tests: T1 T2 T3  201 1/1 tx_pkt_start_o = 1'b0; Tests: T1 T2 T3  202 1/1 tx_pid_o = 4'b0000; Tests: T1 T2 T3  203 1/1 rollback_in_xact = 1'b0; Tests: T1 T2 T3  204 1/1 timeout_cntdown_d = AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  205 1/1 unique case (in_xact_state) Tests: T1 T2 T3  206 StIdle: begin 207 1/1 if (ep_active && in_token_received) begin Tests: T1 T2 T3  208 1/1 in_xact_state_next = StRcvdIn; Tests: T29 T30 T31  209 end else begin 210 // Ignore tokens to inactive endpoints. Send no response. 211 1/1 in_xact_state_next = StIdle; Tests: T1 T2 T3  212 end 213 end 214 215 StRcvdIn: begin 216 1/1 tx_pkt_start_o = 1'b1; // Need to transmit NAK/STALL or DATA Tests: T29 T30 T31  217 218 1/1 if (in_ep_iso_i[in_ep_index]) begin Tests: T29 T30 T31  219 // ISO endpoint 220 // We always need to transmit. When no data is available, we send 221 // a zero-length packet. 222 // DATA0 always for full-speed isochronous endpoints 223 1/1 in_xact_state_next = StSendData; Tests: T36 T68 T69  224 1/1 tx_pid_o = {UsbPidData0}; Tests: T36 T68 T69  225 1/1 end else if (in_ep_stall_i[in_ep_index]) begin Tests: T29 T30 T31  226 1/1 in_xact_state_next = StIdle; Tests: T34 T107 T110  227 1/1 tx_pid_o = {UsbPidStall}; // STALL Tests: T34 T107 T110  228 1/1 end else if (has_data_q) begin Tests: T29 T30 T31  229 1/1 in_xact_state_next = StSendData; Tests: T29 T30 T31  230 1/1 tx_pid_o = {data_toggle_q[in_ep_index], 1'b0, {UsbPidTypeData}}; // DATA0/1 Tests: T29 T30 T31  231 end else begin 232 1/1 in_xact_state_next = StIdle; Tests: T4 T5 T6  233 1/1 tx_pid_o = {UsbPidNak}; // NAK Tests: T4 T5 T6  234 end 235 end 236 237 StSendData: begin 238 // Use &in_ep_get_addr so width can vary, looking for all ones 239 1/1 if ((!more_data_to_send) || ((&in_ep_get_addr_o) && tx_data_get_i)) begin Tests: T29 T30 T31  240 1/1 if (in_ep_iso_i[in_ep_index]) begin Tests: T29 T30 T31  241 1/1 in_xact_state_next = StIdle; // no ACK for ISO EPs Tests: T36 T68 T69  242 1/1 in_xact_end = has_data_q; Tests: T36 T68 T69  243 end else begin 244 1/1 if (tx_pkt_end_i) begin Tests: T29 T30 T31  245 0/1 ==> in_xact_state_next = StWaitAckStart; 246 end else begin 247 1/1 in_xact_state_next = StWaitTxEnd; Tests: T29 T30 T31  248 end 249 end 250 end else begin 251 1/1 in_xact_state_next = StSendData; Tests: T30 T31 T35  252 end 253 end 254 255 StWaitTxEnd: begin 256 1/1 if (tx_pkt_end_i) begin Tests: T29 T30 T31  257 1/1 in_xact_state_next = StWaitAckStart; Tests: T29 T30 T31  258 end MISSING_ELSE 259 end 260 261 StWaitAckStart: begin 262 // The spec says we have up to 18 bit times to wait for the host 263 // response. If it doesn't arrive in time, we must invalidate the 264 // transaction. 265 1/1 timeout_cntdown_d = timeout_cntdown_q - 1'b1; Tests: T29 T30 T31  266 267 1/1 if (rx_pkt_start_i) begin Tests: T29 T30 T31  268 1/1 in_xact_state_next = StWaitAck; Tests: T29 T30 T31  269 1/1 end else if (timeout_cntdown_q == '0) begin Tests: T29 T30 T31  270 1/1 in_xact_state_next = StIdle; Tests: T30 T33 T23  271 1/1 rollback_in_xact = 1'b1; Tests: T30 T33 T23  272 end else begin 273 1/1 in_xact_state_next = StWaitAckStart; Tests: T29 T30 T31  274 end 275 end 276 277 StWaitAck: begin 278 1/1 if (ack_received) begin Tests: T29 T30 T31  279 1/1 in_xact_state_next = StIdle; Tests: T29 T30 T31  280 1/1 in_xact_end = 1'b1; Tests: T29 T30 T31  281 1/1 end else if (in_token_received) begin Tests: T29 T30 T31  282 // Handshake response is missing. 283 0/1 ==> in_xact_state_next = ep_active ? StRcvdIn : StIdle; 284 0/1 ==> rollback_in_xact = 1'b1; 285 1/1 end else if (rx_pkt_end_i) begin Tests: T29 T30 T31  286 // Includes NAK 287 1/1 in_xact_state_next = StIdle; Tests: T30 T37 T111  288 1/1 rollback_in_xact = 1'b1; Tests: T30 T37 T111  289 end else begin 290 1/1 in_xact_state_next = StWaitAck; Tests: T29 T30 T31  291 end 292 end 293 294 default: in_xact_state_next = StIdle; 295 endcase 296 end 297 298 `ASSERT(InXactStateValid_A, 299 in_xact_state inside {StIdle, StRcvdIn, StSendData, StWaitTxEnd, StWaitAckStart, StWaitAck}, 300 clk_48mhz_i) 301 302 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 303 1/1 if (!rst_ni) begin Tests: T1 T2 T3  304 1/1 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  305 end else begin 306 1/1 timeout_cntdown_q <= timeout_cntdown_d; Tests: T1 T2 T3  307 end 308 end 309 310 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 311 1/1 if (!rst_ni) begin Tests: T1 T2 T3  312 1/1 tx_data_o <= '0; Tests: T1 T2 T3  313 end else begin 314 1/1 tx_data_o <= in_ep_data_i; Tests: T1 T2 T3  315 end 316 end 317 318 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 319 1/1 if (!rst_ni) begin Tests: T1 T2 T3  320 1/1 in_xact_state <= StIdle; Tests: T1 T2 T3  321 1/1 in_ep_rollback_o <= 1'b0; Tests: T1 T2 T3  322 1/1 end else if (link_reset_i || !link_active_i) begin Tests: T1 T2 T3  323 1/1 in_xact_state <= StIdle; Tests: T1 T2 T3  324 1/1 in_ep_rollback_o <= 1'b0; Tests: T1 T2 T3  325 end else begin 326 1/1 in_xact_state <= in_xact_state_next; Tests: T1 T2 T3  327 1/1 in_ep_rollback_o <= rollback_in_xact; Tests: T1 T2 T3  328 end 329 end 330 331 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 332 1/1 if (!rst_ni) begin Tests: T1 T2 T3  333 1/1 in_ep_get_addr_o <= '0; Tests: T1 T2 T3  334 end else begin 335 1/1 if (in_xact_state == StIdle) begin Tests: T1 T2 T3  336 1/1 in_ep_get_addr_o <= '0; Tests: T1 T2 T3  337 1/1 end else if ((in_xact_state == StSendData) && tx_data_get_i) begin Tests: T29 T30 T31  338 1/1 in_ep_get_addr_o <= in_ep_get_addr_o + 1'b1; Tests: T30 T31 T35  339 end MISSING_ELSE 340 end 341 end 342 343 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 344 1/1 if (!rst_ni) begin Tests: T1 T2 T3  345 1/1 in_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  346 1/1 in_ep_current_o <= '0; Tests: T1 T2 T3  347 1/1 has_data_q <= 1'b0; Tests: T1 T2 T3  348 end else begin 349 1/1 if (in_token_received) begin Tests: T1 T2 T3  350 1/1 in_ep_current_o <= in_ep_current_d; Tests: T29 T30 T31  351 1/1 in_ep_newpkt_o <= 1'b1; Tests: T29 T30 T31  352 1/1 has_data_q <= in_ep_has_data_i[in_ep_index_d]; Tests: T29 T30 T31  353 end else begin 354 1/1 in_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  355 end 356 end 357 end 358 359 // Updating of data toggles 360 always_comb begin : proc_data_toggle_d 361 1/1 data_toggle_d = data_toggle_q; Tests: T1 T2 T3  362 363 1/1 if (setup_token_received && ep_active) begin Tests: T1 T2 T3  364 1/1 data_toggle_d[in_ep_index_d] = 1'b1; Tests: T4 T89 T49  365 1/1 end else if ((in_xact_state == StWaitAck) && ack_received) begin Tests: T1 T2 T3  366 1/1 data_toggle_d[in_ep_index] = ~data_toggle_q[in_ep_index]; Tests: T29 T30 T31  367 end MISSING_ELSE 368 // Selective modification by software 369 1/1 if (in_datatog_we_i) begin Tests: T1 T2 T3  370 1/1 data_toggle_d = (data_toggle_d & ~in_datatog_mask_i) | Tests: T29 T30 T112  371 (in_datatog_status_i & in_datatog_mask_i); 372 end MISSING_ELSE 373 end 374 // Supply current data toggles to register interface 375 1/1 assign in_data_toggle_o = data_toggle_q; Tests: T1 T2 T3  376 377 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 378 1/1 if (!rst_ni) begin Tests: T1 T2 T3  379 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  380 1/1 end else if (link_reset_i) begin Tests: T1 T2 T3  381 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  382 end else begin 383 1/1 data_toggle_q <= data_toggle_d; Tests: T1 T2 T3  384 end 385 end 386 387 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 388 1/1 if (!rst_ni) begin Tests: T1 T2 T3  389 1/1 in_ep_data_get_o <= 1'b0; Tests: T1 T2 T3  390 end else begin 391 1/1 if ((in_xact_state == StSendData) && tx_data_get_i) begin Tests: T1 T2 T3  392 1/1 in_ep_data_get_o <= 1'b1; Tests: T30 T31 T35  393 end else begin 394 1/1 in_ep_data_get_o <= 1'b0; Tests: T1 T2 T3  395 end 396 end 397 end 398 399 //////////////////////////////////////////////////////////////////////////////// 400 // Count non-Isochronous IN transactions not receiving a handshake response. 401 // 402 // - no handshake response within the timeout period 403 // - packet reception started within the timeout period but it was not ACK/NAK. 404 //////////////////////////////////////////////////////////////////////////////// 405 1/1 assign event_timeout_in_o = (in_xact_state == StWaitAckStart || Tests: T1 T2 T3  406 (in_xact_state == StWaitAck && rx_pkt_end_i && !nak_received)) 407 & rollback_in_xact; 408 409 //////////////////////////////////////////////////////////////////////////////// 410 // Count IN transactions that are actively NAKed by the host. 411 //////////////////////////////////////////////////////////////////////////////// 412 1/1 assign event_nak_in_o = (in_xact_state == StWaitAck) && nak_received; Tests: T1 T2 T3  413 414 //////////////////////////////////////////////////////////////////////////////// 415 // Count the number of IN requests for which data is not available, including 416 // endpoints which are supported but not presently enabled/configured. 417 // (These may be ignored using the event counter configuration if required.) 418 //////////////////////////////////////////////////////////////////////////////// 419 logic event_nodata_in_q; 420 // This event signal must be delayed by a single cycle so that 'in_ep_current_o' becomes valid. 421 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 422 2/2 if (!rst_ni) event_nodata_in_q <= 1'b0; Tests: T1 T2 T3  | T1 T2 T3  423 1/1 else event_nodata_in_q <= in_starting & (ep_in_hw ? !in_ep_has_data_i[in_ep_index_d] : 1'b0); Tests: T1 T2 T3  424 end 425 1/1 assign event_nodata_in_o = event_nodata_in_q; Tests: T1 T2 T3 

Cond Coverage for Module : usb_fs_nb_in_pe
TotalCoveredPercent
Conditions11511095.65
Logical11511095.65
Non-Logical00
Event00

 LINE       135
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && (rx_pid_type == UsbPidTypeToken) && (rx_addr_i == dev_addr_i))
             ------1-----    -------2------    ----------------3---------------    ------------4------------
-1--2--3--4-StatusTests
0111CoveredT1,T28,T29
1011CoveredT78,T79,T76
1101CoveredT1,T28,T29
1110CoveredT3,T40,T42
1111CoveredT1,T28,T29

 LINE       135
 SUB-EXPRESSION (rx_pid_type == UsbPidTypeToken)
                ----------------1---------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T3,T28

 LINE       135
 SUB-EXPRESSION (rx_addr_i == dev_addr_i)
                ------------1------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       141
 EXPRESSION (token_received && (rx_pid == UsbPidSetup))
             -------1------    -----------2-----------
-1--2-StatusTests
01CoveredT1,T28,T42
10CoveredT29,T30,T31
11CoveredT1,T28,T4

 LINE       141
 SUB-EXPRESSION (rx_pid == UsbPidSetup)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T28,T42

 LINE       145
 EXPRESSION (token_received && (rx_pid == UsbPidIn))
             -------1------    ----------2---------
-1--2-StatusTests
01CoveredT29,T30,T42
10CoveredT1,T28,T29
11CoveredT29,T30,T31

 LINE       145
 SUB-EXPRESSION (rx_pid == UsbPidIn)
                ----------1---------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T42

 LINE       149
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && (rx_pid == UsbPidAck))
             ------1-----    -------2------    ----------3----------
-1--2--3-StatusTests
011CoveredT29,T30,T31
101CoveredT82,T83,T113
110CoveredT1,T3,T28
111CoveredT29,T30,T31

 LINE       149
 SUB-EXPRESSION (rx_pid == UsbPidAck)
                ----------1----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T42

 LINE       154
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && (rx_pid == UsbPidNak))
             ------1-----    -------2------    ----------3----------
-1--2--3-StatusTests
011CoveredT30,T37,T111
101CoveredT82,T83
110CoveredT1,T3,T28
111CoveredT30,T111,T114

 LINE       154
 SUB-EXPRESSION (rx_pid == UsbPidNak)
                ----------1----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       161
 EXPRESSION (ep_in_hw ? rx_endp_i : '0)
             ----1---
-1-StatusTests
0CoveredT42,T7,T19
1CoveredT1,T2,T3

 LINE       172
 EXPRESSION (in_ep_enabled_i[in_ep_index_d] & ep_in_hw)
             ---------------1--------------   ----2---
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT9,T79,T115
11CoveredT29,T30,T42

 LINE       178
 EXPRESSION (has_data_q & ((~in_ep_data_done_i[in_ep_index])))
             -----1----   -----------------2-----------------
-1--2-StatusTests
01CoveredT69,T107,T115
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       180
 EXPRESSION ((logic'((in_xact_state == StSendData))) & more_data_to_send)
             -------------------1-------------------   --------2--------
-1--2-StatusTests
01CoveredT30,T31,T35
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       186
 EXPRESSION (((in_xact_state == StIdle) || (in_xact_state == StWaitAck)) && in_token_received)
             -----------------------------1-----------------------------    --------2--------
-1--2-StatusTests
01Not Covered
10CoveredT1,T2,T3
11CoveredT29,T30,T31

 LINE       186
 SUB-EXPRESSION ((in_xact_state == StIdle) || (in_xact_state == StWaitAck))
                 ------------1------------    --------------2-------------
-1--2-StatusTests
00CoveredT29,T30,T31
01CoveredT29,T30,T31
10CoveredT1,T2,T3

 LINE       186
 SUB-EXPRESSION (in_xact_state == StIdle)
                ------------1------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       186
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       188
 EXPRESSION (in_starting & ep_active)
             -----1-----   ----2----
-1--2-StatusTests
01CoveredT29,T30,T42
10CoveredT107,T115,T116
11CoveredT29,T30,T31

 LINE       207
 EXPRESSION (ep_active && in_token_received)
             ----1----    --------2--------
-1--2-StatusTests
01CoveredT107,T115,T116
10CoveredT29,T30,T42
11CoveredT29,T30,T31

 LINE       239
 EXPRESSION (((!more_data_to_send)) || (((&in_ep_get_addr_o)) && tx_data_get_i))
             -----------1----------    --------------------2-------------------
-1--2-StatusTests
00CoveredT30,T31,T35
01CoveredT30,T37,T17
10CoveredT29,T30,T31

 LINE       239
 SUB-EXPRESSION (((&in_ep_get_addr_o)) && tx_data_get_i)
                 ----------1----------    ------2------
-1--2-StatusTests
01CoveredT30,T31,T35
10CoveredT30,T37,T17
11CoveredT30,T37,T17

 LINE       269
 EXPRESSION (timeout_cntdown_q == '0)
            ------------1------------
-1-StatusTests
0CoveredT29,T30,T31
1CoveredT30,T33,T23

 LINE       283
 EXPRESSION (ep_active ? StRcvdIn : StIdle)
             ----1----
-1-StatusTests
0Not Covered
1Not Covered

 LINE       322
 EXPRESSION (link_reset_i || ((!link_active_i)))
             ------1-----    ---------2--------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT1,T2,T3
10CoveredT1,T2,T3

 LINE       335
 EXPRESSION (in_xact_state == StIdle)
            ------------1------------
-1-StatusTests
0CoveredT29,T30,T31
1CoveredT1,T2,T3

 LINE       337
 EXPRESSION ((in_xact_state == StSendData) && tx_data_get_i)
             --------------1--------------    ------2------
-1--2-StatusTests
01Not Covered
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       337
 SUB-EXPRESSION (in_xact_state == StSendData)
                --------------1--------------
-1-StatusTests
0CoveredT29,T30,T31
1CoveredT29,T30,T31

 LINE       363
 EXPRESSION (setup_token_received && ep_active)
             ----------1---------    ----2----
-1--2-StatusTests
01CoveredT29,T30,T42
10CoveredT1,T28,T55
11CoveredT4,T89,T49

 LINE       365
 EXPRESSION ((in_xact_state == StWaitAck) && ack_received)
             --------------1-------------    ------2-----
-1--2-StatusTests
01CoveredT117,T118,T119
10CoveredT29,T30,T31
11CoveredT29,T30,T31

 LINE       365
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       391
 EXPRESSION ((in_xact_state == StSendData) && tx_data_get_i)
             --------------1--------------    ------2------
-1--2-StatusTests
01CoveredT120,T121,T122
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       391
 SUB-EXPRESSION (in_xact_state == StSendData)
                --------------1--------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       405
 EXPRESSION (((in_xact_state == StWaitAckStart) || ((in_xact_state == StWaitAck) && rx_pkt_end_i && ((!nak_received)))) & rollback_in_xact)
             -----------------------------------------------------1----------------------------------------------------   --------2-------
-1--2-StatusTests
01CoveredT30,T111,T114
10CoveredT29,T30,T31
11CoveredT30,T33,T37

 LINE       405
 SUB-EXPRESSION ((in_xact_state == StWaitAckStart) || ((in_xact_state == StWaitAck) && rx_pkt_end_i && ((!nak_received))))
                 ----------------1----------------    ---------------------------------2---------------------------------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT29,T30,T31
10CoveredT29,T30,T31

 LINE       405
 SUB-EXPRESSION (in_xact_state == StWaitAckStart)
                ----------------1----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       405
 SUB-EXPRESSION ((in_xact_state == StWaitAck) && rx_pkt_end_i && ((!nak_received)))
                 --------------1-------------    ------2-----    --------3--------
-1--2--3-StatusTests
011CoveredT1,T3,T28
101CoveredT29,T30,T31
110CoveredT30,T111,T114
111CoveredT29,T30,T31

 LINE       405
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       412
 EXPRESSION ((in_xact_state == StWaitAck) && nak_received)
             --------------1-------------    ------2-----
-1--2-StatusTests
01Not Covered
10CoveredT29,T30,T31
11CoveredT30,T111,T114

 LINE       412
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       423
 EXPRESSION (in_starting & (ep_in_hw ? ((!in_ep_has_data_i[in_ep_index_d])) : 1'b0))
             -----1-----   ----------------------------2---------------------------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT29,T30,T31
11CoveredT4,T5,T6

 LINE       423
 SUB-EXPRESSION (ep_in_hw ? ((!in_ep_has_data_i[in_ep_index_d])) : 1'b0)
                 ----1---
-1-StatusTests
0CoveredT42,T7,T19
1CoveredT1,T2,T3

FSM Coverage for Module : usb_fs_nb_in_pe
Summary for FSM :: in_xact_state
TotalCoveredPercent
States 6 6 100.00 (Not included in score)
Transitions 12 10 83.33
Sequences 0 0

State, Transition and Sequence Details for FSM :: in_xact_state
statesLine No.CoveredTests
StIdle 323 Covered T1,T2,T3
StRcvdIn 208 Covered T29,T30,T31
StSendData 223 Covered T29,T30,T31
StWaitAck 268 Covered T29,T30,T31
StWaitAckStart 245 Covered T29,T30,T31
StWaitTxEnd 247 Covered T29,T30,T31


transitionsLine No.CoveredTests
StIdle->StRcvdIn 208 Covered T29,T30,T31
StRcvdIn->StIdle 323 Covered T34,T4,T5
StRcvdIn->StSendData 223 Covered T29,T30,T31
StSendData->StIdle 323 Covered T36,T68,T69
StSendData->StWaitAckStart 245 Not Covered
StSendData->StWaitTxEnd 247 Covered T29,T30,T31
StWaitAck->StIdle 323 Covered T29,T30,T31
StWaitAck->StRcvdIn 283 Not Covered
StWaitAckStart->StIdle 323 Covered T30,T33,T23
StWaitAckStart->StWaitAck 268 Covered T29,T30,T31
StWaitTxEnd->StIdle 323 Covered T123,T124,T125
StWaitTxEnd->StWaitAckStart 257 Covered T29,T30,T31



Branch Coverage for Module : usb_fs_nb_in_pe
Line No.TotalCoveredPercent
Branches 50 46 92.00
TERNARY 161 2 2 100.00
CASE 205 21 17 80.95
IF 303 2 2 100.00
IF 311 2 2 100.00
IF 319 3 3 100.00
IF 332 4 4 100.00
IF 344 3 3 100.00
IF 363 3 3 100.00
IF 369 2 2 100.00
IF 378 3 3 100.00
IF 388 3 3 100.00
IF 422 2 2 100.00


161 assign in_ep_current_d = ep_in_hw ? rx_endp_i : '0; -1- ==> ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T42,T7,T19


205 unique case (in_xact_state) -1- 206 StIdle: begin 207 if (ep_active && in_token_received) begin -2- 208 in_xact_state_next = StRcvdIn; ==> 209 end else begin 210 // Ignore tokens to inactive endpoints. Send no response. 211 in_xact_state_next = StIdle; ==> 212 end 213 end 214 215 StRcvdIn: begin 216 tx_pkt_start_o = 1'b1; // Need to transmit NAK/STALL or DATA 217 218 if (in_ep_iso_i[in_ep_index]) begin -3- 219 // ISO endpoint 220 // We always need to transmit. When no data is available, we send 221 // a zero-length packet. 222 // DATA0 always for full-speed isochronous endpoints 223 in_xact_state_next = StSendData; ==> 224 tx_pid_o = {UsbPidData0}; 225 end else if (in_ep_stall_i[in_ep_index]) begin -4- 226 in_xact_state_next = StIdle; ==> 227 tx_pid_o = {UsbPidStall}; // STALL 228 end else if (has_data_q) begin -5- 229 in_xact_state_next = StSendData; ==> 230 tx_pid_o = {data_toggle_q[in_ep_index], 1'b0, {UsbPidTypeData}}; // DATA0/1 231 end else begin 232 in_xact_state_next = StIdle; ==> 233 tx_pid_o = {UsbPidNak}; // NAK 234 end 235 end 236 237 StSendData: begin 238 // Use &in_ep_get_addr so width can vary, looking for all ones 239 if ((!more_data_to_send) || ((&in_ep_get_addr_o) && tx_data_get_i)) begin -6- 240 if (in_ep_iso_i[in_ep_index]) begin -7- 241 in_xact_state_next = StIdle; // no ACK for ISO EPs ==> 242 in_xact_end = has_data_q; 243 end else begin 244 if (tx_pkt_end_i) begin -8- 245 in_xact_state_next = StWaitAckStart; ==> 246 end else begin 247 in_xact_state_next = StWaitTxEnd; ==> 248 end 249 end 250 end else begin 251 in_xact_state_next = StSendData; ==> 252 end 253 end 254 255 StWaitTxEnd: begin 256 if (tx_pkt_end_i) begin -9- 257 in_xact_state_next = StWaitAckStart; ==> 258 end MISSING_ELSE ==> 259 end 260 261 StWaitAckStart: begin 262 // The spec says we have up to 18 bit times to wait for the host 263 // response. If it doesn't arrive in time, we must invalidate the 264 // transaction. 265 timeout_cntdown_d = timeout_cntdown_q - 1'b1; 266 267 if (rx_pkt_start_i) begin -10- 268 in_xact_state_next = StWaitAck; ==> 269 end else if (timeout_cntdown_q == '0) begin -11- 270 in_xact_state_next = StIdle; ==> 271 rollback_in_xact = 1'b1; 272 end else begin 273 in_xact_state_next = StWaitAckStart; ==> 274 end 275 end 276 277 StWaitAck: begin 278 if (ack_received) begin -12- 279 in_xact_state_next = StIdle; ==> 280 in_xact_end = 1'b1; 281 end else if (in_token_received) begin -13- 282 // Handshake response is missing. 283 in_xact_state_next = ep_active ? StRcvdIn : StIdle; -14- ==> ==> 284 rollback_in_xact = 1'b1; 285 end else if (rx_pkt_end_i) begin -15- 286 // Includes NAK 287 in_xact_state_next = StIdle; ==> 288 rollback_in_xact = 1'b1; 289 end else begin 290 in_xact_state_next = StWaitAck; ==> 291 end 292 end 293 294 default: in_xact_state_next = StIdle; ==>

Branches:
-1--2--3--4--5--6--7--8--9--10--11--12--13--14--15-StatusTests
StIdle 1 - - - - - - - - - - - - - Covered T29,T30,T31
StIdle 0 - - - - - - - - - - - - - Covered T1,T2,T3
StRcvdIn - 1 - - - - - - - - - - - - Covered T36,T68,T69
StRcvdIn - 0 1 - - - - - - - - - - - Covered T34,T107,T110
StRcvdIn - 0 0 1 - - - - - - - - - - Covered T29,T30,T31
StRcvdIn - 0 0 0 - - - - - - - - - - Covered T4,T5,T6
StSendData - - - - 1 1 - - - - - - - - Covered T36,T68,T69
StSendData - - - - 1 0 1 - - - - - - - Not Covered
StSendData - - - - 1 0 0 - - - - - - - Covered T29,T30,T31
StSendData - - - - 0 - - - - - - - - - Covered T30,T31,T35
StWaitTxEnd - - - - - - - 1 - - - - - - Covered T29,T30,T31
StWaitTxEnd - - - - - - - 0 - - - - - - Covered T29,T30,T31
StWaitAckStart - - - - - - - - 1 - - - - - Covered T29,T30,T31
StWaitAckStart - - - - - - - - 0 1 - - - - Covered T30,T33,T23
StWaitAckStart - - - - - - - - 0 0 - - - - Covered T29,T30,T31
StWaitAck - - - - - - - - - - 1 - - - Covered T29,T30,T31
StWaitAck - - - - - - - - - - 0 1 1 - Not Covered
StWaitAck - - - - - - - - - - 0 1 0 - Not Covered
StWaitAck - - - - - - - - - - 0 0 - 1 Covered T30,T37,T111
StWaitAck - - - - - - - - - - 0 0 - 0 Covered T29,T30,T31
default - - - - - - - - - - - - - - Not Covered


303 if (!rst_ni) begin -1- 304 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; ==> 305 end else begin 306 timeout_cntdown_q <= timeout_cntdown_d; ==>

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


311 if (!rst_ni) begin -1- 312 tx_data_o <= '0; ==> 313 end else begin 314 tx_data_o <= in_ep_data_i; ==>

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


319 if (!rst_ni) begin -1- 320 in_xact_state <= StIdle; ==> 321 in_ep_rollback_o <= 1'b0; 322 end else if (link_reset_i || !link_active_i) begin -2- 323 in_xact_state <= StIdle; ==> 324 in_ep_rollback_o <= 1'b0; 325 end else begin 326 in_xact_state <= in_xact_state_next; ==>

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


332 if (!rst_ni) begin -1- 333 in_ep_get_addr_o <= '0; ==> 334 end else begin 335 if (in_xact_state == StIdle) begin -2- 336 in_ep_get_addr_o <= '0; ==> 337 end else if ((in_xact_state == StSendData) && tx_data_get_i) begin -3- 338 in_ep_get_addr_o <= in_ep_get_addr_o + 1'b1; ==> 339 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T1,T2,T3
0 0 1 Covered T30,T31,T35
0 0 0 Covered T29,T30,T31


344 if (!rst_ni) begin -1- 345 in_ep_newpkt_o <= 1'b0; ==> 346 in_ep_current_o <= '0; 347 has_data_q <= 1'b0; 348 end else begin 349 if (in_token_received) begin -2- 350 in_ep_current_o <= in_ep_current_d; ==> 351 in_ep_newpkt_o <= 1'b1; 352 has_data_q <= in_ep_has_data_i[in_ep_index_d]; 353 end else begin 354 in_ep_newpkt_o <= 1'b0; ==>

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


363 if (setup_token_received && ep_active) begin -1- 364 data_toggle_d[in_ep_index_d] = 1'b1; ==> 365 end else if ((in_xact_state == StWaitAck) && ack_received) begin -2- 366 data_toggle_d[in_ep_index] = ~data_toggle_q[in_ep_index]; ==> 367 end MISSING_ELSE ==>

Branches:
-1--2-StatusTests
1 - Covered T4,T89,T49
0 1 Covered T29,T30,T31
0 0 Covered T1,T2,T3


369 if (in_datatog_we_i) begin -1- 370 data_toggle_d = (data_toggle_d & ~in_datatog_mask_i) | ==> 371 (in_datatog_status_i & in_datatog_mask_i); 372 end MISSING_ELSE ==>

Branches:
-1-StatusTests
1 Covered T29,T30,T112
0 Covered T1,T2,T3


378 if (!rst_ni) begin -1- 379 data_toggle_q <= '0; // Clear for all endpoints ==> 380 end else if (link_reset_i) begin -2- 381 data_toggle_q <= '0; // Clear for all endpoints ==> 382 end else begin 383 data_toggle_q <= data_toggle_d; ==>

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


388 if (!rst_ni) begin -1- 389 in_ep_data_get_o <= 1'b0; ==> 390 end else begin 391 if ((in_xact_state == StSendData) && tx_data_get_i) begin -2- 392 in_ep_data_get_o <= 1'b1; ==> 393 end else begin 394 in_ep_data_get_o <= 1'b0; ==>

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


422 if (!rst_ni) event_nodata_in_q <= 1'b0; -1- ==> 423 else event_nodata_in_q <= in_starting & (ep_in_hw ? !in_ep_has_data_i[in_ep_index_d] : 1'b0); ==>

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


Assert Coverage for Module : usb_fs_nb_in_pe
TotalAttemptedPercentSucceeded/MatchedPercent
Assertions 1 1 100.00 1 100.00
Cover properties 0 0 0
Cover sequences 0 0 0
Total 1 1 100.00 1 100.00




Assertion Details

NameAttemptsReal SuccessesFailuresIncomplete
InXactStateValid_A 575541647 575257361 0 0


InXactStateValid_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 575541647 575257361 0 0
T1 7118 7058 0 0
T2 6427 6353 0 0
T3 7249 7195 0 0
T28 8699 8599 0 0
T29 12933 12840 0 0
T30 43034 42964 0 0
T39 1959 1891 0 0
T40 7184 7112 0 0
T41 1592 1501 0 0
T42 21513 21419 0 0

Line Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_in_pe
Line No.TotalCoveredPercent
TOTAL11911798.32
CONT_ASSIGN11811100.00
CONT_ASSIGN13211100.00
CONT_ASSIGN13311100.00
CONT_ASSIGN13511100.00
CONT_ASSIGN14111100.00
CONT_ASSIGN14511100.00
CONT_ASSIGN14911100.00
CONT_ASSIGN15411100.00
CONT_ASSIGN16011100.00
CONT_ASSIGN16111100.00
CONT_ASSIGN16811100.00
CONT_ASSIGN16911100.00
CONT_ASSIGN17211100.00
CONT_ASSIGN17811100.00
CONT_ASSIGN18011100.00
CONT_ASSIGN18611100.00
CONT_ASSIGN18811100.00
CONT_ASSIGN18911100.00
ALWAYS199484695.83
ALWAYS30333100.00
ALWAYS31133100.00
ALWAYS31988100.00
ALWAYS33266100.00
ALWAYS34499100.00
ALWAYS36177100.00
CONT_ASSIGN37511100.00
ALWAYS37855100.00
ALWAYS38855100.00
CONT_ASSIGN40511100.00
CONT_ASSIGN41211100.00
ALWAYS42233100.00
CONT_ASSIGN42511100.00

117 118 1/1 assign in_ep_xact_end_o = in_xact_end; Tests: T1 T2 T3  119 120 // data toggle state 121 logic [NumInEps-1:0] data_toggle_q, data_toggle_d; 122 123 // endpoint data buffer 124 logic token_received, setup_token_received, in_token_received, ack_received, nak_received; 125 logic more_data_to_send; 126 logic ep_in_hw, ep_active; 127 logic [3:0] in_ep_current_d; 128 129 // More syntax so can compare with enum 130 usb_pid_type_e rx_pid_type; 131 usb_pid_e rx_pid; 132 1/1 assign rx_pid_type = usb_pid_type_e'(rx_pid_i[1:0]); Tests: T1 T2 T3  133 1/1 assign rx_pid = usb_pid_e'(rx_pid_i); Tests: T1 T2 T3  134 135 1/1 assign token_received = Tests: T1 T2 T3  136 rx_pkt_end_i && 137 rx_pkt_valid_i && 138 rx_pid_type == UsbPidTypeToken && 139 rx_addr_i == dev_addr_i; 140 141 1/1 assign setup_token_received = Tests: T1 T2 T3  142 token_received && 143 rx_pid == UsbPidSetup; 144 145 1/1 assign in_token_received = Tests: T1 T2 T3  146 token_received && 147 rx_pid == UsbPidIn; 148 149 1/1 assign ack_received = Tests: T1 T2 T3  150 rx_pkt_end_i && 151 rx_pkt_valid_i && 152 rx_pid == UsbPidAck; 153 154 1/1 assign nak_received = Tests: T1 T2 T3  155 rx_pkt_end_i && 156 rx_pkt_valid_i && 157 rx_pid == UsbPidNak; 158 159 // Is the specified endpoint actually implemented in hardware? 160 1/1 assign ep_in_hw = {1'b0, rx_endp_i} < NumInEps; Tests: T1 T2 T3  161 1/1 assign in_ep_current_d = ep_in_hw ? rx_endp_i : '0; Tests: T1 T2 T3  162 163 // Make widths work - in_ep_current_d/in_ep_current_o only hold implemented endpoint IDs. 164 // These signals can be used to index signals of NumInEps width. 165 // They are only valid if ep_active is set, i.e., if the specified endpoint is implemented. 166 logic [InEpW-1:0] in_ep_index; 167 logic [InEpW-1:0] in_ep_index_d; 168 1/1 assign in_ep_index = in_ep_current_o[0 +: InEpW]; Tests: T1 T2 T3  169 1/1 assign in_ep_index_d = in_ep_current_d[0 +: InEpW]; Tests: T1 T2 T3  170 171 // Is the endpoint active? 172 1/1 assign ep_active = in_ep_enabled_i[in_ep_index_d] & ep_in_hw; Tests: T1 T2 T3  173 174 // Retain whether the current IN transmission has associated data; an Isochronous transaction 175 // for which there was no packet data available must not raise a 'pkt_sent' interrupt. 176 logic has_data_q; 177 178 1/1 assign more_data_to_send = has_data_q & ~in_ep_data_done_i[in_ep_index]; Tests: T1 T2 T3  179 180 1/1 assign tx_data_avail_o = logic'(in_xact_state == StSendData) & more_data_to_send; Tests: T1 T2 T3  181 182 //////////////////////////////////////////////////////////////////////////////// 183 // Transaction is starting on this IN endpoint; capture the packet details. 184 //////////////////////////////////////////////////////////////////////////////// 185 logic in_starting; 186 1/1 assign in_starting = (in_xact_state == StIdle || in_xact_state == StWaitAck) && in_token_received; Tests: T1 T2 T3  187 188 1/1 assign in_xact_starting_o = in_starting & ep_active; Tests: T1 T2 T3  189 1/1 assign in_xact_start_ep_o = in_ep_current_d; Tests: T1 T2 T3  190 191 //////////////////////////////////////////////////////////////////////////////// 192 // in transaction state machine 193 //////////////////////////////////////////////////////////////////////////////// 194 195 logic [AckTimeoutCntW-1:0] timeout_cntdown_d, timeout_cntdown_q; 196 logic rollback_in_xact; 197 198 always_comb begin 199 1/1 in_xact_state_next = in_xact_state; Tests: T1 T2 T3  200 1/1 in_xact_end = 1'b0; Tests: T1 T2 T3  201 1/1 tx_pkt_start_o = 1'b0; Tests: T1 T2 T3  202 1/1 tx_pid_o = 4'b0000; Tests: T1 T2 T3  203 1/1 rollback_in_xact = 1'b0; Tests: T1 T2 T3  204 1/1 timeout_cntdown_d = AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  205 1/1 unique case (in_xact_state) Tests: T1 T2 T3  206 StIdle: begin 207 1/1 if (ep_active && in_token_received) begin Tests: T1 T2 T3  208 1/1 in_xact_state_next = StRcvdIn; Tests: T29 T30 T31  209 end else begin 210 // Ignore tokens to inactive endpoints. Send no response. 211 1/1 in_xact_state_next = StIdle; Tests: T1 T2 T3  212 end 213 end 214 215 StRcvdIn: begin 216 1/1 tx_pkt_start_o = 1'b1; // Need to transmit NAK/STALL or DATA Tests: T29 T30 T31  217 218 1/1 if (in_ep_iso_i[in_ep_index]) begin Tests: T29 T30 T31  219 // ISO endpoint 220 // We always need to transmit. When no data is available, we send 221 // a zero-length packet. 222 // DATA0 always for full-speed isochronous endpoints 223 1/1 in_xact_state_next = StSendData; Tests: T36 T68 T69  224 1/1 tx_pid_o = {UsbPidData0}; Tests: T36 T68 T69  225 1/1 end else if (in_ep_stall_i[in_ep_index]) begin Tests: T29 T30 T31  226 1/1 in_xact_state_next = StIdle; Tests: T34 T107 T110  227 1/1 tx_pid_o = {UsbPidStall}; // STALL Tests: T34 T107 T110  228 1/1 end else if (has_data_q) begin Tests: T29 T30 T31  229 1/1 in_xact_state_next = StSendData; Tests: T29 T30 T31  230 1/1 tx_pid_o = {data_toggle_q[in_ep_index], 1'b0, {UsbPidTypeData}}; // DATA0/1 Tests: T29 T30 T31  231 end else begin 232 1/1 in_xact_state_next = StIdle; Tests: T4 T5 T6  233 1/1 tx_pid_o = {UsbPidNak}; // NAK Tests: T4 T5 T6  234 end 235 end 236 237 StSendData: begin 238 // Use &in_ep_get_addr so width can vary, looking for all ones 239 1/1 if ((!more_data_to_send) || ((&in_ep_get_addr_o) && tx_data_get_i)) begin Tests: T29 T30 T31  240 1/1 if (in_ep_iso_i[in_ep_index]) begin Tests: T29 T30 T31  241 1/1 in_xact_state_next = StIdle; // no ACK for ISO EPs Tests: T36 T68 T69  242 1/1 in_xact_end = has_data_q; Tests: T36 T68 T69  243 end else begin 244 1/1 if (tx_pkt_end_i) begin Tests: T29 T30 T31  245 excluded in_xact_state_next = StWaitAckStart; Exclude Annotation: VC_COV_UNR 246 end else begin 247 1/1 in_xact_state_next = StWaitTxEnd; Tests: T29 T30 T31  248 end 249 end 250 end else begin 251 1/1 in_xact_state_next = StSendData; Tests: T30 T31 T35  252 end 253 end 254 255 StWaitTxEnd: begin 256 1/1 if (tx_pkt_end_i) begin Tests: T29 T30 T31  257 1/1 in_xact_state_next = StWaitAckStart; Tests: T29 T30 T31  258 end MISSING_ELSE 259 end 260 261 StWaitAckStart: begin 262 // The spec says we have up to 18 bit times to wait for the host 263 // response. If it doesn't arrive in time, we must invalidate the 264 // transaction. 265 1/1 timeout_cntdown_d = timeout_cntdown_q - 1'b1; Tests: T29 T30 T31  266 267 1/1 if (rx_pkt_start_i) begin Tests: T29 T30 T31  268 1/1 in_xact_state_next = StWaitAck; Tests: T29 T30 T31  269 1/1 end else if (timeout_cntdown_q == '0) begin Tests: T29 T30 T31  270 1/1 in_xact_state_next = StIdle; Tests: T30 T33 T23  271 1/1 rollback_in_xact = 1'b1; Tests: T30 T33 T23  272 end else begin 273 1/1 in_xact_state_next = StWaitAckStart; Tests: T29 T30 T31  274 end 275 end 276 277 StWaitAck: begin 278 1/1 if (ack_received) begin Tests: T29 T30 T31  279 1/1 in_xact_state_next = StIdle; Tests: T29 T30 T31  280 1/1 in_xact_end = 1'b1; Tests: T29 T30 T31  281 1/1 end else if (in_token_received) begin Tests: T29 T30 T31  282 // Handshake response is missing. 283 0/1 ==> in_xact_state_next = ep_active ? StRcvdIn : StIdle; 284 0/1 ==> rollback_in_xact = 1'b1; 285 1/1 end else if (rx_pkt_end_i) begin Tests: T29 T30 T31  286 // Includes NAK 287 1/1 in_xact_state_next = StIdle; Tests: T30 T37 T111  288 1/1 rollback_in_xact = 1'b1; Tests: T30 T37 T111  289 end else begin 290 1/1 in_xact_state_next = StWaitAck; Tests: T29 T30 T31  291 end 292 end 293 294 default: in_xact_state_next = StIdle; Exclude Annotation: VC_COV_UNR 295 endcase 296 end 297 298 `ASSERT(InXactStateValid_A, 299 in_xact_state inside {StIdle, StRcvdIn, StSendData, StWaitTxEnd, StWaitAckStart, StWaitAck}, 300 clk_48mhz_i) 301 302 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 303 1/1 if (!rst_ni) begin Tests: T1 T2 T3  304 1/1 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  305 end else begin 306 1/1 timeout_cntdown_q <= timeout_cntdown_d; Tests: T1 T2 T3  307 end 308 end 309 310 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 311 1/1 if (!rst_ni) begin Tests: T1 T2 T3  312 1/1 tx_data_o <= '0; Tests: T1 T2 T3  313 end else begin 314 1/1 tx_data_o <= in_ep_data_i; Tests: T1 T2 T3  315 end 316 end 317 318 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 319 1/1 if (!rst_ni) begin Tests: T1 T2 T3  320 1/1 in_xact_state <= StIdle; Tests: T1 T2 T3  321 1/1 in_ep_rollback_o <= 1'b0; Tests: T1 T2 T3  322 1/1 end else if (link_reset_i || !link_active_i) begin Tests: T1 T2 T3  323 1/1 in_xact_state <= StIdle; Tests: T1 T2 T3  324 1/1 in_ep_rollback_o <= 1'b0; Tests: T1 T2 T3  325 end else begin 326 1/1 in_xact_state <= in_xact_state_next; Tests: T1 T2 T3  327 1/1 in_ep_rollback_o <= rollback_in_xact; Tests: T1 T2 T3  328 end 329 end 330 331 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 332 1/1 if (!rst_ni) begin Tests: T1 T2 T3  333 1/1 in_ep_get_addr_o <= '0; Tests: T1 T2 T3  334 end else begin 335 1/1 if (in_xact_state == StIdle) begin Tests: T1 T2 T3  336 1/1 in_ep_get_addr_o <= '0; Tests: T1 T2 T3  337 1/1 end else if ((in_xact_state == StSendData) && tx_data_get_i) begin Tests: T29 T30 T31  338 1/1 in_ep_get_addr_o <= in_ep_get_addr_o + 1'b1; Tests: T30 T31 T35  339 end MISSING_ELSE 340 end 341 end 342 343 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 344 1/1 if (!rst_ni) begin Tests: T1 T2 T3  345 1/1 in_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  346 1/1 in_ep_current_o <= '0; Tests: T1 T2 T3  347 1/1 has_data_q <= 1'b0; Tests: T1 T2 T3  348 end else begin 349 1/1 if (in_token_received) begin Tests: T1 T2 T3  350 1/1 in_ep_current_o <= in_ep_current_d; Tests: T29 T30 T31  351 1/1 in_ep_newpkt_o <= 1'b1; Tests: T29 T30 T31  352 1/1 has_data_q <= in_ep_has_data_i[in_ep_index_d]; Tests: T29 T30 T31  353 end else begin 354 1/1 in_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  355 end 356 end 357 end 358 359 // Updating of data toggles 360 always_comb begin : proc_data_toggle_d 361 1/1 data_toggle_d = data_toggle_q; Tests: T1 T2 T3  362 363 1/1 if (setup_token_received && ep_active) begin Tests: T1 T2 T3  364 1/1 data_toggle_d[in_ep_index_d] = 1'b1; Tests: T4 T89 T49  365 1/1 end else if ((in_xact_state == StWaitAck) && ack_received) begin Tests: T1 T2 T3  366 1/1 data_toggle_d[in_ep_index] = ~data_toggle_q[in_ep_index]; Tests: T29 T30 T31  367 end MISSING_ELSE 368 // Selective modification by software 369 1/1 if (in_datatog_we_i) begin Tests: T1 T2 T3  370 1/1 data_toggle_d = (data_toggle_d & ~in_datatog_mask_i) | Tests: T29 T30 T112  371 (in_datatog_status_i & in_datatog_mask_i); 372 end MISSING_ELSE 373 end 374 // Supply current data toggles to register interface 375 1/1 assign in_data_toggle_o = data_toggle_q; Tests: T1 T2 T3  376 377 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 378 1/1 if (!rst_ni) begin Tests: T1 T2 T3  379 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  380 1/1 end else if (link_reset_i) begin Tests: T1 T2 T3  381 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  382 end else begin 383 1/1 data_toggle_q <= data_toggle_d; Tests: T1 T2 T3  384 end 385 end 386 387 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 388 1/1 if (!rst_ni) begin Tests: T1 T2 T3  389 1/1 in_ep_data_get_o <= 1'b0; Tests: T1 T2 T3  390 end else begin 391 1/1 if ((in_xact_state == StSendData) && tx_data_get_i) begin Tests: T1 T2 T3  392 1/1 in_ep_data_get_o <= 1'b1; Tests: T30 T31 T35  393 end else begin 394 1/1 in_ep_data_get_o <= 1'b0; Tests: T1 T2 T3  395 end 396 end 397 end 398 399 //////////////////////////////////////////////////////////////////////////////// 400 // Count non-Isochronous IN transactions not receiving a handshake response. 401 // 402 // - no handshake response within the timeout period 403 // - packet reception started within the timeout period but it was not ACK/NAK. 404 //////////////////////////////////////////////////////////////////////////////// 405 1/1 assign event_timeout_in_o = (in_xact_state == StWaitAckStart || Tests: T1 T2 T3  406 (in_xact_state == StWaitAck && rx_pkt_end_i && !nak_received)) 407 & rollback_in_xact; 408 409 //////////////////////////////////////////////////////////////////////////////// 410 // Count IN transactions that are actively NAKed by the host. 411 //////////////////////////////////////////////////////////////////////////////// 412 1/1 assign event_nak_in_o = (in_xact_state == StWaitAck) && nak_received; Tests: T1 T2 T3  413 414 //////////////////////////////////////////////////////////////////////////////// 415 // Count the number of IN requests for which data is not available, including 416 // endpoints which are supported but not presently enabled/configured. 417 // (These may be ignored using the event counter configuration if required.) 418 //////////////////////////////////////////////////////////////////////////////// 419 logic event_nodata_in_q; 420 // This event signal must be delayed by a single cycle so that 'in_ep_current_o' becomes valid. 421 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 422 2/2 if (!rst_ni) event_nodata_in_q <= 1'b0; Tests: T1 T2 T3  | T1 T2 T3  423 1/1 else event_nodata_in_q <= in_starting & (ep_in_hw ? !in_ep_has_data_i[in_ep_index_d] : 1'b0); Tests: T1 T2 T3  424 end 425 1/1 assign event_nodata_in_o = event_nodata_in_q; Tests: T1 T2 T3 

Cond Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_in_pe
TotalCoveredPercent
Conditions11411096.49
Logical11411096.49
Non-Logical00
Event00

 LINE       135
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && (rx_pid_type == UsbPidTypeToken) && (rx_addr_i == dev_addr_i))
             ------1-----    -------2------    ----------------3---------------    ------------4------------
-1--2--3--4-StatusTests
0111CoveredT1,T28,T29
1011CoveredT78,T79,T76
1101CoveredT1,T28,T29
1110CoveredT3,T40,T42
1111CoveredT1,T28,T29

 LINE       135
 SUB-EXPRESSION (rx_pid_type == UsbPidTypeToken)
                ----------------1---------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T3,T28

 LINE       135
 SUB-EXPRESSION (rx_addr_i == dev_addr_i)
                ------------1------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       141
 EXPRESSION (token_received && (rx_pid == UsbPidSetup))
             -------1------    -----------2-----------
-1--2-StatusTests
01CoveredT1,T28,T42
10CoveredT29,T30,T31
11CoveredT1,T28,T4

 LINE       141
 SUB-EXPRESSION (rx_pid == UsbPidSetup)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T28,T42

 LINE       145
 EXPRESSION (token_received && (rx_pid == UsbPidIn))
             -------1------    ----------2---------
-1--2-StatusTests
01CoveredT29,T30,T42
10CoveredT1,T28,T29
11CoveredT29,T30,T31

 LINE       145
 SUB-EXPRESSION (rx_pid == UsbPidIn)
                ----------1---------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T42

 LINE       149
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && (rx_pid == UsbPidAck))
             ------1-----    -------2------    ----------3----------
-1--2--3-StatusTests
011CoveredT29,T30,T31
101CoveredT82,T83,T113
110CoveredT1,T3,T28
111CoveredT29,T30,T31

 LINE       149
 SUB-EXPRESSION (rx_pid == UsbPidAck)
                ----------1----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T42

 LINE       154
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && (rx_pid == UsbPidNak))
             ------1-----    -------2------    ----------3----------
-1--2--3-StatusTests
011CoveredT30,T37,T111
101CoveredT82,T83
110CoveredT1,T3,T28
111CoveredT30,T111,T114

 LINE       154
 SUB-EXPRESSION (rx_pid == UsbPidNak)
                ----------1----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       161
 EXPRESSION (ep_in_hw ? rx_endp_i : '0)
             ----1---
-1-StatusTests
0CoveredT42,T7,T19
1CoveredT1,T2,T3

 LINE       172
 EXPRESSION (in_ep_enabled_i[in_ep_index_d] & ep_in_hw)
             ---------------1--------------   ----2---
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT9,T79,T115
11CoveredT29,T30,T42

 LINE       178
 EXPRESSION (has_data_q & ((~in_ep_data_done_i[in_ep_index])))
             -----1----   -----------------2-----------------
-1--2-StatusTests
01CoveredT69,T107,T115
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       180
 EXPRESSION ((logic'((in_xact_state == StSendData))) & more_data_to_send)
             -------------------1-------------------   --------2--------
-1--2-StatusTests
01CoveredT30,T31,T35
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       186
 EXPRESSION (((in_xact_state == StIdle) || (in_xact_state == StWaitAck)) && in_token_received)
             -----------------------------1-----------------------------    --------2--------
-1--2-StatusTests
01Not Covered
10CoveredT1,T2,T3
11CoveredT29,T30,T31

 LINE       186
 SUB-EXPRESSION ((in_xact_state == StIdle) || (in_xact_state == StWaitAck))
                 ------------1------------    --------------2-------------
-1--2-StatusTests
00CoveredT29,T30,T31
01CoveredT29,T30,T31
10CoveredT1,T2,T3

 LINE       186
 SUB-EXPRESSION (in_xact_state == StIdle)
                ------------1------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       186
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       188
 EXPRESSION (in_starting & ep_active)
             -----1-----   ----2----
-1--2-StatusTests
01CoveredT29,T30,T42
10CoveredT107,T115,T116
11CoveredT29,T30,T31

 LINE       207
 EXPRESSION (ep_active && in_token_received)
             ----1----    --------2--------
-1--2-StatusTests
01CoveredT107,T115,T116
10CoveredT29,T30,T42
11CoveredT29,T30,T31

 LINE       239
 EXPRESSION (((!more_data_to_send)) || (((&in_ep_get_addr_o)) && tx_data_get_i))
             -----------1----------    --------------------2-------------------
-1--2-StatusTests
00CoveredT30,T31,T35
01CoveredT30,T37,T17
10CoveredT29,T30,T31

 LINE       239
 SUB-EXPRESSION (((&in_ep_get_addr_o)) && tx_data_get_i)
                 ----------1----------    ------2------
-1--2-StatusTests
01CoveredT30,T31,T35
10CoveredT30,T37,T17
11CoveredT30,T37,T17

 LINE       269
 EXPRESSION (timeout_cntdown_q == '0)
            ------------1------------
-1-StatusTests
0CoveredT29,T30,T31
1CoveredT30,T33,T23

 LINE       283
 EXPRESSION (ep_active ? StRcvdIn : StIdle)
             ----1----
-1-StatusTests
0Not Covered
1Not Covered

 LINE       322
 EXPRESSION (link_reset_i || ((!link_active_i)))
             ------1-----    ---------2--------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT1,T2,T3
10CoveredT1,T2,T3

 LINE       335
 EXPRESSION (in_xact_state == StIdle)
            ------------1------------
-1-StatusTests
0CoveredT29,T30,T31
1CoveredT1,T2,T3

 LINE       337
 EXPRESSION ((in_xact_state == StSendData) && tx_data_get_i)
             --------------1--------------    ------2------
-1--2-StatusTestsExclude Annotation
01Excluded VC_COV_UNR
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       337
 SUB-EXPRESSION (in_xact_state == StSendData)
                --------------1--------------
-1-StatusTests
0CoveredT29,T30,T31
1CoveredT29,T30,T31

 LINE       363
 EXPRESSION (setup_token_received && ep_active)
             ----------1---------    ----2----
-1--2-StatusTests
01CoveredT29,T30,T42
10CoveredT1,T28,T55
11CoveredT4,T89,T49

 LINE       365
 EXPRESSION ((in_xact_state == StWaitAck) && ack_received)
             --------------1-------------    ------2-----
-1--2-StatusTests
01CoveredT117,T118,T119
10CoveredT29,T30,T31
11CoveredT29,T30,T31

 LINE       365
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       391
 EXPRESSION ((in_xact_state == StSendData) && tx_data_get_i)
             --------------1--------------    ------2------
-1--2-StatusTests
01CoveredT120,T121,T122
10CoveredT29,T30,T31
11CoveredT30,T31,T35

 LINE       391
 SUB-EXPRESSION (in_xact_state == StSendData)
                --------------1--------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       405
 EXPRESSION (((in_xact_state == StWaitAckStart) || ((in_xact_state == StWaitAck) && rx_pkt_end_i && ((!nak_received)))) & rollback_in_xact)
             -----------------------------------------------------1----------------------------------------------------   --------2-------
-1--2-StatusTests
01CoveredT30,T111,T114
10CoveredT29,T30,T31
11CoveredT30,T33,T37

 LINE       405
 SUB-EXPRESSION ((in_xact_state == StWaitAckStart) || ((in_xact_state == StWaitAck) && rx_pkt_end_i && ((!nak_received))))
                 ----------------1----------------    ---------------------------------2---------------------------------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT29,T30,T31
10CoveredT29,T30,T31

 LINE       405
 SUB-EXPRESSION (in_xact_state == StWaitAckStart)
                ----------------1----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       405
 SUB-EXPRESSION ((in_xact_state == StWaitAck) && rx_pkt_end_i && ((!nak_received)))
                 --------------1-------------    ------2-----    --------3--------
-1--2--3-StatusTests
011CoveredT1,T3,T28
101CoveredT29,T30,T31
110CoveredT30,T111,T114
111CoveredT29,T30,T31

 LINE       405
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       412
 EXPRESSION ((in_xact_state == StWaitAck) && nak_received)
             --------------1-------------    ------2-----
-1--2-StatusTests
01Not Covered
10CoveredT29,T30,T31
11CoveredT30,T111,T114

 LINE       412
 SUB-EXPRESSION (in_xact_state == StWaitAck)
                --------------1-------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT29,T30,T31

 LINE       423
 EXPRESSION (in_starting & (ep_in_hw ? ((!in_ep_has_data_i[in_ep_index_d])) : 1'b0))
             -----1-----   ----------------------------2---------------------------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT29,T30,T31
11CoveredT4,T5,T6

 LINE       423
 SUB-EXPRESSION (ep_in_hw ? ((!in_ep_has_data_i[in_ep_index_d])) : 1'b0)
                 ----1---
-1-StatusTests
0CoveredT42,T7,T19
1CoveredT1,T2,T3

FSM Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_in_pe
Summary for FSM :: in_xact_state
TotalCoveredPercent
States 6 6 100.00 (Not included in score)
Transitions 11 10 90.91
Sequences 0 0

State, Transition and Sequence Details for FSM :: in_xact_state
statesLine No.CoveredTests
StIdle 323 Covered T1,T2,T3
StRcvdIn 208 Covered T29,T30,T31
StSendData 223 Covered T29,T30,T31
StWaitAck 268 Covered T29,T30,T31
StWaitAckStart 245 Covered T29,T30,T31
StWaitTxEnd 247 Covered T29,T30,T31


transitionsLine No.CoveredTestsExclude Annotation
StIdle->StRcvdIn 208 Covered T29,T30,T31
StRcvdIn->StIdle 323 Covered T34,T4,T5
StRcvdIn->StSendData 223 Covered T29,T30,T31
StSendData->StIdle 323 Covered T36,T68,T69
StSendData->StWaitAckStart 245 Excluded VC_COV_UNR
StSendData->StWaitTxEnd 247 Covered T29,T30,T31
StWaitAck->StIdle 323 Covered T29,T30,T31
StWaitAck->StRcvdIn 283 Not Covered
StWaitAckStart->StIdle 323 Covered T30,T33,T23
StWaitAckStart->StWaitAck 268 Covered T29,T30,T31
StWaitTxEnd->StIdle 323 Covered T123,T124,T125
StWaitTxEnd->StWaitAckStart 257 Covered T29,T30,T31



Branch Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_in_pe
Line No.TotalCoveredPercent
Branches 48 46 95.83
TERNARY 161 2 2 100.00
CASE 205 19 17 89.47
IF 303 2 2 100.00
IF 311 2 2 100.00
IF 319 3 3 100.00
IF 332 4 4 100.00
IF 344 3 3 100.00
IF 363 3 3 100.00
IF 369 2 2 100.00
IF 378 3 3 100.00
IF 388 3 3 100.00
IF 422 2 2 100.00


161 assign in_ep_current_d = ep_in_hw ? rx_endp_i : '0; -1- ==> ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T42,T7,T19


205 unique case (in_xact_state) -1- 206 StIdle: begin 207 if (ep_active && in_token_received) begin -2- 208 in_xact_state_next = StRcvdIn; ==> 209 end else begin 210 // Ignore tokens to inactive endpoints. Send no response. 211 in_xact_state_next = StIdle; ==> 212 end 213 end 214 215 StRcvdIn: begin 216 tx_pkt_start_o = 1'b1; // Need to transmit NAK/STALL or DATA 217 218 if (in_ep_iso_i[in_ep_index]) begin -3- 219 // ISO endpoint 220 // We always need to transmit. When no data is available, we send 221 // a zero-length packet. 222 // DATA0 always for full-speed isochronous endpoints 223 in_xact_state_next = StSendData; ==> 224 tx_pid_o = {UsbPidData0}; 225 end else if (in_ep_stall_i[in_ep_index]) begin -4- 226 in_xact_state_next = StIdle; ==> 227 tx_pid_o = {UsbPidStall}; // STALL 228 end else if (has_data_q) begin -5- 229 in_xact_state_next = StSendData; ==> 230 tx_pid_o = {data_toggle_q[in_ep_index], 1'b0, {UsbPidTypeData}}; // DATA0/1 231 end else begin 232 in_xact_state_next = StIdle; ==> 233 tx_pid_o = {UsbPidNak}; // NAK 234 end 235 end 236 237 StSendData: begin 238 // Use &in_ep_get_addr so width can vary, looking for all ones 239 if ((!more_data_to_send) || ((&in_ep_get_addr_o) && tx_data_get_i)) begin -6- 240 if (in_ep_iso_i[in_ep_index]) begin -7- 241 in_xact_state_next = StIdle; // no ACK for ISO EPs ==> 242 in_xact_end = has_data_q; 243 end else begin 244 if (tx_pkt_end_i) begin -8- 245 in_xact_state_next = StWaitAckStart; ==> (Excluded) Exclude Annotation: VC_COV_UNR 246 end else begin 247 in_xact_state_next = StWaitTxEnd; ==> 248 end 249 end 250 end else begin 251 in_xact_state_next = StSendData; ==> 252 end 253 end 254 255 StWaitTxEnd: begin 256 if (tx_pkt_end_i) begin -9- 257 in_xact_state_next = StWaitAckStart; ==> 258 end MISSING_ELSE ==> 259 end 260 261 StWaitAckStart: begin 262 // The spec says we have up to 18 bit times to wait for the host 263 // response. If it doesn't arrive in time, we must invalidate the 264 // transaction. 265 timeout_cntdown_d = timeout_cntdown_q - 1'b1; 266 267 if (rx_pkt_start_i) begin -10- 268 in_xact_state_next = StWaitAck; ==> 269 end else if (timeout_cntdown_q == '0) begin -11- 270 in_xact_state_next = StIdle; ==> 271 rollback_in_xact = 1'b1; 272 end else begin 273 in_xact_state_next = StWaitAckStart; ==> 274 end 275 end 276 277 StWaitAck: begin 278 if (ack_received) begin -12- 279 in_xact_state_next = StIdle; ==> 280 in_xact_end = 1'b1; 281 end else if (in_token_received) begin -13- 282 // Handshake response is missing. 283 in_xact_state_next = ep_active ? StRcvdIn : StIdle; -14- ==> ==> 284 rollback_in_xact = 1'b1; 285 end else if (rx_pkt_end_i) begin -15- 286 // Includes NAK 287 in_xact_state_next = StIdle; ==> 288 rollback_in_xact = 1'b1; 289 end else begin 290 in_xact_state_next = StWaitAck; ==> 291 end 292 end 293 294 default: in_xact_state_next = StIdle; ==> (Excluded) Exclude Annotation: VC_COV_UNR

Branches:
-1--2--3--4--5--6--7--8--9--10--11--12--13--14--15-StatusTestsExclude Annotation
StIdle 1 - - - - - - - - - - - - - Covered T29,T30,T31
StIdle 0 - - - - - - - - - - - - - Covered T1,T2,T3
StRcvdIn - 1 - - - - - - - - - - - - Covered T36,T68,T69
StRcvdIn - 0 1 - - - - - - - - - - - Covered T34,T107,T110
StRcvdIn - 0 0 1 - - - - - - - - - - Covered T29,T30,T31
StRcvdIn - 0 0 0 - - - - - - - - - - Covered T4,T5,T6
StSendData - - - - 1 1 - - - - - - - - Covered T36,T68,T69
StSendData - - - - 1 0 1 - - - - - - - Excluded VC_COV_UNR
StSendData - - - - 1 0 0 - - - - - - - Covered T29,T30,T31
StSendData - - - - 0 - - - - - - - - - Covered T30,T31,T35
StWaitTxEnd - - - - - - - 1 - - - - - - Covered T29,T30,T31
StWaitTxEnd - - - - - - - 0 - - - - - - Covered T29,T30,T31
StWaitAckStart - - - - - - - - 1 - - - - - Covered T29,T30,T31
StWaitAckStart - - - - - - - - 0 1 - - - - Covered T30,T33,T23
StWaitAckStart - - - - - - - - 0 0 - - - - Covered T29,T30,T31
StWaitAck - - - - - - - - - - 1 - - - Covered T29,T30,T31
StWaitAck - - - - - - - - - - 0 1 1 - Not Covered
StWaitAck - - - - - - - - - - 0 1 0 - Not Covered
StWaitAck - - - - - - - - - - 0 0 - 1 Covered T30,T37,T111
StWaitAck - - - - - - - - - - 0 0 - 0 Covered T29,T30,T31
default - - - - - - - - - - - - - - Excluded VC_COV_UNR


303 if (!rst_ni) begin -1- 304 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; ==> 305 end else begin 306 timeout_cntdown_q <= timeout_cntdown_d; ==>

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


311 if (!rst_ni) begin -1- 312 tx_data_o <= '0; ==> 313 end else begin 314 tx_data_o <= in_ep_data_i; ==>

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


319 if (!rst_ni) begin -1- 320 in_xact_state <= StIdle; ==> 321 in_ep_rollback_o <= 1'b0; 322 end else if (link_reset_i || !link_active_i) begin -2- 323 in_xact_state <= StIdle; ==> 324 in_ep_rollback_o <= 1'b0; 325 end else begin 326 in_xact_state <= in_xact_state_next; ==>

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


332 if (!rst_ni) begin -1- 333 in_ep_get_addr_o <= '0; ==> 334 end else begin 335 if (in_xact_state == StIdle) begin -2- 336 in_ep_get_addr_o <= '0; ==> 337 end else if ((in_xact_state == StSendData) && tx_data_get_i) begin -3- 338 in_ep_get_addr_o <= in_ep_get_addr_o + 1'b1; ==> 339 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T1,T2,T3
0 0 1 Covered T30,T31,T35
0 0 0 Covered T29,T30,T31


344 if (!rst_ni) begin -1- 345 in_ep_newpkt_o <= 1'b0; ==> 346 in_ep_current_o <= '0; 347 has_data_q <= 1'b0; 348 end else begin 349 if (in_token_received) begin -2- 350 in_ep_current_o <= in_ep_current_d; ==> 351 in_ep_newpkt_o <= 1'b1; 352 has_data_q <= in_ep_has_data_i[in_ep_index_d]; 353 end else begin 354 in_ep_newpkt_o <= 1'b0; ==>

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


363 if (setup_token_received && ep_active) begin -1- 364 data_toggle_d[in_ep_index_d] = 1'b1; ==> 365 end else if ((in_xact_state == StWaitAck) && ack_received) begin -2- 366 data_toggle_d[in_ep_index] = ~data_toggle_q[in_ep_index]; ==> 367 end MISSING_ELSE ==>

Branches:
-1--2-StatusTests
1 - Covered T4,T89,T49
0 1 Covered T29,T30,T31
0 0 Covered T1,T2,T3


369 if (in_datatog_we_i) begin -1- 370 data_toggle_d = (data_toggle_d & ~in_datatog_mask_i) | ==> 371 (in_datatog_status_i & in_datatog_mask_i); 372 end MISSING_ELSE ==>

Branches:
-1-StatusTests
1 Covered T29,T30,T112
0 Covered T1,T2,T3


378 if (!rst_ni) begin -1- 379 data_toggle_q <= '0; // Clear for all endpoints ==> 380 end else if (link_reset_i) begin -2- 381 data_toggle_q <= '0; // Clear for all endpoints ==> 382 end else begin 383 data_toggle_q <= data_toggle_d; ==>

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


388 if (!rst_ni) begin -1- 389 in_ep_data_get_o <= 1'b0; ==> 390 end else begin 391 if ((in_xact_state == StSendData) && tx_data_get_i) begin -2- 392 in_ep_data_get_o <= 1'b1; ==> 393 end else begin 394 in_ep_data_get_o <= 1'b0; ==>

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


422 if (!rst_ni) event_nodata_in_q <= 1'b0; -1- ==> 423 else event_nodata_in_q <= in_starting & (ep_in_hw ? !in_ep_has_data_i[in_ep_index_d] : 1'b0); ==>

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


Assert Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_in_pe
TotalAttemptedPercentSucceeded/MatchedPercent
Assertions 1 1 100.00 1 100.00
Cover properties 0 0 0
Cover sequences 0 0 0
Total 1 1 100.00 1 100.00




Assertion Details

NameAttemptsReal SuccessesFailuresIncomplete
InXactStateValid_A 575541647 575257361 0 0


InXactStateValid_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 575541647 575257361 0 0
T1 7118 7058 0 0
T2 6427 6353 0 0
T3 7249 7195 0 0
T28 8699 8599 0 0
T29 12933 12840 0 0
T30 43034 42964 0 0
T39 1959 1891 0 0
T40 7184 7112 0 0
T41 1592 1501 0 0
T42 21513 21419 0 0

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