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

Module : spi_p2s
SCORELINECONDTOGGLEFSMBRANCHASSERT
85.98 100.00 71.43 72.50 100.00

Source File(s) :
/workspaces/repo/scratch/os_regression_2024_09_10/spi_device_1r1w-sim-vcs/default/sim-vcs/../src/lowrisc_ip_spi_device_0.1/rtl/spi_p2s.sv

Module self-instances :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
tb.dut.u_p2s 85.98 100.00 71.43 72.50 100.00



Module Instance : tb.dut.u_p2s

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
85.98 100.00 71.43 72.50 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
85.98 100.00 71.43 72.50 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
92.52 95.20 84.31 97.00 90.62 95.45 dut


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
no children


Since this is the module's only instance, the coverage report is the same as for the module.
Line Coverage for Module : spi_p2s
Line No.TotalCoveredPercent
TOTAL3434100.00
ALWAYS5855100.00
CONT_ASSIGN7911100.00
ALWAYS9855100.00
ALWAYS11044100.00
CONT_ASSIGN13011100.00
ALWAYS13455100.00
CONT_ASSIGN16611100.00
ALWAYS17066100.00
CONT_ASSIGN17911100.00
ALWAYS18355100.00

57 always_comb begin 58 1/1 out_enable = 4'b 0000; // default Tests: T1 T2 T3  59 60 1/1 unique case (io_mode) Tests: T1 T2 T3  61 SingleIO: begin 62 1/1 out_enable = {2'b 00, data_valid_i, 1'b 0}; Tests: T1 T2 T3  63 end 64 65 DualIO: begin 66 1/1 out_enable = {2'b 00, {2{data_valid_i}}}; Tests: T1 T2 T3  67 end 68 69 QuadIO: begin 70 1/1 out_enable = {4{data_valid_i}}; Tests: T1 T2 T3  71 end 72 73 default: begin 74 out_enable = 4'b 0000; 75 end 76 endcase 77 end 78 79 1/1 assign s_en_o = (csb_i) ? 4'b 0000 : out_enable ; Tests: T1 T2 T3  80 81 // `data_sent` 82 // Popping signal is a little bit tricky if p2s supports Quad IO 83 // The sent signal cannot be sent at the end of the beat, as it does not have 84 // enought time to affect the FIFO. 85 // 86 // If the sent signal asserted at the first beat, at the very first byte of 87 // SPI has no time to assert valid signal. So the sent signal does not affect 88 // the FIFO. So the logic sends first byte twice. 89 // 90 // This won't affect in Flash mode as in Flash/Passthrough mode, first byte is 91 // always SPI command. It does not send anything on the SPI bus. 92 // 93 // So, the logic generating `sent` signal looks not straightforward. It tries 94 // assert second last beat. So, in SingleIO (right after reset always), it 95 // asserts at 7th beat. Then the mode could be changed to Dual/ Quad. 96 97 always_comb begin 98 1/1 data_sent_o = 1'b 0; Tests: T1 T2 T3  99 100 1/1 unique case (io_mode) Tests: T1 T2 T3  101 1/1 SingleIO: data_sent_o = (cnt == 6); Tests: T1 T2 T3  102 1/1 DualIO: data_sent_o = (cnt == 2); Tests: T6 T11 T13  103 1/1 QuadIO: data_sent_o = (cnt == 0); Tests: T6 T13 T37  104 default: data_sent_o = '0; 105 endcase 106 end 107 108 // data shift 109 always_ff @(posedge clk_i) begin 110 1/1 unique case (io_mode) Tests: T1 T2 T3  111 SingleIO: begin 112 1/1 out_shift <= (order_i) ? {1'b0, out_shift_d[7:1]} : {out_shift_d[6:0], 1'b0}; Tests: T1 T2 T3  113 end 114 115 DualIO: begin 116 1/1 out_shift <= (order_i) ? {2'b0, out_shift_d[7:2]} : {out_shift_d[5:0], 2'b0}; Tests: T1 T2 T3  117 end 118 119 QuadIO: begin 120 1/1 out_shift <= (order_i) ? {4'b0, out_shift_d[7:4]} : {out_shift_d[3:0], 4'b0}; Tests: T1 T2 T3  121 end 122 123 default: begin 124 out_shift <= out_shift_d; 125 end 126 endcase 127 end 128 129 // out_shift_d 130 1/1 assign out_shift_d = (first_beat) ? data_i : out_shift; Tests: T1 T2 T3  131 132 // SPI out 133 always_comb begin 134 1/1 s_o = 4'b 0000; Tests: T1 T2 T3  135 136 1/1 unique case (io_mode) Tests: T1 T2 T3  137 SingleIO: begin 138 1/1 s_o[1] = (order_i) ? ((!first_beat) ? out_shift[0] : data_i[0]) Tests: T1 T2 T3  139 : ((!first_beat) ? out_shift[7] : data_i[7]); 140 end 141 142 DualIO: begin 143 1/1 s_o[1:0] = (order_i) ? ((!first_beat) ? out_shift[1:0] : data_i[1:0]) Tests: T1 T2 T3  144 : ((!first_beat) ? out_shift[7:6] : data_i[7:6]); 145 end 146 147 QuadIO: begin 148 1/1 s_o = (order_i) ? ((!first_beat) ? out_shift[3:0] : data_i[3:0]) Tests: T1 T2 T3  149 : ((!first_beat) ? out_shift[7:4] : data_i[7:4]); 150 end 151 152 default: begin 153 s_o = 4'b 0000; 154 end 155 endcase 156 end 157 158 // io_mode 159 // io_mode reset value is SingleIO (as described in assumption) 160 // Previously, logic updated io_mode at every byte. It was to make io_mode 161 // safer. However, as `io_mode_i` is updated at @iSCK (from spi_device top), 162 // and also spi_p2s logic runs only when `data_valid_i` is high, the need of 163 // latching logic disapears. 164 // 165 // Now, the logic uses `io_mode_i` directly. 166 1/1 assign io_mode = io_mode_i; Tests: T1 T2 T3  167 168 // cnt 169 always_ff @(posedge clk_i or negedge rst_ni) begin 170 1/1 if (!rst_ni) begin Tests: T1 T2 T3  171 1/1 cnt <= BitWidth'(0); Tests: T1 T2 T3  172 1/1 end else if (last_beat) begin Tests: T6 T7 T8  173 1/1 cnt <= BitWidth'(0); Tests: T6 T11 T12  174 1/1 end else if (data_valid_i) begin Tests: T6 T7 T8  175 1/1 cnt <= cnt + 1'b 1; Tests: T6 T11 T12  176 end MISSING_ELSE 177 end 178 179 1/1 assign first_beat = (cnt == '0); Tests: T1 T2 T3  180 181 // Last beat depends on the mode 182 always_comb begin 183 1/1 last_beat = 1'b 0; Tests: T1 T2 T3  184 185 1/1 unique case (io_mode) Tests: T1 T2 T3  186 1/1 SingleIO: last_beat = (cnt == BitWidth'('h7)); Tests: T1 T2 T3  187 1/1 DualIO: last_beat = (cnt == BitWidth'('h3)); Tests: T6 T11 T13  188 1/1 QuadIO: last_beat = (cnt == BitWidth'('h1)); Tests: T6 T13 T37  189 default: last_beat = 1'b0;

Cond Coverage for Module : spi_p2s
TotalCoveredPercent
Conditions423071.43
Logical423071.43
Non-Logical00
Event00

 LINE       79
 EXPRESSION (csb_i ? 4'b0 : out_enable)
             --1--
-1-StatusTests
0CoveredT1,T6,T7
1CoveredT1,T2,T3

 LINE       101
 EXPRESSION (cnt == 3'h6)
            ------1------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT11,T12,T13

 LINE       102
 EXPRESSION (cnt == 3'h2)
            ------1------
-1-StatusTests
0CoveredT6,T11,T13
1CoveredT6,T11,T13

 LINE       103
 EXPRESSION (cnt == 3'b0)
            ------1------
-1-StatusTests
0CoveredT13,T37,T38
1CoveredT6,T13,T37

 LINE       112
 EXPRESSION (order_i ? ({1'b0, out_shift_d[7:1]}) : ({out_shift_d[6:0], 1'b0}))
             ---1---
-1-StatusTests
0CoveredT3,T4,T5
1Not Covered

 LINE       116
 EXPRESSION (order_i ? ({2'b0, out_shift_d[7:2]}) : ({out_shift_d[5:0], 2'b0}))
             ---1---
-1-StatusTests
0CoveredT6,T11,T13
1Not Covered

 LINE       120
 EXPRESSION (order_i ? ({4'b0, out_shift_d[7:4]}) : ({out_shift_d[3:0], 4'b0}))
             ---1---
-1-StatusTests
0CoveredT13,T37,T38
1Not Covered

 LINE       130
 EXPRESSION (first_beat ? data_i : out_shift)
             -----1----
-1-StatusTests
0CoveredT6,T11,T12
1CoveredT1,T2,T3

 LINE       138
 EXPRESSION (order_i ? (((!first_beat)) ? out_shift[0] : data_i[0]) : (((!first_beat)) ? out_shift[7] : data_i[7]))
             ---1---
-1-StatusTests
0CoveredT1,T2,T3
1Not Covered

 LINE       138
 SUB-EXPRESSION (((!first_beat)) ? out_shift[0] : data_i[0])
                 -------1-------
-1-StatusTests
0Not Covered
1Not Covered

 LINE       138
 SUB-EXPRESSION (((!first_beat)) ? out_shift[7] : data_i[7])
                 -------1-------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT11,T12,T13

 LINE       143
 EXPRESSION (order_i ? (((!first_beat)) ? out_shift[1:0] : data_i[1:0]) : (((!first_beat)) ? out_shift[7:6] : data_i[7:6]))
             ---1---
-1-StatusTests
0CoveredT1,T2,T3
1Not Covered

 LINE       143
 SUB-EXPRESSION (((!first_beat)) ? out_shift[1:0] : data_i[1:0])
                 -------1-------
-1-StatusTests
0Not Covered
1Not Covered

 LINE       143
 SUB-EXPRESSION (((!first_beat)) ? out_shift[7:6] : data_i[7:6])
                 -------1-------
-1-StatusTests
0CoveredT6,T11,T13
1CoveredT6,T11,T13

 LINE       148
 EXPRESSION (order_i ? (((!first_beat)) ? out_shift[3:0] : data_i[3:0]) : (((!first_beat)) ? out_shift[7:4] : data_i[7:4]))
             ---1---
-1-StatusTests
0CoveredT1,T2,T3
1Not Covered

 LINE       148
 SUB-EXPRESSION (((!first_beat)) ? out_shift[3:0] : data_i[3:0])
                 -------1-------
-1-StatusTests
0Not Covered
1Not Covered

 LINE       148
 SUB-EXPRESSION (((!first_beat)) ? out_shift[7:4] : data_i[7:4])
                 -------1-------
-1-StatusTests
0CoveredT6,T13,T37
1CoveredT13,T37,T38

 LINE       179
 EXPRESSION (cnt == '0)
            -----1-----
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT1,T2,T3

 LINE       186
 EXPRESSION (cnt == 3'('h00000007))
            -----------1-----------
-1-StatusTests
0CoveredT1,T2,T3
1CoveredT11,T12,T13

 LINE       187
 EXPRESSION (cnt == 3'('h00000003))
            -----------1-----------
-1-StatusTests
0CoveredT6,T11,T13
1CoveredT6,T11,T13

 LINE       188
 EXPRESSION (cnt == 3'('b1))
            --------1-------
-1-StatusTests
0CoveredT6,T13,T37
1CoveredT13,T37,T38

Branch Coverage for Module : spi_p2s
Line No.TotalCoveredPercent
Branches 40 29 72.50
TERNARY 79 2 2 100.00
TERNARY 130 2 2 100.00
CASE 60 4 4 100.00
CASE 100 4 3 75.00
CASE 110 7 4 57.14
CASE 136 13 7 53.85
IF 170 4 4 100.00
CASE 185 4 3 75.00


79 assign s_en_o = (csb_i) ? 4'b 0000 : out_enable ; -1- ==> ==>

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


130 assign out_shift_d = (first_beat) ? data_i : out_shift; -1- ==> ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T6,T11,T12


60 unique case (io_mode) -1- 61 SingleIO: begin 62 out_enable = {2'b 00, data_valid_i, 1'b 0}; ==> 63 end 64 65 DualIO: begin 66 out_enable = {2'b 00, {2{data_valid_i}}}; ==> 67 end 68 69 QuadIO: begin 70 out_enable = {4{data_valid_i}}; ==> 71 end 72 73 default: begin 74 out_enable = 4'b 0000; ==>

Branches:
-1-StatusTests
SingleIO Covered T1,T2,T3
DualIO Covered T1,T2,T3
QuadIO Covered T1,T2,T3
default Covered T1,T2,T3


100 unique case (io_mode) -1- 101 SingleIO: data_sent_o = (cnt == 6); ==> 102 DualIO: data_sent_o = (cnt == 2); ==> 103 QuadIO: data_sent_o = (cnt == 0); ==> 104 default: data_sent_o = '0; ==>

Branches:
-1-StatusTests
SingleIO Covered T1,T2,T3
DualIO Covered T6,T11,T13
QuadIO Covered T6,T13,T37
default Not Covered


110 unique case (io_mode) -1- 111 SingleIO: begin 112 out_shift <= (order_i) ? {1'b0, out_shift_d[7:1]} : {out_shift_d[6:0], 1'b0}; -2- ==> ==> 113 end 114 115 DualIO: begin 116 out_shift <= (order_i) ? {2'b0, out_shift_d[7:2]} : {out_shift_d[5:0], 2'b0}; -3- ==> ==> 117 end 118 119 QuadIO: begin 120 out_shift <= (order_i) ? {4'b0, out_shift_d[7:4]} : {out_shift_d[3:0], 4'b0}; -4- ==> ==> 121 end 122 123 default: begin 124 out_shift <= out_shift_d; ==>

Branches:
-1--2--3--4-StatusTests
SingleIO 1 - - Not Covered
SingleIO 0 - - Covered T3,T4,T5
DualIO - 1 - Not Covered
DualIO - 0 - Covered T6,T11,T13
QuadIO - - 1 Not Covered
QuadIO - - 0 Covered T13,T37,T38
default - - - Covered T1,T2,T3


136 unique case (io_mode) -1- 137 SingleIO: begin 138 s_o[1] = (order_i) ? ((!first_beat) ? out_shift[0] : data_i[0]) -2- -3- ==> ==> 139 : ((!first_beat) ? out_shift[7] : data_i[7]); -4- ==> ==> 140 end 141 142 DualIO: begin 143 s_o[1:0] = (order_i) ? ((!first_beat) ? out_shift[1:0] : data_i[1:0]) -5- -6- ==> ==> 144 : ((!first_beat) ? out_shift[7:6] : data_i[7:6]); -7- ==> ==> 145 end 146 147 QuadIO: begin 148 s_o = (order_i) ? ((!first_beat) ? out_shift[3:0] : data_i[3:0]) -8- -9- ==> ==> 149 : ((!first_beat) ? out_shift[7:4] : data_i[7:4]); -10- ==> ==> 150 end 151 152 default: begin 153 s_o = 4'b 0000; ==>

Branches:
-1--2--3--4--5--6--7--8--9--10-StatusTests
SingleIO 1 1 - - - - - - - Not Covered
SingleIO 1 0 - - - - - - - Not Covered
SingleIO 0 - 1 - - - - - - Covered T11,T12,T13
SingleIO 0 - 0 - - - - - - Covered T1,T2,T3
DualIO - - - 1 1 - - - - Not Covered
DualIO - - - 1 0 - - - - Not Covered
DualIO - - - 0 - 1 - - - Covered T6,T11,T13
DualIO - - - 0 - 0 - - - Covered T6,T11,T13
QuadIO - - - - - - 1 1 - Not Covered
QuadIO - - - - - - 1 0 - Not Covered
QuadIO - - - - - - 0 - 1 Covered T13,T37,T38
QuadIO - - - - - - 0 - 0 Covered T6,T13,T37
default - - - - - - - - - Covered T1,T2,T3


170 if (!rst_ni) begin -1- 171 cnt <= BitWidth'(0); ==> 172 end else if (last_beat) begin -2- 173 cnt <= BitWidth'(0); ==> 174 end else if (data_valid_i) begin -3- 175 cnt <= cnt + 1'b 1; ==> 176 end MISSING_ELSE ==>

Branches:
-1--2--3-StatusTests
1 - - Covered T1,T2,T3
0 1 - Covered T6,T11,T12
0 0 1 Covered T6,T11,T12
0 0 0 Covered T6,T7,T8


185 unique case (io_mode) -1- 186 SingleIO: last_beat = (cnt == BitWidth'('h7)); ==> 187 DualIO: last_beat = (cnt == BitWidth'('h3)); ==> 188 QuadIO: last_beat = (cnt == BitWidth'('h1)); ==> 189 default: last_beat = 1'b0; ==>

Branches:
-1-StatusTests
SingleIO Covered T1,T2,T3
DualIO Covered T6,T11,T13
QuadIO Covered T6,T13,T37
default Not Covered


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




Assertion Details

NameAttemptsReal SuccessesFailuresIncomplete
IoModeChangeValid_A 153467500 7535 0 0
IoModeDefault_A 153467500 20530 0 0


IoModeChangeValid_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 153467500 7535 0 0
T6 90042 8 0 0
T7 16601 1 0 0
T8 10349 1 0 0
T9 468886 0 0 0
T10 4209 1 0 0
T11 6228 3 0 0
T12 34464 1 0 0
T13 25843 8 0 0
T14 1 0 0 0
T16 0 1 0 0
T17 0 1 0 0
T18 0 1 0 0
T39 1 0 0 0

IoModeDefault_A
NameAttemptsReal SuccessesFailuresIncomplete
Total 153467500 20530 0 0
T6 90042 2 0 0
T7 16601 2 0 0
T8 10349 1 0 0
T9 468886 0 0 0
T10 4209 1 0 0
T11 6228 1 0 0
T12 34464 2 0 0
T13 25843 1 0 0
T14 1 0 0 0
T16 0 1 0 0
T17 0 1 0 0
T18 0 2 0 0
T39 1 0 0 0

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