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 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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T13
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T1,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T5,T1,T2 |
1 | 1 | Covered | T5,T1,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T1,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T1,T2 |
1 | 1 | Covered | T5,T1,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T7,T18,T20 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T7,T18,T20 |
1 | 1 | Covered | T7,T18,T20 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T7,T18,T20 |
1 | - | Covered | T7,T18,T20 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T7,T18,T20 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T7,T18,T20 |
1 | 1 | Covered | T7,T18,T20 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T13 |
0 |
0 |
1 |
Covered |
T1,T2,T13 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T13 |
0 |
0 |
1 |
Covered |
T1,T2,T13 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
98897141 |
0 |
0 |
T1 |
58212 |
328 |
0 |
0 |
T2 |
58326 |
476 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
165510 |
0 |
0 |
0 |
T8 |
170148 |
993 |
0 |
0 |
T9 |
430226 |
1653 |
0 |
0 |
T10 |
0 |
433 |
0 |
0 |
T11 |
0 |
1899 |
0 |
0 |
T12 |
0 |
996 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
498819 |
5700 |
0 |
0 |
T20 |
0 |
5209 |
0 |
0 |
T26 |
457890 |
0 |
0 |
0 |
T27 |
332426 |
0 |
0 |
0 |
T29 |
0 |
13707 |
0 |
0 |
T30 |
0 |
5249 |
0 |
0 |
T31 |
686712 |
329 |
0 |
0 |
T60 |
0 |
1387 |
0 |
0 |
T61 |
0 |
350 |
0 |
0 |
T62 |
0 |
3589 |
0 |
0 |
T63 |
0 |
966 |
0 |
0 |
T64 |
0 |
2193 |
0 |
0 |
T65 |
0 |
15124 |
0 |
0 |
T66 |
0 |
1943 |
0 |
0 |
T67 |
0 |
14389 |
0 |
0 |
T68 |
0 |
2549 |
0 |
0 |
T69 |
402256 |
0 |
0 |
0 |
T70 |
495756 |
0 |
0 |
0 |
T71 |
401268 |
0 |
0 |
0 |
T72 |
72650 |
0 |
0 |
0 |
T73 |
422314 |
0 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
224717526 |
201835832 |
0 |
0 |
T1 |
16490 |
2890 |
0 |
0 |
T2 |
16524 |
2924 |
0 |
0 |
T3 |
22848 |
9248 |
0 |
0 |
T4 |
15198 |
1598 |
0 |
0 |
T5 |
16762 |
3162 |
0 |
0 |
T8 |
17238 |
3638 |
0 |
0 |
T13 |
27948 |
14348 |
0 |
0 |
T14 |
16796 |
3196 |
0 |
0 |
T15 |
14314 |
714 |
0 |
0 |
T16 |
17136 |
3536 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
105274 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
165510 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
430226 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
498819 |
7 |
0 |
0 |
T20 |
0 |
12 |
0 |
0 |
T26 |
457890 |
0 |
0 |
0 |
T27 |
332426 |
0 |
0 |
0 |
T29 |
0 |
8 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
1 |
0 |
0 |
T62 |
0 |
7 |
0 |
0 |
T63 |
0 |
1 |
0 |
0 |
T64 |
0 |
8 |
0 |
0 |
T65 |
0 |
8 |
0 |
0 |
T66 |
0 |
7 |
0 |
0 |
T67 |
0 |
8 |
0 |
0 |
T68 |
0 |
7 |
0 |
0 |
T69 |
402256 |
0 |
0 |
0 |
T70 |
495756 |
0 |
0 |
0 |
T71 |
401268 |
0 |
0 |
0 |
T72 |
72650 |
0 |
0 |
0 |
T73 |
422314 |
0 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
1979208 |
1976216 |
0 |
0 |
T2 |
1983084 |
1979752 |
0 |
0 |
T3 |
2857666 |
2854810 |
0 |
0 |
T4 |
1826106 |
1823624 |
0 |
0 |
T5 |
1762968 |
1761098 |
0 |
0 |
T8 |
5785032 |
5781938 |
0 |
0 |
T13 |
3431586 |
3428186 |
0 |
0 |
T14 |
2017526 |
2015146 |
0 |
0 |
T15 |
7034770 |
7032050 |
0 |
0 |
T16 |
2059142 |
2055742 |
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: T7 T18 T20
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T7 T18 T20
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T7 T18 T20
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T7 T18 T20
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T7 T18 T20
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T7,T18,T20 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T7,T18,T20 |
1 | 1 | Covered | T7,T18,T20 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T20,T76,T38 |
1 | - | Covered | T7,T18,T33 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T7,T18,T20 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T7,T18,T20 |
1 | 1 | Covered | T7,T18,T20 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T7,T18,T20 |
0 |
0 |
1 |
Covered |
T7,T18,T20 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T7,T18,T20 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1121244 |
0 |
0 |
T7 |
18204 |
175 |
0 |
0 |
T10 |
53711 |
0 |
0 |
0 |
T18 |
0 |
1973 |
0 |
0 |
T19 |
0 |
1176 |
0 |
0 |
T20 |
0 |
474 |
0 |
0 |
T25 |
59610 |
0 |
0 |
0 |
T29 |
334136 |
0 |
0 |
0 |
T33 |
0 |
796 |
0 |
0 |
T57 |
0 |
700 |
0 |
0 |
T77 |
0 |
1884 |
0 |
0 |
T78 |
0 |
380 |
0 |
0 |
T79 |
0 |
1331 |
0 |
0 |
T80 |
0 |
397 |
0 |
0 |
T81 |
255838 |
0 |
0 |
0 |
T82 |
50623 |
0 |
0 |
0 |
T83 |
25669 |
0 |
0 |
0 |
T84 |
193090 |
0 |
0 |
0 |
T85 |
63118 |
0 |
0 |
0 |
T86 |
125912 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1097 |
0 |
0 |
T7 |
18204 |
2 |
0 |
0 |
T10 |
53711 |
0 |
0 |
0 |
T18 |
0 |
1 |
0 |
0 |
T19 |
0 |
3 |
0 |
0 |
T20 |
0 |
1 |
0 |
0 |
T25 |
59610 |
0 |
0 |
0 |
T29 |
334136 |
0 |
0 |
0 |
T33 |
0 |
2 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
T79 |
0 |
1 |
0 |
0 |
T80 |
0 |
1 |
0 |
0 |
T81 |
255838 |
0 |
0 |
0 |
T82 |
50623 |
0 |
0 |
0 |
T83 |
25669 |
0 |
0 |
0 |
T84 |
193090 |
0 |
0 |
0 |
T85 |
63118 |
0 |
0 |
0 |
T86 |
125912 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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 T8
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1719073 |
0 |
0 |
T1 |
58212 |
306 |
0 |
0 |
T2 |
58326 |
472 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
989 |
0 |
0 |
T9 |
0 |
1637 |
0 |
0 |
T10 |
0 |
429 |
0 |
0 |
T11 |
0 |
1878 |
0 |
0 |
T12 |
0 |
992 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1371 |
0 |
0 |
T61 |
0 |
339 |
0 |
0 |
T87 |
0 |
1400 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1862 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
1 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T13 T7 T18
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T13 T7 T18
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T13 T7 T18
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T7 T18
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T13 T7 T18
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T7 T18
135 1/1 txn_bits_q <= '0;
Tests: T13 T7 T18
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T7,T18 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T13,T7,T18 |
1 | 1 | Covered | T13,T7,T18 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T7,T18 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T13,T7,T18 |
1 | 1 | Covered | T13,T7,T18 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T13,T7,T18 |
0 |
0 |
1 |
Covered |
T13,T7,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T13,T7,T18 |
0 |
0 |
1 |
Covered |
T13,T7,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
832992 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T7 |
0 |
164 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
723 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T18 |
0 |
3968 |
0 |
0 |
T19 |
0 |
1194 |
0 |
0 |
T20 |
0 |
481 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T77 |
0 |
1911 |
0 |
0 |
T88 |
0 |
1028 |
0 |
0 |
T89 |
0 |
460 |
0 |
0 |
T90 |
0 |
1082 |
0 |
0 |
T91 |
0 |
1460 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
915 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T7 |
0 |
2 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
1 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T18 |
0 |
2 |
0 |
0 |
T19 |
0 |
3 |
0 |
0 |
T20 |
0 |
1 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T88 |
0 |
2 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
0 |
2 |
0 |
0 |
T91 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T13 T7 T18
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T13 T7 T18
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T13 T7 T18
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T7 T18
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T13 T7 T18
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T7 T18
135 1/1 txn_bits_q <= '0;
Tests: T13 T7 T18
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T7,T18 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T13,T7,T18 |
1 | 1 | Covered | T13,T7,T18 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T7,T18 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T13,T7,T18 |
1 | 1 | Covered | T13,T7,T18 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T13,T7,T18 |
0 |
0 |
1 |
Covered |
T13,T7,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T13,T7,T18 |
0 |
0 |
1 |
Covered |
T13,T7,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
833968 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T7 |
0 |
206 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
718 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T18 |
0 |
3954 |
0 |
0 |
T19 |
0 |
1188 |
0 |
0 |
T20 |
0 |
479 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T77 |
0 |
1908 |
0 |
0 |
T88 |
0 |
1012 |
0 |
0 |
T89 |
0 |
458 |
0 |
0 |
T90 |
0 |
1078 |
0 |
0 |
T91 |
0 |
1458 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
905 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T7 |
0 |
2 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
1 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T18 |
0 |
2 |
0 |
0 |
T19 |
0 |
3 |
0 |
0 |
T20 |
0 |
1 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T88 |
0 |
2 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
0 |
2 |
0 |
0 |
T91 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T13 T7 T18
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T13 T7 T18
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T13 T7 T18
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T7 T18
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T13 T7 T18
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T7 T18
135 1/1 txn_bits_q <= '0;
Tests: T13 T7 T18
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T7,T18 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T13,T7,T18 |
1 | 1 | Covered | T13,T7,T18 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T13,T7,T18 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T13,T7,T18 |
1 | 1 | Covered | T13,T7,T18 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T13,T7,T18 |
0 |
0 |
1 |
Covered |
T13,T7,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T13,T7,T18 |
0 |
0 |
1 |
Covered |
T13,T7,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
840586 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T7 |
0 |
196 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
707 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T18 |
0 |
3934 |
0 |
0 |
T19 |
0 |
1182 |
0 |
0 |
T20 |
0 |
477 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T77 |
0 |
1898 |
0 |
0 |
T88 |
0 |
990 |
0 |
0 |
T89 |
0 |
456 |
0 |
0 |
T90 |
0 |
1074 |
0 |
0 |
T91 |
0 |
1456 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
913 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T7 |
0 |
2 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
1 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T18 |
0 |
2 |
0 |
0 |
T19 |
0 |
3 |
0 |
0 |
T20 |
0 |
1 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T88 |
0 |
2 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
0 |
2 |
0 |
0 |
T91 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T5 T14 T25
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T14 T25
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T14 T25
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T14 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T14 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T14 T25
135 1/1 txn_bits_q <= '0;
Tests: T5 T14 T25
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T14,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T5,T14,T25 |
1 | 1 | Covered | T5,T14,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T14,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T14,T25 |
1 | 1 | Covered | T5,T14,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T5,T14,T25 |
0 |
0 |
1 |
Covered |
T5,T14,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T5,T14,T25 |
0 |
0 |
1 |
Covered |
T5,T14,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1982383 |
0 |
0 |
T1 |
58212 |
0 |
0 |
0 |
T2 |
58326 |
0 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T5 |
51852 |
6906 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
8021 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T25 |
0 |
8273 |
0 |
0 |
T92 |
0 |
33977 |
0 |
0 |
T93 |
0 |
17505 |
0 |
0 |
T94 |
0 |
32639 |
0 |
0 |
T95 |
0 |
3980 |
0 |
0 |
T96 |
0 |
34000 |
0 |
0 |
T97 |
0 |
5573 |
0 |
0 |
T98 |
0 |
11734 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
2260 |
0 |
0 |
T1 |
58212 |
0 |
0 |
0 |
T2 |
58326 |
0 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T5 |
51852 |
20 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
20 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T25 |
0 |
20 |
0 |
0 |
T92 |
0 |
20 |
0 |
0 |
T93 |
0 |
20 |
0 |
0 |
T94 |
0 |
20 |
0 |
0 |
T95 |
0 |
20 |
0 |
0 |
T96 |
0 |
20 |
0 |
0 |
T97 |
0 |
20 |
0 |
0 |
T98 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T5 T14 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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T14 T16
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T14 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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T14 T16
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T14 T16
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T14 T16
135 1/1 txn_bits_q <= '0;
Tests: T5 T14 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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T14,T16 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T5,T14,T16 |
1 | 1 | Covered | T5,T14,T16 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T14,T16 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T14,T16 |
1 | 1 | Covered | T5,T14,T16 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T5,T14,T16 |
0 |
0 |
1 |
Covered |
T5,T14,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T5,T14,T16 |
0 |
0 |
1 |
Covered |
T5,T14,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
3516656 |
0 |
0 |
T1 |
58212 |
0 |
0 |
0 |
T2 |
58326 |
0 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T5 |
51852 |
290 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
333 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
8087 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T25 |
0 |
342 |
0 |
0 |
T26 |
0 |
32692 |
0 |
0 |
T27 |
0 |
6678 |
0 |
0 |
T70 |
0 |
32240 |
0 |
0 |
T81 |
0 |
35208 |
0 |
0 |
T85 |
0 |
8084 |
0 |
0 |
T86 |
0 |
17201 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
4035 |
0 |
0 |
T1 |
58212 |
0 |
0 |
0 |
T2 |
58326 |
0 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T5 |
51852 |
1 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
1 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
20 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T25 |
0 |
1 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T27 |
0 |
13 |
0 |
0 |
T70 |
0 |
20 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T85 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T5 T1 T2
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T1 T2
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T1 T2
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T1 T2
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T1 T2
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T1 T2
135 1/1 txn_bits_q <= '0;
Tests: T5 T1 T2
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T1,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T5,T1,T2 |
1 | 1 | Covered | T5,T1,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T1,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T1,T2 |
1 | 1 | Covered | T5,T1,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T5,T1,T2 |
0 |
0 |
1 |
Covered |
T5,T1,T2 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T5,T1,T2 |
0 |
0 |
1 |
Covered |
T5,T1,T2 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
4534501 |
0 |
0 |
T1 |
58212 |
354 |
0 |
0 |
T2 |
58326 |
480 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T5 |
51852 |
302 |
0 |
0 |
T8 |
170148 |
997 |
0 |
0 |
T9 |
0 |
1671 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
340 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
8167 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T26 |
0 |
33123 |
0 |
0 |
T27 |
0 |
6734 |
0 |
0 |
T70 |
0 |
32687 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
5067 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T5 |
51852 |
1 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
1 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
20 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T27 |
0 |
13 |
0 |
0 |
T70 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T16 T26 T27
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T26 T27
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T26 T27
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T16 T26 T27
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T26 T27
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T16 T26 T27
135 1/1 txn_bits_q <= '0;
Tests: T16 T26 T27
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T26,T27 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T16,T26,T27 |
1 | 1 | Covered | T16,T26,T27 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T26,T27 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T26,T27 |
1 | 1 | Covered | T16,T26,T27 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T16,T26,T27 |
0 |
0 |
1 |
Covered |
T16,T26,T27 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T16,T26,T27 |
0 |
0 |
1 |
Covered |
T16,T26,T27 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
3437889 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T16 |
60563 |
8127 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T26 |
228945 |
32923 |
0 |
0 |
T27 |
166213 |
6706 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
32465 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T81 |
0 |
35248 |
0 |
0 |
T85 |
0 |
8124 |
0 |
0 |
T86 |
0 |
17438 |
0 |
0 |
T99 |
0 |
33694 |
0 |
0 |
T100 |
0 |
34777 |
0 |
0 |
T101 |
0 |
52903 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
3955 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T16 |
60563 |
20 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T26 |
228945 |
20 |
0 |
0 |
T27 |
166213 |
13 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
20 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T85 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
T99 |
0 |
20 |
0 |
0 |
T100 |
0 |
20 |
0 |
0 |
T101 |
0 |
60 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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 T6 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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T28
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T6 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T6 T28
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T3,T6,T28 |
1 | 1 | Covered | T3,T6,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T28 |
1 | 1 | Covered | T3,T6,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T3,T6,T28 |
0 |
0 |
1 |
Covered |
T3,T6,T28 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T3,T6,T28 |
0 |
0 |
1 |
Covered |
T3,T6,T28 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
877292 |
0 |
0 |
T3 |
84049 |
359 |
0 |
0 |
T6 |
55170 |
299 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T20 |
0 |
11839 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T28 |
0 |
1995 |
0 |
0 |
T47 |
0 |
674 |
0 |
0 |
T48 |
0 |
1996 |
0 |
0 |
T49 |
0 |
480 |
0 |
0 |
T52 |
0 |
959 |
0 |
0 |
T55 |
0 |
1454 |
0 |
0 |
T56 |
0 |
1897 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
942 |
0 |
0 |
T3 |
84049 |
1 |
0 |
0 |
T6 |
55170 |
1 |
0 |
0 |
T8 |
170148 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T20 |
0 |
28 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T47 |
0 |
1 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T49 |
0 |
1 |
0 |
0 |
T52 |
0 |
1 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T3
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
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 | T4,T5,T1 |
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 | T4,T5,T1 |
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 | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T3 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T3 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1667703 |
0 |
0 |
T1 |
58212 |
296 |
0 |
0 |
T2 |
58326 |
470 |
0 |
0 |
T3 |
84049 |
350 |
0 |
0 |
T6 |
55170 |
297 |
0 |
0 |
T8 |
170148 |
987 |
0 |
0 |
T9 |
0 |
1625 |
0 |
0 |
T10 |
0 |
427 |
0 |
0 |
T11 |
0 |
1859 |
0 |
0 |
T12 |
0 |
990 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T28 |
0 |
1983 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1816 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
1 |
0 |
0 |
T6 |
55170 |
1 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T17 T29 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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T17 T29 T30
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T17 T29 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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T17 T29 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T17 T29 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T17 T29 T30
135 1/1 txn_bits_q <= '0;
Tests: T17 T29 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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T17,T29,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T17,T29,T30 |
1 | 1 | Covered | T17,T29,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T17,T29,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T17,T29,T30 |
1 | 1 | Covered | T17,T29,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T17,T29,T30 |
0 |
0 |
1 |
Covered |
T17,T29,T30 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T17,T29,T30 |
0 |
0 |
1 |
Covered |
T17,T29,T30 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
961937 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T9 |
215113 |
0 |
0 |
0 |
T17 |
166273 |
4229 |
0 |
0 |
T20 |
0 |
841 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T29 |
0 |
8520 |
0 |
0 |
T30 |
0 |
3401 |
0 |
0 |
T62 |
0 |
2007 |
0 |
0 |
T64 |
0 |
1338 |
0 |
0 |
T65 |
0 |
9284 |
0 |
0 |
T66 |
0 |
1100 |
0 |
0 |
T67 |
0 |
8637 |
0 |
0 |
T68 |
0 |
1517 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1099 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T9 |
215113 |
0 |
0 |
0 |
T17 |
166273 |
5 |
0 |
0 |
T20 |
0 |
2 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T29 |
0 |
5 |
0 |
0 |
T30 |
0 |
6 |
0 |
0 |
T62 |
0 |
4 |
0 |
0 |
T64 |
0 |
5 |
0 |
0 |
T65 |
0 |
5 |
0 |
0 |
T66 |
0 |
4 |
0 |
0 |
T67 |
0 |
5 |
0 |
0 |
T68 |
0 |
4 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T17 T29 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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T17 T29 T30
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T17 T29 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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T17 T29 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T17 T29 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T17 T29 T30
135 1/1 txn_bits_q <= '0;
Tests: T17 T29 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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T17,T29,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T17,T29,T30 |
1 | 1 | Covered | T17,T29,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T17,T29,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T17,T29,T30 |
1 | 1 | Covered | T17,T29,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T17,T29,T30 |
0 |
0 |
1 |
Covered |
T17,T29,T30 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T17,T29,T30 |
0 |
0 |
1 |
Covered |
T17,T29,T30 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
865742 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T9 |
215113 |
0 |
0 |
0 |
T17 |
166273 |
1471 |
0 |
0 |
T20 |
0 |
481 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T29 |
0 |
5187 |
0 |
0 |
T30 |
0 |
1848 |
0 |
0 |
T62 |
0 |
1582 |
0 |
0 |
T64 |
0 |
855 |
0 |
0 |
T65 |
0 |
5840 |
0 |
0 |
T66 |
0 |
843 |
0 |
0 |
T67 |
0 |
5752 |
0 |
0 |
T68 |
0 |
1032 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
982 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T9 |
215113 |
0 |
0 |
0 |
T17 |
166273 |
2 |
0 |
0 |
T20 |
0 |
1 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T29 |
0 |
3 |
0 |
0 |
T30 |
0 |
3 |
0 |
0 |
T62 |
0 |
3 |
0 |
0 |
T64 |
0 |
3 |
0 |
0 |
T65 |
0 |
3 |
0 |
0 |
T66 |
0 |
3 |
0 |
0 |
T67 |
0 |
3 |
0 |
0 |
T68 |
0 |
3 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T8 T9 T11
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T8 T9 T11
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T8 T9 T11
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T8 T9 T11
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T8 T9 T11
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T8 T9 T11
135 1/1 txn_bits_q <= '0;
Tests: T8 T9 T11
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T8,T9,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T8,T9,T11 |
1 | 1 | Covered | T8,T9,T11 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T8,T9,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T8,T9,T11 |
1 | 1 | Covered | T8,T9,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T8,T9,T11 |
0 |
0 |
1 |
Covered |
T8,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T8,T9,T11 |
0 |
0 |
1 |
Covered |
T8,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
7196039 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1001 |
0 |
0 |
T9 |
0 |
1686 |
0 |
0 |
T11 |
0 |
1952 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T20 |
0 |
4668 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T31 |
0 |
20511 |
0 |
0 |
T32 |
0 |
21797 |
0 |
0 |
T42 |
0 |
54295 |
0 |
0 |
T59 |
0 |
32406 |
0 |
0 |
T60 |
0 |
1422 |
0 |
0 |
T63 |
0 |
974 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7357 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T42 |
0 |
81 |
0 |
0 |
T59 |
0 |
78 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T63 |
0 |
1 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
6871612 |
0 |
0 |
T20 |
0 |
4661 |
0 |
0 |
T31 |
686712 |
20301 |
0 |
0 |
T32 |
0 |
21587 |
0 |
0 |
T41 |
0 |
36701 |
0 |
0 |
T42 |
0 |
51706 |
0 |
0 |
T43 |
0 |
26385 |
0 |
0 |
T44 |
0 |
61834 |
0 |
0 |
T58 |
0 |
61050 |
0 |
0 |
T59 |
0 |
22029 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
17204 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7149 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T31 |
686712 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T41 |
0 |
90 |
0 |
0 |
T42 |
0 |
79 |
0 |
0 |
T43 |
0 |
65 |
0 |
0 |
T44 |
0 |
77 |
0 |
0 |
T58 |
0 |
72 |
0 |
0 |
T59 |
0 |
55 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
11 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
6710434 |
0 |
0 |
T20 |
0 |
4661 |
0 |
0 |
T31 |
686712 |
20091 |
0 |
0 |
T32 |
0 |
21377 |
0 |
0 |
T41 |
0 |
35229 |
0 |
0 |
T42 |
0 |
36525 |
0 |
0 |
T43 |
0 |
25048 |
0 |
0 |
T44 |
0 |
60751 |
0 |
0 |
T58 |
0 |
53295 |
0 |
0 |
T59 |
0 |
30798 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
17204 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7085 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T31 |
686712 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T41 |
0 |
90 |
0 |
0 |
T42 |
0 |
59 |
0 |
0 |
T43 |
0 |
63 |
0 |
0 |
T44 |
0 |
77 |
0 |
0 |
T58 |
0 |
64 |
0 |
0 |
T59 |
0 |
78 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
11 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
6781178 |
0 |
0 |
T20 |
0 |
4662 |
0 |
0 |
T31 |
686712 |
19881 |
0 |
0 |
T32 |
0 |
21167 |
0 |
0 |
T41 |
0 |
29206 |
0 |
0 |
T42 |
0 |
48273 |
0 |
0 |
T43 |
0 |
31476 |
0 |
0 |
T44 |
0 |
45997 |
0 |
0 |
T58 |
0 |
47990 |
0 |
0 |
T59 |
0 |
27405 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
17204 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7179 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T31 |
686712 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T41 |
0 |
76 |
0 |
0 |
T42 |
0 |
77 |
0 |
0 |
T43 |
0 |
81 |
0 |
0 |
T44 |
0 |
60 |
0 |
0 |
T58 |
0 |
58 |
0 |
0 |
T59 |
0 |
72 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
11 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T8 T9 T11
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T8 T9 T11
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T8 T9 T11
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T8 T9 T11
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T8 T9 T11
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T8 T9 T11
135 1/1 txn_bits_q <= '0;
Tests: T8 T9 T11
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T8,T9,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T8,T9,T11 |
1 | 1 | Covered | T8,T9,T11 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T8,T9,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T8,T9,T11 |
1 | 1 | Covered | T8,T9,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T8,T9,T11 |
0 |
0 |
1 |
Covered |
T8,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T8,T9,T11 |
0 |
0 |
1 |
Covered |
T8,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1108857 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
999 |
0 |
0 |
T9 |
0 |
1676 |
0 |
0 |
T11 |
0 |
1938 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T20 |
0 |
3930 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T31 |
0 |
343 |
0 |
0 |
T32 |
0 |
373 |
0 |
0 |
T42 |
0 |
1917 |
0 |
0 |
T59 |
0 |
489 |
0 |
0 |
T60 |
0 |
1419 |
0 |
0 |
T63 |
0 |
972 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1174 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T26 |
228945 |
0 |
0 |
0 |
T27 |
166213 |
0 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T63 |
0 |
1 |
0 |
0 |
T69 |
201128 |
0 |
0 |
0 |
T70 |
247878 |
0 |
0 |
0 |
T71 |
200634 |
0 |
0 |
0 |
T72 |
36325 |
0 |
0 |
0 |
T73 |
211157 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1072110 |
0 |
0 |
T20 |
0 |
3923 |
0 |
0 |
T31 |
686712 |
333 |
0 |
0 |
T32 |
0 |
363 |
0 |
0 |
T41 |
0 |
3239 |
0 |
0 |
T42 |
0 |
1805 |
0 |
0 |
T43 |
0 |
1126 |
0 |
0 |
T44 |
0 |
2936 |
0 |
0 |
T58 |
0 |
1913 |
0 |
0 |
T59 |
0 |
455 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14245 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1164 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T41 |
0 |
9 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T44 |
0 |
4 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1069078 |
0 |
0 |
T20 |
0 |
3923 |
0 |
0 |
T31 |
686712 |
323 |
0 |
0 |
T32 |
0 |
353 |
0 |
0 |
T41 |
0 |
3035 |
0 |
0 |
T42 |
0 |
1713 |
0 |
0 |
T43 |
0 |
1019 |
0 |
0 |
T44 |
0 |
2797 |
0 |
0 |
T58 |
0 |
1834 |
0 |
0 |
T59 |
0 |
413 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14245 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1150 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T41 |
0 |
9 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T44 |
0 |
4 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1099603 |
0 |
0 |
T20 |
0 |
3924 |
0 |
0 |
T31 |
686712 |
313 |
0 |
0 |
T32 |
0 |
343 |
0 |
0 |
T41 |
0 |
3453 |
0 |
0 |
T42 |
0 |
1592 |
0 |
0 |
T43 |
0 |
1148 |
0 |
0 |
T44 |
0 |
2675 |
0 |
0 |
T58 |
0 |
1773 |
0 |
0 |
T59 |
0 |
379 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14245 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1169 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T41 |
0 |
9 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T44 |
0 |
4 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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 T8
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
7801740 |
0 |
0 |
T1 |
58212 |
337 |
0 |
0 |
T2 |
58326 |
478 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
995 |
0 |
0 |
T9 |
0 |
1660 |
0 |
0 |
T10 |
0 |
435 |
0 |
0 |
T11 |
0 |
1913 |
0 |
0 |
T12 |
0 |
998 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1405 |
0 |
0 |
T61 |
0 |
357 |
0 |
0 |
T63 |
0 |
968 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7977 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
1 |
0 |
0 |
T63 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
7465676 |
0 |
0 |
T20 |
0 |
4625 |
0 |
0 |
T31 |
686712 |
20397 |
0 |
0 |
T32 |
0 |
21683 |
0 |
0 |
T33 |
0 |
1275 |
0 |
0 |
T40 |
0 |
4126 |
0 |
0 |
T42 |
0 |
52199 |
0 |
0 |
T43 |
0 |
26811 |
0 |
0 |
T58 |
0 |
61497 |
0 |
0 |
T59 |
0 |
22329 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
17168 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7695 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T31 |
686712 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
79 |
0 |
0 |
T43 |
0 |
65 |
0 |
0 |
T58 |
0 |
72 |
0 |
0 |
T59 |
0 |
55 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
11 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
7324390 |
0 |
0 |
T20 |
0 |
4625 |
0 |
0 |
T31 |
686712 |
20187 |
0 |
0 |
T32 |
0 |
21473 |
0 |
0 |
T33 |
0 |
1242 |
0 |
0 |
T40 |
0 |
4011 |
0 |
0 |
T42 |
0 |
36861 |
0 |
0 |
T43 |
0 |
25382 |
0 |
0 |
T58 |
0 |
53685 |
0 |
0 |
T59 |
0 |
31316 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
17168 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7682 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T31 |
686712 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
59 |
0 |
0 |
T43 |
0 |
63 |
0 |
0 |
T58 |
0 |
64 |
0 |
0 |
T59 |
0 |
78 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
11 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
7353616 |
0 |
0 |
T20 |
0 |
4626 |
0 |
0 |
T31 |
686712 |
19977 |
0 |
0 |
T32 |
0 |
21263 |
0 |
0 |
T33 |
0 |
1216 |
0 |
0 |
T40 |
0 |
3920 |
0 |
0 |
T42 |
0 |
48676 |
0 |
0 |
T43 |
0 |
32125 |
0 |
0 |
T58 |
0 |
48384 |
0 |
0 |
T59 |
0 |
28044 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
17168 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
7742 |
0 |
0 |
T20 |
0 |
11 |
0 |
0 |
T31 |
686712 |
51 |
0 |
0 |
T32 |
0 |
51 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
77 |
0 |
0 |
T43 |
0 |
81 |
0 |
0 |
T58 |
0 |
58 |
0 |
0 |
T59 |
0 |
72 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
11 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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 T8
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1646561 |
0 |
0 |
T1 |
58212 |
328 |
0 |
0 |
T2 |
58326 |
476 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
993 |
0 |
0 |
T9 |
0 |
1653 |
0 |
0 |
T10 |
0 |
433 |
0 |
0 |
T11 |
0 |
1899 |
0 |
0 |
T12 |
0 |
996 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1387 |
0 |
0 |
T61 |
0 |
350 |
0 |
0 |
T63 |
0 |
966 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1757 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
1 |
0 |
0 |
T63 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1643886 |
0 |
0 |
T20 |
0 |
3887 |
0 |
0 |
T31 |
686712 |
329 |
0 |
0 |
T32 |
0 |
359 |
0 |
0 |
T33 |
0 |
1153 |
0 |
0 |
T40 |
0 |
3688 |
0 |
0 |
T42 |
0 |
1773 |
0 |
0 |
T43 |
0 |
1081 |
0 |
0 |
T58 |
0 |
1887 |
0 |
0 |
T59 |
0 |
434 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14209 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1739 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1643192 |
0 |
0 |
T20 |
0 |
3887 |
0 |
0 |
T31 |
686712 |
319 |
0 |
0 |
T32 |
0 |
349 |
0 |
0 |
T33 |
0 |
1122 |
0 |
0 |
T40 |
0 |
3556 |
0 |
0 |
T42 |
0 |
1659 |
0 |
0 |
T43 |
0 |
970 |
0 |
0 |
T58 |
0 |
1803 |
0 |
0 |
T59 |
0 |
403 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14209 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1756 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1614043 |
0 |
0 |
T20 |
0 |
3888 |
0 |
0 |
T31 |
686712 |
309 |
0 |
0 |
T32 |
0 |
339 |
0 |
0 |
T33 |
0 |
1090 |
0 |
0 |
T40 |
0 |
3465 |
0 |
0 |
T42 |
0 |
1548 |
0 |
0 |
T43 |
0 |
1097 |
0 |
0 |
T58 |
0 |
1739 |
0 |
0 |
T59 |
0 |
493 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14209 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1737 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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 T8
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1682878 |
0 |
0 |
T1 |
58212 |
318 |
0 |
0 |
T2 |
58326 |
474 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
991 |
0 |
0 |
T9 |
0 |
1643 |
0 |
0 |
T10 |
0 |
431 |
0 |
0 |
T11 |
0 |
1889 |
0 |
0 |
T12 |
0 |
994 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1385 |
0 |
0 |
T61 |
0 |
345 |
0 |
0 |
T63 |
0 |
964 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1794 |
0 |
0 |
T1 |
58212 |
1 |
0 |
0 |
T2 |
58326 |
1 |
0 |
0 |
T3 |
84049 |
0 |
0 |
0 |
T6 |
55170 |
0 |
0 |
0 |
T8 |
170148 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
100929 |
0 |
0 |
0 |
T14 |
59339 |
0 |
0 |
0 |
T15 |
206905 |
0 |
0 |
0 |
T16 |
60563 |
0 |
0 |
0 |
T17 |
166273 |
0 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
1 |
0 |
0 |
T63 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1603851 |
0 |
0 |
T20 |
0 |
3869 |
0 |
0 |
T31 |
686712 |
327 |
0 |
0 |
T32 |
0 |
357 |
0 |
0 |
T33 |
0 |
1026 |
0 |
0 |
T40 |
0 |
3545 |
0 |
0 |
T42 |
0 |
1762 |
0 |
0 |
T43 |
0 |
1054 |
0 |
0 |
T58 |
0 |
1868 |
0 |
0 |
T59 |
0 |
432 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14191 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1729 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1625882 |
0 |
0 |
T20 |
0 |
3869 |
0 |
0 |
T31 |
686712 |
317 |
0 |
0 |
T32 |
0 |
347 |
0 |
0 |
T33 |
0 |
993 |
0 |
0 |
T40 |
0 |
3636 |
0 |
0 |
T42 |
0 |
1636 |
0 |
0 |
T43 |
0 |
946 |
0 |
0 |
T58 |
0 |
1798 |
0 |
0 |
T59 |
0 |
392 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14191 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1759 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T31 T20 T32
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T31 T20 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T31 T20 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T31 T20 T32
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T31 T20 T32
135 1/1 txn_bits_q <= '0;
Tests: T31 T20 T32
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T31,T20,T32 |
1 | 1 | Covered | T31,T20,T32 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T31,T20,T32 |
0 |
0 |
1 |
Covered |
T31,T20,T32 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
1214223444 |
1580380 |
0 |
0 |
T20 |
0 |
3870 |
0 |
0 |
T31 |
686712 |
307 |
0 |
0 |
T32 |
0 |
337 |
0 |
0 |
T33 |
0 |
1198 |
0 |
0 |
T40 |
0 |
3714 |
0 |
0 |
T42 |
0 |
1517 |
0 |
0 |
T43 |
0 |
1085 |
0 |
0 |
T58 |
0 |
1731 |
0 |
0 |
T59 |
0 |
481 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
14191 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1728 |
0 |
0 |
T20 |
0 |
9 |
0 |
0 |
T31 |
686712 |
1 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
3 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
3 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T74 |
276958 |
0 |
0 |
0 |
T75 |
34349 |
0 |
0 |
0 |
T76 |
0 |
9 |
0 |
0 |
T89 |
47915 |
0 |
0 |
0 |
T90 |
65794 |
0 |
0 |
0 |
T102 |
47026 |
0 |
0 |
0 |
T103 |
52597 |
0 |
0 |
0 |
T104 |
16305 |
0 |
0 |
0 |
T105 |
211198 |
0 |
0 |
0 |
T106 |
608367 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
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: T7 T18 T20
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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T7 T18 T20
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T7 T18 T20
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: T4 T5 T1
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: T4 T5 T1
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: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
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: T7 T18 T20
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T7 T18 T20
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
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: T7 T18 T20
135 1/1 txn_bits_q <= '0;
Tests: T7 T18 T20
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: T4 T5 T1
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: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
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: T4 T5 T1
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 | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T7,T18,T20 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T7,T18,T20 |
1 | 1 | Covered | T7,T18,T20 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T7,T18,T20 |
1 | - | Covered | T7,T18,T20 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T7,T18,T20 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T7,T18,T20 |
1 | 1 | Covered | T7,T18,T20 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T7,T18,T20 |
0 |
0 |
1 |
Covered |
T7,T18,T20 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
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 |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T7,T18,T20 |
0 |
0 |
1 |
Covered |
T7,T18,T20 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
810169 |
0 |
0 |
T7 |
18204 |
388 |
0 |
0 |
T10 |
53711 |
0 |
0 |
0 |
T18 |
0 |
3973 |
0 |
0 |
T19 |
0 |
2383 |
0 |
0 |
T20 |
0 |
1552 |
0 |
0 |
T25 |
59610 |
0 |
0 |
0 |
T29 |
334136 |
0 |
0 |
0 |
T57 |
0 |
1686 |
0 |
0 |
T77 |
0 |
3327 |
0 |
0 |
T78 |
0 |
792 |
0 |
0 |
T79 |
0 |
2698 |
0 |
0 |
T80 |
0 |
729 |
0 |
0 |
T81 |
255838 |
0 |
0 |
0 |
T82 |
50623 |
0 |
0 |
0 |
T83 |
25669 |
0 |
0 |
0 |
T84 |
193090 |
0 |
0 |
0 |
T85 |
63118 |
0 |
0 |
0 |
T86 |
125912 |
0 |
0 |
0 |
T107 |
0 |
866 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6609339 |
5936348 |
0 |
0 |
T1 |
485 |
85 |
0 |
0 |
T2 |
486 |
86 |
0 |
0 |
T3 |
672 |
272 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
493 |
93 |
0 |
0 |
T8 |
507 |
107 |
0 |
0 |
T13 |
822 |
422 |
0 |
0 |
T14 |
494 |
94 |
0 |
0 |
T15 |
421 |
21 |
0 |
0 |
T16 |
504 |
104 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
904 |
0 |
0 |
T7 |
18204 |
4 |
0 |
0 |
T10 |
53711 |
0 |
0 |
0 |
T18 |
0 |
2 |
0 |
0 |
T19 |
0 |
6 |
0 |
0 |
T20 |
0 |
4 |
0 |
0 |
T25 |
59610 |
0 |
0 |
0 |
T29 |
334136 |
0 |
0 |
0 |
T57 |
0 |
2 |
0 |
0 |
T77 |
0 |
2 |
0 |
0 |
T78 |
0 |
2 |
0 |
0 |
T79 |
0 |
2 |
0 |
0 |
T80 |
0 |
2 |
0 |
0 |
T81 |
255838 |
0 |
0 |
0 |
T82 |
50623 |
0 |
0 |
0 |
T83 |
25669 |
0 |
0 |
0 |
T84 |
193090 |
0 |
0 |
0 |
T85 |
63118 |
0 |
0 |
0 |
T86 |
125912 |
0 |
0 |
0 |
T107 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1214223444 |
1213769184 |
0 |
0 |
T1 |
58212 |
58124 |
0 |
0 |
T2 |
58326 |
58228 |
0 |
0 |
T3 |
84049 |
83965 |
0 |
0 |
T4 |
53709 |
53636 |
0 |
0 |
T5 |
51852 |
51797 |
0 |
0 |
T8 |
170148 |
170057 |
0 |
0 |
T13 |
100929 |
100829 |
0 |
0 |
T14 |
59339 |
59269 |
0 |
0 |
T15 |
206905 |
206825 |
0 |
0 |
T16 |
60563 |
60463 |
0 |
0 |