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: T4 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: T4 T2 T3
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 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: T4 T2 T3
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 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: T4 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T4 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 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 | T4,T5,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T5,T2 |
1 | 1 | Covered | T4,T5,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 | T4,T5,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T5,T2 |
1 | 1 | Covered | T4,T5,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 | T2,T10,T19 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T10,T19 |
1 | 1 | Covered | T2,T10,T19 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T10,T25 |
1 | - | Covered | T2,T10,T19 |
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 | T2,T10,T19 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T19 |
1 | 1 | Covered | T2,T10,T19 |
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 |
T4,T2,T3 |
0 |
0 |
1 |
Covered |
T4,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 |
T4,T2,T3 |
0 |
0 |
1 |
Covered |
T4,T2,T3 |
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 |
87294403 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
370863 |
929 |
0 |
0 |
T4 |
29008 |
174 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
117632 |
473 |
0 |
0 |
T8 |
122670 |
351 |
0 |
0 |
T12 |
0 |
464 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
230142 |
2744 |
0 |
0 |
T16 |
90411 |
0 |
0 |
0 |
T17 |
600555 |
0 |
0 |
0 |
T18 |
210012 |
0 |
0 |
0 |
T19 |
161471 |
951 |
0 |
0 |
T28 |
497166 |
0 |
0 |
0 |
T29 |
501172 |
0 |
0 |
0 |
T30 |
0 |
6772 |
0 |
0 |
T31 |
0 |
7070 |
0 |
0 |
T32 |
0 |
363 |
0 |
0 |
T34 |
0 |
22234 |
0 |
0 |
T35 |
0 |
20617 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T56 |
0 |
1890 |
0 |
0 |
T57 |
0 |
953 |
0 |
0 |
T58 |
0 |
1885 |
0 |
0 |
T59 |
0 |
3061 |
0 |
0 |
T60 |
0 |
348 |
0 |
0 |
T61 |
0 |
4214 |
0 |
0 |
T62 |
0 |
2861 |
0 |
0 |
T63 |
0 |
13754 |
0 |
0 |
T64 |
0 |
7426 |
0 |
0 |
T65 |
156108 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
234679662 |
213251842 |
0 |
0 |
T1 |
20842 |
7242 |
0 |
0 |
T2 |
48280 |
34680 |
0 |
0 |
T3 |
17136 |
3536 |
0 |
0 |
T4 |
15164 |
1564 |
0 |
0 |
T5 |
17748 |
4148 |
0 |
0 |
T13 |
16830 |
3230 |
0 |
0 |
T14 |
14382 |
782 |
0 |
0 |
T15 |
21726 |
8126 |
0 |
0 |
T16 |
14654 |
1054 |
0 |
0 |
T17 |
14790 |
1190 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
101063 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
370863 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
117632 |
1 |
0 |
0 |
T8 |
122670 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
230142 |
7 |
0 |
0 |
T16 |
90411 |
0 |
0 |
0 |
T17 |
600555 |
0 |
0 |
0 |
T18 |
210012 |
0 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T28 |
497166 |
0 |
0 |
0 |
T29 |
501172 |
0 |
0 |
0 |
T30 |
0 |
6 |
0 |
0 |
T31 |
0 |
9 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T34 |
0 |
12 |
0 |
0 |
T35 |
0 |
12 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T59 |
0 |
7 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
8 |
0 |
0 |
T62 |
0 |
7 |
0 |
0 |
T63 |
0 |
9 |
0 |
0 |
T64 |
0 |
9 |
0 |
0 |
T65 |
156108 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
739942 |
738140 |
0 |
0 |
T2 |
1856536 |
1853204 |
0 |
0 |
T3 |
4203114 |
4200190 |
0 |
0 |
T4 |
986272 |
983178 |
0 |
0 |
T5 |
8876754 |
8874170 |
0 |
0 |
T13 |
1855516 |
1852116 |
0 |
0 |
T14 |
3317040 |
3315204 |
0 |
0 |
T15 |
2608276 |
2606270 |
0 |
0 |
T16 |
1024658 |
1022754 |
0 |
0 |
T17 |
6806290 |
6803638 |
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: T2 T10 T19
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: T2 T10 T19
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 T19
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: T2 T10 T19
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 T19
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 | T2,T10,T19 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T10,T19 |
1 | 1 | Covered | T2,T10,T19 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T35,T38,T69 |
1 | - | Covered | T2,T10,T19 |
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 | T2,T10,T19 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T19 |
1 | 1 | Covered | T2,T10,T19 |
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 |
T2,T10,T19 |
0 |
0 |
1 |
Covered |
T2,T10,T19 |
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 |
T2,T10,T19 |
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 |
1256237361 |
953009 |
0 |
0 |
T2 |
54604 |
559 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
1492 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T19 |
0 |
1672 |
0 |
0 |
T25 |
0 |
1773 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T33 |
0 |
3701 |
0 |
0 |
T35 |
0 |
1260 |
0 |
0 |
T44 |
0 |
4637 |
0 |
0 |
T45 |
0 |
1866 |
0 |
0 |
T70 |
0 |
468 |
0 |
0 |
T71 |
0 |
456 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1004 |
0 |
0 |
T2 |
54604 |
2 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T19 |
0 |
2 |
0 |
0 |
T25 |
0 |
1 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T33 |
0 |
9 |
0 |
0 |
T44 |
0 |
5 |
0 |
0 |
T45 |
0 |
6 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T71 |
0 |
1 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T4 T3 T7
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: T4 T3 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T3 T7
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: T4 T3 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T3 T7
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: T4 T3 T7
135 1/1 txn_bits_q <= '0;
Tests: T4 T3 T7
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 | T4,T3,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 | T4,T3,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
1256237361 |
1431712 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
915 |
0 |
0 |
T4 |
29008 |
158 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
469 |
0 |
0 |
T8 |
0 |
347 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
359 |
0 |
0 |
T56 |
0 |
1878 |
0 |
0 |
T57 |
0 |
947 |
0 |
0 |
T73 |
0 |
1467 |
0 |
0 |
T74 |
0 |
1004 |
0 |
0 |
T75 |
0 |
555 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1695 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
0 |
1 |
0 |
0 |
T75 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T2 T24 T10
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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: T2 T24 T10
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T24 T10
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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: T2 T24 T10
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T24 T10
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: T2 T24 T10
135 1/1 txn_bits_q <= '0;
Tests: T2 T24 T10
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T2,T24,T10 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T24,T10 |
1 | 1 | Covered | T2,T24,T10 |
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 | T2,T24,T10 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T24,T10 |
1 | 1 | Covered | T2,T24,T10 |
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 |
T2,T24,T10 |
0 |
0 |
1 |
Covered |
T2,T24,T10 |
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 |
T2,T24,T10 |
0 |
0 |
1 |
Covered |
T2,T24,T10 |
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 |
1256237361 |
707207 |
0 |
0 |
T2 |
54604 |
1025 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
4995 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T24 |
0 |
4838 |
0 |
0 |
T25 |
0 |
3562 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
1915 |
0 |
0 |
T35 |
0 |
1915 |
0 |
0 |
T70 |
0 |
484 |
0 |
0 |
T76 |
0 |
135 |
0 |
0 |
T77 |
0 |
196 |
0 |
0 |
T78 |
0 |
448 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
859 |
0 |
0 |
T2 |
54604 |
3 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
3 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T24 |
0 |
3 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
1 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
2 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T2 T24 T10
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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: T2 T24 T10
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T24 T10
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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: T2 T24 T10
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T24 T10
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: T2 T24 T10
135 1/1 txn_bits_q <= '0;
Tests: T2 T24 T10
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T2,T24,T10 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T24,T10 |
1 | 1 | Covered | T2,T24,T10 |
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 | T2,T24,T10 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T24,T10 |
1 | 1 | Covered | T2,T24,T10 |
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 |
T2,T24,T10 |
0 |
0 |
1 |
Covered |
T2,T24,T10 |
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 |
T2,T24,T10 |
0 |
0 |
1 |
Covered |
T2,T24,T10 |
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 |
1256237361 |
734622 |
0 |
0 |
T2 |
54604 |
1001 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
4989 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T24 |
0 |
4804 |
0 |
0 |
T25 |
0 |
3557 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
1909 |
0 |
0 |
T35 |
0 |
1902 |
0 |
0 |
T70 |
0 |
477 |
0 |
0 |
T76 |
0 |
123 |
0 |
0 |
T77 |
0 |
174 |
0 |
0 |
T78 |
0 |
430 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
884 |
0 |
0 |
T2 |
54604 |
3 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
3 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T24 |
0 |
3 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
1 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
2 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T2 T24 T10
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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: T2 T24 T10
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T24 T10
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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: T2 T24 T10
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T24 T10
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: T2 T24 T10
135 1/1 txn_bits_q <= '0;
Tests: T2 T24 T10
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T2,T24,T10 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T24,T10 |
1 | 1 | Covered | T2,T24,T10 |
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 | T2,T24,T10 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T24,T10 |
1 | 1 | Covered | T2,T24,T10 |
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 |
T2,T24,T10 |
0 |
0 |
1 |
Covered |
T2,T24,T10 |
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 |
T2,T24,T10 |
0 |
0 |
1 |
Covered |
T2,T24,T10 |
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 |
1256237361 |
720013 |
0 |
0 |
T2 |
54604 |
976 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
4983 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T24 |
0 |
4769 |
0 |
0 |
T25 |
0 |
3540 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
1901 |
0 |
0 |
T35 |
0 |
1882 |
0 |
0 |
T70 |
0 |
470 |
0 |
0 |
T76 |
0 |
116 |
0 |
0 |
T77 |
0 |
203 |
0 |
0 |
T78 |
0 |
413 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
873 |
0 |
0 |
T2 |
54604 |
3 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
3 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T24 |
0 |
3 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
1 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
2 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T13 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: T13 T26 T27
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T13 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: T13 T26 T27
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T13 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: T13 T26 T27
135 1/1 txn_bits_q <= '0;
Tests: T13 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_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 | T13,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 | T13,T26,T27 |
1 | 1 | Covered | T13,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 | T13,T26,T27 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T13,T26,T27 |
1 | 1 | Covered | T13,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_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 |
T13,T26,T27 |
0 |
0 |
1 |
Covered |
T13,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 |
T13,T26,T27 |
0 |
0 |
1 |
Covered |
T13,T26,T27 |
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 |
1256237361 |
1858528 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T13 |
54574 |
7385 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T26 |
0 |
36505 |
0 |
0 |
T27 |
0 |
35375 |
0 |
0 |
T79 |
0 |
8504 |
0 |
0 |
T80 |
0 |
5057 |
0 |
0 |
T81 |
0 |
33221 |
0 |
0 |
T82 |
0 |
11268 |
0 |
0 |
T83 |
0 |
4902 |
0 |
0 |
T84 |
0 |
32858 |
0 |
0 |
T85 |
0 |
32641 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
2040 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T13 |
54574 |
20 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T27 |
0 |
20 |
0 |
0 |
T79 |
0 |
20 |
0 |
0 |
T80 |
0 |
20 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T82 |
0 |
20 |
0 |
0 |
T83 |
0 |
20 |
0 |
0 |
T84 |
0 |
20 |
0 |
0 |
T85 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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 T13 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: T5 T13 T28
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T13 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: T5 T13 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T13 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: T5 T13 T28
135 1/1 txn_bits_q <= '0;
Tests: T5 T13 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_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,T13,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T5,T13,T28 |
1 | 1 | Covered | T5,T13,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 | T5,T13,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T13,T28 |
1 | 1 | Covered | T5,T13,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_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,T13,T28 |
0 |
0 |
1 |
Covered |
T5,T13,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 |
T5,T13,T28 |
0 |
0 |
1 |
Covered |
T5,T13,T28 |
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 |
1256237361 |
3120395 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T5 |
261081 |
33423 |
0 |
0 |
T13 |
54574 |
324 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T26 |
0 |
1494 |
0 |
0 |
T27 |
0 |
1472 |
0 |
0 |
T28 |
0 |
33266 |
0 |
0 |
T29 |
0 |
34486 |
0 |
0 |
T65 |
0 |
10623 |
0 |
0 |
T86 |
0 |
11535 |
0 |
0 |
T87 |
0 |
1754 |
0 |
0 |
T88 |
0 |
6051 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
3850 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T5 |
261081 |
20 |
0 |
0 |
T13 |
54574 |
1 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T26 |
0 |
1 |
0 |
0 |
T27 |
0 |
1 |
0 |
0 |
T28 |
0 |
20 |
0 |
0 |
T29 |
0 |
20 |
0 |
0 |
T65 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
T87 |
0 |
3 |
0 |
0 |
T88 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T4 T5 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: T4 T5 T13
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T5 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: T4 T5 T13
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T5 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: T4 T5 T13
135 1/1 txn_bits_q <= '0;
Tests: T4 T5 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 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 | T4,T5,T13 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T5,T13 |
1 | 1 | Covered | T4,T5,T13 |
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 | T4,T5,T13 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T5,T13 |
1 | 1 | Covered | T4,T5,T13 |
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 |
T4,T5,T13 |
0 |
0 |
1 |
Covered |
T4,T5,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 |
T4,T5,T13 |
0 |
0 |
1 |
Covered |
T4,T5,T13 |
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 |
1256237361 |
4017534 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
947 |
0 |
0 |
T4 |
29008 |
189 |
0 |
0 |
T5 |
261081 |
33503 |
0 |
0 |
T7 |
0 |
477 |
0 |
0 |
T8 |
0 |
355 |
0 |
0 |
T13 |
54574 |
327 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T28 |
0 |
33541 |
0 |
0 |
T29 |
0 |
34566 |
0 |
0 |
T65 |
0 |
10703 |
0 |
0 |
T73 |
0 |
1469 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
4771 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
20 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T13 |
54574 |
1 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T28 |
0 |
20 |
0 |
0 |
T29 |
0 |
20 |
0 |
0 |
T65 |
0 |
20 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T5 T28 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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 T28 T29
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T28 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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 T28 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T28 T29
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 T28 T29
135 1/1 txn_bits_q <= '0;
Tests: T5 T28 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T5,T28,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T5,T28,T29 |
1 | 1 | Covered | T5,T28,T29 |
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,T28,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T28,T29 |
1 | 1 | Covered | T5,T28,T29 |
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 |
T5,T28,T29 |
0 |
0 |
1 |
Covered |
T5,T28,T29 |
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,T28,T29 |
0 |
0 |
1 |
Covered |
T5,T28,T29 |
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 |
1256237361 |
3124855 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T5 |
261081 |
33463 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
0 |
33399 |
0 |
0 |
T29 |
0 |
34526 |
0 |
0 |
T65 |
0 |
10663 |
0 |
0 |
T86 |
0 |
11676 |
0 |
0 |
T87 |
0 |
1788 |
0 |
0 |
T88 |
0 |
6091 |
0 |
0 |
T89 |
0 |
35489 |
0 |
0 |
T90 |
0 |
7692 |
0 |
0 |
T91 |
0 |
33463 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
3811 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T5 |
261081 |
20 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
0 |
20 |
0 |
0 |
T29 |
0 |
20 |
0 |
0 |
T65 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
T87 |
0 |
3 |
0 |
0 |
T88 |
0 |
20 |
0 |
0 |
T89 |
0 |
20 |
0 |
0 |
T90 |
0 |
20 |
0 |
0 |
T91 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T1 T6 T9
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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 T6 T9
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T6 T9
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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 T6 T9
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T6 T9
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 T6 T9
135 1/1 txn_bits_q <= '0;
Tests: T1 T6 T9
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T1,T6,T9 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T6,T9 |
1 | 1 | Covered | T1,T6,T9 |
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,T6,T9 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T6,T9 |
1 | 1 | Covered | T1,T6,T9 |
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 |
T1,T6,T9 |
0 |
0 |
1 |
Covered |
T1,T6,T9 |
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,T6,T9 |
0 |
0 |
1 |
Covered |
T1,T6,T9 |
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 |
1256237361 |
758006 |
0 |
0 |
T1 |
21763 |
177 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T6 |
0 |
354 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T9 |
0 |
1694 |
0 |
0 |
T11 |
0 |
370 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T34 |
0 |
49075 |
0 |
0 |
T35 |
0 |
46146 |
0 |
0 |
T50 |
0 |
486 |
0 |
0 |
T51 |
0 |
359 |
0 |
0 |
T52 |
0 |
955 |
0 |
0 |
T53 |
0 |
1993 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
900 |
0 |
0 |
T1 |
21763 |
1 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T34 |
0 |
28 |
0 |
0 |
T35 |
0 |
28 |
0 |
0 |
T50 |
0 |
1 |
0 |
0 |
T51 |
0 |
1 |
0 |
0 |
T52 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T4 T1 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: T4 T1 T3
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T1 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: T4 T1 T3
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T1 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: T4 T1 T3
135 1/1 txn_bits_q <= '0;
Tests: T4 T1 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 | T4,T1,T3 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T1,T3 |
1 | 1 | Covered | T4,T1,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 | T4,T1,T3 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T3 |
1 | 1 | Covered | T4,T1,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 |
T4,T1,T3 |
0 |
0 |
1 |
Covered |
T4,T1,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 |
T4,T1,T3 |
0 |
0 |
1 |
Covered |
T4,T1,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 |
1256237361 |
1457320 |
0 |
0 |
T1 |
21763 |
175 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
905 |
0 |
0 |
T4 |
29008 |
152 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T6 |
0 |
348 |
0 |
0 |
T7 |
0 |
467 |
0 |
0 |
T8 |
0 |
345 |
0 |
0 |
T9 |
0 |
1687 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
357 |
0 |
0 |
T56 |
0 |
1867 |
0 |
0 |
T57 |
0 |
939 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1701 |
0 |
0 |
T1 |
21763 |
1 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T15 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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: T15 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T15 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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: T15 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T15 T30 T31
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: T15 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T15 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T15,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T15,T30,T31 |
1 | 1 | Covered | T15,T30,T31 |
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 | T15,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T15,T30,T31 |
1 | 1 | Covered | T15,T30,T31 |
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 |
T15,T30,T31 |
0 |
0 |
1 |
Covered |
T15,T30,T31 |
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 |
T15,T30,T31 |
0 |
0 |
1 |
Covered |
T15,T30,T31 |
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 |
1256237361 |
949274 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T15 |
76714 |
1555 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T30 |
0 |
3394 |
0 |
0 |
T31 |
0 |
4800 |
0 |
0 |
T34 |
0 |
3832 |
0 |
0 |
T35 |
0 |
3835 |
0 |
0 |
T59 |
0 |
1731 |
0 |
0 |
T61 |
0 |
2679 |
0 |
0 |
T62 |
0 |
1993 |
0 |
0 |
T63 |
0 |
9015 |
0 |
0 |
T64 |
0 |
5210 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1100 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T15 |
76714 |
4 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T30 |
0 |
3 |
0 |
0 |
T31 |
0 |
6 |
0 |
0 |
T34 |
0 |
2 |
0 |
0 |
T35 |
0 |
2 |
0 |
0 |
T59 |
0 |
4 |
0 |
0 |
T61 |
0 |
5 |
0 |
0 |
T62 |
0 |
5 |
0 |
0 |
T63 |
0 |
6 |
0 |
0 |
T64 |
0 |
6 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T15 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: 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: T15 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T15 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: 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: T15 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T15 T30 T31
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: T15 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T15 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: 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 | T15,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T15,T30,T31 |
1 | 1 | Covered | T15,T30,T31 |
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 | T15,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T15,T30,T31 |
1 | 1 | Covered | T15,T30,T31 |
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 |
T15,T30,T31 |
0 |
0 |
1 |
Covered |
T15,T30,T31 |
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 |
T15,T30,T31 |
0 |
0 |
1 |
Covered |
T15,T30,T31 |
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 |
1256237361 |
825063 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T15 |
76714 |
1189 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T30 |
0 |
3378 |
0 |
0 |
T31 |
0 |
2270 |
0 |
0 |
T34 |
0 |
1916 |
0 |
0 |
T35 |
0 |
1912 |
0 |
0 |
T59 |
0 |
1330 |
0 |
0 |
T61 |
0 |
1535 |
0 |
0 |
T62 |
0 |
868 |
0 |
0 |
T63 |
0 |
4739 |
0 |
0 |
T64 |
0 |
2216 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
983 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T15 |
76714 |
3 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T30 |
0 |
3 |
0 |
0 |
T31 |
0 |
3 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
1 |
0 |
0 |
T59 |
0 |
3 |
0 |
0 |
T61 |
0 |
3 |
0 |
0 |
T62 |
0 |
2 |
0 |
0 |
T63 |
0 |
3 |
0 |
0 |
T64 |
0 |
3 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T3 T8 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: T3 T8 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T8 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: T3 T8 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T8 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: T3 T8 T32
135 1/1 txn_bits_q <= '0;
Tests: T3 T8 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_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 | T3,T8,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T3,T8,T32 |
1 | 1 | Covered | T3,T8,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 | T3,T8,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T8,T32 |
1 | 1 | Covered | T3,T8,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_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 |
T3,T8,T32 |
0 |
0 |
1 |
Covered |
T3,T8,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 |
T3,T8,T32 |
0 |
0 |
1 |
Covered |
T3,T8,T32 |
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 |
1256237361 |
6157795 |
0 |
0 |
T3 |
123621 |
970 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
359 |
0 |
0 |
T12 |
0 |
490 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T32 |
0 |
371 |
0 |
0 |
T33 |
0 |
28463 |
0 |
0 |
T34 |
0 |
19570 |
0 |
0 |
T35 |
0 |
18091 |
0 |
0 |
T44 |
0 |
58125 |
0 |
0 |
T54 |
0 |
17916 |
0 |
0 |
T58 |
0 |
1915 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
T73 |
281294 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
7030 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
67 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
70 |
0 |
0 |
T54 |
0 |
67 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
T73 |
281294 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T33 T34 T35
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: T33 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T33 T34 T35
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: T33 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T33 T34 T35
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: T33 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T33 T34 T35
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 | T33,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 | T33,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
1256237361 |
6008644 |
0 |
0 |
T33 |
304236 |
30954 |
0 |
0 |
T34 |
0 |
19563 |
0 |
0 |
T35 |
0 |
18046 |
0 |
0 |
T44 |
0 |
76178 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
23035 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
30572 |
0 |
0 |
T93 |
0 |
7305 |
0 |
0 |
T94 |
0 |
44018 |
0 |
0 |
T95 |
0 |
41417 |
0 |
0 |
T96 |
0 |
8161 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
6948 |
0 |
0 |
T33 |
304236 |
75 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
91 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
91 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
51 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
56 |
0 |
0 |
T95 |
0 |
51 |
0 |
0 |
T96 |
0 |
68 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T33 T34 T35
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: T33 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T33 T34 T35
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: T33 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T33 T34 T35
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: T33 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T33 T34 T35
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 | T33,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 | T33,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
1256237361 |
6024783 |
0 |
0 |
T33 |
304236 |
29441 |
0 |
0 |
T34 |
0 |
19525 |
0 |
0 |
T35 |
0 |
18046 |
0 |
0 |
T44 |
0 |
56620 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
17027 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
29440 |
0 |
0 |
T93 |
0 |
8276 |
0 |
0 |
T94 |
0 |
63076 |
0 |
0 |
T95 |
0 |
40484 |
0 |
0 |
T96 |
0 |
10233 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
6959 |
0 |
0 |
T33 |
304236 |
74 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
69 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
70 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
51 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
80 |
0 |
0 |
T95 |
0 |
51 |
0 |
0 |
T96 |
0 |
84 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T33 T34 T35
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: T33 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T33 T34 T35
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: T33 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T33 T34 T35
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: T33 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T33 T34 T35
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 | T33,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 | T33,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
1256237361 |
6126951 |
0 |
0 |
T33 |
304236 |
32584 |
0 |
0 |
T34 |
0 |
19526 |
0 |
0 |
T35 |
0 |
18073 |
0 |
0 |
T44 |
0 |
75488 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
21479 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
28430 |
0 |
0 |
T93 |
0 |
7721 |
0 |
0 |
T94 |
0 |
61136 |
0 |
0 |
T95 |
0 |
39500 |
0 |
0 |
T96 |
0 |
10131 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
7127 |
0 |
0 |
T33 |
304236 |
83 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
91 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
91 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
51 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
80 |
0 |
0 |
T95 |
0 |
51 |
0 |
0 |
T96 |
0 |
84 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T3 T8 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: T3 T8 T32
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T8 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: T3 T8 T32
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T8 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: T3 T8 T32
135 1/1 txn_bits_q <= '0;
Tests: T3 T8 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_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 | T3,T8,T32 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T3,T8,T32 |
1 | 1 | Covered | T3,T8,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 | T3,T8,T32 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T8,T32 |
1 | 1 | Covered | T3,T8,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_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 |
T3,T8,T32 |
0 |
0 |
1 |
Covered |
T3,T8,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 |
T3,T8,T32 |
0 |
0 |
1 |
Covered |
T3,T8,T32 |
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 |
1256237361 |
995963 |
0 |
0 |
T3 |
123621 |
959 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
357 |
0 |
0 |
T12 |
0 |
480 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T32 |
0 |
369 |
0 |
0 |
T33 |
0 |
3275 |
0 |
0 |
T34 |
0 |
16621 |
0 |
0 |
T35 |
0 |
15134 |
0 |
0 |
T44 |
0 |
5628 |
0 |
0 |
T54 |
0 |
1435 |
0 |
0 |
T58 |
0 |
1907 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
T73 |
281294 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1175 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T29 |
250586 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T65 |
78054 |
0 |
0 |
0 |
T73 |
281294 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T33 T34 T35
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: T33 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T33 T34 T35
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: T33 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T33 T34 T35
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: T33 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T33 T34 T35
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 | T33,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 | T33,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
1256237361 |
985505 |
0 |
0 |
T33 |
304236 |
3003 |
0 |
0 |
T34 |
0 |
16623 |
0 |
0 |
T35 |
0 |
15081 |
0 |
0 |
T44 |
0 |
5568 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
1245 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
489 |
0 |
0 |
T93 |
0 |
187 |
0 |
0 |
T94 |
0 |
4761 |
0 |
0 |
T95 |
0 |
884 |
0 |
0 |
T96 |
0 |
1238 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1180 |
0 |
0 |
T33 |
304236 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
T96 |
0 |
11 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T33 T34 T35
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: T33 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T33 T34 T35
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: T33 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T33 T34 T35
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: T33 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T33 T34 T35
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 | T33,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 | T33,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
1256237361 |
966823 |
0 |
0 |
T33 |
304236 |
2699 |
0 |
0 |
T34 |
0 |
16582 |
0 |
0 |
T35 |
0 |
15077 |
0 |
0 |
T44 |
0 |
5508 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
1290 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
423 |
0 |
0 |
T93 |
0 |
179 |
0 |
0 |
T94 |
0 |
4443 |
0 |
0 |
T95 |
0 |
824 |
0 |
0 |
T96 |
0 |
1340 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1157 |
0 |
0 |
T33 |
304236 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
T96 |
0 |
11 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T33 T34 T35
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: T33 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T33 T34 T35
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: T33 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T33 T34 T35
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: T33 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T33 T34 T35
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 | T33,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 | T33,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T33,T34,T35 |
1 | 1 | Covered | T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
T33,T34,T35 |
0 |
0 |
1 |
Covered |
T33,T34,T35 |
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 |
1256237361 |
938981 |
0 |
0 |
T33 |
304236 |
3018 |
0 |
0 |
T34 |
0 |
16614 |
0 |
0 |
T35 |
0 |
15125 |
0 |
0 |
T44 |
0 |
5448 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
1401 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
554 |
0 |
0 |
T93 |
0 |
183 |
0 |
0 |
T94 |
0 |
4150 |
0 |
0 |
T95 |
0 |
769 |
0 |
0 |
T96 |
0 |
1335 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1129 |
0 |
0 |
T33 |
304236 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T52 |
172823 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T83 |
34745 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
T96 |
0 |
11 |
0 |
0 |
T97 |
33008 |
0 |
0 |
0 |
T98 |
101720 |
0 |
0 |
0 |
T99 |
177478 |
0 |
0 |
0 |
T100 |
60584 |
0 |
0 |
0 |
T101 |
365994 |
0 |
0 |
0 |
T102 |
248207 |
0 |
0 |
0 |
T103 |
337696 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T4 T3 T7
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: T4 T3 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T3 T7
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: T4 T3 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T3 T7
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: T4 T3 T7
135 1/1 txn_bits_q <= '0;
Tests: T4 T3 T7
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 | T4,T3,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 | T4,T3,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
1256237361 |
6649861 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
939 |
0 |
0 |
T4 |
29008 |
186 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
475 |
0 |
0 |
T8 |
0 |
353 |
0 |
0 |
T12 |
0 |
468 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
365 |
0 |
0 |
T56 |
0 |
1899 |
0 |
0 |
T57 |
0 |
955 |
0 |
0 |
T58 |
0 |
1891 |
0 |
0 |
T60 |
0 |
357 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
7481 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
6487490 |
0 |
0 |
T19 |
161471 |
959 |
0 |
0 |
T33 |
0 |
31297 |
0 |
0 |
T34 |
0 |
19420 |
0 |
0 |
T35 |
0 |
17843 |
0 |
0 |
T44 |
0 |
76324 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
23964 |
0 |
0 |
T55 |
0 |
5276 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
31070 |
0 |
0 |
T93 |
0 |
7731 |
0 |
0 |
T94 |
0 |
44400 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
7404 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
75 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
91 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
91 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
51 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
56 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
6469642 |
0 |
0 |
T19 |
161471 |
957 |
0 |
0 |
T33 |
0 |
29770 |
0 |
0 |
T34 |
0 |
19386 |
0 |
0 |
T35 |
0 |
17826 |
0 |
0 |
T44 |
0 |
56722 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
17378 |
0 |
0 |
T55 |
0 |
5270 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
29976 |
0 |
0 |
T93 |
0 |
7718 |
0 |
0 |
T94 |
0 |
63765 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
7382 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
74 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
69 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
70 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
51 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
80 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
6608733 |
0 |
0 |
T19 |
161471 |
955 |
0 |
0 |
T33 |
0 |
33466 |
0 |
0 |
T34 |
0 |
19403 |
0 |
0 |
T35 |
0 |
17906 |
0 |
0 |
T44 |
0 |
75634 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
21545 |
0 |
0 |
T55 |
0 |
5264 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
29056 |
0 |
0 |
T93 |
0 |
8118 |
0 |
0 |
T94 |
0 |
61831 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
7591 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
83 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T35 |
0 |
11 |
0 |
0 |
T44 |
0 |
91 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
91 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
51 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
80 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T4 T3 T7
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: T4 T3 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T3 T7
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: T4 T3 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T3 T7
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: T4 T3 T7
135 1/1 txn_bits_q <= '0;
Tests: T4 T3 T7
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 | T4,T3,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 | T4,T3,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
1256237361 |
1487594 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
929 |
0 |
0 |
T4 |
29008 |
174 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
473 |
0 |
0 |
T8 |
0 |
351 |
0 |
0 |
T12 |
0 |
464 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
363 |
0 |
0 |
T56 |
0 |
1890 |
0 |
0 |
T57 |
0 |
953 |
0 |
0 |
T58 |
0 |
1885 |
0 |
0 |
T60 |
0 |
348 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1690 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
1477332 |
0 |
0 |
T19 |
161471 |
951 |
0 |
0 |
T33 |
0 |
2884 |
0 |
0 |
T34 |
0 |
16486 |
0 |
0 |
T35 |
0 |
14870 |
0 |
0 |
T44 |
0 |
5544 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
1457 |
0 |
0 |
T55 |
0 |
5252 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
468 |
0 |
0 |
T93 |
0 |
165 |
0 |
0 |
T94 |
0 |
4650 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1659 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
1407237 |
0 |
0 |
T19 |
161471 |
949 |
0 |
0 |
T33 |
0 |
2578 |
0 |
0 |
T34 |
0 |
16459 |
0 |
0 |
T35 |
0 |
14863 |
0 |
0 |
T44 |
0 |
5484 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
1266 |
0 |
0 |
T55 |
0 |
5246 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
404 |
0 |
0 |
T93 |
0 |
161 |
0 |
0 |
T94 |
0 |
4328 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1623 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
1450230 |
0 |
0 |
T19 |
161471 |
947 |
0 |
0 |
T33 |
0 |
3041 |
0 |
0 |
T34 |
0 |
16493 |
0 |
0 |
T35 |
0 |
14931 |
0 |
0 |
T44 |
0 |
5424 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
1272 |
0 |
0 |
T55 |
0 |
5240 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
534 |
0 |
0 |
T93 |
0 |
160 |
0 |
0 |
T94 |
0 |
4031 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1662 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T4 T3 T7
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: T4 T3 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T3 T7
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: T4 T3 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T3 T7
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: T4 T3 T7
135 1/1 txn_bits_q <= '0;
Tests: T4 T3 T7
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 | T4,T3,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 | T4,T3,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T3,T7 |
1 | 1 | Covered | T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
T4,T3,T7 |
0 |
0 |
1 |
Covered |
T4,T3,T7 |
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 |
1256237361 |
1433496 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
923 |
0 |
0 |
T4 |
29008 |
169 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
471 |
0 |
0 |
T8 |
0 |
349 |
0 |
0 |
T12 |
0 |
454 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
361 |
0 |
0 |
T56 |
0 |
1882 |
0 |
0 |
T57 |
0 |
949 |
0 |
0 |
T58 |
0 |
1882 |
0 |
0 |
T60 |
0 |
341 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1614 |
0 |
0 |
T1 |
21763 |
0 |
0 |
0 |
T2 |
54604 |
0 |
0 |
0 |
T3 |
123621 |
1 |
0 |
0 |
T4 |
29008 |
1 |
0 |
0 |
T5 |
261081 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
54574 |
0 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T32 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
1437361 |
0 |
0 |
T19 |
161471 |
943 |
0 |
0 |
T33 |
0 |
2821 |
0 |
0 |
T34 |
0 |
16424 |
0 |
0 |
T35 |
0 |
14767 |
0 |
0 |
T44 |
0 |
5532 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
1391 |
0 |
0 |
T55 |
0 |
5228 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
453 |
0 |
0 |
T93 |
0 |
153 |
0 |
0 |
T94 |
0 |
4559 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1648 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
1423447 |
0 |
0 |
T19 |
161471 |
941 |
0 |
0 |
T33 |
0 |
2515 |
0 |
0 |
T34 |
0 |
16403 |
0 |
0 |
T35 |
0 |
14796 |
0 |
0 |
T44 |
0 |
5472 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
1367 |
0 |
0 |
T55 |
0 |
5222 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
392 |
0 |
0 |
T93 |
0 |
201 |
0 |
0 |
T94 |
0 |
4270 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1647 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T19 T33 T34
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: T19 T33 T34
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T19 T33 T34
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: T19 T33 T34
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T19 T33 T34
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: T19 T33 T34
135 1/1 txn_bits_q <= '0;
Tests: T19 T33 T34
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 | T19,T33,T34 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 | T19,T33,T34 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T19,T33,T34 |
1 | 1 | Covered | T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
T19,T33,T34 |
0 |
0 |
1 |
Covered |
T19,T33,T34 |
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 |
1256237361 |
1395843 |
0 |
0 |
T19 |
161471 |
939 |
0 |
0 |
T33 |
0 |
3234 |
0 |
0 |
T34 |
0 |
16430 |
0 |
0 |
T35 |
0 |
14820 |
0 |
0 |
T44 |
0 |
5412 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
1233 |
0 |
0 |
T55 |
0 |
5216 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
526 |
0 |
0 |
T93 |
0 |
201 |
0 |
0 |
T94 |
0 |
3979 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1630 |
0 |
0 |
T19 |
161471 |
1 |
0 |
0 |
T33 |
0 |
8 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T35 |
0 |
9 |
0 |
0 |
T44 |
0 |
6 |
0 |
0 |
T53 |
293804 |
0 |
0 |
0 |
T54 |
0 |
5 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T62 |
85083 |
0 |
0 |
0 |
T66 |
215743 |
0 |
0 |
0 |
T67 |
32765 |
0 |
0 |
0 |
T68 |
51294 |
0 |
0 |
0 |
T82 |
83542 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
6 |
0 |
0 |
T104 |
155808 |
0 |
0 |
0 |
T105 |
201002 |
0 |
0 |
0 |
T106 |
43349 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
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: T2 T10 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: T2 T10 T25
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 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: T2 T10 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 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: T2 T10 T25
135 1/1 txn_bits_q <= '0;
Tests: T2 T10 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_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 | T2,T10,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T10,T25 |
1 | 1 | Covered | T2,T10,T25 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T10,T25 |
1 | - | Covered | T2,T10,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 | T2,T10,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T25 |
1 | 1 | Covered | T2,T10,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_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 |
T2,T10,T25 |
0 |
0 |
1 |
Covered |
T2,T10,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 |
T2,T10,T25 |
0 |
0 |
1 |
Covered |
T2,T10,T25 |
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 |
1256237361 |
703154 |
0 |
0 |
T2 |
54604 |
1310 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
2994 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T25 |
0 |
3578 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
6672 |
0 |
0 |
T35 |
0 |
6632 |
0 |
0 |
T70 |
0 |
967 |
0 |
0 |
T71 |
0 |
959 |
0 |
0 |
T72 |
0 |
2842 |
0 |
0 |
T107 |
0 |
644 |
0 |
0 |
T108 |
0 |
1490 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6902343 |
6272113 |
0 |
0 |
T1 |
613 |
213 |
0 |
0 |
T2 |
1420 |
1020 |
0 |
0 |
T3 |
504 |
104 |
0 |
0 |
T4 |
446 |
46 |
0 |
0 |
T5 |
522 |
122 |
0 |
0 |
T13 |
495 |
95 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
639 |
239 |
0 |
0 |
T16 |
431 |
31 |
0 |
0 |
T17 |
435 |
35 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
856 |
0 |
0 |
T2 |
54604 |
4 |
0 |
0 |
T3 |
123621 |
0 |
0 |
0 |
T7 |
58816 |
0 |
0 |
0 |
T8 |
61335 |
0 |
0 |
0 |
T10 |
0 |
2 |
0 |
0 |
T14 |
97560 |
0 |
0 |
0 |
T15 |
76714 |
0 |
0 |
0 |
T16 |
30137 |
0 |
0 |
0 |
T17 |
200185 |
0 |
0 |
0 |
T18 |
105006 |
0 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T28 |
248583 |
0 |
0 |
0 |
T34 |
0 |
4 |
0 |
0 |
T35 |
0 |
4 |
0 |
0 |
T70 |
0 |
2 |
0 |
0 |
T71 |
0 |
2 |
0 |
0 |
T72 |
0 |
2 |
0 |
0 |
T107 |
0 |
2 |
0 |
0 |
T108 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1256237361 |
1255822323 |
0 |
0 |
T1 |
21763 |
21710 |
0 |
0 |
T2 |
54604 |
54506 |
0 |
0 |
T3 |
123621 |
123535 |
0 |
0 |
T4 |
29008 |
28917 |
0 |
0 |
T5 |
261081 |
261005 |
0 |
0 |
T13 |
54574 |
54474 |
0 |
0 |
T14 |
97560 |
97506 |
0 |
0 |
T15 |
76714 |
76655 |
0 |
0 |
T16 |
30137 |
30081 |
0 |
0 |
T17 |
200185 |
200107 |
0 |
0 |