Line Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 T2
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T2
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 T2
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T5 T2
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T2
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T15
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T15
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=16,ResetVal,BitMask=65535,DstWrReq=0,TxnWidth=3 + DataWidth=12,ResetVal=0,BitMask=4095,DstWrReq=0,TxnWidth=3 + DataWidth=8,ResetVal,BitMask=255,DstWrReq=0,TxnWidth=3 + DataWidth=14,ResetVal=0,BitMask=16383,DstWrReq=0,TxnWidth=3 + DataWidth=17,ResetVal=2000,BitMask=131071,DstWrReq=0,TxnWidth=3 + DataWidth=7,ResetVal=0,BitMask=119,DstWrReq=0,TxnWidth=3 + DataWidth=5,ResetVal=0,BitMask=31,DstWrReq=0,TxnWidth=3 + DataWidth=32,ResetVal=0,BitMask=-1,DstWrReq=0,TxnWidth=3 + DataWidth=4,ResetVal=0,BitMask=15,DstWrReq=0,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T2 |
1 | 1 | Covered | T1,T5,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T2 |
1 | 1 | Covered | T1,T5,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=0,TxnWidth=3 + DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=1,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T20 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T6,T12,T20 |
1 | 1 | Covered | T6,T12,T20 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T6,T12,T19 |
1 | - | Covered | T6,T12,T20 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T6,T12,T20 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T12,T20 |
1 | 1 | Covered | T6,T12,T20 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T2 |
0 |
0 |
1 |
Covered |
T1,T5,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T2 |
0 |
0 |
1 |
Covered |
T1,T2,T15 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
99529387 |
0 |
0 |
T1 |
68287 |
356 |
0 |
0 |
T2 |
215378 |
1776 |
0 |
0 |
T3 |
454652 |
0 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T6 |
456104 |
0 |
0 |
0 |
T8 |
487588 |
1868 |
0 |
0 |
T9 |
485178 |
1965 |
0 |
0 |
T10 |
0 |
1353 |
0 |
0 |
T12 |
651560 |
5269 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
1011747 |
10983 |
0 |
0 |
T17 |
479727 |
0 |
0 |
0 |
T18 |
171603 |
0 |
0 |
0 |
T20 |
0 |
1480 |
0 |
0 |
T26 |
492074 |
0 |
0 |
0 |
T27 |
0 |
12542 |
0 |
0 |
T28 |
0 |
13751 |
0 |
0 |
T29 |
0 |
1909 |
0 |
0 |
T30 |
0 |
344 |
0 |
0 |
T31 |
0 |
1217 |
0 |
0 |
T56 |
0 |
676 |
0 |
0 |
T57 |
0 |
1495 |
0 |
0 |
T58 |
0 |
13322 |
0 |
0 |
T59 |
0 |
11554 |
0 |
0 |
T60 |
0 |
2580 |
0 |
0 |
T61 |
0 |
11272 |
0 |
0 |
T62 |
0 |
10811 |
0 |
0 |
T63 |
0 |
10591 |
0 |
0 |
T64 |
385932 |
0 |
0 |
0 |
T65 |
342316 |
0 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
259251394 |
236514064 |
0 |
0 |
T1 |
17170 |
3570 |
0 |
0 |
T2 |
16422 |
2822 |
0 |
0 |
T4 |
15198 |
1598 |
0 |
0 |
T5 |
16864 |
3264 |
0 |
0 |
T13 |
14348 |
748 |
0 |
0 |
T14 |
17782 |
4182 |
0 |
0 |
T15 |
24072 |
10472 |
0 |
0 |
T16 |
22916 |
9316 |
0 |
0 |
T17 |
51748 |
1598 |
0 |
0 |
T18 |
16898 |
3298 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
104476 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T3 |
454652 |
0 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T6 |
456104 |
0 |
0 |
0 |
T8 |
487588 |
1 |
0 |
0 |
T9 |
485178 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
651560 |
21 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
1011747 |
7 |
0 |
0 |
T17 |
479727 |
0 |
0 |
0 |
T18 |
171603 |
0 |
0 |
0 |
T20 |
0 |
4 |
0 |
0 |
T26 |
492074 |
0 |
0 |
0 |
T27 |
0 |
7 |
0 |
0 |
T28 |
0 |
8 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
8 |
0 |
0 |
T59 |
0 |
7 |
0 |
0 |
T60 |
0 |
7 |
0 |
0 |
T61 |
0 |
7 |
0 |
0 |
T62 |
0 |
7 |
0 |
0 |
T63 |
0 |
6 |
0 |
0 |
T64 |
385932 |
0 |
0 |
0 |
T65 |
342316 |
0 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
2321758 |
2319718 |
0 |
0 |
T2 |
7322852 |
7320982 |
0 |
0 |
T4 |
1901620 |
1899682 |
0 |
0 |
T5 |
8020770 |
8017812 |
0 |
0 |
T13 |
6887924 |
6885612 |
0 |
0 |
T14 |
4356488 |
4353598 |
0 |
0 |
T15 |
5902264 |
5899000 |
0 |
0 |
T16 |
11466466 |
11463746 |
0 |
0 |
T17 |
5436906 |
5405660 |
0 |
0 |
T18 |
1944834 |
1943100 |
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: T6 T12 T20
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T12 T20
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T12 T20
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T12 T20
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T12 T20
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T20 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T6,T12,T20 |
1 | 1 | Covered | T6,T12,T20 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T12,T35,T36 |
1 | - | Covered | T6,T20,T19 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T6,T12,T20 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T12,T20 |
1 | 1 | Covered | T6,T12,T20 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T20 |
0 |
0 |
1 |
Covered |
T6,T12,T20 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T20 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
972065 |
0 |
0 |
T6 |
228052 |
1463 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
246 |
0 |
0 |
T19 |
0 |
3451 |
0 |
0 |
T20 |
0 |
376 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
734 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
755 |
0 |
0 |
T70 |
0 |
705 |
0 |
0 |
T71 |
0 |
791 |
0 |
0 |
T72 |
0 |
1934 |
0 |
0 |
T73 |
0 |
298 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1074 |
0 |
0 |
T6 |
228052 |
1 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T19 |
0 |
2 |
0 |
0 |
T20 |
0 |
1 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
2 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
2 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T71 |
0 |
2 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
2 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T15
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T15
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T15
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T15
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T15
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T15
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T15
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T15 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T2,T15 |
1 | 1 | Covered | T1,T2,T15 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T15 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T15 |
1 | 1 | Covered | T1,T2,T15 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T15 |
0 |
0 |
1 |
Covered |
T1,T2,T15 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T15 |
0 |
0 |
1 |
Covered |
T1,T2,T15 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1641147 |
0 |
0 |
T1 |
68287 |
340 |
0 |
0 |
T2 |
215378 |
1772 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1851 |
0 |
0 |
T9 |
0 |
1945 |
0 |
0 |
T10 |
0 |
1349 |
0 |
0 |
T12 |
0 |
270 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
732 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T29 |
0 |
1905 |
0 |
0 |
T56 |
0 |
664 |
0 |
0 |
T78 |
0 |
1986 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1804 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
1 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T78 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T6 T12 T19
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T12 T19
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T12 T19
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T12 T19
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T12 T19
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T12 T19
135 1/1 txn_bits_q <= '0;
Tests: T6 T12 T19
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
840202 |
0 |
0 |
T6 |
228052 |
3425 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
263 |
0 |
0 |
T19 |
0 |
3461 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
1243 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
1096 |
0 |
0 |
T70 |
0 |
719 |
0 |
0 |
T71 |
0 |
1344 |
0 |
0 |
T72 |
0 |
1949 |
0 |
0 |
T73 |
0 |
317 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
345 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
934 |
0 |
0 |
T6 |
228052 |
2 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T19 |
0 |
2 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
3 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
3 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T71 |
0 |
3 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
2 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T6 T12 T19
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T12 T19
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T12 T19
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T12 T19
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T12 T19
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T12 T19
135 1/1 txn_bits_q <= '0;
Tests: T6 T12 T19
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
881220 |
0 |
0 |
T6 |
228052 |
3421 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
256 |
0 |
0 |
T19 |
0 |
3457 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
1237 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
1090 |
0 |
0 |
T70 |
0 |
713 |
0 |
0 |
T71 |
0 |
1332 |
0 |
0 |
T72 |
0 |
1945 |
0 |
0 |
T73 |
0 |
298 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
339 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
988 |
0 |
0 |
T6 |
228052 |
2 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T19 |
0 |
2 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
3 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
3 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T71 |
0 |
3 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
2 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T6 T12 T19
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T12 T19
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T12 T19
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T12 T19
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T12 T19
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T12 T19
135 1/1 txn_bits_q <= '0;
Tests: T6 T12 T19
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
876040 |
0 |
0 |
T6 |
228052 |
3417 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
254 |
0 |
0 |
T19 |
0 |
3453 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
1231 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
1084 |
0 |
0 |
T70 |
0 |
705 |
0 |
0 |
T71 |
0 |
1313 |
0 |
0 |
T72 |
0 |
1935 |
0 |
0 |
T73 |
0 |
267 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
333 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
978 |
0 |
0 |
T6 |
228052 |
2 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T19 |
0 |
2 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
3 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
3 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
T71 |
0 |
3 |
0 |
0 |
T72 |
0 |
1 |
0 |
0 |
T73 |
0 |
2 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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 T18 T25
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T18 T25
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T18 T25
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T5 T18 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T18 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T5 T18 T25
135 1/1 txn_bits_q <= '0;
Tests: T5 T18 T25
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T18,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T5,T18,T25 |
1 | 1 | Covered | T5,T18,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T18,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T18,T25 |
1 | 1 | Covered | T5,T18,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T18,T25 |
0 |
0 |
1 |
Covered |
T5,T18,T25 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T18,T25 |
0 |
0 |
1 |
Covered |
T5,T18,T25 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1927894 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T5 |
235905 |
35053 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
7827 |
0 |
0 |
T25 |
0 |
3152 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T68 |
0 |
3607 |
0 |
0 |
T80 |
0 |
32767 |
0 |
0 |
T81 |
0 |
17753 |
0 |
0 |
T82 |
0 |
8638 |
0 |
0 |
T83 |
0 |
35508 |
0 |
0 |
T84 |
0 |
5215 |
0 |
0 |
T85 |
0 |
8281 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
2086 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T5 |
235905 |
20 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
20 |
0 |
0 |
T25 |
0 |
20 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T68 |
0 |
20 |
0 |
0 |
T80 |
0 |
20 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T82 |
0 |
20 |
0 |
0 |
T83 |
0 |
20 |
0 |
0 |
T84 |
0 |
20 |
0 |
0 |
T85 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T5 T14 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T14 T17
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T14 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T5 T14 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T14 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T5 T14 T17
135 1/1 txn_bits_q <= '0;
Tests: T5 T14 T17
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T14,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T5,T14,T17 |
1 | 1 | Covered | T5,T14,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T14,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T14,T17 |
1 | 1 | Covered | T5,T14,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T14,T17 |
0 |
0 |
1 |
Covered |
T5,T14,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T5,T14,T17 |
0 |
0 |
1 |
Covered |
T5,T14,T17 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
3587704 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T5 |
235905 |
1886 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
16833 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
1869 |
0 |
0 |
T18 |
57201 |
327 |
0 |
0 |
T25 |
0 |
175 |
0 |
0 |
T26 |
246037 |
34921 |
0 |
0 |
T74 |
0 |
37431 |
0 |
0 |
T75 |
0 |
17680 |
0 |
0 |
T86 |
0 |
7681 |
0 |
0 |
T87 |
0 |
25902 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
3890 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T5 |
235905 |
1 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
20 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
5 |
0 |
0 |
T18 |
57201 |
1 |
0 |
0 |
T25 |
0 |
1 |
0 |
0 |
T26 |
246037 |
20 |
0 |
0 |
T74 |
0 |
20 |
0 |
0 |
T75 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
T87 |
0 |
60 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T5 T2
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T5 T2
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T5 T2
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T5 T2
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T5 T2
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T5 T2
135 1/1 txn_bits_q <= '0;
Tests: T1 T5 T2
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T5,T2 |
1 | 1 | Covered | T1,T5,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T5,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T5,T2 |
1 | 1 | Covered | T1,T5,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T2 |
0 |
0 |
1 |
Covered |
T1,T5,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T5,T2 |
0 |
0 |
1 |
Covered |
T1,T5,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
4527068 |
0 |
0 |
T1 |
68287 |
378 |
0 |
0 |
T2 |
215378 |
1780 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
1894 |
0 |
0 |
T8 |
0 |
1890 |
0 |
0 |
T9 |
0 |
1988 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
16913 |
0 |
0 |
T15 |
173596 |
734 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
1977 |
0 |
0 |
T18 |
57201 |
334 |
0 |
0 |
T26 |
0 |
35179 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
4844 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
20 |
0 |
0 |
T15 |
173596 |
1 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
5 |
0 |
0 |
T18 |
57201 |
1 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T14 T17 T26
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T14 T17 T26
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T14 T17 T26
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T14 T17 T26
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T14 T17 T26
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T14 T17 T26
135 1/1 txn_bits_q <= '0;
Tests: T14 T17 T26
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T14,T17,T26 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T14,T17,T26 |
1 | 1 | Covered | T14,T17,T26 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T14,T17,T26 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T14,T17,T26 |
1 | 1 | Covered | T14,T17,T26 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T14,T17,T26 |
0 |
0 |
1 |
Covered |
T14,T17,T26 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T14,T17,T26 |
0 |
0 |
1 |
Covered |
T14,T17,T26 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
3553638 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T14 |
128132 |
16873 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
1930 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T26 |
246037 |
35041 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T74 |
0 |
37471 |
0 |
0 |
T75 |
0 |
17720 |
0 |
0 |
T86 |
0 |
7799 |
0 |
0 |
T87 |
0 |
26022 |
0 |
0 |
T88 |
0 |
16874 |
0 |
0 |
T89 |
0 |
8420 |
0 |
0 |
T90 |
0 |
8338 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
3808 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T14 |
128132 |
20 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
5 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T26 |
246037 |
20 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T74 |
0 |
20 |
0 |
0 |
T75 |
0 |
20 |
0 |
0 |
T86 |
0 |
20 |
0 |
0 |
T87 |
0 |
60 |
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 |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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 T11
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T7 T11
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T7 T11
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T3 T7 T11
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T7 T11
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T3 T7 T11
135 1/1 txn_bits_q <= '0;
Tests: T3 T7 T11
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T7,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T3,T7,T11 |
1 | 1 | Covered | T3,T7,T11 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T7,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T7,T11 |
1 | 1 | Covered | T3,T7,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T3,T7,T11 |
0 |
0 |
1 |
Covered |
T3,T7,T11 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T3,T7,T11 |
0 |
0 |
1 |
Covered |
T3,T7,T11 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
860608 |
0 |
0 |
T3 |
227326 |
1917 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T7 |
0 |
960 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T11 |
0 |
215 |
0 |
0 |
T12 |
0 |
8240 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T45 |
0 |
477 |
0 |
0 |
T46 |
0 |
1426 |
0 |
0 |
T48 |
0 |
366 |
0 |
0 |
T49 |
0 |
374 |
0 |
0 |
T52 |
0 |
479 |
0 |
0 |
T53 |
0 |
1406 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
941 |
0 |
0 |
T3 |
227326 |
1 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T12 |
0 |
28 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T45 |
0 |
1 |
0 |
0 |
T46 |
0 |
1 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T49 |
0 |
1 |
0 |
0 |
T52 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T3
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T3
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T3
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T3
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T3
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T3 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T2,T3 |
1 | 1 | Covered | T1,T2,T3 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T3 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T3 |
1 | 1 | Covered | T1,T2,T3 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T3 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T3 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1613761 |
0 |
0 |
T1 |
68287 |
334 |
0 |
0 |
T2 |
215378 |
1770 |
0 |
0 |
T3 |
0 |
1915 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T7 |
0 |
948 |
0 |
0 |
T8 |
0 |
1842 |
0 |
0 |
T9 |
0 |
1933 |
0 |
0 |
T10 |
0 |
1347 |
0 |
0 |
T11 |
0 |
198 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T29 |
0 |
1903 |
0 |
0 |
T56 |
0 |
655 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1813 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T3 |
0 |
1 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T16 T27 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T27 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T27 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T16 T27 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T27 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T16 T27 T28
135 1/1 txn_bits_q <= '0;
Tests: T16 T27 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1085685 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
531 |
0 |
0 |
T16 |
337249 |
6495 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T27 |
0 |
7255 |
0 |
0 |
T28 |
0 |
8726 |
0 |
0 |
T58 |
0 |
8392 |
0 |
0 |
T59 |
0 |
6761 |
0 |
0 |
T60 |
0 |
1541 |
0 |
0 |
T61 |
0 |
6579 |
0 |
0 |
T62 |
0 |
6404 |
0 |
0 |
T63 |
0 |
5309 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1176 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
2 |
0 |
0 |
T16 |
337249 |
4 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T27 |
0 |
4 |
0 |
0 |
T28 |
0 |
5 |
0 |
0 |
T58 |
0 |
5 |
0 |
0 |
T59 |
0 |
4 |
0 |
0 |
T60 |
0 |
4 |
0 |
0 |
T61 |
0 |
4 |
0 |
0 |
T62 |
0 |
4 |
0 |
0 |
T63 |
0 |
3 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T16 T27 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T27 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T27 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T16 T27 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T27 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T16 T27 T28
135 1/1 txn_bits_q <= '0;
Tests: T16 T27 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
989431 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
266 |
0 |
0 |
T16 |
337249 |
4488 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T27 |
0 |
5287 |
0 |
0 |
T28 |
0 |
5025 |
0 |
0 |
T58 |
0 |
4930 |
0 |
0 |
T59 |
0 |
4793 |
0 |
0 |
T60 |
0 |
1039 |
0 |
0 |
T61 |
0 |
4693 |
0 |
0 |
T62 |
0 |
4407 |
0 |
0 |
T63 |
0 |
5282 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1110 |
0 |
0 |
T3 |
227326 |
0 |
0 |
0 |
T6 |
228052 |
0 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T16 |
337249 |
3 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T26 |
246037 |
0 |
0 |
0 |
T27 |
0 |
3 |
0 |
0 |
T28 |
0 |
3 |
0 |
0 |
T58 |
0 |
3 |
0 |
0 |
T59 |
0 |
3 |
0 |
0 |
T60 |
0 |
3 |
0 |
0 |
T61 |
0 |
3 |
0 |
0 |
T62 |
0 |
3 |
0 |
0 |
T63 |
0 |
3 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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 T8 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T8 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T8 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T8 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T8 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T8 T29
135 1/1 txn_bits_q <= '0;
Tests: T1 T8 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7079823 |
0 |
0 |
T1 |
68287 |
392 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1912 |
0 |
0 |
T12 |
0 |
3067 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
29196 |
0 |
0 |
T29 |
0 |
1917 |
0 |
0 |
T30 |
0 |
22132 |
0 |
0 |
T31 |
0 |
56014 |
0 |
0 |
T42 |
0 |
34790 |
0 |
0 |
T56 |
0 |
707 |
0 |
0 |
T91 |
0 |
379 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7155 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
0 |
11 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
87 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T42 |
0 |
85 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T91 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7000056 |
0 |
0 |
T12 |
651560 |
3019 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
23985 |
0 |
0 |
T30 |
0 |
21922 |
0 |
0 |
T31 |
0 |
55285 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
33715 |
0 |
0 |
T55 |
0 |
18245 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
55701 |
0 |
0 |
T93 |
0 |
20008 |
0 |
0 |
T94 |
0 |
82747 |
0 |
0 |
T95 |
0 |
111976 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7109 |
0 |
0 |
T12 |
651560 |
11 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
73 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
85 |
0 |
0 |
T55 |
0 |
11 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
70 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
51 |
0 |
0 |
T95 |
0 |
67 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
6811298 |
0 |
0 |
T12 |
651560 |
3016 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
28547 |
0 |
0 |
T30 |
0 |
21712 |
0 |
0 |
T31 |
0 |
54534 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
26723 |
0 |
0 |
T55 |
0 |
18211 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
51815 |
0 |
0 |
T93 |
0 |
19289 |
0 |
0 |
T94 |
0 |
82537 |
0 |
0 |
T95 |
0 |
107316 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
6952 |
0 |
0 |
T12 |
651560 |
11 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
87 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
69 |
0 |
0 |
T55 |
0 |
11 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
65 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
51 |
0 |
0 |
T95 |
0 |
65 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7095073 |
0 |
0 |
T12 |
651560 |
3030 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
19596 |
0 |
0 |
T30 |
0 |
21502 |
0 |
0 |
T31 |
0 |
53867 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
23353 |
0 |
0 |
T55 |
0 |
18264 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
60061 |
0 |
0 |
T93 |
0 |
18600 |
0 |
0 |
T94 |
0 |
82327 |
0 |
0 |
T95 |
0 |
158854 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7248 |
0 |
0 |
T12 |
651560 |
11 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
61 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
61 |
0 |
0 |
T55 |
0 |
11 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
76 |
0 |
0 |
T93 |
0 |
51 |
0 |
0 |
T94 |
0 |
51 |
0 |
0 |
T95 |
0 |
97 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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 T8 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T8 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T8 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T8 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T8 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T8 T29
135 1/1 txn_bits_q <= '0;
Tests: T1 T8 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1050096 |
0 |
0 |
T1 |
68287 |
387 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1897 |
0 |
0 |
T12 |
0 |
2377 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
758 |
0 |
0 |
T29 |
0 |
1915 |
0 |
0 |
T30 |
0 |
358 |
0 |
0 |
T31 |
0 |
1265 |
0 |
0 |
T42 |
0 |
1141 |
0 |
0 |
T56 |
0 |
701 |
0 |
0 |
T91 |
0 |
362 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1164 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
0 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
0 |
9 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
2 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T91 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1058432 |
0 |
0 |
T12 |
651560 |
2331 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
738 |
0 |
0 |
T30 |
0 |
348 |
0 |
0 |
T31 |
0 |
1232 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
1032 |
0 |
0 |
T55 |
0 |
14750 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
909 |
0 |
0 |
T93 |
0 |
443 |
0 |
0 |
T94 |
0 |
1428 |
0 |
0 |
T95 |
0 |
1864 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1190 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
1 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1061862 |
0 |
0 |
T12 |
651560 |
2324 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
718 |
0 |
0 |
T30 |
0 |
338 |
0 |
0 |
T31 |
0 |
1201 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
943 |
0 |
0 |
T55 |
0 |
14725 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
899 |
0 |
0 |
T93 |
0 |
418 |
0 |
0 |
T94 |
0 |
1418 |
0 |
0 |
T95 |
0 |
1828 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1177 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
1 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
993825 |
0 |
0 |
T12 |
651560 |
2332 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
698 |
0 |
0 |
T30 |
0 |
328 |
0 |
0 |
T31 |
0 |
1171 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
967 |
0 |
0 |
T55 |
0 |
14786 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
889 |
0 |
0 |
T93 |
0 |
392 |
0 |
0 |
T94 |
0 |
1408 |
0 |
0 |
T95 |
0 |
1777 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1157 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
T93 |
0 |
1 |
0 |
0 |
T94 |
0 |
1 |
0 |
0 |
T95 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T8
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7720264 |
0 |
0 |
T1 |
68287 |
367 |
0 |
0 |
T2 |
215378 |
1778 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1879 |
0 |
0 |
T9 |
0 |
1979 |
0 |
0 |
T10 |
0 |
1355 |
0 |
0 |
T12 |
0 |
2959 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
29358 |
0 |
0 |
T29 |
0 |
1911 |
0 |
0 |
T56 |
0 |
684 |
0 |
0 |
T57 |
0 |
1497 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7758 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
0 |
11 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
87 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7565438 |
0 |
0 |
T12 |
651560 |
2890 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
24119 |
0 |
0 |
T30 |
0 |
22018 |
0 |
0 |
T31 |
0 |
55615 |
0 |
0 |
T32 |
0 |
2032 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
998 |
0 |
0 |
T42 |
0 |
34226 |
0 |
0 |
T43 |
0 |
6300 |
0 |
0 |
T55 |
0 |
18056 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
55835 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7636 |
0 |
0 |
T12 |
651560 |
11 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
73 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
85 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
11 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
70 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7436977 |
0 |
0 |
T12 |
651560 |
2871 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
28709 |
0 |
0 |
T30 |
0 |
21808 |
0 |
0 |
T31 |
0 |
54881 |
0 |
0 |
T32 |
0 |
2022 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
994 |
0 |
0 |
T42 |
0 |
27180 |
0 |
0 |
T43 |
0 |
6185 |
0 |
0 |
T55 |
0 |
18008 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
51939 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7572 |
0 |
0 |
T12 |
651560 |
11 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
87 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
69 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
11 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
65 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7675970 |
0 |
0 |
T12 |
651560 |
2899 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
19706 |
0 |
0 |
T30 |
0 |
21598 |
0 |
0 |
T31 |
0 |
54169 |
0 |
0 |
T32 |
0 |
2012 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
990 |
0 |
0 |
T42 |
0 |
23690 |
0 |
0 |
T43 |
0 |
6092 |
0 |
0 |
T55 |
0 |
18068 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
60207 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
7812 |
0 |
0 |
T12 |
651560 |
11 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
61 |
0 |
0 |
T30 |
0 |
51 |
0 |
0 |
T31 |
0 |
51 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
61 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
11 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
76 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T8
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1625023 |
0 |
0 |
T1 |
68287 |
356 |
0 |
0 |
T2 |
215378 |
1776 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1868 |
0 |
0 |
T9 |
0 |
1965 |
0 |
0 |
T10 |
0 |
1353 |
0 |
0 |
T12 |
0 |
2265 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
750 |
0 |
0 |
T29 |
0 |
1909 |
0 |
0 |
T56 |
0 |
676 |
0 |
0 |
T57 |
0 |
1495 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1747 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
0 |
9 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
2 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1608605 |
0 |
0 |
T12 |
651560 |
2207 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
730 |
0 |
0 |
T30 |
0 |
344 |
0 |
0 |
T31 |
0 |
1217 |
0 |
0 |
T32 |
0 |
1992 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
982 |
0 |
0 |
T42 |
0 |
996 |
0 |
0 |
T43 |
0 |
5896 |
0 |
0 |
T55 |
0 |
14580 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
905 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1781 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1565163 |
0 |
0 |
T12 |
651560 |
2259 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
710 |
0 |
0 |
T30 |
0 |
334 |
0 |
0 |
T31 |
0 |
1188 |
0 |
0 |
T32 |
0 |
1982 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
978 |
0 |
0 |
T42 |
0 |
913 |
0 |
0 |
T43 |
0 |
5781 |
0 |
0 |
T55 |
0 |
14508 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
895 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1752 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1588395 |
0 |
0 |
T12 |
651560 |
2216 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
690 |
0 |
0 |
T30 |
0 |
324 |
0 |
0 |
T31 |
0 |
1161 |
0 |
0 |
T32 |
0 |
1972 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
974 |
0 |
0 |
T42 |
0 |
1156 |
0 |
0 |
T43 |
0 |
5668 |
0 |
0 |
T55 |
0 |
14590 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
885 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1784 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T8
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T8
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T8
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T8
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T8
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T8 |
1 | 1 | Covered | T1,T2,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T1,T2,T8 |
0 |
0 |
1 |
Covered |
T1,T2,T8 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1625910 |
0 |
0 |
T1 |
68287 |
350 |
0 |
0 |
T2 |
215378 |
1774 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1862 |
0 |
0 |
T9 |
0 |
1955 |
0 |
0 |
T10 |
0 |
1351 |
0 |
0 |
T12 |
0 |
2209 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
746 |
0 |
0 |
T29 |
0 |
1907 |
0 |
0 |
T56 |
0 |
669 |
0 |
0 |
T57 |
0 |
1493 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1778 |
0 |
0 |
T1 |
68287 |
1 |
0 |
0 |
T2 |
215378 |
1 |
0 |
0 |
T4 |
55930 |
0 |
0 |
0 |
T5 |
235905 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T12 |
0 |
9 |
0 |
0 |
T13 |
202586 |
0 |
0 |
0 |
T14 |
128132 |
0 |
0 |
0 |
T15 |
173596 |
0 |
0 |
0 |
T16 |
337249 |
0 |
0 |
0 |
T17 |
159909 |
0 |
0 |
0 |
T18 |
57201 |
0 |
0 |
0 |
T20 |
0 |
2 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1602494 |
0 |
0 |
T12 |
651560 |
2166 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
726 |
0 |
0 |
T30 |
0 |
342 |
0 |
0 |
T31 |
0 |
1206 |
0 |
0 |
T32 |
0 |
1952 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
966 |
0 |
0 |
T42 |
0 |
973 |
0 |
0 |
T43 |
0 |
5448 |
0 |
0 |
T55 |
0 |
14484 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
903 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1759 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1588585 |
0 |
0 |
T12 |
651560 |
2211 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
706 |
0 |
0 |
T30 |
0 |
332 |
0 |
0 |
T31 |
0 |
1180 |
0 |
0 |
T32 |
0 |
1942 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
962 |
0 |
0 |
T42 |
0 |
1011 |
0 |
0 |
T43 |
0 |
5352 |
0 |
0 |
T55 |
0 |
14431 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
893 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1775 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T12 T20 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T12 T20 T30
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T12 T20 T30
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T12 T20 T30
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T12 T20 T30
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T12 T20 T30
135 1/1 txn_bits_q <= '0;
Tests: T12 T20 T30
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T12,T20,T30 |
1 | 1 | Covered | T12,T20,T30 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T12,T20,T30 |
0 |
0 |
1 |
Covered |
T12,T20,T30 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1556427 |
0 |
0 |
T12 |
651560 |
2168 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
686 |
0 |
0 |
T30 |
0 |
322 |
0 |
0 |
T31 |
0 |
1151 |
0 |
0 |
T32 |
0 |
1932 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
958 |
0 |
0 |
T42 |
0 |
1135 |
0 |
0 |
T43 |
0 |
5267 |
0 |
0 |
T55 |
0 |
14503 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
883 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1752 |
0 |
0 |
T12 |
651560 |
9 |
0 |
0 |
T19 |
247972 |
0 |
0 |
0 |
T20 |
811870 |
2 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
1 |
0 |
0 |
T32 |
0 |
5 |
0 |
0 |
T38 |
64431 |
0 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T42 |
0 |
3 |
0 |
0 |
T43 |
0 |
14 |
0 |
0 |
T55 |
0 |
9 |
0 |
0 |
T66 |
31354 |
0 |
0 |
0 |
T67 |
84962 |
0 |
0 |
0 |
T68 |
110983 |
0 |
0 |
0 |
T80 |
224761 |
0 |
0 |
0 |
T89 |
63351 |
0 |
0 |
0 |
T90 |
65687 |
0 |
0 |
0 |
T92 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
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: T6 T12 T19
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T5
73 1/1 end else if (src_req) begin
Tests: T1 T4 T5
74 1/1 src_busy_q <= 1'b1;
Tests: T6 T12 T19
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T5
76 1/1 src_busy_q <= 1'b0;
Tests: T6 T12 T19
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T5
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T5
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T5
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T5
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T5
118 1/1 end else if (src_req) begin
Tests: T1 T4 T5
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T6 T12 T19
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T6 T12 T19
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T5
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T6 T12 T19
135 1/1 txn_bits_q <= '0;
Tests: T6 T12 T19
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T5
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T5
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T5
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T5
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Total | Covered | Percent |
Conditions | 13 | 12 | 92.31 |
Logical | 13 | 12 | 92.31 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T6,T12,T19 |
1 | - | Covered | T6,T12,T19 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T5 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T6,T12,T19 |
1 | 1 | Covered | T6,T12,T19 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T5 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T5 |
0 |
1 |
- |
Covered |
T6,T12,T19 |
0 |
0 |
1 |
Covered |
T6,T12,T19 |
0 |
0 |
0 |
Covered |
T1,T4,T5 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
863208 |
0 |
0 |
T6 |
228052 |
3421 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
1039 |
0 |
0 |
T19 |
0 |
7415 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
1614 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
1419 |
0 |
0 |
T70 |
0 |
1436 |
0 |
0 |
T71 |
0 |
1670 |
0 |
0 |
T72 |
0 |
3896 |
0 |
0 |
T73 |
0 |
612 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
200 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7625041 |
6956296 |
0 |
0 |
T1 |
505 |
105 |
0 |
0 |
T2 |
483 |
83 |
0 |
0 |
T4 |
447 |
47 |
0 |
0 |
T5 |
496 |
96 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
523 |
123 |
0 |
0 |
T15 |
708 |
308 |
0 |
0 |
T16 |
674 |
274 |
0 |
0 |
T17 |
1522 |
47 |
0 |
0 |
T18 |
497 |
97 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
972 |
0 |
0 |
T6 |
228052 |
2 |
0 |
0 |
T8 |
243794 |
0 |
0 |
0 |
T9 |
242589 |
0 |
0 |
0 |
T12 |
0 |
4 |
0 |
0 |
T19 |
0 |
4 |
0 |
0 |
T25 |
22809 |
0 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T64 |
192966 |
0 |
0 |
0 |
T65 |
171158 |
0 |
0 |
0 |
T69 |
0 |
4 |
0 |
0 |
T70 |
0 |
2 |
0 |
0 |
T71 |
0 |
4 |
0 |
0 |
T72 |
0 |
2 |
0 |
0 |
T73 |
0 |
4 |
0 |
0 |
T74 |
250973 |
0 |
0 |
0 |
T75 |
130915 |
0 |
0 |
0 |
T76 |
211853 |
0 |
0 |
0 |
T77 |
44667 |
0 |
0 |
0 |
T79 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1278357336 |
1277929763 |
0 |
0 |
T1 |
68287 |
68227 |
0 |
0 |
T2 |
215378 |
215323 |
0 |
0 |
T4 |
55930 |
55873 |
0 |
0 |
T5 |
235905 |
235818 |
0 |
0 |
T13 |
202586 |
202518 |
0 |
0 |
T14 |
128132 |
128047 |
0 |
0 |
T15 |
173596 |
173500 |
0 |
0 |
T16 |
337249 |
337169 |
0 |
0 |
T17 |
159909 |
158990 |
0 |
0 |
T18 |
57201 |
57150 |
0 |
0 |