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



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

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
95.47 99.21 92.54 87.50 98.08 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
95.47 99.21 92.54 87.50 98.08 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_out_pe
Line No.TotalCoveredPercent
TOTAL12712699.21
CONT_ASSIGN9011100.00
CONT_ASSIGN13111100.00
CONT_ASSIGN13211100.00
CONT_ASSIGN13411100.00
CONT_ASSIGN14011100.00
CONT_ASSIGN14411100.00
CONT_ASSIGN14811100.00
CONT_ASSIGN15211100.00
CONT_ASSIGN15711100.00
CONT_ASSIGN16311100.00
CONT_ASSIGN16411100.00
CONT_ASSIGN17111100.00
CONT_ASSIGN17211100.00
CONT_ASSIGN17511100.00
CONT_ASSIGN17611100.00
CONT_ASSIGN17811100.00
ALWAYS18466100.00
ALWAYS19644100.00
ALWAYS212555498.18
CONT_ASSIGN32611100.00
ALWAYS32933100.00
ALWAYS33733100.00
ALWAYS34677100.00
CONT_ASSIGN36011100.00
ALWAYS36355100.00
ALWAYS37399100.00
ALWAYS39033100.00
ALWAYS40266100.00
CONT_ASSIGN41811100.00
ALWAYS42166100.00
CONT_ASSIGN43511100.00

89 logic unused_1; 90 1/1 assign unused_1 = tx_pkt_end_i; Tests: T1 T2 T3  91 92 /////////////////////////////////// 93 // out transaction state machine // 94 /////////////////////////////////// 95 import usb_consts_pkg::*; 96 97 typedef enum logic [2:0] { 98 StIdle, 99 StRcvdOut, 100 StRcvdDataStart, 101 StRcvdDataEnd, 102 StRcvdIsoDataEnd 103 } state_out_e; 104 105 state_out_e out_xact_state; 106 state_out_e out_xact_state_next; 107 108 logic out_xact_start; 109 logic new_pkt_end; 110 logic rollback_data; 111 112 // set when the endpoint buffer is unable to receive the out transaction 113 logic nak_out_transaction; 114 115 // data toggle state 116 logic [NumOutEps - 1:0] data_toggle_q, data_toggle_d; 117 118 // Decode the rx token 119 logic token_received, out_token_received, setup_token_received; 120 logic invalid_packet_received, data_packet_received, non_data_packet_received; 121 logic bad_data_toggle; 122 logic ep_in_hw, ep_active, ep_is_control; 123 logic [3:0] out_ep_current_d; 124 125 // 1: If the current transaction is a SETUP, 0: OUT 126 logic current_xact_setup_q; 127 128 // More syntax so can compare with enum 129 usb_pid_type_e rx_pid_type; 130 usb_pid_e rx_pid; 131 1/1 assign rx_pid_type = usb_pid_type_e'(rx_pid_i[1:0]); Tests: T1 T2 T3  132 1/1 assign rx_pid = usb_pid_e'(rx_pid_i); Tests: T1 T2 T3  133 134 1/1 assign token_received = Tests: T1 T2 T3  135 rx_pkt_end_i && 136 rx_pkt_valid_i && 137 rx_pid_type == UsbPidTypeToken && 138 rx_addr_i == dev_addr_i; 139 140 1/1 assign out_token_received = Tests: T1 T2 T3  141 token_received && 142 rx_pid == UsbPidOut; 143 144 1/1 assign setup_token_received = Tests: T1 T2 T3  145 token_received && 146 rx_pid == UsbPidSetup; 147 148 1/1 assign invalid_packet_received = Tests: T1 T2 T3  149 rx_pkt_end_i && 150 !rx_pkt_valid_i; 151 152 1/1 assign data_packet_received = Tests: T1 T2 T3  153 rx_pkt_end_i && 154 rx_pkt_valid_i && 155 ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)); 156 157 1/1 assign non_data_packet_received = Tests: T1 T2 T3  158 rx_pkt_end_i && 159 rx_pkt_valid_i && 160 !((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)); 161 162 // Is the specified endpoint actually implemented in hardware? 163 1/1 assign ep_in_hw = {1'b0, rx_endp_i} < NumOutEps; Tests: T1 T2 T3  164 1/1 assign out_ep_current_d = ep_in_hw ? rx_endp_i : '0; Tests: T1 T2 T3  165 166 // Make widths work - out_ep_current_d/out_ep_current_o only hold implemented endpoint IDs. 167 // These signals can be used to index signals of NumOutEps width. 168 // They are only valid if ep_in_hw is set, i.e., if the specified endpoint is implemented. 169 logic [OutEpW-1:0] out_ep_index; 170 logic [OutEpW-1:0] out_ep_index_d; 171 1/1 assign out_ep_index = out_ep_current_o[0 +: OutEpW]; Tests: T1 T2 T3  172 1/1 assign out_ep_index_d = out_ep_current_d[0 +: OutEpW]; Tests: T1 T2 T3  173 174 // Is the endpoint active? 175 1/1 assign ep_active = out_ep_enabled_i[out_ep_index_d] & ep_in_hw; Tests: T1 T2 T3  176 1/1 assign ep_is_control = out_ep_control_i[out_ep_index_d]; Tests: T1 T2 T3  177 178 1/1 assign bad_data_toggle = Tests: T1 T2 T3  179 data_packet_received && 180 ep_active && 181 rx_pid_i[3] != data_toggle_q[out_ep_index_d]; 182 183 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 184 1/1 if (!rst_ni) begin Tests: T1 T2 T3  185 1/1 out_ep_setup_o <= '0; Tests: T1 T2 T3  186 end else begin 187 1/1 if (setup_token_received && ep_active) begin Tests: T1 T2 T3  188 1/1 out_ep_setup_o[out_ep_index_d] <= 1'b1; Tests: T3 T28 T30  189 1/1 end else if (out_token_received && ep_active) begin Tests: T1 T2 T3  190 1/1 out_ep_setup_o[out_ep_index_d] <= 1'b0; Tests: T29 T30 T32  191 end MISSING_ELSE 192 end 193 end 194 195 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 196 1/1 if (!rst_ni) begin Tests: T1 T2 T3  197 1/1 out_ep_data_o <= 0; Tests: T1 T2 T3  198 end else begin 199 1/1 if (rx_data_put_i) begin Tests: T1 T2 T3  200 1/1 out_ep_data_o <= rx_data_i; Tests: T2 T3 T28  201 end MISSING_ELSE 202 end 203 end 204 205 /////////////////////////////////// 206 // out transaction state machine // 207 /////////////////////////////////// 208 209 logic [AckTimeoutCntW-1:0] timeout_cntdown_d, timeout_cntdown_q; 210 211 always_comb begin 212 1/1 out_ep_acked_o = 1'b0; Tests: T1 T2 T3  213 1/1 out_xact_start = 1'b0; Tests: T1 T2 T3  214 1/1 out_xact_state_next = out_xact_state; Tests: T1 T2 T3  215 1/1 tx_pkt_start_o = 1'b0; Tests: T1 T2 T3  216 1/1 tx_pid_o = 4'b0000; Tests: T1 T2 T3  217 1/1 new_pkt_end = 1'b0; Tests: T1 T2 T3  218 1/1 rollback_data = 1'b0; Tests: T1 T2 T3  219 1/1 timeout_cntdown_d = AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  220 221 1/1 unique case (out_xact_state) Tests: T1 T2 T3  222 StIdle: begin 223 // For unimplemented EPs, transactions are ignored. 224 // SETUP transactions are also ignored for non-control EPs. 225 1/1 if (ep_active && (out_token_received || (setup_token_received && ep_is_control))) begin Tests: T1 T2 T3  226 1/1 out_xact_state_next = StRcvdOut; Tests: T3 T28 T29  227 1/1 out_xact_start = 1'b1; Tests: T3 T28 T29  228 end else begin 229 1/1 out_xact_state_next = StIdle; Tests: T1 T2 T3  230 end 231 end 232 233 StRcvdOut: begin 234 // The spec says we have up to 18 bit times to wait for the host's 235 // data packet. If it doesn't arrive in time, we must invalidate the 236 // transaction. 237 1/1 timeout_cntdown_d = timeout_cntdown_q - 1'b1; Tests: T3 T28 T29  238 239 1/1 if (rx_pkt_start_i) begin Tests: T3 T28 T29  240 1/1 out_xact_state_next = StRcvdDataStart; Tests: T3 T28 T29  241 1/1 end else if (timeout_cntdown_q == '0) begin Tests: T3 T28 T29  242 0/1 ==> out_xact_state_next = StIdle; 243 end else begin 244 1/1 out_xact_state_next = StRcvdOut; Tests: T3 T28 T29  245 end 246 end 247 248 StRcvdDataStart: begin 249 1/1 if (!ep_is_control && out_ep_iso_i[out_ep_index] && data_packet_received) begin Tests: T3 T28 T29  250 // ISO EP: Don't send a handshake, ignore toggle. 251 // But ignore iso bit for endpoints marked control. This is 252 // a configuration error. 253 1/1 out_xact_state_next = StRcvdIsoDataEnd; Tests: T30 T84 T159  254 1/1 end else if (bad_data_toggle && !out_ep_stall_i[out_ep_index]) begin Tests: T3 T28 T29  255 // The DATA toggle was wrong (skipped when this EP is stalled) 256 // Note: bad_data_toggle is meaningless for unimplemented EPs. 257 1/1 out_xact_state_next = StIdle; Tests: T32 T37 T39  258 1/1 rollback_data = 1'b1; Tests: T32 T37 T39  259 1/1 tx_pkt_start_o = 1'b1; Tests: T32 T37 T39  260 1/1 tx_pid_o = {UsbPidAck}; // ACK by spec because this is most likely previous ACK was lost Tests: T32 T37 T39  261 1/1 end else if (invalid_packet_received || non_data_packet_received) begin Tests: T3 T28 T29  262 // in these cases eg bad CRC, send no response (not a NAK) 263 1/1 out_xact_state_next = StIdle; Tests: T37 T39 T71  264 1/1 rollback_data = 1'b1; Tests: T37 T39 T71  265 1/1 end else if (data_packet_received) begin Tests: T3 T28 T29  266 1/1 out_xact_state_next = StRcvdDataEnd; Tests: T3 T28 T29  267 end else begin 268 1/1 out_xact_state_next = StRcvdDataStart; Tests: T3 T28 T29  269 end 270 end 271 272 StRcvdDataEnd: begin 273 1/1 out_xact_state_next = StIdle; Tests: T3 T28 T29  274 1/1 tx_pkt_start_o = 1'b1; Tests: T3 T28 T29  275 276 1/1 if (current_xact_setup_q) begin Tests: T3 T28 T29  277 // SETUP transactions end here 278 1/1 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin Tests: T3 T28 T30  279 // SETUP transactions that fail to be received are dropped without a response. 280 1/1 tx_pkt_start_o = 1'b0; Tests: T194 T195 T196  281 1/1 rollback_data = 1'b1; Tests: T194 T195 T196  282 end else begin 283 1/1 tx_pid_o = {UsbPidAck}; Tests: T3 T28 T30  284 1/1 new_pkt_end = 1'b1; Tests: T3 T28 T30  285 1/1 out_ep_acked_o = 1'b1; Tests: T3 T28 T30  286 end 287 end else begin 288 // Non-isochronous OUT transactions end here 289 1/1 if (out_ep_stall_i[out_ep_index]) begin Tests: T29 T32 T33  290 1/1 tx_pid_o = {UsbPidStall}; // STALL Tests: T164 T171 T197  291 1/1 rollback_data = 1'b1; // Packet not accepted Tests: T164 T171 T197  292 1/1 end else if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin Tests: T29 T32 T33  293 1/1 tx_pid_o = {UsbPidNak}; // NAK -- the endpoint could not accept the data at the moment Tests: T37 T39 T72  294 1/1 rollback_data = 1'b1; Tests: T37 T39 T72  295 end else begin 296 1/1 tx_pid_o = {UsbPidAck}; // ACK Tests: T29 T32 T33  297 1/1 new_pkt_end = 1'b1; Tests: T29 T32 T33  298 1/1 out_ep_acked_o = 1'b1; Tests: T29 T32 T33  299 end 300 end 301 end 302 303 StRcvdIsoDataEnd: begin 304 // Isochronous OUT transactions end here 305 1/1 out_xact_state_next = StIdle; Tests: T30 T84 T159  306 307 1/1 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin Tests: T30 T84 T159  308 // We got a valid packet, but can't store it (error that the software must resolve) 309 1/1 rollback_data = 1'b1; Tests: T30 T198 T199  310 end else begin 311 // We got a valid packet, but we don't send an ACK on the bus 312 1/1 new_pkt_end = 1'b1; Tests: T84 T159 T169  313 1/1 out_ep_acked_o = 1'b1; Tests: T84 T159 T169  314 end 315 end 316 317 default: out_xact_state_next = StIdle; 318 endcase 319 end 320 321 `ASSERT(OutXactStateValid_A, 322 out_xact_state inside {StIdle, StRcvdOut, StRcvdDataStart, StRcvdDataEnd, StRcvdIsoDataEnd}, 323 clk_48mhz_i) 324 325 // could flop this if needed 326 1/1 assign out_ep_rollback_o = rollback_data; Tests: T1 T2 T3  327 328 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 329 1/1 if (!rst_ni) begin Tests: T1 T2 T3  330 1/1 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  331 end else begin 332 1/1 timeout_cntdown_q <= timeout_cntdown_d; Tests: T1 T2 T3  333 end 334 end 335 336 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 337 1/1 if (!rst_ni) begin Tests: T1 T2 T3  338 1/1 out_xact_state <= StIdle; Tests: T1 T2 T3  339 end else begin 340 1/1 out_xact_state <= link_reset_i ? StIdle : out_xact_state_next; Tests: T1 T2 T3  341 end 342 end 343 344 // Updating of data toggles 345 always_comb begin : proc_data_toggle_d 346 1/1 data_toggle_d = data_toggle_q; Tests: T1 T2 T3  347 348 1/1 if (setup_token_received && ep_active) begin Tests: T1 T2 T3  349 1/1 data_toggle_d[out_ep_index_d] = 1'b0; Tests: T3 T28 T30  350 1/1 end else if (new_pkt_end) begin Tests: T1 T2 T3  351 1/1 data_toggle_d[out_ep_index] = ~data_toggle_q[out_ep_index]; Tests: T3 T28 T29  352 end MISSING_ELSE 353 // Selective modification by software 354 1/1 if (out_datatog_we_i) begin Tests: T1 T2 T3  355 1/1 data_toggle_d = (data_toggle_d & ~out_datatog_mask_i) | Tests: T29 T32 T37  356 (out_datatog_status_i & out_datatog_mask_i); 357 end MISSING_ELSE 358 end 359 // Supply current data toggles to register interface 360 1/1 assign out_data_toggle_o = data_toggle_q; Tests: T1 T2 T3  361 362 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 363 1/1 if (!rst_ni) begin Tests: T1 T2 T3  364 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  365 1/1 end else if (link_reset_i) begin Tests: T1 T2 T3  366 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  367 end else begin 368 1/1 data_toggle_q <= data_toggle_d; Tests: T1 T2 T3  369 end 370 end 371 372 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 373 1/1 if (!rst_ni) begin Tests: T1 T2 T3  374 1/1 out_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  375 1/1 out_ep_current_o <= '0; Tests: T1 T2 T3  376 1/1 current_xact_setup_q <= 1'b0; Tests: T1 T2 T3  377 end else begin 378 1/1 if (out_xact_start) begin Tests: T1 T2 T3  379 1/1 out_ep_newpkt_o <= 1'b1; Tests: T3 T28 T29  380 1/1 out_ep_current_o <= out_ep_current_d; Tests: T3 T28 T29  381 1/1 current_xact_setup_q <= setup_token_received; Tests: T3 T28 T29  382 end else begin 383 1/1 out_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  384 end 385 end 386 end 387 388 // put data strobe follows the rx strobe (which will latch the data) 389 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 390 1/1 if (!rst_ni) begin Tests: T1 T2 T3  391 1/1 out_ep_data_put_o <= 1'b0; Tests: T1 T2 T3  392 end else begin 393 1/1 out_ep_data_put_o <= ((out_xact_state == StRcvdDataStart) && rx_data_put_i); Tests: T1 T2 T3  394 end 395 end 396 397 // nak an OUT if any data comes in with the endpoint full 398 // Note that if there is a full size packet buffer this will only be all or nothing 399 // but in the case there was a FIFO with less than a max packet size free you 400 // could get lucky and the packet received be small and fit with no need to NAK 401 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 402 1/1 if (!rst_ni) begin Tests: T1 T2 T3  403 1/1 nak_out_transaction <= 1'b0; Tests: T1 T2 T3  404 end else begin 405 1/1 if ((out_xact_state == StIdle) || (out_xact_state == StRcvdOut)) begin Tests: T1 T2 T3  406 1/1 nak_out_transaction <= 1'b0; Tests: T1 T2 T3  407 1/1 end else if (out_ep_data_put_o && out_ep_full_i[out_ep_index]) begin Tests: T3 T28 T29  408 1/1 nak_out_transaction <= 1'b1; Tests: T30 T37 T39  409 end MISSING_ELSE 410 end 411 end 412 413 // address increment whenever there is a data put unless 414 // -- already going to NAK transaction and replay things 415 // -- the address is at max packet size 416 // NOTE if more than max packet size received then data is lost 417 logic increment_addr; 418 1/1 assign increment_addr = !nak_out_transaction && (~&out_ep_put_addr_o) && out_ep_data_put_o; Tests: T1 T2 T3  419 420 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 421 1/1 if (!rst_ni) begin Tests: T1 T2 T3  422 1/1 out_ep_put_addr_o <= '0; Tests: T1 T2 T3  423 end else begin 424 1/1 if (out_xact_state == StRcvdOut) begin Tests: T1 T2 T3  425 1/1 out_ep_put_addr_o <= '0; Tests: T3 T28 T29  426 1/1 end else if ((out_xact_state == StRcvdDataStart) && increment_addr) begin Tests: T1 T2 T3  427 1/1 out_ep_put_addr_o <= out_ep_put_addr_o + 1; Tests: T3 T28 T29  428 end MISSING_ELSE 429 end 430 end 431 432 /////////////////////////////////////////////////////////////////////////////////////////////// 433 // Count OUT transactions that have been ACKed and dropped because of unexpected Data Toggles. 434 /////////////////////////////////////////////////////////////////////////////////////////////// 435 1/1 assign event_datatog_out_o = (out_xact_state == StRcvdDataStart) && Tests: T1 T2 T3 

Cond Coverage for Module : usb_fs_nb_out_pe
TotalCoveredPercent
Conditions13412492.54
Logical13412492.54
Non-Logical00
Event00

 LINE       134
 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
0111CoveredT3,T28,T29
1011CoveredT19,T23,T110
1101CoveredT3,T28,T29
1110CoveredT2,T41,T42
1111CoveredT3,T28,T29

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

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

 LINE       140
 EXPRESSION (token_received && (rx_pid == UsbPidOut))
             -------1------    ----------2----------
-1--2-StatusTests
01CoveredT2,T29,T42
10CoveredT3,T28,T29
11CoveredT29,T30,T32

 LINE       140
 SUB-EXPRESSION (rx_pid == UsbPidOut)
                ----------1----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T29,T42

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

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

 LINE       148
 EXPRESSION (rx_pkt_end_i && ((!rx_pkt_valid_i)))
             ------1-----    ---------2---------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT2,T3,T28
11CoveredT2,T42,T43

 LINE       152
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)))
             ------1-----    -------2------    --------------------------3-------------------------
-1--2--3-StatusTests
011CoveredT3,T28,T29
101CoveredT2,T37,T39
110CoveredT2,T3,T28
111CoveredT3,T28,T29

 LINE       152
 SUB-EXPRESSION ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1))
                 -----------1-----------    -----------2-----------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT3,T28,T29
10CoveredT2,T3,T28

 LINE       152
 SUB-EXPRESSION (rx_pid == UsbPidData0)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       152
 SUB-EXPRESSION (rx_pid == UsbPidData1)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       157
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && ( ! ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)) ))
             ------1-----    -------2------    -----------------------------3----------------------------
-1--2--3-StatusTests
011CoveredT2,T3,T28
101CoveredT42,T43,T19
110CoveredT3,T28,T29
111CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION ( ! ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)) )
                    --------------------------1-------------------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1))
                 -----------1-----------    -----------2-----------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT3,T28,T29
10CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION (rx_pid == UsbPidData0)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION (rx_pid == UsbPidData1)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       164
 EXPRESSION (ep_in_hw ? rx_endp_i : '0)
             ----1---
-1-StatusTests
0CoveredT42,T61,T8
1CoveredT1,T2,T3

 LINE       175
 EXPRESSION (out_ep_enabled_i[out_ep_index_d] & ep_in_hw)
             ----------------1---------------   ----2---
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT8,T115,T10
11CoveredT2,T3,T28

 LINE       178
 EXPRESSION (data_packet_received && ep_active && (rx_pid_i[3] != data_toggle_q[out_ep_index_d]))
             ----------1---------    ----2----    -----------------------3----------------------
-1--2--3-StatusTests
011CoveredT2,T3,T28
101CoveredT116,T76,T117
110CoveredT3,T28,T29
111CoveredT32,T37,T39

 LINE       178
 SUB-EXPRESSION (rx_pid_i[3] != data_toggle_q[out_ep_index_d])
                -----------------------1----------------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       187
 EXPRESSION (setup_token_received && ep_active)
             ----------1---------    ----2----
-1--2-StatusTests
01CoveredT2,T3,T28
10CoveredT68,T116,T117
11CoveredT3,T28,T30

 LINE       189
 EXPRESSION (out_token_received && ep_active)
             ---------1--------    ----2----
-1--2-StatusTests
01CoveredT2,T3,T28
10CoveredT66,T4,T68
11CoveredT29,T30,T32

 LINE       225
 EXPRESSION (ep_active && (out_token_received || (setup_token_received && ep_is_control)))
             ----1----    -------------------------------2-------------------------------
-1--2-StatusTests
01CoveredT66,T4,T68
10CoveredT2,T3,T28
11CoveredT3,T28,T29

 LINE       225
 SUB-EXPRESSION (out_token_received || (setup_token_received && ep_is_control))
                 ---------1--------    -------------------2-------------------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT3,T28,T30
10CoveredT29,T30,T32

 LINE       225
 SUB-EXPRESSION (setup_token_received && ep_is_control)
                 ----------1---------    ------2------
-1--2-StatusTests
01CoveredT3,T28,T42
10CoveredT200,T68,T201
11CoveredT3,T28,T30

 LINE       241
 EXPRESSION (timeout_cntdown_q == '0)
            ------------1------------
-1-StatusTests
0CoveredT3,T28,T29
1Not Covered

 LINE       249
 EXPRESSION (((!ep_is_control)) && out_ep_iso_i[out_ep_index] && data_packet_received)
             ---------1--------    -------------2------------    ----------3---------
-1--2--3-StatusTests
011CoveredT159,T169,T202
101CoveredT29,T32,T33
110CoveredT30,T84,T159
111CoveredT30,T84,T159

 LINE       254
 EXPRESSION (bad_data_toggle && ((!out_ep_stall_i[out_ep_index])))
             -------1-------    ----------------2----------------
-1--2-StatusTests
01CoveredT3,T28,T29
10Not Covered
11CoveredT32,T37,T39

 LINE       261
 EXPRESSION (invalid_packet_received || non_data_packet_received)
             -----------1-----------    ------------2-----------
-1--2-StatusTests
00CoveredT3,T28,T29
01CoveredT76,T78,T113
10CoveredT37,T39,T71

 LINE       278
 EXPRESSION (nak_out_transaction | out_ep_full_i[out_ep_index])
             ---------1---------   -------------2-------------
-1--2-StatusTests
00CoveredT3,T28,T30
01Not Covered
10Not Covered

 LINE       292
 EXPRESSION (nak_out_transaction | out_ep_full_i[out_ep_index])
             ---------1---------   -------------2-------------
-1--2-StatusTests
00CoveredT29,T32,T33
01Not Covered
10Not Covered

 LINE       307
 EXPRESSION (nak_out_transaction | out_ep_full_i[out_ep_index])
             ---------1---------   -------------2-------------
-1--2-StatusTests
00CoveredT84,T159,T169
01Not Covered
10Not Covered

 LINE       340
 EXPRESSION (link_reset_i ? StIdle : out_xact_state_next)
             ------1-----
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       348
 EXPRESSION (setup_token_received && ep_active)
             ----------1---------    ----2----
-1--2-StatusTests
01CoveredT2,T3,T28
10CoveredT68,T116,T117
11CoveredT3,T28,T30

 LINE       393
 EXPRESSION ((out_xact_state == StRcvdDataStart) && rx_data_put_i)
             -----------------1-----------------    ------2------
-1--2-StatusTests
01CoveredT2,T42,T43
10CoveredT3,T28,T29
11CoveredT3,T28,T29

 LINE       393
 SUB-EXPRESSION (out_xact_state == StRcvdDataStart)
                -----------------1-----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       405
 EXPRESSION ((out_xact_state == StIdle) || (out_xact_state == StRcvdOut))
             -------------1------------    --------------2--------------
-1--2-StatusTests
00CoveredT3,T28,T29
01CoveredT3,T28,T29
10CoveredT1,T2,T3

 LINE       405
 SUB-EXPRESSION (out_xact_state == StIdle)
                -------------1------------
-1-StatusTests
0CoveredT3,T28,T29
1CoveredT1,T2,T3

 LINE       405
 SUB-EXPRESSION (out_xact_state == StRcvdOut)
                --------------1--------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       407
 EXPRESSION (out_ep_data_put_o && out_ep_full_i[out_ep_index])
             --------1--------    -------------2-------------
-1--2-StatusTests
01CoveredT30,T37,T39
10CoveredT3,T28,T29
11CoveredT30,T37,T39

 LINE       418
 EXPRESSION (((!nak_out_transaction)) && ((~&out_ep_put_addr_o)) && out_ep_data_put_o)
             ------------1-----------    -----------2-----------    --------3--------
-1--2--3-StatusTests
011CoveredT30,T37,T39
101CoveredT37,T39,T83
110CoveredT1,T2,T3
111CoveredT3,T28,T29

 LINE       424
 EXPRESSION (out_xact_state == StRcvdOut)
            --------------1--------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       426
 EXPRESSION ((out_xact_state == StRcvdDataStart) && increment_addr)
             -----------------1-----------------    -------2------
-1--2-StatusTests
01Not Covered
10CoveredT3,T28,T29
11CoveredT3,T28,T29

 LINE       426
 SUB-EXPRESSION (out_xact_state == StRcvdDataStart)
                -----------------1-----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       435
 EXPRESSION ((out_xact_state == StRcvdDataStart) && (ep_is_control || ((!out_ep_iso_i[out_ep_index]))) && ((!out_ep_stall_i[out_ep_index])) && bad_data_toggle)
             -----------------1-----------------    -------------------------2------------------------    ----------------3----------------    -------4-------
-1--2--3--4-StatusTests
0111CoveredT23,T68,T116
1011CoveredT159,T169,T188
1101Not Covered
1110CoveredT3,T28,T29
1111CoveredT32,T37,T39

 LINE       435
 SUB-EXPRESSION (out_xact_state == StRcvdDataStart)
                -----------------1-----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       435
 SUB-EXPRESSION (ep_is_control || ((!out_ep_iso_i[out_ep_index])))
                 ------1------    ---------------2---------------
-1--2-StatusTests
00CoveredT30,T84,T159
01CoveredT1,T2,T3
10CoveredT159,T169,T188

FSM Coverage for Module : usb_fs_nb_out_pe
Summary for FSM :: out_xact_state
TotalCoveredPercent
States 5 5 100.00 (Not included in score)
Transitions 8 7 87.50
Sequences 0 0

State, Transition and Sequence Details for FSM :: out_xact_state
statesLine No.CoveredTests
StIdle 340 Covered T1,T2,T3
StRcvdDataEnd 266 Covered T3,T28,T29
StRcvdDataStart 240 Covered T3,T28,T29
StRcvdIsoDataEnd 253 Covered T30,T84,T159
StRcvdOut 226 Covered T3,T28,T29


transitionsLine No.CoveredTests
StIdle->StRcvdOut 226 Covered T3,T28,T29
StRcvdDataEnd->StIdle 340 Covered T3,T28,T29
StRcvdDataStart->StIdle 340 Covered T32,T37,T39
StRcvdDataStart->StRcvdDataEnd 266 Covered T3,T28,T29
StRcvdDataStart->StRcvdIsoDataEnd 253 Covered T30,T84,T159
StRcvdIsoDataEnd->StIdle 340 Covered T30,T84,T159
StRcvdOut->StIdle 340 Not Covered
StRcvdOut->StRcvdDataStart 240 Covered T3,T28,T29



Branch Coverage for Module : usb_fs_nb_out_pe
Line No.TotalCoveredPercent
Branches 53 51 96.23
TERNARY 164 2 2 100.00
IF 184 4 4 100.00
IF 196 3 3 100.00
CASE 221 18 16 88.89
IF 329 2 2 100.00
IF 337 3 3 100.00
IF 348 3 3 100.00
IF 354 2 2 100.00
IF 363 3 3 100.00
IF 373 3 3 100.00
IF 390 2 2 100.00
IF 402 4 4 100.00
IF 421 4 4 100.00


164 assign out_ep_current_d = ep_in_hw ? rx_endp_i : '0; -1- ==> ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T42,T61,T8


184 if (!rst_ni) begin -1- 185 out_ep_setup_o <= '0; ==> 186 end else begin 187 if (setup_token_received && ep_active) begin -2- 188 out_ep_setup_o[out_ep_index_d] <= 1'b1; ==> 189 end else if (out_token_received && ep_active) begin -3- 190 out_ep_setup_o[out_ep_index_d] <= 1'b0; ==> 191 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T3,T28,T30
0 0 1 Covered T29,T30,T32
0 0 0 Covered T1,T2,T3


196 if (!rst_ni) begin -1- 197 out_ep_data_o <= 0; ==> 198 end else begin 199 if (rx_data_put_i) begin -2- 200 out_ep_data_o <= rx_data_i; ==> 201 end MISSING_ELSE ==>

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


221 unique case (out_xact_state) -1- 222 StIdle: begin 223 // For unimplemented EPs, transactions are ignored. 224 // SETUP transactions are also ignored for non-control EPs. 225 if (ep_active && (out_token_received || (setup_token_received && ep_is_control))) begin -2- 226 out_xact_state_next = StRcvdOut; ==> 227 out_xact_start = 1'b1; 228 end else begin 229 out_xact_state_next = StIdle; ==> 230 end 231 end 232 233 StRcvdOut: begin 234 // The spec says we have up to 18 bit times to wait for the host's 235 // data packet. If it doesn't arrive in time, we must invalidate the 236 // transaction. 237 timeout_cntdown_d = timeout_cntdown_q - 1'b1; 238 239 if (rx_pkt_start_i) begin -3- 240 out_xact_state_next = StRcvdDataStart; ==> 241 end else if (timeout_cntdown_q == '0) begin -4- 242 out_xact_state_next = StIdle; ==> 243 end else begin 244 out_xact_state_next = StRcvdOut; ==> 245 end 246 end 247 248 StRcvdDataStart: begin 249 if (!ep_is_control && out_ep_iso_i[out_ep_index] && data_packet_received) begin -5- 250 // ISO EP: Don't send a handshake, ignore toggle. 251 // But ignore iso bit for endpoints marked control. This is 252 // a configuration error. 253 out_xact_state_next = StRcvdIsoDataEnd; ==> 254 end else if (bad_data_toggle && !out_ep_stall_i[out_ep_index]) begin -6- 255 // The DATA toggle was wrong (skipped when this EP is stalled) 256 // Note: bad_data_toggle is meaningless for unimplemented EPs. 257 out_xact_state_next = StIdle; ==> 258 rollback_data = 1'b1; 259 tx_pkt_start_o = 1'b1; 260 tx_pid_o = {UsbPidAck}; // ACK by spec because this is most likely previous ACK was lost 261 end else if (invalid_packet_received || non_data_packet_received) begin -7- 262 // in these cases eg bad CRC, send no response (not a NAK) 263 out_xact_state_next = StIdle; ==> 264 rollback_data = 1'b1; 265 end else if (data_packet_received) begin -8- 266 out_xact_state_next = StRcvdDataEnd; ==> 267 end else begin 268 out_xact_state_next = StRcvdDataStart; ==> 269 end 270 end 271 272 StRcvdDataEnd: begin 273 out_xact_state_next = StIdle; 274 tx_pkt_start_o = 1'b1; 275 276 if (current_xact_setup_q) begin -9- 277 // SETUP transactions end here 278 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin -10- 279 // SETUP transactions that fail to be received are dropped without a response. 280 tx_pkt_start_o = 1'b0; ==> 281 rollback_data = 1'b1; 282 end else begin 283 tx_pid_o = {UsbPidAck}; ==> 284 new_pkt_end = 1'b1; 285 out_ep_acked_o = 1'b1; 286 end 287 end else begin 288 // Non-isochronous OUT transactions end here 289 if (out_ep_stall_i[out_ep_index]) begin -11- 290 tx_pid_o = {UsbPidStall}; // STALL ==> 291 rollback_data = 1'b1; // Packet not accepted 292 end else if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin -12- 293 tx_pid_o = {UsbPidNak}; // NAK -- the endpoint could not accept the data at the moment ==> 294 rollback_data = 1'b1; 295 end else begin 296 tx_pid_o = {UsbPidAck}; // ACK ==> 297 new_pkt_end = 1'b1; 298 out_ep_acked_o = 1'b1; 299 end 300 end 301 end 302 303 StRcvdIsoDataEnd: begin 304 // Isochronous OUT transactions end here 305 out_xact_state_next = StIdle; 306 307 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin -13- 308 // We got a valid packet, but can't store it (error that the software must resolve) 309 rollback_data = 1'b1; ==> 310 end else begin 311 // We got a valid packet, but we don't send an ACK on the bus 312 new_pkt_end = 1'b1; ==> 313 out_ep_acked_o = 1'b1; 314 end 315 end 316 317 default: out_xact_state_next = StIdle; ==>

Branches:
-1--2--3--4--5--6--7--8--9--10--11--12--13-StatusTests
StIdle 1 - - - - - - - - - - - Covered T3,T28,T29
StIdle 0 - - - - - - - - - - - Covered T1,T2,T3
StRcvdOut - 1 - - - - - - - - - - Covered T3,T28,T29
StRcvdOut - 0 1 - - - - - - - - - Not Covered
StRcvdOut - 0 0 - - - - - - - - - Covered T3,T28,T29
StRcvdDataStart - - - 1 - - - - - - - - Covered T30,T84,T159
StRcvdDataStart - - - 0 1 - - - - - - - Covered T32,T37,T39
StRcvdDataStart - - - 0 0 1 - - - - - - Covered T37,T39,T71
StRcvdDataStart - - - 0 0 0 1 - - - - - Covered T3,T28,T29
StRcvdDataStart - - - 0 0 0 0 - - - - - Covered T3,T28,T29
StRcvdDataEnd - - - - - - - 1 1 - - - Covered T194,T195,T196
StRcvdDataEnd - - - - - - - 1 0 - - - Covered T3,T28,T30
StRcvdDataEnd - - - - - - - 0 - 1 - - Covered T164,T171,T197
StRcvdDataEnd - - - - - - - 0 - 0 1 - Covered T37,T39,T72
StRcvdDataEnd - - - - - - - 0 - 0 0 - Covered T29,T32,T33
StRcvdIsoDataEnd - - - - - - - - - - - 1 Covered T30,T198,T199
StRcvdIsoDataEnd - - - - - - - - - - - 0 Covered T84,T159,T169
default - - - - - - - - - - - - Not Covered


329 if (!rst_ni) begin -1- 330 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; ==> 331 end else begin 332 timeout_cntdown_q <= timeout_cntdown_d; ==>

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


337 if (!rst_ni) begin -1- 338 out_xact_state <= StIdle; ==> 339 end else begin 340 out_xact_state <= link_reset_i ? StIdle : out_xact_state_next; -2- ==> ==>

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


348 if (setup_token_received && ep_active) begin -1- 349 data_toggle_d[out_ep_index_d] = 1'b0; ==> 350 end else if (new_pkt_end) begin -2- 351 data_toggle_d[out_ep_index] = ~data_toggle_q[out_ep_index]; ==> 352 end MISSING_ELSE ==>

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


354 if (out_datatog_we_i) begin -1- 355 data_toggle_d = (data_toggle_d & ~out_datatog_mask_i) | ==> 356 (out_datatog_status_i & out_datatog_mask_i); 357 end MISSING_ELSE ==>

Branches:
-1-StatusTests
1 Covered T29,T32,T37
0 Covered T1,T2,T3


363 if (!rst_ni) begin -1- 364 data_toggle_q <= '0; // Clear for all endpoints ==> 365 end else if (link_reset_i) begin -2- 366 data_toggle_q <= '0; // Clear for all endpoints ==> 367 end else begin 368 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


373 if (!rst_ni) begin -1- 374 out_ep_newpkt_o <= 1'b0; ==> 375 out_ep_current_o <= '0; 376 current_xact_setup_q <= 1'b0; 377 end else begin 378 if (out_xact_start) begin -2- 379 out_ep_newpkt_o <= 1'b1; ==> 380 out_ep_current_o <= out_ep_current_d; 381 current_xact_setup_q <= setup_token_received; 382 end else begin 383 out_ep_newpkt_o <= 1'b0; ==>

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


390 if (!rst_ni) begin -1- 391 out_ep_data_put_o <= 1'b0; ==> 392 end else begin 393 out_ep_data_put_o <= ((out_xact_state == StRcvdDataStart) && rx_data_put_i); ==>

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


402 if (!rst_ni) begin -1- 403 nak_out_transaction <= 1'b0; ==> 404 end else begin 405 if ((out_xact_state == StIdle) || (out_xact_state == StRcvdOut)) begin -2- 406 nak_out_transaction <= 1'b0; ==> 407 end else if (out_ep_data_put_o && out_ep_full_i[out_ep_index]) begin -3- 408 nak_out_transaction <= 1'b1; ==> 409 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T1,T2,T3
0 0 1 Covered T30,T37,T39
0 0 0 Covered T3,T28,T29


421 if (!rst_ni) begin -1- 422 out_ep_put_addr_o <= '0; ==> 423 end else begin 424 if (out_xact_state == StRcvdOut) begin -2- 425 out_ep_put_addr_o <= '0; ==> 426 end else if ((out_xact_state == StRcvdDataStart) && increment_addr) begin -3- 427 out_ep_put_addr_o <= out_ep_put_addr_o + 1; ==> 428 end MISSING_ELSE ==>

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


Assert Coverage for Module : usb_fs_nb_out_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
OutXactStateValid_A 586533067 586232617 0 0


OutXactStateValid_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 586533067 586232617 0 0
T1 6313 6244 0 0
T2 8483 8429 0 0
T3 10220 10144 0 0
T28 8434 8382 0 0
T29 19184 19133 0 0
T30 12616 12552 0 0
T40 2350 2274 0 0
T41 6622 6558 0 0
T42 16481 16406 0 0
T43 55030 54950 0 0

Line Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_out_pe
Line No.TotalCoveredPercent
TOTAL12712699.21
CONT_ASSIGN9011100.00
CONT_ASSIGN13111100.00
CONT_ASSIGN13211100.00
CONT_ASSIGN13411100.00
CONT_ASSIGN14011100.00
CONT_ASSIGN14411100.00
CONT_ASSIGN14811100.00
CONT_ASSIGN15211100.00
CONT_ASSIGN15711100.00
CONT_ASSIGN16311100.00
CONT_ASSIGN16411100.00
CONT_ASSIGN17111100.00
CONT_ASSIGN17211100.00
CONT_ASSIGN17511100.00
CONT_ASSIGN17611100.00
CONT_ASSIGN17811100.00
ALWAYS18466100.00
ALWAYS19644100.00
ALWAYS212555498.18
CONT_ASSIGN32611100.00
ALWAYS32933100.00
ALWAYS33733100.00
ALWAYS34677100.00
CONT_ASSIGN36011100.00
ALWAYS36355100.00
ALWAYS37399100.00
ALWAYS39033100.00
ALWAYS40266100.00
CONT_ASSIGN41811100.00
ALWAYS42166100.00
CONT_ASSIGN43511100.00

89 logic unused_1; 90 1/1 assign unused_1 = tx_pkt_end_i; Tests: T1 T2 T3  91 92 /////////////////////////////////// 93 // out transaction state machine // 94 /////////////////////////////////// 95 import usb_consts_pkg::*; 96 97 typedef enum logic [2:0] { 98 StIdle, 99 StRcvdOut, 100 StRcvdDataStart, 101 StRcvdDataEnd, 102 StRcvdIsoDataEnd 103 } state_out_e; 104 105 state_out_e out_xact_state; 106 state_out_e out_xact_state_next; 107 108 logic out_xact_start; 109 logic new_pkt_end; 110 logic rollback_data; 111 112 // set when the endpoint buffer is unable to receive the out transaction 113 logic nak_out_transaction; 114 115 // data toggle state 116 logic [NumOutEps - 1:0] data_toggle_q, data_toggle_d; 117 118 // Decode the rx token 119 logic token_received, out_token_received, setup_token_received; 120 logic invalid_packet_received, data_packet_received, non_data_packet_received; 121 logic bad_data_toggle; 122 logic ep_in_hw, ep_active, ep_is_control; 123 logic [3:0] out_ep_current_d; 124 125 // 1: If the current transaction is a SETUP, 0: OUT 126 logic current_xact_setup_q; 127 128 // More syntax so can compare with enum 129 usb_pid_type_e rx_pid_type; 130 usb_pid_e rx_pid; 131 1/1 assign rx_pid_type = usb_pid_type_e'(rx_pid_i[1:0]); Tests: T1 T2 T3  132 1/1 assign rx_pid = usb_pid_e'(rx_pid_i); Tests: T1 T2 T3  133 134 1/1 assign token_received = Tests: T1 T2 T3  135 rx_pkt_end_i && 136 rx_pkt_valid_i && 137 rx_pid_type == UsbPidTypeToken && 138 rx_addr_i == dev_addr_i; 139 140 1/1 assign out_token_received = Tests: T1 T2 T3  141 token_received && 142 rx_pid == UsbPidOut; 143 144 1/1 assign setup_token_received = Tests: T1 T2 T3  145 token_received && 146 rx_pid == UsbPidSetup; 147 148 1/1 assign invalid_packet_received = Tests: T1 T2 T3  149 rx_pkt_end_i && 150 !rx_pkt_valid_i; 151 152 1/1 assign data_packet_received = Tests: T1 T2 T3  153 rx_pkt_end_i && 154 rx_pkt_valid_i && 155 ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)); 156 157 1/1 assign non_data_packet_received = Tests: T1 T2 T3  158 rx_pkt_end_i && 159 rx_pkt_valid_i && 160 !((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)); 161 162 // Is the specified endpoint actually implemented in hardware? 163 1/1 assign ep_in_hw = {1'b0, rx_endp_i} < NumOutEps; Tests: T1 T2 T3  164 1/1 assign out_ep_current_d = ep_in_hw ? rx_endp_i : '0; Tests: T1 T2 T3  165 166 // Make widths work - out_ep_current_d/out_ep_current_o only hold implemented endpoint IDs. 167 // These signals can be used to index signals of NumOutEps width. 168 // They are only valid if ep_in_hw is set, i.e., if the specified endpoint is implemented. 169 logic [OutEpW-1:0] out_ep_index; 170 logic [OutEpW-1:0] out_ep_index_d; 171 1/1 assign out_ep_index = out_ep_current_o[0 +: OutEpW]; Tests: T1 T2 T3  172 1/1 assign out_ep_index_d = out_ep_current_d[0 +: OutEpW]; Tests: T1 T2 T3  173 174 // Is the endpoint active? 175 1/1 assign ep_active = out_ep_enabled_i[out_ep_index_d] & ep_in_hw; Tests: T1 T2 T3  176 1/1 assign ep_is_control = out_ep_control_i[out_ep_index_d]; Tests: T1 T2 T3  177 178 1/1 assign bad_data_toggle = Tests: T1 T2 T3  179 data_packet_received && 180 ep_active && 181 rx_pid_i[3] != data_toggle_q[out_ep_index_d]; 182 183 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 184 1/1 if (!rst_ni) begin Tests: T1 T2 T3  185 1/1 out_ep_setup_o <= '0; Tests: T1 T2 T3  186 end else begin 187 1/1 if (setup_token_received && ep_active) begin Tests: T1 T2 T3  188 1/1 out_ep_setup_o[out_ep_index_d] <= 1'b1; Tests: T3 T28 T30  189 1/1 end else if (out_token_received && ep_active) begin Tests: T1 T2 T3  190 1/1 out_ep_setup_o[out_ep_index_d] <= 1'b0; Tests: T29 T30 T32  191 end MISSING_ELSE 192 end 193 end 194 195 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 196 1/1 if (!rst_ni) begin Tests: T1 T2 T3  197 1/1 out_ep_data_o <= 0; Tests: T1 T2 T3  198 end else begin 199 1/1 if (rx_data_put_i) begin Tests: T1 T2 T3  200 1/1 out_ep_data_o <= rx_data_i; Tests: T2 T3 T28  201 end MISSING_ELSE 202 end 203 end 204 205 /////////////////////////////////// 206 // out transaction state machine // 207 /////////////////////////////////// 208 209 logic [AckTimeoutCntW-1:0] timeout_cntdown_d, timeout_cntdown_q; 210 211 always_comb begin 212 1/1 out_ep_acked_o = 1'b0; Tests: T1 T2 T3  213 1/1 out_xact_start = 1'b0; Tests: T1 T2 T3  214 1/1 out_xact_state_next = out_xact_state; Tests: T1 T2 T3  215 1/1 tx_pkt_start_o = 1'b0; Tests: T1 T2 T3  216 1/1 tx_pid_o = 4'b0000; Tests: T1 T2 T3  217 1/1 new_pkt_end = 1'b0; Tests: T1 T2 T3  218 1/1 rollback_data = 1'b0; Tests: T1 T2 T3  219 1/1 timeout_cntdown_d = AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  220 221 1/1 unique case (out_xact_state) Tests: T1 T2 T3  222 StIdle: begin 223 // For unimplemented EPs, transactions are ignored. 224 // SETUP transactions are also ignored for non-control EPs. 225 1/1 if (ep_active && (out_token_received || (setup_token_received && ep_is_control))) begin Tests: T1 T2 T3  226 1/1 out_xact_state_next = StRcvdOut; Tests: T3 T28 T29  227 1/1 out_xact_start = 1'b1; Tests: T3 T28 T29  228 end else begin 229 1/1 out_xact_state_next = StIdle; Tests: T1 T2 T3  230 end 231 end 232 233 StRcvdOut: begin 234 // The spec says we have up to 18 bit times to wait for the host's 235 // data packet. If it doesn't arrive in time, we must invalidate the 236 // transaction. 237 1/1 timeout_cntdown_d = timeout_cntdown_q - 1'b1; Tests: T3 T28 T29  238 239 1/1 if (rx_pkt_start_i) begin Tests: T3 T28 T29  240 1/1 out_xact_state_next = StRcvdDataStart; Tests: T3 T28 T29  241 1/1 end else if (timeout_cntdown_q == '0) begin Tests: T3 T28 T29  242 0/1 ==> out_xact_state_next = StIdle; 243 end else begin 244 1/1 out_xact_state_next = StRcvdOut; Tests: T3 T28 T29  245 end 246 end 247 248 StRcvdDataStart: begin 249 1/1 if (!ep_is_control && out_ep_iso_i[out_ep_index] && data_packet_received) begin Tests: T3 T28 T29  250 // ISO EP: Don't send a handshake, ignore toggle. 251 // But ignore iso bit for endpoints marked control. This is 252 // a configuration error. 253 1/1 out_xact_state_next = StRcvdIsoDataEnd; Tests: T30 T84 T159  254 1/1 end else if (bad_data_toggle && !out_ep_stall_i[out_ep_index]) begin Tests: T3 T28 T29  255 // The DATA toggle was wrong (skipped when this EP is stalled) 256 // Note: bad_data_toggle is meaningless for unimplemented EPs. 257 1/1 out_xact_state_next = StIdle; Tests: T32 T37 T39  258 1/1 rollback_data = 1'b1; Tests: T32 T37 T39  259 1/1 tx_pkt_start_o = 1'b1; Tests: T32 T37 T39  260 1/1 tx_pid_o = {UsbPidAck}; // ACK by spec because this is most likely previous ACK was lost Tests: T32 T37 T39  261 1/1 end else if (invalid_packet_received || non_data_packet_received) begin Tests: T3 T28 T29  262 // in these cases eg bad CRC, send no response (not a NAK) 263 1/1 out_xact_state_next = StIdle; Tests: T37 T39 T71  264 1/1 rollback_data = 1'b1; Tests: T37 T39 T71  265 1/1 end else if (data_packet_received) begin Tests: T3 T28 T29  266 1/1 out_xact_state_next = StRcvdDataEnd; Tests: T3 T28 T29  267 end else begin 268 1/1 out_xact_state_next = StRcvdDataStart; Tests: T3 T28 T29  269 end 270 end 271 272 StRcvdDataEnd: begin 273 1/1 out_xact_state_next = StIdle; Tests: T3 T28 T29  274 1/1 tx_pkt_start_o = 1'b1; Tests: T3 T28 T29  275 276 1/1 if (current_xact_setup_q) begin Tests: T3 T28 T29  277 // SETUP transactions end here 278 1/1 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin Tests: T3 T28 T30  279 // SETUP transactions that fail to be received are dropped without a response. 280 1/1 tx_pkt_start_o = 1'b0; Tests: T194 T195 T196  281 1/1 rollback_data = 1'b1; Tests: T194 T195 T196  282 end else begin 283 1/1 tx_pid_o = {UsbPidAck}; Tests: T3 T28 T30  284 1/1 new_pkt_end = 1'b1; Tests: T3 T28 T30  285 1/1 out_ep_acked_o = 1'b1; Tests: T3 T28 T30  286 end 287 end else begin 288 // Non-isochronous OUT transactions end here 289 1/1 if (out_ep_stall_i[out_ep_index]) begin Tests: T29 T32 T33  290 1/1 tx_pid_o = {UsbPidStall}; // STALL Tests: T164 T171 T197  291 1/1 rollback_data = 1'b1; // Packet not accepted Tests: T164 T171 T197  292 1/1 end else if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin Tests: T29 T32 T33  293 1/1 tx_pid_o = {UsbPidNak}; // NAK -- the endpoint could not accept the data at the moment Tests: T37 T39 T72  294 1/1 rollback_data = 1'b1; Tests: T37 T39 T72  295 end else begin 296 1/1 tx_pid_o = {UsbPidAck}; // ACK Tests: T29 T32 T33  297 1/1 new_pkt_end = 1'b1; Tests: T29 T32 T33  298 1/1 out_ep_acked_o = 1'b1; Tests: T29 T32 T33  299 end 300 end 301 end 302 303 StRcvdIsoDataEnd: begin 304 // Isochronous OUT transactions end here 305 1/1 out_xact_state_next = StIdle; Tests: T30 T84 T159  306 307 1/1 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin Tests: T30 T84 T159  308 // We got a valid packet, but can't store it (error that the software must resolve) 309 1/1 rollback_data = 1'b1; Tests: T30 T198 T199  310 end else begin 311 // We got a valid packet, but we don't send an ACK on the bus 312 1/1 new_pkt_end = 1'b1; Tests: T84 T159 T169  313 1/1 out_ep_acked_o = 1'b1; Tests: T84 T159 T169  314 end 315 end 316 317 default: out_xact_state_next = StIdle; Exclude Annotation: VC_COV_UNR 318 endcase 319 end 320 321 `ASSERT(OutXactStateValid_A, 322 out_xact_state inside {StIdle, StRcvdOut, StRcvdDataStart, StRcvdDataEnd, StRcvdIsoDataEnd}, 323 clk_48mhz_i) 324 325 // could flop this if needed 326 1/1 assign out_ep_rollback_o = rollback_data; Tests: T1 T2 T3  327 328 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 329 1/1 if (!rst_ni) begin Tests: T1 T2 T3  330 1/1 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; Tests: T1 T2 T3  331 end else begin 332 1/1 timeout_cntdown_q <= timeout_cntdown_d; Tests: T1 T2 T3  333 end 334 end 335 336 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 337 1/1 if (!rst_ni) begin Tests: T1 T2 T3  338 1/1 out_xact_state <= StIdle; Tests: T1 T2 T3  339 end else begin 340 1/1 out_xact_state <= link_reset_i ? StIdle : out_xact_state_next; Tests: T1 T2 T3  341 end 342 end 343 344 // Updating of data toggles 345 always_comb begin : proc_data_toggle_d 346 1/1 data_toggle_d = data_toggle_q; Tests: T1 T2 T3  347 348 1/1 if (setup_token_received && ep_active) begin Tests: T1 T2 T3  349 1/1 data_toggle_d[out_ep_index_d] = 1'b0; Tests: T3 T28 T30  350 1/1 end else if (new_pkt_end) begin Tests: T1 T2 T3  351 1/1 data_toggle_d[out_ep_index] = ~data_toggle_q[out_ep_index]; Tests: T3 T28 T29  352 end MISSING_ELSE 353 // Selective modification by software 354 1/1 if (out_datatog_we_i) begin Tests: T1 T2 T3  355 1/1 data_toggle_d = (data_toggle_d & ~out_datatog_mask_i) | Tests: T29 T32 T37  356 (out_datatog_status_i & out_datatog_mask_i); 357 end MISSING_ELSE 358 end 359 // Supply current data toggles to register interface 360 1/1 assign out_data_toggle_o = data_toggle_q; Tests: T1 T2 T3  361 362 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 363 1/1 if (!rst_ni) begin Tests: T1 T2 T3  364 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  365 1/1 end else if (link_reset_i) begin Tests: T1 T2 T3  366 1/1 data_toggle_q <= '0; // Clear for all endpoints Tests: T1 T2 T3  367 end else begin 368 1/1 data_toggle_q <= data_toggle_d; Tests: T1 T2 T3  369 end 370 end 371 372 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 373 1/1 if (!rst_ni) begin Tests: T1 T2 T3  374 1/1 out_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  375 1/1 out_ep_current_o <= '0; Tests: T1 T2 T3  376 1/1 current_xact_setup_q <= 1'b0; Tests: T1 T2 T3  377 end else begin 378 1/1 if (out_xact_start) begin Tests: T1 T2 T3  379 1/1 out_ep_newpkt_o <= 1'b1; Tests: T3 T28 T29  380 1/1 out_ep_current_o <= out_ep_current_d; Tests: T3 T28 T29  381 1/1 current_xact_setup_q <= setup_token_received; Tests: T3 T28 T29  382 end else begin 383 1/1 out_ep_newpkt_o <= 1'b0; Tests: T1 T2 T3  384 end 385 end 386 end 387 388 // put data strobe follows the rx strobe (which will latch the data) 389 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 390 1/1 if (!rst_ni) begin Tests: T1 T2 T3  391 1/1 out_ep_data_put_o <= 1'b0; Tests: T1 T2 T3  392 end else begin 393 1/1 out_ep_data_put_o <= ((out_xact_state == StRcvdDataStart) && rx_data_put_i); Tests: T1 T2 T3  394 end 395 end 396 397 // nak an OUT if any data comes in with the endpoint full 398 // Note that if there is a full size packet buffer this will only be all or nothing 399 // but in the case there was a FIFO with less than a max packet size free you 400 // could get lucky and the packet received be small and fit with no need to NAK 401 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 402 1/1 if (!rst_ni) begin Tests: T1 T2 T3  403 1/1 nak_out_transaction <= 1'b0; Tests: T1 T2 T3  404 end else begin 405 1/1 if ((out_xact_state == StIdle) || (out_xact_state == StRcvdOut)) begin Tests: T1 T2 T3  406 1/1 nak_out_transaction <= 1'b0; Tests: T1 T2 T3  407 1/1 end else if (out_ep_data_put_o && out_ep_full_i[out_ep_index]) begin Tests: T3 T28 T29  408 1/1 nak_out_transaction <= 1'b1; Tests: T30 T37 T39  409 end MISSING_ELSE 410 end 411 end 412 413 // address increment whenever there is a data put unless 414 // -- already going to NAK transaction and replay things 415 // -- the address is at max packet size 416 // NOTE if more than max packet size received then data is lost 417 logic increment_addr; 418 1/1 assign increment_addr = !nak_out_transaction && (~&out_ep_put_addr_o) && out_ep_data_put_o; Tests: T1 T2 T3  419 420 always_ff @(posedge clk_48mhz_i or negedge rst_ni) begin 421 1/1 if (!rst_ni) begin Tests: T1 T2 T3  422 1/1 out_ep_put_addr_o <= '0; Tests: T1 T2 T3  423 end else begin 424 1/1 if (out_xact_state == StRcvdOut) begin Tests: T1 T2 T3  425 1/1 out_ep_put_addr_o <= '0; Tests: T3 T28 T29  426 1/1 end else if ((out_xact_state == StRcvdDataStart) && increment_addr) begin Tests: T1 T2 T3  427 1/1 out_ep_put_addr_o <= out_ep_put_addr_o + 1; Tests: T3 T28 T29  428 end MISSING_ELSE 429 end 430 end 431 432 /////////////////////////////////////////////////////////////////////////////////////////////// 433 // Count OUT transactions that have been ACKed and dropped because of unexpected Data Toggles. 434 /////////////////////////////////////////////////////////////////////////////////////////////// 435 1/1 assign event_datatog_out_o = (out_xact_state == StRcvdDataStart) && Tests: T1 T2 T3 

Cond Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_out_pe
TotalCoveredPercent
Conditions13412492.54
Logical13412492.54
Non-Logical00
Event00

 LINE       134
 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
0111CoveredT3,T28,T29
1011CoveredT19,T23,T110
1101CoveredT3,T28,T29
1110CoveredT2,T41,T42
1111CoveredT3,T28,T29

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

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

 LINE       140
 EXPRESSION (token_received && (rx_pid == UsbPidOut))
             -------1------    ----------2----------
-1--2-StatusTests
01CoveredT2,T29,T42
10CoveredT3,T28,T29
11CoveredT29,T30,T32

 LINE       140
 SUB-EXPRESSION (rx_pid == UsbPidOut)
                ----------1----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T29,T42

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

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

 LINE       148
 EXPRESSION (rx_pkt_end_i && ((!rx_pkt_valid_i)))
             ------1-----    ---------2---------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT2,T3,T28
11CoveredT2,T42,T43

 LINE       152
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)))
             ------1-----    -------2------    --------------------------3-------------------------
-1--2--3-StatusTests
011CoveredT3,T28,T29
101CoveredT2,T37,T39
110CoveredT2,T3,T28
111CoveredT3,T28,T29

 LINE       152
 SUB-EXPRESSION ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1))
                 -----------1-----------    -----------2-----------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT3,T28,T29
10CoveredT2,T3,T28

 LINE       152
 SUB-EXPRESSION (rx_pid == UsbPidData0)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       152
 SUB-EXPRESSION (rx_pid == UsbPidData1)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       157
 EXPRESSION (rx_pkt_end_i && rx_pkt_valid_i && ( ! ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)) ))
             ------1-----    -------2------    -----------------------------3----------------------------
-1--2--3-StatusTests
011CoveredT2,T3,T28
101CoveredT42,T43,T19
110CoveredT3,T28,T29
111CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION ( ! ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1)) )
                    --------------------------1-------------------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION ((rx_pid == UsbPidData0) || (rx_pid == UsbPidData1))
                 -----------1-----------    -----------2-----------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT3,T28,T29
10CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION (rx_pid == UsbPidData0)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       157
 SUB-EXPRESSION (rx_pid == UsbPidData1)
                -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       164
 EXPRESSION (ep_in_hw ? rx_endp_i : '0)
             ----1---
-1-StatusTests
0CoveredT42,T61,T8
1CoveredT1,T2,T3

 LINE       175
 EXPRESSION (out_ep_enabled_i[out_ep_index_d] & ep_in_hw)
             ----------------1---------------   ----2---
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT8,T115,T10
11CoveredT2,T3,T28

 LINE       178
 EXPRESSION (data_packet_received && ep_active && (rx_pid_i[3] != data_toggle_q[out_ep_index_d]))
             ----------1---------    ----2----    -----------------------3----------------------
-1--2--3-StatusTests
011CoveredT2,T3,T28
101CoveredT116,T76,T117
110CoveredT3,T28,T29
111CoveredT32,T37,T39

 LINE       178
 SUB-EXPRESSION (rx_pid_i[3] != data_toggle_q[out_ep_index_d])
                -----------------------1----------------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT2,T3,T28

 LINE       187
 EXPRESSION (setup_token_received && ep_active)
             ----------1---------    ----2----
-1--2-StatusTests
01CoveredT2,T3,T28
10CoveredT68,T116,T117
11CoveredT3,T28,T30

 LINE       189
 EXPRESSION (out_token_received && ep_active)
             ---------1--------    ----2----
-1--2-StatusTests
01CoveredT2,T3,T28
10CoveredT66,T4,T68
11CoveredT29,T30,T32

 LINE       225
 EXPRESSION (ep_active && (out_token_received || (setup_token_received && ep_is_control)))
             ----1----    -------------------------------2-------------------------------
-1--2-StatusTests
01CoveredT66,T4,T68
10CoveredT2,T3,T28
11CoveredT3,T28,T29

 LINE       225
 SUB-EXPRESSION (out_token_received || (setup_token_received && ep_is_control))
                 ---------1--------    -------------------2-------------------
-1--2-StatusTests
00CoveredT1,T2,T3
01CoveredT3,T28,T30
10CoveredT29,T30,T32

 LINE       225
 SUB-EXPRESSION (setup_token_received && ep_is_control)
                 ----------1---------    ------2------
-1--2-StatusTests
01CoveredT3,T28,T42
10CoveredT200,T68,T201
11CoveredT3,T28,T30

 LINE       241
 EXPRESSION (timeout_cntdown_q == '0)
            ------------1------------
-1-StatusTests
0CoveredT3,T28,T29
1Not Covered

 LINE       249
 EXPRESSION (((!ep_is_control)) && out_ep_iso_i[out_ep_index] && data_packet_received)
             ---------1--------    -------------2------------    ----------3---------
-1--2--3-StatusTests
011CoveredT159,T169,T202
101CoveredT29,T32,T33
110CoveredT30,T84,T159
111CoveredT30,T84,T159

 LINE       254
 EXPRESSION (bad_data_toggle && ((!out_ep_stall_i[out_ep_index])))
             -------1-------    ----------------2----------------
-1--2-StatusTests
01CoveredT3,T28,T29
10Not Covered
11CoveredT32,T37,T39

 LINE       261
 EXPRESSION (invalid_packet_received || non_data_packet_received)
             -----------1-----------    ------------2-----------
-1--2-StatusTests
00CoveredT3,T28,T29
01CoveredT76,T78,T113
10CoveredT37,T39,T71

 LINE       278
 EXPRESSION (nak_out_transaction | out_ep_full_i[out_ep_index])
             ---------1---------   -------------2-------------
-1--2-StatusTests
00CoveredT3,T28,T30
01Not Covered
10Not Covered

 LINE       292
 EXPRESSION (nak_out_transaction | out_ep_full_i[out_ep_index])
             ---------1---------   -------------2-------------
-1--2-StatusTests
00CoveredT29,T32,T33
01Not Covered
10Not Covered

 LINE       307
 EXPRESSION (nak_out_transaction | out_ep_full_i[out_ep_index])
             ---------1---------   -------------2-------------
-1--2-StatusTests
00CoveredT84,T159,T169
01Not Covered
10Not Covered

 LINE       340
 EXPRESSION (link_reset_i ? StIdle : out_xact_state_next)
             ------1-----
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       348
 EXPRESSION (setup_token_received && ep_active)
             ----------1---------    ----2----
-1--2-StatusTests
01CoveredT2,T3,T28
10CoveredT68,T116,T117
11CoveredT3,T28,T30

 LINE       393
 EXPRESSION ((out_xact_state == StRcvdDataStart) && rx_data_put_i)
             -----------------1-----------------    ------2------
-1--2-StatusTests
01CoveredT2,T42,T43
10CoveredT3,T28,T29
11CoveredT3,T28,T29

 LINE       393
 SUB-EXPRESSION (out_xact_state == StRcvdDataStart)
                -----------------1-----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       405
 EXPRESSION ((out_xact_state == StIdle) || (out_xact_state == StRcvdOut))
             -------------1------------    --------------2--------------
-1--2-StatusTests
00CoveredT3,T28,T29
01CoveredT3,T28,T29
10CoveredT1,T2,T3

 LINE       405
 SUB-EXPRESSION (out_xact_state == StIdle)
                -------------1------------
-1-StatusTests
0CoveredT3,T28,T29
1CoveredT1,T2,T3

 LINE       405
 SUB-EXPRESSION (out_xact_state == StRcvdOut)
                --------------1--------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       407
 EXPRESSION (out_ep_data_put_o && out_ep_full_i[out_ep_index])
             --------1--------    -------------2-------------
-1--2-StatusTests
01CoveredT30,T37,T39
10CoveredT3,T28,T29
11CoveredT30,T37,T39

 LINE       418
 EXPRESSION (((!nak_out_transaction)) && ((~&out_ep_put_addr_o)) && out_ep_data_put_o)
             ------------1-----------    -----------2-----------    --------3--------
-1--2--3-StatusTests
011CoveredT30,T37,T39
101CoveredT37,T39,T83
110CoveredT1,T2,T3
111CoveredT3,T28,T29

 LINE       424
 EXPRESSION (out_xact_state == StRcvdOut)
            --------------1--------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       426
 EXPRESSION ((out_xact_state == StRcvdDataStart) && increment_addr)
             -----------------1-----------------    -------2------
-1--2-StatusTests
01Not Covered
10CoveredT3,T28,T29
11CoveredT3,T28,T29

 LINE       426
 SUB-EXPRESSION (out_xact_state == StRcvdDataStart)
                -----------------1-----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       435
 EXPRESSION ((out_xact_state == StRcvdDataStart) && (ep_is_control || ((!out_ep_iso_i[out_ep_index]))) && ((!out_ep_stall_i[out_ep_index])) && bad_data_toggle)
             -----------------1-----------------    -------------------------2------------------------    ----------------3----------------    -------4-------
-1--2--3--4-StatusTests
0111CoveredT23,T68,T116
1011CoveredT159,T169,T188
1101Not Covered
1110CoveredT3,T28,T29
1111CoveredT32,T37,T39

 LINE       435
 SUB-EXPRESSION (out_xact_state == StRcvdDataStart)
                -----------------1-----------------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT3,T28,T29

 LINE       435
 SUB-EXPRESSION (ep_is_control || ((!out_ep_iso_i[out_ep_index])))
                 ------1------    ---------------2---------------
-1--2-StatusTests
00CoveredT30,T84,T159
01CoveredT1,T2,T3
10CoveredT159,T169,T188

FSM Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_out_pe
Summary for FSM :: out_xact_state
TotalCoveredPercent
States 5 5 100.00 (Not included in score)
Transitions 8 7 87.50
Sequences 0 0

State, Transition and Sequence Details for FSM :: out_xact_state
statesLine No.CoveredTests
StIdle 340 Covered T1,T2,T3
StRcvdDataEnd 266 Covered T3,T28,T29
StRcvdDataStart 240 Covered T3,T28,T29
StRcvdIsoDataEnd 253 Covered T30,T84,T159
StRcvdOut 226 Covered T3,T28,T29


transitionsLine No.CoveredTests
StIdle->StRcvdOut 226 Covered T3,T28,T29
StRcvdDataEnd->StIdle 340 Covered T3,T28,T29
StRcvdDataStart->StIdle 340 Covered T32,T37,T39
StRcvdDataStart->StRcvdDataEnd 266 Covered T3,T28,T29
StRcvdDataStart->StRcvdIsoDataEnd 253 Covered T30,T84,T159
StRcvdIsoDataEnd->StIdle 340 Covered T30,T84,T159
StRcvdOut->StIdle 340 Not Covered
StRcvdOut->StRcvdDataStart 240 Covered T3,T28,T29



Branch Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_out_pe
Line No.TotalCoveredPercent
Branches 52 51 98.08
TERNARY 164 2 2 100.00
IF 184 4 4 100.00
IF 196 3 3 100.00
CASE 221 17 16 94.12
IF 329 2 2 100.00
IF 337 3 3 100.00
IF 348 3 3 100.00
IF 354 2 2 100.00
IF 363 3 3 100.00
IF 373 3 3 100.00
IF 390 2 2 100.00
IF 402 4 4 100.00
IF 421 4 4 100.00


164 assign out_ep_current_d = ep_in_hw ? rx_endp_i : '0; -1- ==> ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T42,T61,T8


184 if (!rst_ni) begin -1- 185 out_ep_setup_o <= '0; ==> 186 end else begin 187 if (setup_token_received && ep_active) begin -2- 188 out_ep_setup_o[out_ep_index_d] <= 1'b1; ==> 189 end else if (out_token_received && ep_active) begin -3- 190 out_ep_setup_o[out_ep_index_d] <= 1'b0; ==> 191 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T3,T28,T30
0 0 1 Covered T29,T30,T32
0 0 0 Covered T1,T2,T3


196 if (!rst_ni) begin -1- 197 out_ep_data_o <= 0; ==> 198 end else begin 199 if (rx_data_put_i) begin -2- 200 out_ep_data_o <= rx_data_i; ==> 201 end MISSING_ELSE ==>

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


221 unique case (out_xact_state) -1- 222 StIdle: begin 223 // For unimplemented EPs, transactions are ignored. 224 // SETUP transactions are also ignored for non-control EPs. 225 if (ep_active && (out_token_received || (setup_token_received && ep_is_control))) begin -2- 226 out_xact_state_next = StRcvdOut; ==> 227 out_xact_start = 1'b1; 228 end else begin 229 out_xact_state_next = StIdle; ==> 230 end 231 end 232 233 StRcvdOut: begin 234 // The spec says we have up to 18 bit times to wait for the host's 235 // data packet. If it doesn't arrive in time, we must invalidate the 236 // transaction. 237 timeout_cntdown_d = timeout_cntdown_q - 1'b1; 238 239 if (rx_pkt_start_i) begin -3- 240 out_xact_state_next = StRcvdDataStart; ==> 241 end else if (timeout_cntdown_q == '0) begin -4- 242 out_xact_state_next = StIdle; ==> 243 end else begin 244 out_xact_state_next = StRcvdOut; ==> 245 end 246 end 247 248 StRcvdDataStart: begin 249 if (!ep_is_control && out_ep_iso_i[out_ep_index] && data_packet_received) begin -5- 250 // ISO EP: Don't send a handshake, ignore toggle. 251 // But ignore iso bit for endpoints marked control. This is 252 // a configuration error. 253 out_xact_state_next = StRcvdIsoDataEnd; ==> 254 end else if (bad_data_toggle && !out_ep_stall_i[out_ep_index]) begin -6- 255 // The DATA toggle was wrong (skipped when this EP is stalled) 256 // Note: bad_data_toggle is meaningless for unimplemented EPs. 257 out_xact_state_next = StIdle; ==> 258 rollback_data = 1'b1; 259 tx_pkt_start_o = 1'b1; 260 tx_pid_o = {UsbPidAck}; // ACK by spec because this is most likely previous ACK was lost 261 end else if (invalid_packet_received || non_data_packet_received) begin -7- 262 // in these cases eg bad CRC, send no response (not a NAK) 263 out_xact_state_next = StIdle; ==> 264 rollback_data = 1'b1; 265 end else if (data_packet_received) begin -8- 266 out_xact_state_next = StRcvdDataEnd; ==> 267 end else begin 268 out_xact_state_next = StRcvdDataStart; ==> 269 end 270 end 271 272 StRcvdDataEnd: begin 273 out_xact_state_next = StIdle; 274 tx_pkt_start_o = 1'b1; 275 276 if (current_xact_setup_q) begin -9- 277 // SETUP transactions end here 278 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin -10- 279 // SETUP transactions that fail to be received are dropped without a response. 280 tx_pkt_start_o = 1'b0; ==> 281 rollback_data = 1'b1; 282 end else begin 283 tx_pid_o = {UsbPidAck}; ==> 284 new_pkt_end = 1'b1; 285 out_ep_acked_o = 1'b1; 286 end 287 end else begin 288 // Non-isochronous OUT transactions end here 289 if (out_ep_stall_i[out_ep_index]) begin -11- 290 tx_pid_o = {UsbPidStall}; // STALL ==> 291 rollback_data = 1'b1; // Packet not accepted 292 end else if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin -12- 293 tx_pid_o = {UsbPidNak}; // NAK -- the endpoint could not accept the data at the moment ==> 294 rollback_data = 1'b1; 295 end else begin 296 tx_pid_o = {UsbPidAck}; // ACK ==> 297 new_pkt_end = 1'b1; 298 out_ep_acked_o = 1'b1; 299 end 300 end 301 end 302 303 StRcvdIsoDataEnd: begin 304 // Isochronous OUT transactions end here 305 out_xact_state_next = StIdle; 306 307 if (nak_out_transaction | out_ep_full_i[out_ep_index]) begin -13- 308 // We got a valid packet, but can't store it (error that the software must resolve) 309 rollback_data = 1'b1; ==> 310 end else begin 311 // We got a valid packet, but we don't send an ACK on the bus 312 new_pkt_end = 1'b1; ==> 313 out_ep_acked_o = 1'b1; 314 end 315 end 316 317 default: out_xact_state_next = StIdle; ==> (Excluded) Exclude Annotation: VC_COV_UNR

Branches:
-1--2--3--4--5--6--7--8--9--10--11--12--13-StatusTestsExclude Annotation
StIdle 1 - - - - - - - - - - - Covered T3,T28,T29
StIdle 0 - - - - - - - - - - - Covered T1,T2,T3
StRcvdOut - 1 - - - - - - - - - - Covered T3,T28,T29
StRcvdOut - 0 1 - - - - - - - - - Not Covered
StRcvdOut - 0 0 - - - - - - - - - Covered T3,T28,T29
StRcvdDataStart - - - 1 - - - - - - - - Covered T30,T84,T159
StRcvdDataStart - - - 0 1 - - - - - - - Covered T32,T37,T39
StRcvdDataStart - - - 0 0 1 - - - - - - Covered T37,T39,T71
StRcvdDataStart - - - 0 0 0 1 - - - - - Covered T3,T28,T29
StRcvdDataStart - - - 0 0 0 0 - - - - - Covered T3,T28,T29
StRcvdDataEnd - - - - - - - 1 1 - - - Covered T194,T195,T196
StRcvdDataEnd - - - - - - - 1 0 - - - Covered T3,T28,T30
StRcvdDataEnd - - - - - - - 0 - 1 - - Covered T164,T171,T197
StRcvdDataEnd - - - - - - - 0 - 0 1 - Covered T37,T39,T72
StRcvdDataEnd - - - - - - - 0 - 0 0 - Covered T29,T32,T33
StRcvdIsoDataEnd - - - - - - - - - - - 1 Covered T30,T198,T199
StRcvdIsoDataEnd - - - - - - - - - - - 0 Covered T84,T159,T169
default - - - - - - - - - - - - Excluded VC_COV_UNR


329 if (!rst_ni) begin -1- 330 timeout_cntdown_q <= AckTimeoutCnt[AckTimeoutCntW-1:0]; ==> 331 end else begin 332 timeout_cntdown_q <= timeout_cntdown_d; ==>

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


337 if (!rst_ni) begin -1- 338 out_xact_state <= StIdle; ==> 339 end else begin 340 out_xact_state <= link_reset_i ? StIdle : out_xact_state_next; -2- ==> ==>

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


348 if (setup_token_received && ep_active) begin -1- 349 data_toggle_d[out_ep_index_d] = 1'b0; ==> 350 end else if (new_pkt_end) begin -2- 351 data_toggle_d[out_ep_index] = ~data_toggle_q[out_ep_index]; ==> 352 end MISSING_ELSE ==>

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


354 if (out_datatog_we_i) begin -1- 355 data_toggle_d = (data_toggle_d & ~out_datatog_mask_i) | ==> 356 (out_datatog_status_i & out_datatog_mask_i); 357 end MISSING_ELSE ==>

Branches:
-1-StatusTests
1 Covered T29,T32,T37
0 Covered T1,T2,T3


363 if (!rst_ni) begin -1- 364 data_toggle_q <= '0; // Clear for all endpoints ==> 365 end else if (link_reset_i) begin -2- 366 data_toggle_q <= '0; // Clear for all endpoints ==> 367 end else begin 368 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


373 if (!rst_ni) begin -1- 374 out_ep_newpkt_o <= 1'b0; ==> 375 out_ep_current_o <= '0; 376 current_xact_setup_q <= 1'b0; 377 end else begin 378 if (out_xact_start) begin -2- 379 out_ep_newpkt_o <= 1'b1; ==> 380 out_ep_current_o <= out_ep_current_d; 381 current_xact_setup_q <= setup_token_received; 382 end else begin 383 out_ep_newpkt_o <= 1'b0; ==>

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


390 if (!rst_ni) begin -1- 391 out_ep_data_put_o <= 1'b0; ==> 392 end else begin 393 out_ep_data_put_o <= ((out_xact_state == StRcvdDataStart) && rx_data_put_i); ==>

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


402 if (!rst_ni) begin -1- 403 nak_out_transaction <= 1'b0; ==> 404 end else begin 405 if ((out_xact_state == StIdle) || (out_xact_state == StRcvdOut)) begin -2- 406 nak_out_transaction <= 1'b0; ==> 407 end else if (out_ep_data_put_o && out_ep_full_i[out_ep_index]) begin -3- 408 nak_out_transaction <= 1'b1; ==> 409 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T1,T2,T3
0 0 1 Covered T30,T37,T39
0 0 0 Covered T3,T28,T29


421 if (!rst_ni) begin -1- 422 out_ep_put_addr_o <= '0; ==> 423 end else begin 424 if (out_xact_state == StRcvdOut) begin -2- 425 out_ep_put_addr_o <= '0; ==> 426 end else if ((out_xact_state == StRcvdDataStart) && increment_addr) begin -3- 427 out_ep_put_addr_o <= out_ep_put_addr_o + 1; ==> 428 end MISSING_ELSE ==>

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


Assert Coverage for Instance : tb.dut.usbdev_impl.u_usb_fs_nb_pe.u_usb_fs_nb_out_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
OutXactStateValid_A 586533067 586232617 0 0


OutXactStateValid_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 586533067 586232617 0 0
T1 6313 6244 0 0
T2 8483 8429 0 0
T3 10220 10144 0 0
T28 8434 8382 0 0
T29 19184 19133 0 0
T30 12616 12552 0 0
T40 2350 2274 0 0
T41 6622 6558 0 0
T42 16481 16406 0 0
T43 55030 54950 0 0

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