Line Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T12
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T12
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T12
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T12
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T12
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T12
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T12
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=16,ResetVal,BitMask=65535,DstWrReq=0,TxnWidth=3 + DataWidth=12,ResetVal=0,BitMask=4095,DstWrReq=0,TxnWidth=3 + DataWidth=8,ResetVal,BitMask=255,DstWrReq=0,TxnWidth=3 + DataWidth=14,ResetVal=0,BitMask=16383,DstWrReq=0,TxnWidth=3 + DataWidth=17,ResetVal=2000,BitMask=131071,DstWrReq=0,TxnWidth=3 + DataWidth=7,ResetVal=0,BitMask=119,DstWrReq=0,TxnWidth=3 + DataWidth=5,ResetVal=0,BitMask=31,DstWrReq=0,TxnWidth=3 + DataWidth=32,ResetVal=0,BitMask=-1,DstWrReq=0,TxnWidth=3 + DataWidth=4,ResetVal=0,BitMask=15,DstWrReq=0,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T12 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T12 |
1 | 1 | Covered | T1,T2,T12 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T12 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T12 |
1 | 1 | Covered | T1,T2,T12 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=0,TxnWidth=3 + DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=1,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T6,T9 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T5,T6,T9 |
1 | 1 | Covered | T5,T6,T9 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T5,T9,T21 |
1 | - | Covered | T5,T6,T9 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T5,T6,T9 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T6,T9 |
1 | 1 | Covered | T5,T6,T9 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T12 |
0 |
0 |
1 |
Covered |
T1,T2,T12 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T12 |
0 |
0 |
1 |
Covered |
T1,T2,T12 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
115434623 |
0 |
0 |
T1 |
63648 |
447 |
0 |
0 |
T2 |
58317 |
476 |
0 |
0 |
T3 |
646785 |
0 |
0 |
0 |
T4 |
129978 |
1502 |
0 |
0 |
T6 |
568425 |
432 |
0 |
0 |
T7 |
0 |
351 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
2098 |
0 |
0 |
T12 |
56868 |
0 |
0 |
0 |
T13 |
385056 |
0 |
0 |
0 |
T14 |
587730 |
0 |
0 |
0 |
T15 |
304482 |
0 |
0 |
0 |
T16 |
389460 |
0 |
0 |
0 |
T17 |
153681 |
0 |
0 |
0 |
T21 |
0 |
8822 |
0 |
0 |
T22 |
471816 |
0 |
0 |
0 |
T27 |
0 |
14820 |
0 |
0 |
T28 |
0 |
5644 |
0 |
0 |
T29 |
52546 |
318 |
0 |
0 |
T30 |
0 |
1890 |
0 |
0 |
T31 |
121222 |
496 |
0 |
0 |
T32 |
0 |
2933 |
0 |
0 |
T57 |
53142 |
338 |
0 |
0 |
T58 |
0 |
12812 |
0 |
0 |
T59 |
0 |
468 |
0 |
0 |
T60 |
0 |
1071 |
0 |
0 |
T61 |
0 |
5547 |
0 |
0 |
T62 |
0 |
11960 |
0 |
0 |
T63 |
0 |
4039 |
0 |
0 |
T64 |
0 |
6844 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
247225050 |
219125172 |
0 |
0 |
T1 |
17306 |
3706 |
0 |
0 |
T2 |
16524 |
2924 |
0 |
0 |
T3 |
16354 |
2754 |
0 |
0 |
T4 |
22644 |
9044 |
0 |
0 |
T12 |
25398 |
11798 |
0 |
0 |
T13 |
17782 |
4182 |
0 |
0 |
T14 |
14008 |
408 |
0 |
0 |
T15 |
14382 |
782 |
0 |
0 |
T16 |
35292 |
21692 |
0 |
0 |
T17 |
14484 |
884 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
122808 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
646785 |
0 |
0 |
0 |
T4 |
129978 |
7 |
0 |
0 |
T6 |
568425 |
2 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
24 |
0 |
0 |
T12 |
56868 |
0 |
0 |
0 |
T13 |
385056 |
0 |
0 |
0 |
T14 |
587730 |
0 |
0 |
0 |
T15 |
304482 |
0 |
0 |
0 |
T16 |
389460 |
0 |
0 |
0 |
T17 |
153681 |
0 |
0 |
0 |
T21 |
0 |
12 |
0 |
0 |
T22 |
471816 |
0 |
0 |
0 |
T27 |
0 |
9 |
0 |
0 |
T28 |
0 |
7 |
0 |
0 |
T29 |
52546 |
1 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T31 |
121222 |
1 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T57 |
53142 |
1 |
0 |
0 |
T58 |
0 |
7 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T60 |
0 |
5 |
0 |
0 |
T61 |
0 |
7 |
0 |
0 |
T62 |
0 |
7 |
0 |
0 |
T63 |
0 |
8 |
0 |
0 |
T64 |
0 |
8 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
2164032 |
2160768 |
0 |
0 |
T2 |
1982778 |
1979412 |
0 |
0 |
T3 |
7330230 |
7327272 |
0 |
0 |
T4 |
1473084 |
1470330 |
0 |
0 |
T12 |
644504 |
641886 |
0 |
0 |
T13 |
4363968 |
4360636 |
0 |
0 |
T14 |
6660940 |
6657710 |
0 |
0 |
T15 |
3450796 |
3447736 |
0 |
0 |
T16 |
4413880 |
4412146 |
0 |
0 |
T17 |
1741718 |
1739066 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T5 T6 T9
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T6 T9
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T6 T9
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T5 T6 T9
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T6 T9
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T6,T9 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T5,T6,T9 |
1 | 1 | Covered | T5,T6,T9 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T21,T56,T34 |
1 | - | Covered | T5,T6,T9 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T5,T6,T9 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T6,T9 |
1 | 1 | Covered | T5,T6,T9 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T5,T6,T9 |
0 |
0 |
1 |
Covered |
T5,T6,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T5,T6,T9 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1038565 |
0 |
0 |
T5 |
54551 |
303 |
0 |
0 |
T6 |
568425 |
2147 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T9 |
0 |
429 |
0 |
0 |
T11 |
0 |
962 |
0 |
0 |
T21 |
0 |
657 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T27 |
309902 |
0 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
956 |
0 |
0 |
T32 |
0 |
1736 |
0 |
0 |
T39 |
0 |
940 |
0 |
0 |
T40 |
0 |
3480 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T70 |
0 |
218 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1124 |
0 |
0 |
T5 |
54551 |
1 |
0 |
0 |
T6 |
568425 |
8 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T11 |
0 |
11 |
0 |
0 |
T21 |
0 |
1 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T27 |
309902 |
0 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T32 |
0 |
4 |
0 |
0 |
T39 |
0 |
1 |
0 |
0 |
T40 |
0 |
8 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T16
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T16
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T16
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T16
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T16
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T16
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T16
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T16 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T16 |
1 | 1 | Covered | T1,T2,T16 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T16 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T16 |
1 | 1 | Covered | T1,T2,T16 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T16 |
0 |
0 |
1 |
Covered |
T1,T2,T16 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T16 |
0 |
0 |
1 |
Covered |
T1,T2,T16 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2159833 |
0 |
0 |
T1 |
63648 |
428 |
0 |
0 |
T2 |
58317 |
472 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
201 |
0 |
0 |
T7 |
0 |
347 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
357 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T29 |
0 |
310 |
0 |
0 |
T31 |
0 |
481 |
0 |
0 |
T57 |
0 |
325 |
0 |
0 |
T68 |
0 |
1423 |
0 |
0 |
T69 |
0 |
102 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2139 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
1 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T12 T5 T9
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T5 T9
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T5 T9
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T5 T9
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T5 T9
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T5 T9
135 1/1 txn_bits_q <= '0;
Tests: T12 T5 T9
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T5,T9 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T12,T5,T9 |
1 | 1 | Covered | T12,T5,T9 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T5,T9 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T5,T9 |
1 | 1 | Covered | T12,T5,T9 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T12,T5,T9 |
0 |
0 |
1 |
Covered |
T12,T5,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T12,T5,T9 |
0 |
0 |
1 |
Covered |
T12,T5,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1394830 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T5 |
0 |
338 |
0 |
0 |
T9 |
0 |
457 |
0 |
0 |
T12 |
18956 |
120 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
682 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T39 |
0 |
1696 |
0 |
0 |
T56 |
0 |
1953 |
0 |
0 |
T70 |
0 |
523 |
0 |
0 |
T71 |
0 |
176 |
0 |
0 |
T72 |
0 |
1997 |
0 |
0 |
T73 |
0 |
348 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1120 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T5 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
18956 |
1 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
1 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T39 |
0 |
2 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T70 |
0 |
2 |
0 |
0 |
T71 |
0 |
1 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T12 T5 T9
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T5 T9
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T5 T9
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T5 T9
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T5 T9
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T5 T9
135 1/1 txn_bits_q <= '0;
Tests: T12 T5 T9
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T5,T9 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T12,T5,T9 |
1 | 1 | Covered | T12,T5,T9 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T5,T9 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T5,T9 |
1 | 1 | Covered | T12,T5,T9 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T12,T5,T9 |
0 |
0 |
1 |
Covered |
T12,T5,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T12,T5,T9 |
0 |
0 |
1 |
Covered |
T12,T5,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1377632 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T5 |
0 |
329 |
0 |
0 |
T9 |
0 |
448 |
0 |
0 |
T12 |
18956 |
111 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
673 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T39 |
0 |
1678 |
0 |
0 |
T56 |
0 |
1946 |
0 |
0 |
T70 |
0 |
519 |
0 |
0 |
T71 |
0 |
174 |
0 |
0 |
T72 |
0 |
1995 |
0 |
0 |
T73 |
0 |
338 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1117 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T5 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
18956 |
1 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
1 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T39 |
0 |
2 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T70 |
0 |
2 |
0 |
0 |
T71 |
0 |
1 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T12 T5 T9
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T5 T9
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T5 T9
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T5 T9
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T5 T9
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T5 T9
135 1/1 txn_bits_q <= '0;
Tests: T12 T5 T9
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T5,T9 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T12,T5,T9 |
1 | 1 | Covered | T12,T5,T9 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T5,T9 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T5,T9 |
1 | 1 | Covered | T12,T5,T9 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T12,T5,T9 |
0 |
0 |
1 |
Covered |
T12,T5,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T12,T5,T9 |
0 |
0 |
1 |
Covered |
T12,T5,T9 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1392883 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T5 |
0 |
318 |
0 |
0 |
T9 |
0 |
439 |
0 |
0 |
T12 |
18956 |
103 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
666 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T39 |
0 |
1663 |
0 |
0 |
T56 |
0 |
1938 |
0 |
0 |
T70 |
0 |
515 |
0 |
0 |
T71 |
0 |
172 |
0 |
0 |
T72 |
0 |
1993 |
0 |
0 |
T73 |
0 |
334 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1116 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T5 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
18956 |
1 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
1 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T39 |
0 |
2 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T70 |
0 |
2 |
0 |
0 |
T71 |
0 |
1 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T22 T23 T24
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T22 T23 T24
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T22 T23 T24
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T22 T23 T24
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T22 T23 T24
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T22 T23 T24
135 1/1 txn_bits_q <= '0;
Tests: T22 T23 T24
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T22,T23,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T22,T23,T24 |
1 | 1 | Covered | T22,T23,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T22,T23,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T22,T23,T24 |
1 | 1 | Covered | T22,T23,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T22,T23,T24 |
0 |
0 |
1 |
Covered |
T22,T23,T24 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T22,T23,T24 |
0 |
0 |
1 |
Covered |
T22,T23,T24 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
3436135 |
0 |
0 |
T5 |
54551 |
0 |
0 |
0 |
T7 |
60814 |
0 |
0 |
0 |
T22 |
235908 |
32992 |
0 |
0 |
T23 |
67247 |
9631 |
0 |
0 |
T24 |
0 |
33895 |
0 |
0 |
T25 |
248822 |
0 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T27 |
309902 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T54 |
0 |
23616 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T75 |
0 |
34541 |
0 |
0 |
T76 |
0 |
33388 |
0 |
0 |
T77 |
0 |
1696 |
0 |
0 |
T78 |
0 |
6847 |
0 |
0 |
T79 |
0 |
35506 |
0 |
0 |
T80 |
0 |
6120 |
0 |
0 |
T81 |
101285 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
3206 |
0 |
0 |
T5 |
54551 |
0 |
0 |
0 |
T7 |
60814 |
0 |
0 |
0 |
T22 |
235908 |
20 |
0 |
0 |
T23 |
67247 |
20 |
0 |
0 |
T24 |
0 |
20 |
0 |
0 |
T25 |
248822 |
0 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T27 |
309902 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T54 |
0 |
20 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T75 |
0 |
20 |
0 |
0 |
T76 |
0 |
20 |
0 |
0 |
T77 |
0 |
20 |
0 |
0 |
T78 |
0 |
20 |
0 |
0 |
T79 |
0 |
20 |
0 |
0 |
T80 |
0 |
20 |
0 |
0 |
T81 |
101285 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T13 T22 T23
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T13 T22 T23
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T13 T22 T23
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T13 T22 T23
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T13 T22 T23
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T13 T22 T23
135 1/1 txn_bits_q <= '0;
Tests: T13 T22 T23
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T22,T23 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T13,T22,T23 |
1 | 1 | Covered | T13,T22,T23 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T22,T23 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T13,T22,T23 |
1 | 1 | Covered | T13,T22,T23 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T13,T22,T23 |
0 |
0 |
1 |
Covered |
T13,T22,T23 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T13,T22,T23 |
0 |
0 |
1 |
Covered |
T13,T22,T23 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6080589 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T13 |
128352 |
16937 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T22 |
235908 |
1914 |
0 |
0 |
T23 |
67247 |
531 |
0 |
0 |
T24 |
0 |
1486 |
0 |
0 |
T25 |
0 |
33091 |
0 |
0 |
T26 |
0 |
33927 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T51 |
0 |
4064 |
0 |
0 |
T65 |
0 |
33113 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T82 |
0 |
7960 |
0 |
0 |
T83 |
0 |
33046 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6218 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T13 |
128352 |
20 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T22 |
235908 |
1 |
0 |
0 |
T23 |
67247 |
1 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T25 |
0 |
20 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T51 |
0 |
20 |
0 |
0 |
T65 |
0 |
20 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T82 |
0 |
20 |
0 |
0 |
T83 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T13
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T13
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T13
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T13
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T13
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T13
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T13
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T13 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T13 |
1 | 1 | Covered | T1,T2,T13 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T13 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T13 |
1 | 1 | Covered | T1,T2,T13 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T13 |
0 |
0 |
1 |
Covered |
T1,T2,T13 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T13 |
0 |
0 |
1 |
Covered |
T1,T2,T13 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7143647 |
0 |
0 |
T1 |
63648 |
470 |
0 |
0 |
T2 |
58317 |
480 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T7 |
0 |
355 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
17252 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
360 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T22 |
0 |
1916 |
0 |
0 |
T23 |
0 |
535 |
0 |
0 |
T25 |
0 |
33171 |
0 |
0 |
T26 |
0 |
34007 |
0 |
0 |
T31 |
0 |
520 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7419 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
20 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
1 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T22 |
0 |
1 |
0 |
0 |
T23 |
0 |
1 |
0 |
0 |
T25 |
0 |
20 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T13 T25 T26
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T13 T25 T26
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T13 T25 T26
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T13 T25 T26
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T13 T25 T26
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T13 T25 T26
135 1/1 txn_bits_q <= '0;
Tests: T13 T25 T26
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T25,T26 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T13,T25,T26 |
1 | 1 | Covered | T13,T25,T26 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T25,T26 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T13,T25,T26 |
1 | 1 | Covered | T13,T25,T26 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T13,T25,T26 |
0 |
0 |
1 |
Covered |
T13,T25,T26 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T13,T25,T26 |
0 |
0 |
1 |
Covered |
T13,T25,T26 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6034795 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T13 |
128352 |
17090 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T23 |
67247 |
0 |
0 |
0 |
T25 |
0 |
33131 |
0 |
0 |
T26 |
0 |
33967 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T51 |
0 |
4258 |
0 |
0 |
T65 |
0 |
33306 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T82 |
0 |
8197 |
0 |
0 |
T83 |
0 |
33086 |
0 |
0 |
T84 |
0 |
9092 |
0 |
0 |
T85 |
0 |
33431 |
0 |
0 |
T86 |
0 |
9535 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6120 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T13 |
128352 |
20 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T23 |
67247 |
0 |
0 |
0 |
T25 |
0 |
20 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T51 |
0 |
20 |
0 |
0 |
T65 |
0 |
20 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T82 |
0 |
20 |
0 |
0 |
T83 |
0 |
20 |
0 |
0 |
T84 |
0 |
20 |
0 |
0 |
T85 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T3 T8 T10
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T8 T10
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T8 T10
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T3 T8 T10
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T8 T10
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T3 T8 T10
135 1/1 txn_bits_q <= '0;
Tests: T3 T8 T10
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T8,T10 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T3,T8,T10 |
1 | 1 | Covered | T3,T8,T10 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T8,T10 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T8,T10 |
1 | 1 | Covered | T3,T8,T10 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T3,T8,T10 |
0 |
0 |
1 |
Covered |
T3,T8,T10 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T3,T8,T10 |
0 |
0 |
1 |
Covered |
T3,T8,T10 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1482370 |
0 |
0 |
T3 |
215595 |
1956 |
0 |
0 |
T5 |
54551 |
0 |
0 |
0 |
T7 |
60814 |
0 |
0 |
0 |
T8 |
0 |
1421 |
0 |
0 |
T10 |
0 |
747 |
0 |
0 |
T21 |
0 |
22455 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T23 |
67247 |
0 |
0 |
0 |
T25 |
248822 |
0 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T45 |
0 |
474 |
0 |
0 |
T48 |
0 |
304 |
0 |
0 |
T49 |
0 |
557 |
0 |
0 |
T51 |
0 |
186 |
0 |
0 |
T52 |
0 |
997 |
0 |
0 |
T53 |
0 |
960 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T81 |
101285 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1193 |
0 |
0 |
T3 |
215595 |
1 |
0 |
0 |
T5 |
54551 |
0 |
0 |
0 |
T7 |
60814 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T21 |
0 |
28 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T23 |
67247 |
0 |
0 |
0 |
T25 |
248822 |
0 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T45 |
0 |
1 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T49 |
0 |
1 |
0 |
0 |
T51 |
0 |
1 |
0 |
0 |
T52 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T74 |
104693 |
0 |
0 |
0 |
T81 |
101285 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T3
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T3
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T3
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T3
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T3
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T3 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T3 |
1 | 1 | Covered | T1,T2,T3 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T3 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T3 |
1 | 1 | Covered | T1,T2,T3 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T3 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T3 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2174864 |
0 |
0 |
T1 |
63648 |
416 |
0 |
0 |
T2 |
58317 |
470 |
0 |
0 |
T3 |
215595 |
1944 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
199 |
0 |
0 |
T7 |
0 |
345 |
0 |
0 |
T8 |
0 |
1419 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
702 |
0 |
0 |
T29 |
0 |
302 |
0 |
0 |
T31 |
0 |
467 |
0 |
0 |
T57 |
0 |
322 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2169 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
215595 |
1 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T27 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T27 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T27 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T27 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T27 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T27 T28
135 1/1 txn_bits_q <= '0;
Tests: T4 T27 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T27,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T4,T27,T28 |
1 | 1 | Covered | T4,T27,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T27,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T27,T28 |
1 | 1 | Covered | T4,T27,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T4,T27,T28 |
0 |
0 |
1 |
Covered |
T4,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T4,T27,T28 |
0 |
0 |
1 |
Covered |
T4,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1796798 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
1079 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
1599 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T27 |
0 |
10057 |
0 |
0 |
T28 |
0 |
2473 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T58 |
0 |
7404 |
0 |
0 |
T60 |
0 |
658 |
0 |
0 |
T61 |
0 |
3148 |
0 |
0 |
T62 |
0 |
6989 |
0 |
0 |
T63 |
0 |
2563 |
0 |
0 |
T64 |
0 |
4404 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1511 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
5 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
2 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T27 |
0 |
6 |
0 |
0 |
T28 |
0 |
3 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T58 |
0 |
4 |
0 |
0 |
T60 |
0 |
3 |
0 |
0 |
T61 |
0 |
4 |
0 |
0 |
T62 |
0 |
4 |
0 |
0 |
T63 |
0 |
5 |
0 |
0 |
T64 |
0 |
5 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T27 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T27 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T27 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T27 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T27 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T27 T28
135 1/1 txn_bits_q <= '0;
Tests: T4 T27 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T27,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T4,T27,T28 |
1 | 1 | Covered | T4,T27,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T27,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T27,T28 |
1 | 1 | Covered | T4,T27,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T4,T27,T28 |
0 |
0 |
1 |
Covered |
T4,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T4,T27,T28 |
0 |
0 |
1 |
Covered |
T4,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1568357 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
423 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
689 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T27 |
0 |
4763 |
0 |
0 |
T28 |
0 |
2448 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T58 |
0 |
5408 |
0 |
0 |
T60 |
0 |
413 |
0 |
0 |
T61 |
0 |
2399 |
0 |
0 |
T62 |
0 |
4971 |
0 |
0 |
T63 |
0 |
1476 |
0 |
0 |
T64 |
0 |
2440 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1303 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
2 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
1 |
0 |
0 |
T22 |
235908 |
0 |
0 |
0 |
T27 |
0 |
3 |
0 |
0 |
T28 |
0 |
3 |
0 |
0 |
T31 |
60611 |
0 |
0 |
0 |
T58 |
0 |
3 |
0 |
0 |
T60 |
0 |
2 |
0 |
0 |
T61 |
0 |
3 |
0 |
0 |
T62 |
0 |
3 |
0 |
0 |
T63 |
0 |
3 |
0 |
0 |
T64 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T7 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T7 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T7 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T7 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T7 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T7 T29
135 1/1 txn_bits_q <= '0;
Tests: T1 T7 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T7,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T7,T29 |
1 | 1 | Covered | T1,T7,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T7,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T7,T29 |
1 | 1 | Covered | T1,T7,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T7,T29 |
0 |
0 |
1 |
Covered |
T1,T7,T29 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T7,T29 |
0 |
0 |
1 |
Covered |
T1,T7,T29 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6555492 |
0 |
0 |
T1 |
63648 |
495 |
0 |
0 |
T2 |
58317 |
0 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T7 |
0 |
359 |
0 |
0 |
T11 |
0 |
6321 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
8161 |
0 |
0 |
T29 |
0 |
337 |
0 |
0 |
T30 |
0 |
54591 |
0 |
0 |
T40 |
0 |
34462 |
0 |
0 |
T56 |
0 |
18029 |
0 |
0 |
T59 |
0 |
522 |
0 |
0 |
T87 |
0 |
485 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7698 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
0 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T11 |
0 |
80 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
65 |
0 |
0 |
T40 |
0 |
77 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T11 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T21 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T21 T30
135 1/1 txn_bits_q <= '0;
Tests: T11 T21 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6610322 |
0 |
0 |
T11 |
750449 |
6280 |
0 |
0 |
T21 |
0 |
8112 |
0 |
0 |
T30 |
0 |
72311 |
0 |
0 |
T40 |
0 |
35710 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
17980 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
24246 |
0 |
0 |
T89 |
0 |
45219 |
0 |
0 |
T90 |
0 |
42371 |
0 |
0 |
T91 |
0 |
25873 |
0 |
0 |
T92 |
0 |
35775 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7816 |
0 |
0 |
T11 |
750449 |
80 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T30 |
0 |
86 |
0 |
0 |
T40 |
0 |
80 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
62 |
0 |
0 |
T89 |
0 |
51 |
0 |
0 |
T90 |
0 |
51 |
0 |
0 |
T91 |
0 |
65 |
0 |
0 |
T92 |
0 |
82 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T11 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T21 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T21 T30
135 1/1 txn_bits_q <= '0;
Tests: T11 T21 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6485239 |
0 |
0 |
T11 |
750449 |
4944 |
0 |
0 |
T21 |
0 |
8133 |
0 |
0 |
T30 |
0 |
49128 |
0 |
0 |
T40 |
0 |
33825 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
18004 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
28229 |
0 |
0 |
T89 |
0 |
45009 |
0 |
0 |
T90 |
0 |
41652 |
0 |
0 |
T91 |
0 |
28157 |
0 |
0 |
T92 |
0 |
30797 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7723 |
0 |
0 |
T11 |
750449 |
62 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T30 |
0 |
59 |
0 |
0 |
T40 |
0 |
77 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
74 |
0 |
0 |
T89 |
0 |
51 |
0 |
0 |
T90 |
0 |
51 |
0 |
0 |
T91 |
0 |
73 |
0 |
0 |
T92 |
0 |
71 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T11 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T21 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T21 T30
135 1/1 txn_bits_q <= '0;
Tests: T11 T21 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6506963 |
0 |
0 |
T11 |
750449 |
6206 |
0 |
0 |
T21 |
0 |
8138 |
0 |
0 |
T30 |
0 |
71722 |
0 |
0 |
T40 |
0 |
41251 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
17994 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
31393 |
0 |
0 |
T89 |
0 |
44799 |
0 |
0 |
T90 |
0 |
40890 |
0 |
0 |
T91 |
0 |
27063 |
0 |
0 |
T92 |
0 |
30483 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7784 |
0 |
0 |
T11 |
750449 |
80 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T30 |
0 |
86 |
0 |
0 |
T40 |
0 |
95 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
84 |
0 |
0 |
T89 |
0 |
51 |
0 |
0 |
T90 |
0 |
51 |
0 |
0 |
T91 |
0 |
73 |
0 |
0 |
T92 |
0 |
71 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T7 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T7 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T7 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T7 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T7 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T7 T29
135 1/1 txn_bits_q <= '0;
Tests: T1 T7 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T7,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T7,T29 |
1 | 1 | Covered | T1,T7,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T7,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T7,T29 |
1 | 1 | Covered | T1,T7,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T7,T29 |
0 |
0 |
1 |
Covered |
T1,T7,T29 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T7,T29 |
0 |
0 |
1 |
Covered |
T1,T7,T29 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1532211 |
0 |
0 |
T1 |
63648 |
479 |
0 |
0 |
T2 |
58317 |
0 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T7 |
0 |
357 |
0 |
0 |
T11 |
0 |
992 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
6743 |
0 |
0 |
T29 |
0 |
333 |
0 |
0 |
T30 |
0 |
1918 |
0 |
0 |
T40 |
0 |
4535 |
0 |
0 |
T56 |
0 |
14043 |
0 |
0 |
T59 |
0 |
514 |
0 |
0 |
T87 |
0 |
475 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1405 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
0 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T11 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T21 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T21 T30
135 1/1 txn_bits_q <= '0;
Tests: T11 T21 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1533650 |
0 |
0 |
T11 |
750449 |
1077 |
0 |
0 |
T21 |
0 |
6674 |
0 |
0 |
T30 |
0 |
1898 |
0 |
0 |
T40 |
0 |
4435 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
14007 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
2571 |
0 |
0 |
T89 |
0 |
989 |
0 |
0 |
T90 |
0 |
681 |
0 |
0 |
T91 |
0 |
2239 |
0 |
0 |
T92 |
0 |
2067 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1414 |
0 |
0 |
T11 |
750449 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
0 |
1 |
0 |
0 |
T91 |
0 |
6 |
0 |
0 |
T92 |
0 |
5 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T11 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T21 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T21 T30
135 1/1 txn_bits_q <= '0;
Tests: T11 T21 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1582242 |
0 |
0 |
T11 |
750449 |
1063 |
0 |
0 |
T21 |
0 |
6700 |
0 |
0 |
T30 |
0 |
1878 |
0 |
0 |
T40 |
0 |
4335 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
14041 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
2325 |
0 |
0 |
T89 |
0 |
979 |
0 |
0 |
T90 |
0 |
653 |
0 |
0 |
T91 |
0 |
2058 |
0 |
0 |
T92 |
0 |
2017 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1453 |
0 |
0 |
T11 |
750449 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
0 |
1 |
0 |
0 |
T91 |
0 |
6 |
0 |
0 |
T92 |
0 |
5 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T11 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T21 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T21 T30
135 1/1 txn_bits_q <= '0;
Tests: T11 T21 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T21,T30 |
1 | 1 | Covered | T11,T21,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T11,T21,T30 |
0 |
0 |
1 |
Covered |
T11,T21,T30 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1537391 |
0 |
0 |
T11 |
750449 |
1012 |
0 |
0 |
T21 |
0 |
6728 |
0 |
0 |
T30 |
0 |
1858 |
0 |
0 |
T40 |
0 |
4235 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
14013 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
2336 |
0 |
0 |
T89 |
0 |
969 |
0 |
0 |
T90 |
0 |
623 |
0 |
0 |
T91 |
0 |
2093 |
0 |
0 |
T92 |
0 |
1967 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1421 |
0 |
0 |
T11 |
750449 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T51 |
103734 |
0 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T58 |
342709 |
0 |
0 |
0 |
T59 |
68785 |
0 |
0 |
0 |
T60 |
46454 |
0 |
0 |
0 |
T75 |
243533 |
0 |
0 |
0 |
T84 |
63404 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
0 |
1 |
0 |
0 |
T91 |
0 |
6 |
0 |
0 |
T92 |
0 |
5 |
0 |
0 |
T93 |
51059 |
0 |
0 |
0 |
T94 |
844352 |
0 |
0 |
0 |
T95 |
53819 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T31
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T31 |
1 | 1 | Covered | T1,T2,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T31 |
1 | 1 | Covered | T1,T2,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T31 |
0 |
0 |
1 |
Covered |
T1,T2,T31 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T31 |
0 |
0 |
1 |
Covered |
T1,T2,T31 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7160965 |
0 |
0 |
T1 |
63648 |
452 |
0 |
0 |
T2 |
58317 |
478 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
225 |
0 |
0 |
T7 |
0 |
353 |
0 |
0 |
T11 |
0 |
6536 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
731 |
0 |
0 |
T29 |
0 |
324 |
0 |
0 |
T31 |
0 |
510 |
0 |
0 |
T57 |
0 |
345 |
0 |
0 |
T59 |
0 |
482 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
8291 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T11 |
0 |
80 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7149823 |
0 |
0 |
T6 |
568425 |
223 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
6278 |
0 |
0 |
T21 |
0 |
7972 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
72471 |
0 |
0 |
T32 |
0 |
2989 |
0 |
0 |
T40 |
0 |
35810 |
0 |
0 |
T41 |
0 |
5841 |
0 |
0 |
T42 |
0 |
1078 |
0 |
0 |
T56 |
0 |
17854 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
24558 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
8375 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
80 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
86 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
80 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
62 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
7024393 |
0 |
0 |
T6 |
568425 |
221 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
4855 |
0 |
0 |
T21 |
0 |
8003 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
49234 |
0 |
0 |
T32 |
0 |
2975 |
0 |
0 |
T40 |
0 |
33919 |
0 |
0 |
T41 |
0 |
5695 |
0 |
0 |
T42 |
0 |
1053 |
0 |
0 |
T56 |
0 |
17880 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
28603 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
8259 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
62 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
59 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
77 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
74 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
6999781 |
0 |
0 |
T6 |
568425 |
219 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
6302 |
0 |
0 |
T21 |
0 |
8025 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
71882 |
0 |
0 |
T32 |
0 |
2961 |
0 |
0 |
T40 |
0 |
41381 |
0 |
0 |
T41 |
0 |
5572 |
0 |
0 |
T42 |
0 |
1013 |
0 |
0 |
T56 |
0 |
17855 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
32041 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
8288 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
80 |
0 |
0 |
T21 |
0 |
11 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
86 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
95 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
11 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
84 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T31
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T31 |
1 | 1 | Covered | T1,T2,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T31 |
1 | 1 | Covered | T1,T2,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T31 |
0 |
0 |
1 |
Covered |
T1,T2,T31 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T31 |
0 |
0 |
1 |
Covered |
T1,T2,T31 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2130601 |
0 |
0 |
T1 |
63648 |
447 |
0 |
0 |
T2 |
58317 |
476 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
217 |
0 |
0 |
T7 |
0 |
351 |
0 |
0 |
T11 |
0 |
1062 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
723 |
0 |
0 |
T29 |
0 |
318 |
0 |
0 |
T31 |
0 |
496 |
0 |
0 |
T57 |
0 |
338 |
0 |
0 |
T59 |
0 |
468 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2067 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2016633 |
0 |
0 |
T6 |
568425 |
215 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
1036 |
0 |
0 |
T21 |
0 |
6534 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1890 |
0 |
0 |
T32 |
0 |
2933 |
0 |
0 |
T40 |
0 |
4395 |
0 |
0 |
T41 |
0 |
5268 |
0 |
0 |
T42 |
0 |
943 |
0 |
0 |
T56 |
0 |
13881 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
2470 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1982 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2043247 |
0 |
0 |
T6 |
568425 |
213 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
1043 |
0 |
0 |
T21 |
0 |
6582 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1870 |
0 |
0 |
T32 |
0 |
2919 |
0 |
0 |
T40 |
0 |
4295 |
0 |
0 |
T41 |
0 |
5142 |
0 |
0 |
T42 |
0 |
905 |
0 |
0 |
T56 |
0 |
13920 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
2227 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1984 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2028929 |
0 |
0 |
T6 |
568425 |
211 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
1041 |
0 |
0 |
T21 |
0 |
6579 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1850 |
0 |
0 |
T32 |
0 |
2905 |
0 |
0 |
T40 |
0 |
4195 |
0 |
0 |
T41 |
0 |
5014 |
0 |
0 |
T42 |
0 |
880 |
0 |
0 |
T56 |
0 |
13850 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
2492 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1984 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T31
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T1,T2,T31 |
1 | 1 | Covered | T1,T2,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T31 |
1 | 1 | Covered | T1,T2,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T31 |
0 |
0 |
1 |
Covered |
T1,T2,T31 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T1,T2,T31 |
0 |
0 |
1 |
Covered |
T1,T2,T31 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2090592 |
0 |
0 |
T1 |
63648 |
440 |
0 |
0 |
T2 |
58317 |
474 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
209 |
0 |
0 |
T7 |
0 |
349 |
0 |
0 |
T11 |
0 |
1011 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
719 |
0 |
0 |
T29 |
0 |
314 |
0 |
0 |
T31 |
0 |
492 |
0 |
0 |
T57 |
0 |
332 |
0 |
0 |
T59 |
0 |
463 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2064 |
0 |
0 |
T1 |
63648 |
1 |
0 |
0 |
T2 |
58317 |
1 |
0 |
0 |
T3 |
215595 |
0 |
0 |
0 |
T4 |
43326 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T12 |
18956 |
0 |
0 |
0 |
T13 |
128352 |
0 |
0 |
0 |
T14 |
195910 |
0 |
0 |
0 |
T15 |
101494 |
0 |
0 |
0 |
T16 |
129820 |
0 |
0 |
0 |
T17 |
51227 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2024520 |
0 |
0 |
T6 |
568425 |
207 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
1005 |
0 |
0 |
T21 |
0 |
6470 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1886 |
0 |
0 |
T32 |
0 |
2877 |
0 |
0 |
T40 |
0 |
4375 |
0 |
0 |
T41 |
0 |
4776 |
0 |
0 |
T42 |
0 |
973 |
0 |
0 |
T56 |
0 |
13835 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
2425 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
2000 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1978802 |
0 |
0 |
T6 |
568425 |
205 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
1044 |
0 |
0 |
T21 |
0 |
6520 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1866 |
0 |
0 |
T32 |
0 |
2863 |
0 |
0 |
T40 |
0 |
4275 |
0 |
0 |
T41 |
0 |
4884 |
0 |
0 |
T42 |
0 |
950 |
0 |
0 |
T56 |
0 |
13862 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
2303 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1955 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T6 T11 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T11 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T11 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T11 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T11 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T11 T21
135 1/1 txn_bits_q <= '0;
Tests: T6 T11 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T11,T21 |
1 | 1 | Covered | T6,T11,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T6,T11,T21 |
0 |
0 |
1 |
Covered |
T6,T11,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1964686 |
0 |
0 |
T6 |
568425 |
203 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
993 |
0 |
0 |
T21 |
0 |
6503 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
1846 |
0 |
0 |
T32 |
0 |
2849 |
0 |
0 |
T40 |
0 |
4175 |
0 |
0 |
T41 |
0 |
5078 |
0 |
0 |
T42 |
0 |
1009 |
0 |
0 |
T56 |
0 |
13782 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
2442 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1964 |
0 |
0 |
T6 |
568425 |
1 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T11 |
0 |
12 |
0 |
0 |
T21 |
0 |
9 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T32 |
0 |
7 |
0 |
0 |
T40 |
0 |
10 |
0 |
0 |
T41 |
0 |
14 |
0 |
0 |
T42 |
0 |
4 |
0 |
0 |
T56 |
0 |
9 |
0 |
0 |
T57 |
53142 |
0 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T69 |
21542 |
0 |
0 |
0 |
T82 |
63369 |
0 |
0 |
0 |
T88 |
0 |
7 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T5 T9 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
72 1/1 src_busy_q <= '0;
Tests: T1 T2 T4
73 1/1 end else if (src_req) begin
Tests: T1 T2 T4
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T9 T21
75 1/1 end else if (src_ack) begin
Tests: T1 T2 T4
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T9 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T2 T4
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T2 T4
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T2 T4
116 1/1 src_q <= ResetVal;
Tests: T1 T2 T4
117 1/1 txn_bits_q <= '0;
Tests: T1 T2 T4
118 1/1 end else if (src_req) begin
Tests: T1 T2 T4
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T5 T9 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T9 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T2 T4
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T5 T9 T21
135 1/1 txn_bits_q <= '0;
Tests: T5 T9 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T2 T4
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T2 T4
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T2 T4
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T2 T4
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Total | Covered | Percent |
Conditions | 13 | 12 | 92.31 |
Logical | 13 | 12 | 92.31 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T9,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Covered | T5,T9,T21 |
1 | 1 | Covered | T5,T9,T21 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T5,T9,T21 |
1 | - | Covered | T5,T9,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T2,T4 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T9,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T9,T21 |
1 | 1 | Covered | T5,T9,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T2,T4 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T5,T9,T21 |
0 |
0 |
1 |
Covered |
T5,T9,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T2,T4 |
0 |
1 |
- |
Covered |
T5,T9,T21 |
0 |
0 |
1 |
Covered |
T5,T9,T21 |
0 |
0 |
0 |
Covered |
T1,T2,T4 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1396843 |
0 |
0 |
T5 |
54551 |
776 |
0 |
0 |
T6 |
568425 |
0 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T9 |
0 |
789 |
0 |
0 |
T21 |
0 |
2692 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T27 |
309902 |
0 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T39 |
0 |
1682 |
0 |
0 |
T54 |
0 |
4938 |
0 |
0 |
T55 |
0 |
3316 |
0 |
0 |
T56 |
0 |
5826 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T70 |
0 |
519 |
0 |
0 |
T96 |
0 |
3355 |
0 |
0 |
T97 |
0 |
732 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7271325 |
6444858 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
481 |
81 |
0 |
0 |
T4 |
666 |
266 |
0 |
0 |
T12 |
747 |
347 |
0 |
0 |
T13 |
523 |
123 |
0 |
0 |
T14 |
412 |
12 |
0 |
0 |
T15 |
423 |
23 |
0 |
0 |
T16 |
1038 |
638 |
0 |
0 |
T17 |
426 |
26 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1126 |
0 |
0 |
T5 |
54551 |
2 |
0 |
0 |
T6 |
568425 |
0 |
0 |
0 |
T8 |
240611 |
0 |
0 |
0 |
T9 |
0 |
2 |
0 |
0 |
T21 |
0 |
4 |
0 |
0 |
T26 |
250832 |
0 |
0 |
0 |
T27 |
309902 |
0 |
0 |
0 |
T29 |
52546 |
0 |
0 |
0 |
T39 |
0 |
2 |
0 |
0 |
T54 |
0 |
4 |
0 |
0 |
T55 |
0 |
2 |
0 |
0 |
T56 |
0 |
4 |
0 |
0 |
T65 |
251010 |
0 |
0 |
0 |
T66 |
48764 |
0 |
0 |
0 |
T67 |
53084 |
0 |
0 |
0 |
T68 |
393069 |
0 |
0 |
0 |
T70 |
0 |
2 |
0 |
0 |
T96 |
0 |
2 |
0 |
0 |
T97 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1332231489 |
1331790336 |
0 |
0 |
T1 |
63648 |
63552 |
0 |
0 |
T2 |
58317 |
58218 |
0 |
0 |
T3 |
215595 |
215508 |
0 |
0 |
T4 |
43326 |
43245 |
0 |
0 |
T12 |
18956 |
18879 |
0 |
0 |
T13 |
128352 |
128254 |
0 |
0 |
T14 |
195910 |
195815 |
0 |
0 |
T15 |
101494 |
101404 |
0 |
0 |
T16 |
129820 |
129769 |
0 |
0 |
T17 |
51227 |
51149 |
0 |
0 |