Line Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 T2
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T2
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 T2
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T2
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T2
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T2
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 T2
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=16,ResetVal,BitMask=65535,DstWrReq=0,TxnWidth=3 + DataWidth=12,ResetVal=0,BitMask=4095,DstWrReq=0,TxnWidth=3 + DataWidth=8,ResetVal,BitMask=255,DstWrReq=0,TxnWidth=3 + DataWidth=14,ResetVal=0,BitMask=16383,DstWrReq=0,TxnWidth=3 + DataWidth=17,ResetVal=2000,BitMask=131071,DstWrReq=0,TxnWidth=3 + DataWidth=7,ResetVal=0,BitMask=119,DstWrReq=0,TxnWidth=3 + DataWidth=5,ResetVal=0,BitMask=31,DstWrReq=0,TxnWidth=3 + DataWidth=32,ResetVal=0,BitMask=-1,DstWrReq=0,TxnWidth=3 + DataWidth=4,ResetVal=0,BitMask=15,DstWrReq=0,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T2 |
1 | 1 | Covered | T1,T5,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T2 |
1 | 1 | Covered | T1,T5,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=0,TxnWidth=3 + DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=1,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T10,T17 |
1 | - | Covered | T2,T10,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T2 |
0 |
0 |
1 |
Covered |
T1,T5,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T2 |
0 |
0 |
1 |
Covered |
T1,T5,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
98010616 |
0 |
0 |
T1 |
41595 |
329 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
310 |
0 |
0 |
T7 |
20487 |
152 |
0 |
0 |
T8 |
116340 |
466 |
0 |
0 |
T9 |
0 |
496 |
0 |
0 |
T12 |
0 |
972 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
360711 |
4312 |
0 |
0 |
T17 |
0 |
338 |
0 |
0 |
T22 |
99336 |
0 |
0 |
0 |
T24 |
101690 |
0 |
0 |
0 |
T25 |
477102 |
0 |
0 |
0 |
T26 |
376406 |
2649 |
0 |
0 |
T27 |
290112 |
5393 |
0 |
0 |
T28 |
0 |
1905 |
0 |
0 |
T32 |
303147 |
141 |
0 |
0 |
T57 |
0 |
1916 |
0 |
0 |
T58 |
0 |
9801 |
0 |
0 |
T59 |
0 |
1959 |
0 |
0 |
T60 |
0 |
5394 |
0 |
0 |
T61 |
0 |
5395 |
0 |
0 |
T62 |
0 |
698 |
0 |
0 |
T63 |
0 |
8488 |
0 |
0 |
T64 |
0 |
5028 |
0 |
0 |
T65 |
0 |
11632 |
0 |
0 |
T66 |
85332 |
0 |
0 |
0 |
T67 |
210020 |
0 |
0 |
0 |
T68 |
182624 |
0 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
207191954 |
185746352 |
0 |
0 |
T1 |
16626 |
3026 |
0 |
0 |
T2 |
47124 |
33524 |
0 |
0 |
T3 |
37128 |
23528 |
0 |
0 |
T4 |
14314 |
714 |
0 |
0 |
T5 |
16014 |
2414 |
0 |
0 |
T7 |
17374 |
3774 |
0 |
0 |
T13 |
14348 |
748 |
0 |
0 |
T14 |
16898 |
3298 |
0 |
0 |
T15 |
17782 |
4182 |
0 |
0 |
T16 |
22712 |
9112 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
107184 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
116340 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
360711 |
6 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T22 |
99336 |
0 |
0 |
0 |
T24 |
101690 |
0 |
0 |
0 |
T25 |
477102 |
0 |
0 |
0 |
T26 |
376406 |
6 |
0 |
0 |
T27 |
290112 |
7 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T32 |
303147 |
0 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
8 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
T60 |
0 |
7 |
0 |
0 |
T61 |
0 |
7 |
0 |
0 |
T62 |
0 |
1 |
0 |
0 |
T63 |
0 |
6 |
0 |
0 |
T64 |
0 |
7 |
0 |
0 |
T65 |
0 |
6 |
0 |
0 |
T66 |
85332 |
0 |
0 |
0 |
T67 |
210020 |
0 |
0 |
0 |
T68 |
182624 |
0 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T70 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
1414230 |
1412054 |
0 |
0 |
T2 |
1334126 |
1330896 |
0 |
0 |
T3 |
2786878 |
2783716 |
0 |
0 |
T4 |
1645872 |
1643084 |
0 |
0 |
T5 |
1844602 |
1841848 |
0 |
0 |
T7 |
696558 |
694008 |
0 |
0 |
T13 |
6898668 |
6895914 |
0 |
0 |
T14 |
5911172 |
5908554 |
0 |
0 |
T15 |
4094246 |
4092512 |
0 |
0 |
T16 |
4088058 |
4086154 |
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 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T10 T17
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T52,T71,T35 |
1 | - | Covered | T2,T10,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
968283 |
0 |
0 |
T2 |
39239 |
235 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
3785 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
328 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T33 |
0 |
1376 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
746 |
0 |
0 |
T73 |
0 |
132 |
0 |
0 |
T74 |
0 |
824 |
0 |
0 |
T75 |
0 |
158 |
0 |
0 |
T76 |
0 |
352 |
0 |
0 |
T77 |
0 |
1447 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1092 |
0 |
0 |
T2 |
39239 |
1 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
2 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T33 |
0 |
6 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
2 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
0 |
2 |
0 |
0 |
T75 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1701521 |
0 |
0 |
T1 |
41595 |
316 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
276 |
0 |
0 |
T7 |
20487 |
148 |
0 |
0 |
T8 |
0 |
452 |
0 |
0 |
T9 |
0 |
492 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T28 |
0 |
1874 |
0 |
0 |
T57 |
0 |
1912 |
0 |
0 |
T78 |
0 |
1907 |
0 |
0 |
T79 |
0 |
282 |
0 |
0 |
T80 |
0 |
1477 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1867 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
T79 |
0 |
1 |
0 |
0 |
T80 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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 T10 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T10 T17
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T17
135 1/1 txn_bits_q <= '0;
Tests: T2 T10 T17
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
996412 |
0 |
0 |
T2 |
39239 |
571 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
3795 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
344 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
809 |
0 |
0 |
T73 |
0 |
384 |
0 |
0 |
T74 |
0 |
833 |
0 |
0 |
T75 |
0 |
182 |
0 |
0 |
T76 |
0 |
357 |
0 |
0 |
T77 |
0 |
1452 |
0 |
0 |
T81 |
0 |
4733 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
995 |
0 |
0 |
T2 |
39239 |
2 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
2 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
2 |
0 |
0 |
T73 |
0 |
3 |
0 |
0 |
T74 |
0 |
2 |
0 |
0 |
T75 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T81 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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 T10 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T10 T17
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T17
135 1/1 txn_bits_q <= '0;
Tests: T2 T10 T17
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
962623 |
0 |
0 |
T2 |
39239 |
554 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
3791 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
333 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
787 |
0 |
0 |
T73 |
0 |
378 |
0 |
0 |
T74 |
0 |
829 |
0 |
0 |
T75 |
0 |
176 |
0 |
0 |
T76 |
0 |
355 |
0 |
0 |
T77 |
0 |
1450 |
0 |
0 |
T81 |
0 |
4714 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
980 |
0 |
0 |
T2 |
39239 |
2 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
2 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
2 |
0 |
0 |
T73 |
0 |
3 |
0 |
0 |
T74 |
0 |
2 |
0 |
0 |
T75 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T81 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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 T10 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T10 T17
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T17
135 1/1 txn_bits_q <= '0;
Tests: T2 T10 T17
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
970682 |
0 |
0 |
T2 |
39239 |
547 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
3787 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
321 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
777 |
0 |
0 |
T73 |
0 |
372 |
0 |
0 |
T74 |
0 |
825 |
0 |
0 |
T75 |
0 |
165 |
0 |
0 |
T76 |
0 |
353 |
0 |
0 |
T77 |
0 |
1448 |
0 |
0 |
T81 |
0 |
4693 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
981 |
0 |
0 |
T2 |
39239 |
2 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
2 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
2 |
0 |
0 |
T73 |
0 |
3 |
0 |
0 |
T74 |
0 |
2 |
0 |
0 |
T75 |
0 |
1 |
0 |
0 |
T76 |
0 |
1 |
0 |
0 |
T77 |
0 |
1 |
0 |
0 |
T81 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T14 T22 T23
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T14 T22 T23
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T14 T22 T23
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T14 T22 T23
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T14 T22 T23
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T14 T22 T23
135 1/1 txn_bits_q <= '0;
Tests: T14 T22 T23
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T14,T22,T23 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T14,T22,T23 |
1 | 1 | Covered | T14,T22,T23 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T14,T22,T23 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T14,T22,T23 |
1 | 1 | Covered | T14,T22,T23 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T14,T22,T23 |
0 |
0 |
1 |
Covered |
T14,T22,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T14,T22,T23 |
0 |
0 |
1 |
Covered |
T14,T22,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
2262740 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T14 |
173858 |
25808 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
0 |
6693 |
0 |
0 |
T23 |
0 |
5103 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T82 |
0 |
8526 |
0 |
0 |
T83 |
0 |
8168 |
0 |
0 |
T84 |
0 |
17143 |
0 |
0 |
T85 |
0 |
33376 |
0 |
0 |
T86 |
0 |
15841 |
0 |
0 |
T87 |
0 |
18146 |
0 |
0 |
T88 |
0 |
2458 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
2310 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T14 |
173858 |
20 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
0 |
20 |
0 |
0 |
T23 |
0 |
20 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T82 |
0 |
20 |
0 |
0 |
T83 |
0 |
20 |
0 |
0 |
T84 |
0 |
20 |
0 |
0 |
T85 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
T87 |
0 |
20 |
0 |
0 |
T88 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T14 T15 T24
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T14 T15 T24
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T14 T15 T24
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T14 T15 T24
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T14 T15 T24
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T14 T15 T24
135 1/1 txn_bits_q <= '0;
Tests: T14 T15 T24
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T14,T15,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T14,T15,T24 |
1 | 1 | Covered | T14,T15,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T14,T15,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T14,T15,T24 |
1 | 1 | Covered | T14,T15,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T14,T15,T24 |
0 |
0 |
1 |
Covered |
T14,T15,T24 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T14,T15,T24 |
0 |
0 |
1 |
Covered |
T14,T15,T24 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
3574111 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T9 |
0 |
8679 |
0 |
0 |
T14 |
173858 |
1033 |
0 |
0 |
T15 |
120419 |
16950 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
0 |
285 |
0 |
0 |
T23 |
0 |
222 |
0 |
0 |
T24 |
50845 |
6828 |
0 |
0 |
T25 |
238551 |
32702 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T89 |
0 |
34193 |
0 |
0 |
T90 |
0 |
8931 |
0 |
0 |
T91 |
0 |
15632 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
3777 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T9 |
0 |
20 |
0 |
0 |
T14 |
173858 |
1 |
0 |
0 |
T15 |
120419 |
20 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
0 |
1 |
0 |
0 |
T23 |
0 |
1 |
0 |
0 |
T24 |
50845 |
20 |
0 |
0 |
T25 |
238551 |
20 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T89 |
0 |
20 |
0 |
0 |
T90 |
0 |
20 |
0 |
0 |
T91 |
0 |
40 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 T14
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T14
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 T14
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T14
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T14
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T14
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 T14
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T14 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T14 |
1 | 1 | Covered | T1,T5,T14 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T14 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T14 |
1 | 1 | Covered | T1,T5,T14 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T14 |
0 |
0 |
1 |
Covered |
T1,T5,T14 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T14 |
0 |
0 |
1 |
Covered |
T1,T5,T14 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
4470577 |
0 |
0 |
T1 |
41595 |
340 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
324 |
0 |
0 |
T7 |
20487 |
156 |
0 |
0 |
T8 |
0 |
477 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
1045 |
0 |
0 |
T15 |
120419 |
17030 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
0 |
299 |
0 |
0 |
T24 |
0 |
6908 |
0 |
0 |
T25 |
0 |
32782 |
0 |
0 |
T78 |
0 |
1917 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
4742 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
1 |
0 |
0 |
T15 |
120419 |
20 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
0 |
1 |
0 |
0 |
T24 |
0 |
20 |
0 |
0 |
T25 |
0 |
20 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T15 T24 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T15 T24 T25
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T15 T24 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T24 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T15 T24 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T24 T25
135 1/1 txn_bits_q <= '0;
Tests: T15 T24 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T24,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T15,T24,T25 |
1 | 1 | Covered | T15,T24,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T24,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T15,T24,T25 |
1 | 1 | Covered | T15,T24,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T15,T24,T25 |
0 |
0 |
1 |
Covered |
T15,T24,T25 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T15,T24,T25 |
0 |
0 |
1 |
Covered |
T15,T24,T25 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
3508671 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T9 |
0 |
8719 |
0 |
0 |
T15 |
120419 |
16990 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
6868 |
0 |
0 |
T25 |
238551 |
32742 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T67 |
105010 |
0 |
0 |
0 |
T89 |
0 |
34309 |
0 |
0 |
T90 |
0 |
8971 |
0 |
0 |
T91 |
0 |
16050 |
0 |
0 |
T92 |
0 |
32918 |
0 |
0 |
T93 |
0 |
35264 |
0 |
0 |
T94 |
0 |
16840 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
3663 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T9 |
0 |
20 |
0 |
0 |
T15 |
120419 |
20 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
20 |
0 |
0 |
T25 |
238551 |
20 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T67 |
105010 |
0 |
0 |
0 |
T89 |
0 |
20 |
0 |
0 |
T90 |
0 |
20 |
0 |
0 |
T91 |
0 |
40 |
0 |
0 |
T92 |
0 |
20 |
0 |
0 |
T93 |
0 |
20 |
0 |
0 |
T94 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T3 T6 T11
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T11
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 T11
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T3 T6 T11
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T11
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T3 T6 T11
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 T11
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T3,T6,T11 |
1 | 1 | Covered | T3,T6,T11 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T11 |
1 | 1 | Covered | T3,T6,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T3,T6,T11 |
0 |
0 |
1 |
Covered |
T3,T6,T11 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T3,T6,T11 |
0 |
0 |
1 |
Covered |
T3,T6,T11 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1078534 |
0 |
0 |
T3 |
81967 |
222 |
0 |
0 |
T6 |
0 |
1274 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T11 |
0 |
1371 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T43 |
0 |
473 |
0 |
0 |
T44 |
0 |
1912 |
0 |
0 |
T45 |
0 |
356 |
0 |
0 |
T46 |
0 |
715 |
0 |
0 |
T48 |
0 |
459 |
0 |
0 |
T49 |
0 |
1248 |
0 |
0 |
T50 |
0 |
249 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1041 |
0 |
0 |
T3 |
81967 |
1 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T43 |
0 |
1 |
0 |
0 |
T44 |
0 |
1 |
0 |
0 |
T45 |
0 |
1 |
0 |
0 |
T46 |
0 |
1 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T49 |
0 |
1 |
0 |
0 |
T50 |
0 |
1 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 T3
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T3
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 T3
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T3
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T3
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T3 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T3 |
1 | 1 | Covered | T1,T5,T3 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T3 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T3 |
1 | 1 | Covered | T1,T5,T3 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T3 |
0 |
0 |
1 |
Covered |
T1,T5,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T3 |
0 |
0 |
1 |
Covered |
T1,T5,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1737256 |
0 |
0 |
T1 |
41595 |
311 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
211 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
264 |
0 |
0 |
T6 |
0 |
1271 |
0 |
0 |
T7 |
20487 |
146 |
0 |
0 |
T8 |
0 |
443 |
0 |
0 |
T9 |
0 |
490 |
0 |
0 |
T11 |
0 |
1362 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T28 |
0 |
1864 |
0 |
0 |
T57 |
0 |
1910 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1896 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
1 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T16 T26 T27
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T26 T27
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T26 T27
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T16 T26 T27
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T26 T27
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T16 T26 T27
135 1/1 txn_bits_q <= '0;
Tests: T16 T26 T27
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T26,T27 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T16,T26,T27 |
1 | 1 | Covered | T16,T26,T27 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T26,T27 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T26,T27 |
1 | 1 | Covered | T16,T26,T27 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T26,T27 |
0 |
0 |
1 |
Covered |
T16,T26,T27 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T26,T27 |
0 |
0 |
1 |
Covered |
T16,T26,T27 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1174909 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T16 |
120237 |
2159 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
1342 |
0 |
0 |
T27 |
145056 |
2999 |
0 |
0 |
T58 |
0 |
6096 |
0 |
0 |
T60 |
0 |
3052 |
0 |
0 |
T61 |
0 |
3053 |
0 |
0 |
T62 |
0 |
540 |
0 |
0 |
T63 |
0 |
4247 |
0 |
0 |
T64 |
0 |
2877 |
0 |
0 |
T65 |
0 |
5819 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T67 |
105010 |
0 |
0 |
0 |
T68 |
91312 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1196 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T16 |
120237 |
3 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
3 |
0 |
0 |
T27 |
145056 |
4 |
0 |
0 |
T58 |
0 |
5 |
0 |
0 |
T60 |
0 |
4 |
0 |
0 |
T61 |
0 |
4 |
0 |
0 |
T62 |
0 |
1 |
0 |
0 |
T63 |
0 |
3 |
0 |
0 |
T64 |
0 |
4 |
0 |
0 |
T65 |
0 |
3 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T67 |
105010 |
0 |
0 |
0 |
T68 |
91312 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T16 T26 T27
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T26 T27
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T26 T27
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T16 T26 T27
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T26 T27
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T16 T26 T27
135 1/1 txn_bits_q <= '0;
Tests: T16 T26 T27
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T26,T27 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T16,T26,T27 |
1 | 1 | Covered | T16,T26,T27 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T26,T27 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T26,T27 |
1 | 1 | Covered | T16,T26,T27 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T26,T27 |
0 |
0 |
1 |
Covered |
T16,T26,T27 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T26,T27 |
0 |
0 |
1 |
Covered |
T16,T26,T27 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1126360 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T16 |
120237 |
2153 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
1307 |
0 |
0 |
T27 |
145056 |
2394 |
0 |
0 |
T58 |
0 |
3705 |
0 |
0 |
T60 |
0 |
2342 |
0 |
0 |
T61 |
0 |
2342 |
0 |
0 |
T62 |
0 |
158 |
0 |
0 |
T63 |
0 |
4241 |
0 |
0 |
T64 |
0 |
2151 |
0 |
0 |
T65 |
0 |
5813 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T67 |
105010 |
0 |
0 |
0 |
T68 |
91312 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1120 |
0 |
0 |
T8 |
58170 |
0 |
0 |
0 |
T16 |
120237 |
3 |
0 |
0 |
T22 |
49668 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
3 |
0 |
0 |
T27 |
145056 |
3 |
0 |
0 |
T58 |
0 |
3 |
0 |
0 |
T60 |
0 |
3 |
0 |
0 |
T61 |
0 |
3 |
0 |
0 |
T63 |
0 |
3 |
0 |
0 |
T64 |
0 |
3 |
0 |
0 |
T65 |
0 |
3 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T67 |
105010 |
0 |
0 |
0 |
T68 |
91312 |
0 |
0 |
0 |
T70 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T5 T7 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T7 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T7 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T7 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T7 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T7 T28
135 1/1 txn_bits_q <= '0;
Tests: T5 T7 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T7,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T5,T7,T28 |
1 | 1 | Covered | T5,T7,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T7,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T7,T28 |
1 | 1 | Covered | T5,T7,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T7,T28 |
0 |
0 |
1 |
Covered |
T5,T7,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T7,T28 |
0 |
0 |
1 |
Covered |
T5,T7,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
6547759 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T5 |
54253 |
343 |
0 |
0 |
T7 |
20487 |
160 |
0 |
0 |
T12 |
0 |
980 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T28 |
0 |
1953 |
0 |
0 |
T29 |
0 |
21716 |
0 |
0 |
T30 |
0 |
25827 |
0 |
0 |
T31 |
0 |
9591 |
0 |
0 |
T41 |
0 |
29825 |
0 |
0 |
T52 |
0 |
16451 |
0 |
0 |
T69 |
0 |
477 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7348 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T29 |
0 |
51 |
0 |
0 |
T30 |
0 |
63 |
0 |
0 |
T31 |
0 |
72 |
0 |
0 |
T41 |
0 |
70 |
0 |
0 |
T52 |
0 |
11 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T29 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T29 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T29 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T29 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T29 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T29 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T29 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
6601707 |
0 |
0 |
T29 |
152744 |
20752 |
0 |
0 |
T30 |
0 |
25569 |
0 |
0 |
T31 |
0 |
10654 |
0 |
0 |
T41 |
0 |
31229 |
0 |
0 |
T52 |
0 |
16445 |
0 |
0 |
T56 |
0 |
30024 |
0 |
0 |
T71 |
0 |
17967 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
34621 |
0 |
0 |
T96 |
0 |
5730 |
0 |
0 |
T97 |
0 |
29429 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7399 |
0 |
0 |
T29 |
152744 |
51 |
0 |
0 |
T30 |
0 |
63 |
0 |
0 |
T31 |
0 |
82 |
0 |
0 |
T41 |
0 |
74 |
0 |
0 |
T52 |
0 |
11 |
0 |
0 |
T56 |
0 |
80 |
0 |
0 |
T71 |
0 |
11 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
51 |
0 |
0 |
T96 |
0 |
59 |
0 |
0 |
T97 |
0 |
69 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T29 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T29 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T29 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T29 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T29 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T29 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T29 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
6505265 |
0 |
0 |
T29 |
152744 |
19839 |
0 |
0 |
T30 |
0 |
20479 |
0 |
0 |
T31 |
0 |
6460 |
0 |
0 |
T41 |
0 |
30959 |
0 |
0 |
T52 |
0 |
16445 |
0 |
0 |
T56 |
0 |
25240 |
0 |
0 |
T71 |
0 |
17950 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
34411 |
0 |
0 |
T96 |
0 |
5599 |
0 |
0 |
T97 |
0 |
29123 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7354 |
0 |
0 |
T29 |
152744 |
51 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T41 |
0 |
74 |
0 |
0 |
T52 |
0 |
11 |
0 |
0 |
T56 |
0 |
67 |
0 |
0 |
T71 |
0 |
11 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
51 |
0 |
0 |
T96 |
0 |
59 |
0 |
0 |
T97 |
0 |
69 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T29 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T29 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T29 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T29 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T29 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T29 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T29 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
6273991 |
0 |
0 |
T29 |
152744 |
19068 |
0 |
0 |
T30 |
0 |
25101 |
0 |
0 |
T31 |
0 |
10110 |
0 |
0 |
T41 |
0 |
24242 |
0 |
0 |
T52 |
0 |
16445 |
0 |
0 |
T56 |
0 |
23212 |
0 |
0 |
T71 |
0 |
17946 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
34201 |
0 |
0 |
T96 |
0 |
5609 |
0 |
0 |
T97 |
0 |
23133 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7231 |
0 |
0 |
T29 |
152744 |
51 |
0 |
0 |
T30 |
0 |
63 |
0 |
0 |
T31 |
0 |
82 |
0 |
0 |
T41 |
0 |
58 |
0 |
0 |
T52 |
0 |
11 |
0 |
0 |
T56 |
0 |
63 |
0 |
0 |
T71 |
0 |
11 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
51 |
0 |
0 |
T96 |
0 |
59 |
0 |
0 |
T97 |
0 |
55 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T5 T7 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T7 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T7 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T7 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T7 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T7 T28
135 1/1 txn_bits_q <= '0;
Tests: T5 T7 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T7,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T5,T7,T28 |
1 | 1 | Covered | T5,T7,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T7,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T7,T28 |
1 | 1 | Covered | T5,T7,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T7,T28 |
0 |
0 |
1 |
Covered |
T5,T7,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T7,T28 |
0 |
0 |
1 |
Covered |
T5,T7,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1270130 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T5 |
54253 |
335 |
0 |
0 |
T7 |
20487 |
158 |
0 |
0 |
T12 |
0 |
978 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T28 |
0 |
1937 |
0 |
0 |
T29 |
0 |
479 |
0 |
0 |
T30 |
0 |
459 |
0 |
0 |
T31 |
0 |
118 |
0 |
0 |
T41 |
0 |
1195 |
0 |
0 |
T52 |
0 |
13763 |
0 |
0 |
T69 |
0 |
475 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1304 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T52 |
0 |
9 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T29 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T29 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T29 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T29 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T29 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T29 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T29 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1235031 |
0 |
0 |
T29 |
152744 |
440 |
0 |
0 |
T30 |
0 |
449 |
0 |
0 |
T31 |
0 |
108 |
0 |
0 |
T41 |
0 |
1165 |
0 |
0 |
T52 |
0 |
13757 |
0 |
0 |
T56 |
0 |
747 |
0 |
0 |
T71 |
0 |
14949 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
573 |
0 |
0 |
T96 |
0 |
218 |
0 |
0 |
T97 |
0 |
2445 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1264 |
0 |
0 |
T29 |
152744 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T52 |
0 |
9 |
0 |
0 |
T56 |
0 |
2 |
0 |
0 |
T71 |
0 |
9 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
T96 |
0 |
3 |
0 |
0 |
T97 |
0 |
5 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T29 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T29 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T29 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T29 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T29 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T29 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T29 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1227969 |
0 |
0 |
T29 |
152744 |
407 |
0 |
0 |
T30 |
0 |
439 |
0 |
0 |
T31 |
0 |
98 |
0 |
0 |
T41 |
0 |
1135 |
0 |
0 |
T52 |
0 |
13757 |
0 |
0 |
T56 |
0 |
727 |
0 |
0 |
T71 |
0 |
14950 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
563 |
0 |
0 |
T96 |
0 |
238 |
0 |
0 |
T97 |
0 |
2395 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1265 |
0 |
0 |
T29 |
152744 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T52 |
0 |
9 |
0 |
0 |
T56 |
0 |
2 |
0 |
0 |
T71 |
0 |
9 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
T96 |
0 |
3 |
0 |
0 |
T97 |
0 |
5 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T29 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T29 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T29 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T29 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T29 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T29 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T29 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T29,T30,T31 |
1 | 1 | Covered | T29,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T29,T30,T31 |
0 |
0 |
1 |
Covered |
T29,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1226889 |
0 |
0 |
T29 |
152744 |
477 |
0 |
0 |
T30 |
0 |
429 |
0 |
0 |
T31 |
0 |
88 |
0 |
0 |
T41 |
0 |
1105 |
0 |
0 |
T52 |
0 |
13757 |
0 |
0 |
T56 |
0 |
707 |
0 |
0 |
T71 |
0 |
14927 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
553 |
0 |
0 |
T96 |
0 |
239 |
0 |
0 |
T97 |
0 |
2345 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1307 |
0 |
0 |
T29 |
152744 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T52 |
0 |
9 |
0 |
0 |
T56 |
0 |
2 |
0 |
0 |
T71 |
0 |
9 |
0 |
0 |
T75 |
116830 |
0 |
0 |
0 |
T86 |
338985 |
0 |
0 |
0 |
T87 |
124086 |
0 |
0 |
0 |
T88 |
17914 |
0 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
T96 |
0 |
3 |
0 |
0 |
T97 |
0 |
5 |
0 |
0 |
T98 |
125736 |
0 |
0 |
0 |
T99 |
63093 |
0 |
0 |
0 |
T100 |
109005 |
0 |
0 |
0 |
T101 |
50849 |
0 |
0 |
0 |
T102 |
201180 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
7030071 |
0 |
0 |
T1 |
41595 |
331 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
320 |
0 |
0 |
T7 |
20487 |
154 |
0 |
0 |
T8 |
0 |
475 |
0 |
0 |
T9 |
0 |
498 |
0 |
0 |
T12 |
0 |
974 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
342 |
0 |
0 |
T28 |
0 |
1913 |
0 |
0 |
T57 |
0 |
1918 |
0 |
0 |
T59 |
0 |
1970 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7859 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
7174947 |
0 |
0 |
T29 |
0 |
21167 |
0 |
0 |
T30 |
0 |
25689 |
0 |
0 |
T31 |
0 |
10812 |
0 |
0 |
T32 |
303147 |
145 |
0 |
0 |
T33 |
0 |
1667 |
0 |
0 |
T40 |
0 |
2092 |
0 |
0 |
T41 |
0 |
31359 |
0 |
0 |
T42 |
0 |
2016 |
0 |
0 |
T55 |
0 |
745 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
373 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7976 |
0 |
0 |
T29 |
0 |
51 |
0 |
0 |
T30 |
0 |
63 |
0 |
0 |
T31 |
0 |
82 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
74 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
7016437 |
0 |
0 |
T29 |
0 |
20262 |
0 |
0 |
T30 |
0 |
20575 |
0 |
0 |
T31 |
0 |
6556 |
0 |
0 |
T32 |
303147 |
131 |
0 |
0 |
T33 |
0 |
1598 |
0 |
0 |
T40 |
0 |
2030 |
0 |
0 |
T41 |
0 |
31089 |
0 |
0 |
T42 |
0 |
1986 |
0 |
0 |
T55 |
0 |
739 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
371 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7884 |
0 |
0 |
T29 |
0 |
51 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
74 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
6746619 |
0 |
0 |
T29 |
0 |
19483 |
0 |
0 |
T30 |
0 |
25221 |
0 |
0 |
T31 |
0 |
10268 |
0 |
0 |
T32 |
303147 |
125 |
0 |
0 |
T33 |
0 |
1531 |
0 |
0 |
T40 |
0 |
1981 |
0 |
0 |
T41 |
0 |
24340 |
0 |
0 |
T42 |
0 |
1956 |
0 |
0 |
T55 |
0 |
733 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
369 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
7755 |
0 |
0 |
T29 |
0 |
51 |
0 |
0 |
T30 |
0 |
63 |
0 |
0 |
T31 |
0 |
82 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
58 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1780373 |
0 |
0 |
T1 |
41595 |
329 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
310 |
0 |
0 |
T7 |
20487 |
152 |
0 |
0 |
T8 |
0 |
466 |
0 |
0 |
T9 |
0 |
496 |
0 |
0 |
T12 |
0 |
972 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
338 |
0 |
0 |
T28 |
0 |
1905 |
0 |
0 |
T57 |
0 |
1916 |
0 |
0 |
T59 |
0 |
1959 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1870 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1652950 |
0 |
0 |
T29 |
0 |
430 |
0 |
0 |
T30 |
0 |
445 |
0 |
0 |
T31 |
0 |
104 |
0 |
0 |
T32 |
303147 |
141 |
0 |
0 |
T33 |
0 |
1417 |
0 |
0 |
T40 |
0 |
1881 |
0 |
0 |
T41 |
0 |
1153 |
0 |
0 |
T42 |
0 |
1896 |
0 |
0 |
T55 |
0 |
721 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
365 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1793 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1698173 |
0 |
0 |
T29 |
0 |
387 |
0 |
0 |
T30 |
0 |
435 |
0 |
0 |
T31 |
0 |
94 |
0 |
0 |
T32 |
303147 |
127 |
0 |
0 |
T33 |
0 |
1544 |
0 |
0 |
T40 |
0 |
1822 |
0 |
0 |
T41 |
0 |
1123 |
0 |
0 |
T42 |
0 |
1866 |
0 |
0 |
T55 |
0 |
715 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
363 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1809 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1657044 |
0 |
0 |
T29 |
0 |
463 |
0 |
0 |
T30 |
0 |
425 |
0 |
0 |
T31 |
0 |
84 |
0 |
0 |
T32 |
303147 |
155 |
0 |
0 |
T33 |
0 |
1546 |
0 |
0 |
T40 |
0 |
1766 |
0 |
0 |
T41 |
0 |
1093 |
0 |
0 |
T42 |
0 |
1836 |
0 |
0 |
T55 |
0 |
709 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
361 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1794 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 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: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 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: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T5 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T5 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 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: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T7 |
1 | 1 | Covered | T1,T5,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T7 |
0 |
0 |
1 |
Covered |
T1,T5,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1729950 |
0 |
0 |
T1 |
41595 |
319 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
293 |
0 |
0 |
T7 |
20487 |
150 |
0 |
0 |
T8 |
0 |
454 |
0 |
0 |
T9 |
0 |
494 |
0 |
0 |
T12 |
0 |
970 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
330 |
0 |
0 |
T28 |
0 |
1885 |
0 |
0 |
T57 |
0 |
1914 |
0 |
0 |
T59 |
0 |
1957 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1843 |
0 |
0 |
T1 |
41595 |
1 |
0 |
0 |
T2 |
39239 |
0 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T4 |
48408 |
0 |
0 |
0 |
T5 |
54253 |
1 |
0 |
0 |
T7 |
20487 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202902 |
0 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
1 |
0 |
0 |
T28 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T59 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1705666 |
0 |
0 |
T29 |
0 |
423 |
0 |
0 |
T30 |
0 |
443 |
0 |
0 |
T31 |
0 |
102 |
0 |
0 |
T32 |
303147 |
136 |
0 |
0 |
T33 |
0 |
1598 |
0 |
0 |
T40 |
0 |
1677 |
0 |
0 |
T41 |
0 |
1147 |
0 |
0 |
T42 |
0 |
1776 |
0 |
0 |
T55 |
0 |
697 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
357 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1822 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1680101 |
0 |
0 |
T29 |
0 |
379 |
0 |
0 |
T30 |
0 |
433 |
0 |
0 |
T31 |
0 |
92 |
0 |
0 |
T32 |
303147 |
160 |
0 |
0 |
T33 |
0 |
1527 |
0 |
0 |
T40 |
0 |
1644 |
0 |
0 |
T41 |
0 |
1117 |
0 |
0 |
T42 |
0 |
1746 |
0 |
0 |
T55 |
0 |
691 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
355 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1807 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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: T32 T33 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T32 T33 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T32 T33 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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: T32 T33 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T32 T33 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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: T32 T33 T29
135 1/1 txn_bits_q <= '0;
Tests: T32 T33 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T32,T33,T29 |
1 | 1 | Covered | T32,T33,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T32,T33,T29 |
0 |
0 |
1 |
Covered |
T32,T33,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
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 |
1194890855 |
1714012 |
0 |
0 |
T29 |
0 |
458 |
0 |
0 |
T30 |
0 |
423 |
0 |
0 |
T31 |
0 |
82 |
0 |
0 |
T32 |
303147 |
156 |
0 |
0 |
T33 |
0 |
1468 |
0 |
0 |
T40 |
0 |
1697 |
0 |
0 |
T41 |
0 |
1087 |
0 |
0 |
T42 |
0 |
1716 |
0 |
0 |
T55 |
0 |
685 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
353 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1847 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
303147 |
1 |
0 |
0 |
T33 |
0 |
7 |
0 |
0 |
T40 |
0 |
7 |
0 |
0 |
T41 |
0 |
3 |
0 |
0 |
T42 |
0 |
15 |
0 |
0 |
T55 |
0 |
3 |
0 |
0 |
T69 |
60619 |
0 |
0 |
0 |
T72 |
61466 |
0 |
0 |
0 |
T83 |
154419 |
0 |
0 |
0 |
T84 |
123037 |
0 |
0 |
0 |
T103 |
0 |
1 |
0 |
0 |
T104 |
50819 |
0 |
0 |
0 |
T105 |
33305 |
0 |
0 |
0 |
T106 |
210749 |
0 |
0 |
0 |
T107 |
65688 |
0 |
0 |
0 |
T108 |
195226 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
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 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T10 T17
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T10 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
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 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T10 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
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 T17
135 1/1 txn_bits_q <= '0;
Tests: T2 T10 T17
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Total | Covered | Percent |
Conditions | 13 | 12 | 92.31 |
Logical | 13 | 12 | 92.31 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T10,T17 |
1 | - | Covered | T2,T10,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T10,T17 |
1 | 1 | Covered | T2,T10,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T2,T10,T17 |
0 |
0 |
1 |
Covered |
T2,T10,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1002853 |
0 |
0 |
T2 |
39239 |
574 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
7113 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
813 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
1481 |
0 |
0 |
T73 |
0 |
240 |
0 |
0 |
T74 |
0 |
1545 |
0 |
0 |
T75 |
0 |
362 |
0 |
0 |
T76 |
0 |
713 |
0 |
0 |
T77 |
0 |
2903 |
0 |
0 |
T109 |
0 |
1537 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6093881 |
5463128 |
0 |
0 |
T1 |
489 |
89 |
0 |
0 |
T2 |
1386 |
986 |
0 |
0 |
T3 |
1092 |
692 |
0 |
0 |
T4 |
421 |
21 |
0 |
0 |
T5 |
471 |
71 |
0 |
0 |
T7 |
511 |
111 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
497 |
97 |
0 |
0 |
T15 |
523 |
123 |
0 |
0 |
T16 |
668 |
268 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
993 |
0 |
0 |
T2 |
39239 |
2 |
0 |
0 |
T3 |
81967 |
0 |
0 |
0 |
T7 |
20487 |
0 |
0 |
0 |
T10 |
0 |
4 |
0 |
0 |
T14 |
173858 |
0 |
0 |
0 |
T15 |
120419 |
0 |
0 |
0 |
T16 |
120237 |
0 |
0 |
0 |
T17 |
0 |
2 |
0 |
0 |
T24 |
50845 |
0 |
0 |
0 |
T25 |
238551 |
0 |
0 |
0 |
T26 |
188203 |
0 |
0 |
0 |
T66 |
42666 |
0 |
0 |
0 |
T72 |
0 |
4 |
0 |
0 |
T73 |
0 |
2 |
0 |
0 |
T74 |
0 |
4 |
0 |
0 |
T75 |
0 |
2 |
0 |
0 |
T76 |
0 |
2 |
0 |
0 |
T77 |
0 |
2 |
0 |
0 |
T109 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1194890855 |
1194468130 |
0 |
0 |
T1 |
41595 |
41531 |
0 |
0 |
T2 |
39239 |
39144 |
0 |
0 |
T3 |
81967 |
81874 |
0 |
0 |
T4 |
48408 |
48326 |
0 |
0 |
T5 |
54253 |
54172 |
0 |
0 |
T7 |
20487 |
20412 |
0 |
0 |
T13 |
202902 |
202821 |
0 |
0 |
T14 |
173858 |
173781 |
0 |
0 |
T15 |
120419 |
120368 |
0 |
0 |
T16 |
120237 |
120181 |
0 |
0 |