Line Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T25 T1
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T25 T1
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T25 T1
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T25 T1
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T25 T1
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T25 T1
135 1/1 txn_bits_q <= '0;
Tests: T4 T25 T1
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=16,ResetVal,BitMask=65535,DstWrReq=0,TxnWidth=3 + DataWidth=12,ResetVal=0,BitMask=4095,DstWrReq=0,TxnWidth=3 + DataWidth=8,ResetVal,BitMask=255,DstWrReq=0,TxnWidth=3 + DataWidth=14,ResetVal=0,BitMask=16383,DstWrReq=0,TxnWidth=3 + DataWidth=17,ResetVal=2000,BitMask=131071,DstWrReq=0,TxnWidth=3 + DataWidth=7,ResetVal=0,BitMask=119,DstWrReq=0,TxnWidth=3 + DataWidth=5,ResetVal=0,BitMask=31,DstWrReq=0,TxnWidth=3 + DataWidth=32,ResetVal=0,BitMask=-1,DstWrReq=0,TxnWidth=3 + DataWidth=4,ResetVal=0,BitMask=15,DstWrReq=0,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T5,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T5,T25 |
1 | 1 | Covered | T4,T5,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T5,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T5,T25 |
1 | 1 | Covered | T4,T5,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=0,TxnWidth=3 + DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=1,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T2,T34,T35 |
1 | 1 | Covered | T2,T34,T35 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T34,T30 |
1 | - | Covered | T2,T34,T35 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T2,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T34,T35 |
1 | 1 | Covered | T2,T34,T35 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T25,T1 |
0 |
0 |
1 |
Covered |
T4,T25,T1 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T25,T1 |
0 |
0 |
1 |
Covered |
T4,T25,T1 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
91689197 |
0 |
0 |
T1 |
759114 |
1491 |
0 |
0 |
T4 |
22391 |
184 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
72846 |
897 |
0 |
0 |
T9 |
0 |
1455 |
0 |
0 |
T10 |
0 |
322 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T14 |
152301 |
0 |
0 |
0 |
T15 |
311712 |
0 |
0 |
0 |
T16 |
119390 |
321 |
0 |
0 |
T17 |
501050 |
0 |
0 |
0 |
T21 |
0 |
1514 |
0 |
0 |
T23 |
305346 |
0 |
0 |
0 |
T24 |
182193 |
0 |
0 |
0 |
T25 |
285861 |
0 |
0 |
0 |
T26 |
610530 |
0 |
0 |
0 |
T30 |
0 |
10919 |
0 |
0 |
T34 |
843599 |
7272 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T38 |
0 |
11505 |
0 |
0 |
T39 |
0 |
2708 |
0 |
0 |
T40 |
0 |
1886 |
0 |
0 |
T41 |
0 |
1189 |
0 |
0 |
T66 |
0 |
396 |
0 |
0 |
T67 |
0 |
3111 |
0 |
0 |
T68 |
0 |
1474 |
0 |
0 |
T69 |
0 |
13482 |
0 |
0 |
T70 |
0 |
9394 |
0 |
0 |
T71 |
0 |
2982 |
0 |
0 |
T72 |
0 |
2748 |
0 |
0 |
T73 |
0 |
414 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
228419480 |
206171240 |
0 |
0 |
T1 |
17204 |
3604 |
0 |
0 |
T4 |
15232 |
1632 |
0 |
0 |
T5 |
17136 |
3536 |
0 |
0 |
T6 |
23562 |
9962 |
0 |
0 |
T14 |
14382 |
782 |
0 |
0 |
T15 |
14416 |
816 |
0 |
0 |
T23 |
14382 |
782 |
0 |
0 |
T24 |
17204 |
3604 |
0 |
0 |
T25 |
19040 |
5440 |
0 |
0 |
T26 |
13804 |
204 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
105577 |
0 |
0 |
T1 |
759114 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
72846 |
8 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T14 |
152301 |
0 |
0 |
0 |
T15 |
311712 |
0 |
0 |
0 |
T16 |
119390 |
1 |
0 |
0 |
T17 |
501050 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T23 |
305346 |
0 |
0 |
0 |
T24 |
182193 |
0 |
0 |
0 |
T25 |
285861 |
0 |
0 |
0 |
T26 |
610530 |
0 |
0 |
0 |
T30 |
0 |
12 |
0 |
0 |
T34 |
843599 |
21 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T38 |
0 |
7 |
0 |
0 |
T39 |
0 |
8 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T41 |
0 |
2 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T67 |
0 |
8 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
T69 |
0 |
9 |
0 |
0 |
T70 |
0 |
8 |
0 |
0 |
T71 |
0 |
7 |
0 |
0 |
T72 |
0 |
7 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
8603292 |
8601320 |
0 |
0 |
T4 |
761294 |
758778 |
0 |
0 |
T5 |
1116628 |
1113296 |
0 |
0 |
T6 |
825588 |
823752 |
0 |
0 |
T14 |
1726078 |
1723154 |
0 |
0 |
T15 |
3532736 |
3530696 |
0 |
0 |
T23 |
3460588 |
3457460 |
0 |
0 |
T24 |
2064854 |
2062712 |
0 |
0 |
T25 |
3239758 |
3237310 |
0 |
0 |
T26 |
6919340 |
6917572 |
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 T21 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T21 T30
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T21 T22
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T21 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T21 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T21,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T2,T21,T22 |
1 | 1 | Covered | T2,T21,T30 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T30,T27,T43 |
1 | - | Covered | T2,T21,T22 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T2,T21,T22 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T21,T30 |
1 | 1 | Covered | T2,T21,T22 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T21,T30 |
0 |
0 |
1 |
Covered |
T2,T21,T22 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T21,T30 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
972827 |
0 |
0 |
T2 |
219920 |
1396 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T21 |
0 |
956 |
0 |
0 |
T22 |
0 |
82 |
0 |
0 |
T30 |
0 |
814 |
0 |
0 |
T32 |
104132 |
0 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T45 |
0 |
1478 |
0 |
0 |
T46 |
0 |
2510 |
0 |
0 |
T47 |
0 |
863 |
0 |
0 |
T49 |
0 |
2729 |
0 |
0 |
T50 |
0 |
3744 |
0 |
0 |
T80 |
0 |
1545 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1102 |
0 |
0 |
T2 |
219920 |
1 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T21 |
0 |
4 |
0 |
0 |
T22 |
0 |
1 |
0 |
0 |
T32 |
104132 |
0 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T45 |
0 |
1 |
0 |
0 |
T46 |
0 |
4 |
0 |
0 |
T47 |
0 |
2 |
0 |
0 |
T49 |
0 |
6 |
0 |
0 |
T50 |
0 |
2 |
0 |
0 |
T80 |
0 |
4 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T82 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T25 T1
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T25 T1
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T25 T1
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T25 T1
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T25 T1
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T25 T1
135 1/1 txn_bits_q <= '0;
Tests: T4 T25 T1
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T25,T1 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T25,T1 |
1 | 1 | Covered | T4,T25,T1 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T25,T1 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T25,T1 |
1 | 1 | Covered | T4,T25,T1 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T25,T1 |
0 |
0 |
1 |
Covered |
T4,T25,T1 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T25,T1 |
0 |
0 |
1 |
Covered |
T4,T25,T1 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1646413 |
0 |
0 |
T1 |
253038 |
1487 |
0 |
0 |
T4 |
22391 |
179 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1439 |
0 |
0 |
T10 |
0 |
311 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
307 |
0 |
0 |
T19 |
0 |
525 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
485 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T40 |
0 |
1868 |
0 |
0 |
T66 |
0 |
383 |
0 |
0 |
T83 |
0 |
478 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1857 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
1 |
0 |
0 |
T19 |
0 |
1 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
1 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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 T32 T33
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T32 T33
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T32 T33
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T32 T33
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T32 T33
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T32 T33
135 1/1 txn_bits_q <= '0;
Tests: T2 T32 T33
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T32,T33 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T2,T32,T33 |
1 | 1 | Covered | T2,T32,T33 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T32,T33 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T32,T33 |
1 | 1 | Covered | T2,T32,T33 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T32,T33 |
0 |
0 |
1 |
Covered |
T2,T32,T33 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T32,T33 |
0 |
0 |
1 |
Covered |
T2,T32,T33 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
974314 |
0 |
0 |
T2 |
219920 |
3306 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
174 |
0 |
0 |
T30 |
0 |
1001 |
0 |
0 |
T32 |
104132 |
1020 |
0 |
0 |
T33 |
0 |
353 |
0 |
0 |
T34 |
0 |
330 |
0 |
0 |
T35 |
0 |
3327 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T84 |
0 |
344 |
0 |
0 |
T85 |
0 |
701 |
0 |
0 |
T86 |
0 |
2750 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
993 |
0 |
0 |
T2 |
219920 |
2 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T32 |
104132 |
1 |
0 |
0 |
T33 |
0 |
1 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
2 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T84 |
0 |
1 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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 T32 T33
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T32 T33
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T32 T33
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T32 T33
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T32 T33
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T32 T33
135 1/1 txn_bits_q <= '0;
Tests: T2 T32 T33
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T32,T33 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T2,T32,T33 |
1 | 1 | Covered | T2,T32,T33 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T32,T33 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T32,T33 |
1 | 1 | Covered | T2,T32,T33 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T32,T33 |
0 |
0 |
1 |
Covered |
T2,T32,T33 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T32,T33 |
0 |
0 |
1 |
Covered |
T2,T32,T33 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
985980 |
0 |
0 |
T2 |
219920 |
3288 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
170 |
0 |
0 |
T30 |
0 |
991 |
0 |
0 |
T32 |
104132 |
1018 |
0 |
0 |
T33 |
0 |
340 |
0 |
0 |
T34 |
0 |
320 |
0 |
0 |
T35 |
0 |
3307 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T84 |
0 |
342 |
0 |
0 |
T85 |
0 |
699 |
0 |
0 |
T86 |
0 |
2742 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
973 |
0 |
0 |
T2 |
219920 |
2 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T32 |
104132 |
1 |
0 |
0 |
T33 |
0 |
1 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
2 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T84 |
0 |
1 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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 T32 T33
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T32 T33
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T32 T33
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T32 T33
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T32 T33
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T32 T33
135 1/1 txn_bits_q <= '0;
Tests: T2 T32 T33
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T32,T33 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T2,T32,T33 |
1 | 1 | Covered | T2,T32,T33 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T32,T33 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T32,T33 |
1 | 1 | Covered | T2,T32,T33 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T32,T33 |
0 |
0 |
1 |
Covered |
T2,T32,T33 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T32,T33 |
0 |
0 |
1 |
Covered |
T2,T32,T33 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
987467 |
0 |
0 |
T2 |
219920 |
3275 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
166 |
0 |
0 |
T30 |
0 |
980 |
0 |
0 |
T32 |
104132 |
1016 |
0 |
0 |
T33 |
0 |
332 |
0 |
0 |
T34 |
0 |
301 |
0 |
0 |
T35 |
0 |
3275 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T84 |
0 |
340 |
0 |
0 |
T85 |
0 |
697 |
0 |
0 |
T86 |
0 |
2733 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
991 |
0 |
0 |
T2 |
219920 |
2 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T32 |
104132 |
1 |
0 |
0 |
T33 |
0 |
1 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T35 |
0 |
2 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T84 |
0 |
1 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T5 T36 T37
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T36 T37
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T36 T37
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T36 T37
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T36 T37
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T36 T37
135 1/1 txn_bits_q <= '0;
Tests: T5 T36 T37
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T36,T37 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T5,T36,T37 |
1 | 1 | Covered | T5,T36,T37 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T36,T37 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T36,T37 |
1 | 1 | Covered | T5,T36,T37 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T5,T36,T37 |
0 |
0 |
1 |
Covered |
T5,T36,T37 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T5,T36,T37 |
0 |
0 |
1 |
Covered |
T5,T36,T37 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
2108591 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T5 |
32842 |
4610 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T36 |
0 |
31999 |
0 |
0 |
T37 |
0 |
8146 |
0 |
0 |
T55 |
0 |
36885 |
0 |
0 |
T74 |
0 |
34566 |
0 |
0 |
T77 |
0 |
1972 |
0 |
0 |
T87 |
0 |
28349 |
0 |
0 |
T88 |
0 |
17201 |
0 |
0 |
T89 |
0 |
8160 |
0 |
0 |
T90 |
0 |
17502 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
2238 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T5 |
32842 |
20 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T36 |
0 |
20 |
0 |
0 |
T37 |
0 |
20 |
0 |
0 |
T55 |
0 |
20 |
0 |
0 |
T74 |
0 |
20 |
0 |
0 |
T77 |
0 |
20 |
0 |
0 |
T87 |
0 |
20 |
0 |
0 |
T88 |
0 |
20 |
0 |
0 |
T89 |
0 |
20 |
0 |
0 |
T90 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T5 T24 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: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T24 T17
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T24 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: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T24 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T24 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T24 T17
135 1/1 txn_bits_q <= '0;
Tests: T5 T24 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: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T24,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T5,T24,T17 |
1 | 1 | Covered | T5,T24,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T24,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T24,T17 |
1 | 1 | Covered | T5,T24,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T5,T24,T17 |
0 |
0 |
1 |
Covered |
T5,T24,T17 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T5,T24,T17 |
0 |
0 |
1 |
Covered |
T5,T24,T17 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
3673905 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T5 |
32842 |
241 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
0 |
33673 |
0 |
0 |
T18 |
0 |
3870 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
8084 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T36 |
0 |
1497 |
0 |
0 |
T37 |
0 |
358 |
0 |
0 |
T81 |
0 |
32971 |
0 |
0 |
T91 |
0 |
4251 |
0 |
0 |
T92 |
0 |
5286 |
0 |
0 |
T93 |
0 |
19451 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
3925 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T5 |
32842 |
1 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
0 |
20 |
0 |
0 |
T18 |
0 |
20 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
20 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T36 |
0 |
1 |
0 |
0 |
T37 |
0 |
1 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T91 |
0 |
20 |
0 |
0 |
T92 |
0 |
20 |
0 |
0 |
T93 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T5 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: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T5 T24
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T5 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: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T5 T24
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T5 T24
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T5 T24
135 1/1 txn_bits_q <= '0;
Tests: T4 T5 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: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T5,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T5,T24 |
1 | 1 | Covered | T4,T5,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T5,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T5,T24 |
1 | 1 | Covered | T4,T5,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T5,T24 |
0 |
0 |
1 |
Covered |
T4,T5,T24 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T5,T24 |
0 |
0 |
1 |
Covered |
T4,T5,T24 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
4519666 |
0 |
0 |
T1 |
253038 |
1495 |
0 |
0 |
T4 |
22391 |
192 |
0 |
0 |
T5 |
32842 |
251 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
339 |
0 |
0 |
T17 |
0 |
33955 |
0 |
0 |
T18 |
0 |
4249 |
0 |
0 |
T19 |
0 |
536 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
8164 |
0 |
0 |
T25 |
95287 |
491 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T36 |
0 |
1499 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
4846 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
1 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
1 |
0 |
0 |
T17 |
0 |
20 |
0 |
0 |
T18 |
0 |
20 |
0 |
0 |
T19 |
0 |
1 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
20 |
0 |
0 |
T25 |
95287 |
1 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T36 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T24 T17 T18
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T17 T18
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T17 T18
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T24 T17 T18
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T17 T18
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T24 T17 T18
135 1/1 txn_bits_q <= '0;
Tests: T24 T17 T18
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T17,T18 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T24,T17,T18 |
1 | 1 | Covered | T24,T17,T18 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T17,T18 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T17,T18 |
1 | 1 | Covered | T24,T17,T18 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T24,T17,T18 |
0 |
0 |
1 |
Covered |
T24,T17,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T24,T17,T18 |
0 |
0 |
1 |
Covered |
T24,T17,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
3595445 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T2 |
219920 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
250525 |
33800 |
0 |
0 |
T18 |
31940 |
4058 |
0 |
0 |
T24 |
60731 |
8124 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T79 |
0 |
16853 |
0 |
0 |
T81 |
0 |
33148 |
0 |
0 |
T91 |
0 |
4291 |
0 |
0 |
T92 |
0 |
5418 |
0 |
0 |
T93 |
0 |
19491 |
0 |
0 |
T94 |
0 |
4105 |
0 |
0 |
T95 |
0 |
7854 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
3808 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T2 |
219920 |
0 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
250525 |
20 |
0 |
0 |
T18 |
31940 |
20 |
0 |
0 |
T24 |
60731 |
20 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T79 |
0 |
40 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T91 |
0 |
20 |
0 |
0 |
T92 |
0 |
20 |
0 |
0 |
T93 |
0 |
20 |
0 |
0 |
T94 |
0 |
20 |
0 |
0 |
T95 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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 T7 T8
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T7 T8
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T7 T8
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T7 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T7 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T7 T8
135 1/1 txn_bits_q <= '0;
Tests: T3 T7 T8
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T7,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T3,T7,T8 |
1 | 1 | Covered | T3,T7,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T7,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T7,T8 |
1 | 1 | Covered | T3,T7,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T3,T7,T8 |
0 |
0 |
1 |
Covered |
T3,T7,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T3,T7,T8 |
0 |
0 |
1 |
Covered |
T3,T7,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
997253 |
0 |
0 |
T3 |
278273 |
2000 |
0 |
0 |
T7 |
62025 |
419 |
0 |
0 |
T8 |
0 |
957 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T11 |
0 |
497 |
0 |
0 |
T13 |
0 |
91 |
0 |
0 |
T32 |
104132 |
0 |
0 |
0 |
T34 |
0 |
10534 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T37 |
61553 |
0 |
0 |
0 |
T55 |
0 |
1483 |
0 |
0 |
T57 |
0 |
944 |
0 |
0 |
T60 |
0 |
386 |
0 |
0 |
T61 |
0 |
856 |
0 |
0 |
T66 |
46824 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T91 |
30682 |
0 |
0 |
0 |
T96 |
421337 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1052 |
0 |
0 |
T3 |
278273 |
1 |
0 |
0 |
T7 |
62025 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T13 |
0 |
1 |
0 |
0 |
T32 |
104132 |
0 |
0 |
0 |
T34 |
0 |
28 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T37 |
61553 |
0 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T60 |
0 |
1 |
0 |
0 |
T61 |
0 |
1 |
0 |
0 |
T66 |
46824 |
0 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T91 |
30682 |
0 |
0 |
0 |
T96 |
421337 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T1 T16
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T1 T16
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T1 T16
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T1 T16
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T1 T16
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T1 T16
135 1/1 txn_bits_q <= '0;
Tests: T4 T1 T16
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1680495 |
0 |
0 |
T1 |
253038 |
1485 |
0 |
0 |
T3 |
0 |
1998 |
0 |
0 |
T4 |
22391 |
172 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T7 |
0 |
417 |
0 |
0 |
T8 |
0 |
955 |
0 |
0 |
T9 |
0 |
1428 |
0 |
0 |
T10 |
0 |
309 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
304 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T40 |
0 |
1858 |
0 |
0 |
T66 |
0 |
372 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1869 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T3 |
0 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
1 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T6 T38 T39
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T38 T39
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T38 T39
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T38 T39
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T38 T39
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T38 T39
135 1/1 txn_bits_q <= '0;
Tests: T6 T38 T39
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T38,T39 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T6,T38,T39 |
1 | 1 | Covered | T6,T38,T39 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T38,T39 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T38,T39 |
1 | 1 | Covered | T6,T38,T39 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T6,T38,T39 |
0 |
0 |
1 |
Covered |
T6,T38,T39 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T6,T38,T39 |
0 |
0 |
1 |
Covered |
T6,T38,T39 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1152836 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T6 |
24282 |
556 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T30 |
0 |
1996 |
0 |
0 |
T34 |
0 |
648 |
0 |
0 |
T38 |
0 |
6716 |
0 |
0 |
T39 |
0 |
1698 |
0 |
0 |
T67 |
0 |
1996 |
0 |
0 |
T69 |
0 |
8994 |
0 |
0 |
T70 |
0 |
5931 |
0 |
0 |
T71 |
0 |
1724 |
0 |
0 |
T72 |
0 |
1555 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1195 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T6 |
24282 |
5 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T34 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
5 |
0 |
0 |
T67 |
0 |
5 |
0 |
0 |
T69 |
0 |
6 |
0 |
0 |
T70 |
0 |
5 |
0 |
0 |
T71 |
0 |
4 |
0 |
0 |
T72 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T6 T38 T39
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T38 T39
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T38 T39
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T38 T39
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T38 T39
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T38 T39
135 1/1 txn_bits_q <= '0;
Tests: T6 T38 T39
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T38,T39 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T6,T38,T39 |
1 | 1 | Covered | T6,T38,T39 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T38,T39 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T38,T39 |
1 | 1 | Covered | T6,T38,T39 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T6,T38,T39 |
0 |
0 |
1 |
Covered |
T6,T38,T39 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T6,T38,T39 |
0 |
0 |
1 |
Covered |
T6,T38,T39 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1020637 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T6 |
24282 |
341 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T30 |
0 |
1000 |
0 |
0 |
T34 |
0 |
321 |
0 |
0 |
T38 |
0 |
4789 |
0 |
0 |
T39 |
0 |
1010 |
0 |
0 |
T67 |
0 |
1115 |
0 |
0 |
T69 |
0 |
4488 |
0 |
0 |
T70 |
0 |
3463 |
0 |
0 |
T71 |
0 |
1258 |
0 |
0 |
T72 |
0 |
1193 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1074 |
0 |
0 |
T1 |
253038 |
0 |
0 |
0 |
T6 |
24282 |
3 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
0 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T34 |
0 |
1 |
0 |
0 |
T38 |
0 |
3 |
0 |
0 |
T39 |
0 |
3 |
0 |
0 |
T67 |
0 |
3 |
0 |
0 |
T69 |
0 |
3 |
0 |
0 |
T70 |
0 |
3 |
0 |
0 |
T71 |
0 |
3 |
0 |
0 |
T72 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T16 T40
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T16 T40
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T16 T40
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T16 T40
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T16 T40
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T16 T40
135 1/1 txn_bits_q <= '0;
Tests: T1 T16 T40
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T16,T40 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T1,T16,T40 |
1 | 1 | Covered | T1,T16,T40 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T16,T40 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T16,T40 |
1 | 1 | Covered | T1,T16,T40 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T1,T16,T40 |
0 |
0 |
1 |
Covered |
T1,T16,T40 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T1,T16,T40 |
0 |
0 |
1 |
Covered |
T1,T16,T40 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
6006061 |
0 |
0 |
T1 |
253038 |
1499 |
0 |
0 |
T2 |
219920 |
0 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T10 |
0 |
356 |
0 |
0 |
T12 |
0 |
1496 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
352 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T21 |
0 |
19770 |
0 |
0 |
T30 |
0 |
9898 |
0 |
0 |
T34 |
0 |
4027 |
0 |
0 |
T40 |
0 |
1910 |
0 |
0 |
T41 |
0 |
37238 |
0 |
0 |
T73 |
0 |
20228 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7145 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T2 |
219920 |
0 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
1 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T21 |
0 |
81 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
5956433 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
14782 |
0 |
0 |
T30 |
0 |
9868 |
0 |
0 |
T34 |
843599 |
4004 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
36232 |
0 |
0 |
T73 |
0 |
19482 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
47039 |
0 |
0 |
T98 |
0 |
18363 |
0 |
0 |
T99 |
0 |
21413 |
0 |
0 |
T100 |
0 |
35672 |
0 |
0 |
T101 |
0 |
20845 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7173 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
66 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
843599 |
11 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
51 |
0 |
0 |
T98 |
0 |
51 |
0 |
0 |
T99 |
0 |
62 |
0 |
0 |
T100 |
0 |
74 |
0 |
0 |
T101 |
0 |
51 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
5935425 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
13069 |
0 |
0 |
T30 |
0 |
9866 |
0 |
0 |
T34 |
843599 |
3993 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
35291 |
0 |
0 |
T73 |
0 |
18782 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
46829 |
0 |
0 |
T98 |
0 |
25034 |
0 |
0 |
T99 |
0 |
21269 |
0 |
0 |
T100 |
0 |
34581 |
0 |
0 |
T101 |
0 |
19755 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7256 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
61 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
843599 |
11 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
51 |
0 |
0 |
T98 |
0 |
73 |
0 |
0 |
T99 |
0 |
63 |
0 |
0 |
T100 |
0 |
74 |
0 |
0 |
T101 |
0 |
51 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
5750342 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
14068 |
0 |
0 |
T30 |
0 |
9874 |
0 |
0 |
T34 |
843599 |
3991 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
34288 |
0 |
0 |
T73 |
0 |
18071 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
46619 |
0 |
0 |
T98 |
0 |
24046 |
0 |
0 |
T99 |
0 |
24560 |
0 |
0 |
T100 |
0 |
33504 |
0 |
0 |
T101 |
0 |
18798 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7244 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
61 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
843599 |
11 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
51 |
0 |
0 |
T98 |
0 |
73 |
0 |
0 |
T99 |
0 |
75 |
0 |
0 |
T100 |
0 |
74 |
0 |
0 |
T101 |
0 |
51 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T16 T40
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T16 T40
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T16 T40
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T16 T40
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T16 T40
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T16 T40
135 1/1 txn_bits_q <= '0;
Tests: T1 T16 T40
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T16,T40 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T1,T16,T40 |
1 | 1 | Covered | T1,T16,T40 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T16,T40 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T16,T40 |
1 | 1 | Covered | T1,T16,T40 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T1,T16,T40 |
0 |
0 |
1 |
Covered |
T1,T16,T40 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T1,T16,T40 |
0 |
0 |
1 |
Covered |
T1,T16,T40 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1131485 |
0 |
0 |
T1 |
253038 |
1497 |
0 |
0 |
T2 |
219920 |
0 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T10 |
0 |
348 |
0 |
0 |
T12 |
0 |
1494 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
350 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T21 |
0 |
1468 |
0 |
0 |
T30 |
0 |
8099 |
0 |
0 |
T34 |
0 |
3296 |
0 |
0 |
T40 |
0 |
1901 |
0 |
0 |
T41 |
0 |
641 |
0 |
0 |
T73 |
0 |
454 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1230 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T2 |
219920 |
0 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
59695 |
1 |
0 |
0 |
T17 |
250525 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1143537 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1242 |
0 |
0 |
T30 |
0 |
8052 |
0 |
0 |
T34 |
843599 |
3273 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
587 |
0 |
0 |
T73 |
0 |
419 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
768 |
0 |
0 |
T98 |
0 |
291 |
0 |
0 |
T99 |
0 |
380 |
0 |
0 |
T100 |
0 |
534 |
0 |
0 |
T101 |
0 |
325 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1228 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T100 |
0 |
1 |
0 |
0 |
T101 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1144209 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1309 |
0 |
0 |
T30 |
0 |
8065 |
0 |
0 |
T34 |
843599 |
3251 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
541 |
0 |
0 |
T73 |
0 |
394 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
758 |
0 |
0 |
T98 |
0 |
250 |
0 |
0 |
T99 |
0 |
342 |
0 |
0 |
T100 |
0 |
492 |
0 |
0 |
T101 |
0 |
278 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1276 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T100 |
0 |
1 |
0 |
0 |
T101 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1203184 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1406 |
0 |
0 |
T30 |
0 |
8077 |
0 |
0 |
T34 |
843599 |
3234 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
497 |
0 |
0 |
T73 |
0 |
354 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
748 |
0 |
0 |
T98 |
0 |
223 |
0 |
0 |
T99 |
0 |
405 |
0 |
0 |
T100 |
0 |
467 |
0 |
0 |
T101 |
0 |
367 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1313 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T100 |
0 |
1 |
0 |
0 |
T101 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T1 T16
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T1 T16
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T1 T16
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T1 T16
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T1 T16
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T1 T16
135 1/1 txn_bits_q <= '0;
Tests: T4 T1 T16
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
6449358 |
0 |
0 |
T1 |
253038 |
1493 |
0 |
0 |
T4 |
22391 |
186 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1457 |
0 |
0 |
T10 |
0 |
327 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
328 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T34 |
0 |
3835 |
0 |
0 |
T40 |
0 |
1894 |
0 |
0 |
T41 |
0 |
37640 |
0 |
0 |
T66 |
0 |
404 |
0 |
0 |
T68 |
0 |
1481 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7611 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
1 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T34 |
0 |
11 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
6403546 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
15447 |
0 |
0 |
T30 |
0 |
9733 |
0 |
0 |
T34 |
843599 |
3833 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
36676 |
0 |
0 |
T46 |
0 |
1827 |
0 |
0 |
T65 |
0 |
3579 |
0 |
0 |
T73 |
0 |
19825 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
47135 |
0 |
0 |
T98 |
0 |
18728 |
0 |
0 |
T99 |
0 |
22043 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7650 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
66 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
843599 |
11 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
51 |
0 |
0 |
T98 |
0 |
51 |
0 |
0 |
T99 |
0 |
62 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
6385257 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
13439 |
0 |
0 |
T30 |
0 |
9749 |
0 |
0 |
T34 |
843599 |
3788 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
35713 |
0 |
0 |
T46 |
0 |
1803 |
0 |
0 |
T65 |
0 |
3551 |
0 |
0 |
T73 |
0 |
19096 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
46925 |
0 |
0 |
T98 |
0 |
25556 |
0 |
0 |
T99 |
0 |
21854 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7742 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
61 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
843599 |
11 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
51 |
0 |
0 |
T98 |
0 |
73 |
0 |
0 |
T99 |
0 |
63 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
6266063 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
13828 |
0 |
0 |
T30 |
0 |
9750 |
0 |
0 |
T34 |
843599 |
3783 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
34755 |
0 |
0 |
T46 |
0 |
1786 |
0 |
0 |
T65 |
0 |
3531 |
0 |
0 |
T73 |
0 |
18365 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
46715 |
0 |
0 |
T98 |
0 |
24634 |
0 |
0 |
T99 |
0 |
25305 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
7749 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
61 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T34 |
843599 |
11 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
51 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
51 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
51 |
0 |
0 |
T98 |
0 |
73 |
0 |
0 |
T99 |
0 |
75 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T1 T16
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T1 T16
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T1 T16
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T1 T16
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T1 T16
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T1 T16
135 1/1 txn_bits_q <= '0;
Tests: T4 T1 T16
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1620934 |
0 |
0 |
T1 |
253038 |
1491 |
0 |
0 |
T4 |
22391 |
184 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1455 |
0 |
0 |
T10 |
0 |
322 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
321 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T34 |
0 |
3189 |
0 |
0 |
T40 |
0 |
1886 |
0 |
0 |
T41 |
0 |
620 |
0 |
0 |
T66 |
0 |
396 |
0 |
0 |
T68 |
0 |
1474 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1772 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
1 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1597451 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1514 |
0 |
0 |
T30 |
0 |
7923 |
0 |
0 |
T34 |
843599 |
3114 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
569 |
0 |
0 |
T46 |
0 |
1743 |
0 |
0 |
T65 |
0 |
3480 |
0 |
0 |
T73 |
0 |
414 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
764 |
0 |
0 |
T98 |
0 |
276 |
0 |
0 |
T99 |
0 |
365 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1769 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1565327 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1269 |
0 |
0 |
T30 |
0 |
7953 |
0 |
0 |
T34 |
843599 |
3051 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
525 |
0 |
0 |
T46 |
0 |
1721 |
0 |
0 |
T65 |
0 |
3453 |
0 |
0 |
T73 |
0 |
376 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
754 |
0 |
0 |
T98 |
0 |
236 |
0 |
0 |
T99 |
0 |
437 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1736 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1579254 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1341 |
0 |
0 |
T30 |
0 |
7938 |
0 |
0 |
T34 |
843599 |
3067 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
484 |
0 |
0 |
T46 |
0 |
1695 |
0 |
0 |
T65 |
0 |
3426 |
0 |
0 |
T73 |
0 |
460 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
744 |
0 |
0 |
T98 |
0 |
312 |
0 |
0 |
T99 |
0 |
387 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1758 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T1 T16
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T1 T16
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T1 T16
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T1 T16
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T1 T16
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T1 T16
135 1/1 txn_bits_q <= '0;
Tests: T4 T1 T16
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T16 |
1 | 1 | Covered | T4,T1,T16 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T4,T1,T16 |
0 |
0 |
1 |
Covered |
T4,T1,T16 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1601194 |
0 |
0 |
T1 |
253038 |
1489 |
0 |
0 |
T4 |
22391 |
182 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1446 |
0 |
0 |
T10 |
0 |
313 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
310 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T34 |
0 |
3107 |
0 |
0 |
T40 |
0 |
1879 |
0 |
0 |
T41 |
0 |
611 |
0 |
0 |
T66 |
0 |
392 |
0 |
0 |
T68 |
0 |
1466 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1772 |
0 |
0 |
T1 |
253038 |
1 |
0 |
0 |
T4 |
22391 |
1 |
0 |
0 |
T5 |
32842 |
0 |
0 |
0 |
T6 |
24282 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T14 |
50767 |
0 |
0 |
0 |
T15 |
103904 |
0 |
0 |
0 |
T16 |
0 |
1 |
0 |
0 |
T23 |
101782 |
0 |
0 |
0 |
T24 |
60731 |
0 |
0 |
0 |
T25 |
95287 |
0 |
0 |
0 |
T26 |
203510 |
0 |
0 |
0 |
T34 |
0 |
9 |
0 |
0 |
T40 |
0 |
1 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1561922 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1445 |
0 |
0 |
T30 |
0 |
7856 |
0 |
0 |
T34 |
843599 |
3128 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
560 |
0 |
0 |
T46 |
0 |
1638 |
0 |
0 |
T65 |
0 |
3362 |
0 |
0 |
T73 |
0 |
409 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
762 |
0 |
0 |
T98 |
0 |
264 |
0 |
0 |
T99 |
0 |
363 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1728 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1576051 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1365 |
0 |
0 |
T30 |
0 |
7890 |
0 |
0 |
T34 |
843599 |
3073 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
514 |
0 |
0 |
T46 |
0 |
1623 |
0 |
0 |
T65 |
0 |
3339 |
0 |
0 |
T73 |
0 |
372 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
752 |
0 |
0 |
T98 |
0 |
232 |
0 |
0 |
T99 |
0 |
425 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1762 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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: T34 T41 T21
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T34 T41 T21
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T34 T41 T21
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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: T34 T41 T21
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T34 T41 T21
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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: T34 T41 T21
135 1/1 txn_bits_q <= '0;
Tests: T34 T41 T21
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T34,T41,T21 |
1 | 1 | Covered | T34,T41,T21 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T34,T41,T21 |
0 |
0 |
1 |
Covered |
T34,T41,T21 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
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 |
977756588 |
1532042 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
1359 |
0 |
0 |
T30 |
0 |
7866 |
0 |
0 |
T34 |
843599 |
2970 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
469 |
0 |
0 |
T46 |
0 |
1610 |
0 |
0 |
T65 |
0 |
3305 |
0 |
0 |
T73 |
0 |
448 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
742 |
0 |
0 |
T98 |
0 |
306 |
0 |
0 |
T99 |
0 |
368 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
1750 |
0 |
0 |
T11 |
77637 |
0 |
0 |
0 |
T21 |
0 |
6 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T34 |
843599 |
9 |
0 |
0 |
T35 |
203708 |
0 |
0 |
0 |
T41 |
0 |
1 |
0 |
0 |
T46 |
0 |
3 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T73 |
0 |
1 |
0 |
0 |
T74 |
841295 |
0 |
0 |
0 |
T75 |
551451 |
0 |
0 |
0 |
T76 |
48732 |
0 |
0 |
0 |
T77 |
15210 |
0 |
0 |
0 |
T78 |
103875 |
0 |
0 |
0 |
T79 |
169821 |
0 |
0 |
0 |
T97 |
0 |
1 |
0 |
0 |
T98 |
0 |
1 |
0 |
0 |
T99 |
0 |
1 |
0 |
0 |
T102 |
485596 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
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 T34 T35
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T6
73 1/1 end else if (src_req) begin
Tests: T4 T5 T6
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T34 T35
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T6
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T34 T35
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T6
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T6
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T6
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T6
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T6
118 1/1 end else if (src_req) begin
Tests: T4 T5 T6
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T34 T35
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T34 T35
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T6
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T34 T35
135 1/1 txn_bits_q <= '0;
Tests: T2 T34 T35
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T6
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T6
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T6
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T6
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Total | Covered | Percent |
Conditions | 13 | 12 | 92.31 |
Logical | 13 | 12 | 92.31 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T34,T35 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Covered | T2,T34,T35 |
1 | 1 | Covered | T2,T34,T35 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T34,T30 |
1 | - | Covered | T2,T34,T35 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T6 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T34,T35 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T34,T35 |
1 | 1 | Covered | T2,T34,T35 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T6 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T34,T35 |
0 |
0 |
1 |
Covered |
T2,T34,T35 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T6 |
0 |
1 |
- |
Covered |
T2,T34,T35 |
0 |
0 |
1 |
Covered |
T2,T34,T35 |
0 |
0 |
0 |
Covered |
T4,T5,T6 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
964293 |
0 |
0 |
T2 |
219920 |
3295 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
174 |
0 |
0 |
T30 |
0 |
3459 |
0 |
0 |
T32 |
104132 |
0 |
0 |
0 |
T34 |
0 |
1126 |
0 |
0 |
T35 |
0 |
1912 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T45 |
0 |
3456 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T103 |
0 |
838 |
0 |
0 |
T104 |
0 |
3443 |
0 |
0 |
T105 |
0 |
3915 |
0 |
0 |
T106 |
0 |
1602 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
6718220 |
6063860 |
0 |
0 |
T1 |
506 |
106 |
0 |
0 |
T4 |
448 |
48 |
0 |
0 |
T5 |
504 |
104 |
0 |
0 |
T6 |
693 |
293 |
0 |
0 |
T14 |
423 |
23 |
0 |
0 |
T15 |
424 |
24 |
0 |
0 |
T23 |
423 |
23 |
0 |
0 |
T24 |
506 |
106 |
0 |
0 |
T25 |
560 |
160 |
0 |
0 |
T26 |
406 |
6 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
990 |
0 |
0 |
T2 |
219920 |
2 |
0 |
0 |
T3 |
278273 |
0 |
0 |
0 |
T7 |
62025 |
0 |
0 |
0 |
T9 |
234949 |
0 |
0 |
0 |
T18 |
31940 |
0 |
0 |
0 |
T19 |
72045 |
0 |
0 |
0 |
T20 |
201455 |
0 |
0 |
0 |
T22 |
0 |
2 |
0 |
0 |
T30 |
0 |
4 |
0 |
0 |
T32 |
104132 |
0 |
0 |
0 |
T34 |
0 |
4 |
0 |
0 |
T35 |
0 |
1 |
0 |
0 |
T36 |
243173 |
0 |
0 |
0 |
T45 |
0 |
2 |
0 |
0 |
T81 |
243850 |
0 |
0 |
0 |
T103 |
0 |
2 |
0 |
0 |
T104 |
0 |
4 |
0 |
0 |
T105 |
0 |
2 |
0 |
0 |
T106 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
977756588 |
977335211 |
0 |
0 |
T1 |
253038 |
252980 |
0 |
0 |
T4 |
22391 |
22317 |
0 |
0 |
T5 |
32842 |
32744 |
0 |
0 |
T6 |
24282 |
24228 |
0 |
0 |
T14 |
50767 |
50681 |
0 |
0 |
T15 |
103904 |
103844 |
0 |
0 |
T23 |
101782 |
101690 |
0 |
0 |
T24 |
60731 |
60668 |
0 |
0 |
T25 |
95287 |
95215 |
0 |
0 |
T26 |
203510 |
203458 |
0 |
0 |