Line Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T18
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T18
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T18
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T2 T18
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T18
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T18
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T18
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=16,ResetVal,BitMask=65535,DstWrReq=0,TxnWidth=3 + DataWidth=12,ResetVal=0,BitMask=4095,DstWrReq=0,TxnWidth=3 + DataWidth=8,ResetVal,BitMask=255,DstWrReq=0,TxnWidth=3 + DataWidth=14,ResetVal=0,BitMask=16383,DstWrReq=0,TxnWidth=3 + DataWidth=17,ResetVal=2000,BitMask=131071,DstWrReq=0,TxnWidth=3 + DataWidth=7,ResetVal=0,BitMask=119,DstWrReq=0,TxnWidth=3 + DataWidth=5,ResetVal=0,BitMask=31,DstWrReq=0,TxnWidth=3 + DataWidth=32,ResetVal=0,BitMask=-1,DstWrReq=0,TxnWidth=3 + DataWidth=4,ResetVal=0,BitMask=15,DstWrReq=0,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T13 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T1,T13 |
1 | 1 | Covered | T4,T1,T13 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T13 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T13 |
1 | 1 | Covered | T4,T1,T13 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=0,TxnWidth=3 + DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=1,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T9,T11 |
1 | 1 | Covered | T2,T9,T11 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T9,T11 |
1 | - | Covered | T2,T9,T11 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T2,T9,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T9,T11 |
1 | 1 | Covered | T2,T9,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T18 |
0 |
0 |
1 |
Covered |
T1,T2,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T2,T18 |
0 |
0 |
1 |
Covered |
T1,T2,T18 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
92828417 |
0 |
0 |
T1 |
20909 |
110 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T3 |
279170 |
0 |
0 |
0 |
T7 |
0 |
1956 |
0 |
0 |
T10 |
0 |
1972 |
0 |
0 |
T11 |
257847 |
2451 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
195681 |
2531 |
0 |
0 |
T16 |
79836 |
0 |
0 |
0 |
T17 |
290967 |
0 |
0 |
0 |
T18 |
321207 |
707 |
0 |
0 |
T19 |
181533 |
0 |
0 |
0 |
T20 |
324489 |
0 |
0 |
0 |
T24 |
204952 |
0 |
0 |
0 |
T27 |
271640 |
0 |
0 |
0 |
T28 |
158528 |
7733 |
0 |
0 |
T29 |
0 |
326 |
0 |
0 |
T30 |
0 |
5169 |
0 |
0 |
T31 |
0 |
599 |
0 |
0 |
T39 |
0 |
2463 |
0 |
0 |
T52 |
382773 |
14174 |
0 |
0 |
T53 |
243845 |
1985 |
0 |
0 |
T54 |
0 |
927 |
0 |
0 |
T55 |
0 |
683 |
0 |
0 |
T56 |
0 |
1939 |
0 |
0 |
T57 |
0 |
475 |
0 |
0 |
T58 |
0 |
2945 |
0 |
0 |
T59 |
0 |
13856 |
0 |
0 |
T60 |
0 |
2156 |
0 |
0 |
T61 |
0 |
14760 |
0 |
0 |
T62 |
422770 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
245486086 |
223716464 |
0 |
0 |
T1 |
17748 |
4148 |
0 |
0 |
T2 |
75650 |
62050 |
0 |
0 |
T4 |
16864 |
3264 |
0 |
0 |
T5 |
14382 |
782 |
0 |
0 |
T13 |
16966 |
3366 |
0 |
0 |
T14 |
13770 |
170 |
0 |
0 |
T15 |
22168 |
8568 |
0 |
0 |
T16 |
13872 |
272 |
0 |
0 |
T17 |
17816 |
4216 |
0 |
0 |
T18 |
15164 |
1564 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
104275 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T3 |
279170 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
257847 |
21 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
195681 |
7 |
0 |
0 |
T16 |
79836 |
0 |
0 |
0 |
T17 |
290967 |
0 |
0 |
0 |
T18 |
321207 |
1 |
0 |
0 |
T19 |
181533 |
0 |
0 |
0 |
T20 |
324489 |
0 |
0 |
0 |
T24 |
204952 |
0 |
0 |
0 |
T27 |
271640 |
0 |
0 |
0 |
T28 |
158528 |
8 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
12 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T52 |
382773 |
8 |
0 |
0 |
T53 |
243845 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T55 |
0 |
7 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
8 |
0 |
0 |
T59 |
0 |
8 |
0 |
0 |
T60 |
0 |
8 |
0 |
0 |
T61 |
0 |
9 |
0 |
0 |
T62 |
422770 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
710906 |
707880 |
0 |
0 |
T2 |
1509702 |
1507186 |
0 |
0 |
T4 |
2278714 |
2276436 |
0 |
0 |
T5 |
3595126 |
3592984 |
0 |
0 |
T13 |
1020170 |
1017620 |
0 |
0 |
T14 |
1726180 |
1724004 |
0 |
0 |
T15 |
2217718 |
2215610 |
0 |
0 |
T16 |
904808 |
902598 |
0 |
0 |
T17 |
3297626 |
3294770 |
0 |
0 |
T18 |
3640346 |
3638034 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T2 T9 T11
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T9 T11
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T9 T11
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T2 T9 T11
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T9 T11
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T9,T11 |
1 | 1 | Covered | T2,T9,T11 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T11,T30,T32 |
1 | - | Covered | T2,T9,T36 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T2,T9,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T9,T11 |
1 | 1 | Covered | T2,T9,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T11 |
0 |
0 |
1 |
Covered |
T2,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T11 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1081731 |
0 |
0 |
T2 |
44403 |
777 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
1700 |
0 |
0 |
T11 |
0 |
135 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
449 |
0 |
0 |
T31 |
0 |
533 |
0 |
0 |
T36 |
0 |
615 |
0 |
0 |
T37 |
0 |
630 |
0 |
0 |
T39 |
0 |
2022 |
0 |
0 |
T48 |
0 |
327 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T65 |
0 |
1315 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1085 |
0 |
0 |
T2 |
44403 |
3 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
2 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T36 |
0 |
2 |
0 |
0 |
T37 |
0 |
1 |
0 |
0 |
T39 |
0 |
5 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T65 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T18 T24
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T18 T24
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T18 T24
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T18 T24
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T18 T24
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T18 T24
135 1/1 txn_bits_q <= '0;
Tests: T1 T18 T24
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T18,T24 |
1 | 1 | Covered | T1,T18,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T18,T24 |
1 | 1 | Covered | T1,T18,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T24 |
0 |
0 |
1 |
Covered |
T1,T18,T24 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T24 |
0 |
0 |
1 |
Covered |
T1,T18,T24 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1746047 |
0 |
0 |
T1 |
20909 |
93 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1938 |
0 |
0 |
T10 |
0 |
1968 |
0 |
0 |
T11 |
0 |
141 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
700 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
0 |
465 |
0 |
0 |
T29 |
0 |
321 |
0 |
0 |
T51 |
0 |
298 |
0 |
0 |
T53 |
0 |
1972 |
0 |
0 |
T66 |
0 |
1900 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1839 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
1 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T51 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T2 T9 T25
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T9 T25
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T9 T25
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T2 T9 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T9 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T2 T9 T25
135 1/1 txn_bits_q <= '0;
Tests: T2 T9 T25
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T9,T25 |
1 | 1 | Covered | T2,T9,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T9,T25 |
1 | 1 | Covered | T2,T9,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T25 |
0 |
0 |
1 |
Covered |
T2,T9,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T25 |
0 |
0 |
1 |
Covered |
T2,T9,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1018232 |
0 |
0 |
T2 |
44403 |
794 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
1708 |
0 |
0 |
T11 |
0 |
141 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T25 |
0 |
166 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
479 |
0 |
0 |
T36 |
0 |
623 |
0 |
0 |
T48 |
0 |
338 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T67 |
0 |
2203 |
0 |
0 |
T68 |
0 |
488 |
0 |
0 |
T69 |
0 |
713 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1027 |
0 |
0 |
T2 |
44403 |
3 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
2 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T36 |
0 |
2 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T2 T9 T25
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T9 T25
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T9 T25
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T2 T9 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T9 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T2 T9 T25
135 1/1 txn_bits_q <= '0;
Tests: T2 T9 T25
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T9,T25 |
1 | 1 | Covered | T2,T9,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T9,T25 |
1 | 1 | Covered | T2,T9,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T25 |
0 |
0 |
1 |
Covered |
T2,T9,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T25 |
0 |
0 |
1 |
Covered |
T2,T9,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1011808 |
0 |
0 |
T2 |
44403 |
788 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
1704 |
0 |
0 |
T11 |
0 |
139 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T25 |
0 |
155 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
474 |
0 |
0 |
T36 |
0 |
619 |
0 |
0 |
T48 |
0 |
328 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T67 |
0 |
2199 |
0 |
0 |
T68 |
0 |
476 |
0 |
0 |
T69 |
0 |
710 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1017 |
0 |
0 |
T2 |
44403 |
3 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
2 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T36 |
0 |
2 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T2 T9 T25
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T9 T25
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T9 T25
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T2 T9 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T9 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T2 T9 T25
135 1/1 txn_bits_q <= '0;
Tests: T2 T9 T25
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T9,T25 |
1 | 1 | Covered | T2,T9,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T9,T25 |
1 | 1 | Covered | T2,T9,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T25 |
0 |
0 |
1 |
Covered |
T2,T9,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T25 |
0 |
0 |
1 |
Covered |
T2,T9,T25 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1015267 |
0 |
0 |
T2 |
44403 |
782 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
1700 |
0 |
0 |
T11 |
0 |
137 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T25 |
0 |
141 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
469 |
0 |
0 |
T36 |
0 |
615 |
0 |
0 |
T48 |
0 |
318 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T67 |
0 |
2195 |
0 |
0 |
T68 |
0 |
466 |
0 |
0 |
T69 |
0 |
708 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1012 |
0 |
0 |
T2 |
44403 |
3 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
2 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T25 |
0 |
2 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T36 |
0 |
2 |
0 |
0 |
T48 |
0 |
1 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T68 |
0 |
1 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T4 T13 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: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T13 T26
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T13 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: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T13 T26
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T13 T26
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T13 T26
135 1/1 txn_bits_q <= '0;
Tests: T4 T13 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: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T13,T26 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T13,T26 |
1 | 1 | Covered | T4,T13,T26 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T13,T26 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T13,T26 |
1 | 1 | Covered | T4,T13,T26 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T4,T13,T26 |
0 |
0 |
1 |
Covered |
T4,T13,T26 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T4,T13,T26 |
0 |
0 |
1 |
Covered |
T4,T13,T26 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
2049405 |
0 |
0 |
T1 |
20909 |
0 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T4 |
67021 |
9325 |
0 |
0 |
T5 |
105739 |
0 |
0 |
0 |
T13 |
30005 |
4060 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T26 |
0 |
7846 |
0 |
0 |
T64 |
0 |
8292 |
0 |
0 |
T70 |
0 |
2472 |
0 |
0 |
T71 |
0 |
16295 |
0 |
0 |
T72 |
0 |
5842 |
0 |
0 |
T73 |
0 |
15776 |
0 |
0 |
T74 |
0 |
32650 |
0 |
0 |
T75 |
0 |
34537 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
2306 |
0 |
0 |
T1 |
20909 |
0 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T4 |
67021 |
20 |
0 |
0 |
T5 |
105739 |
0 |
0 |
0 |
T13 |
30005 |
20 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T64 |
0 |
20 |
0 |
0 |
T70 |
0 |
20 |
0 |
0 |
T71 |
0 |
20 |
0 |
0 |
T72 |
0 |
20 |
0 |
0 |
T73 |
0 |
20 |
0 |
0 |
T74 |
0 |
20 |
0 |
0 |
T75 |
0 |
40 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T4 T13 T17
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T13 T17
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T13 T17
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T13 T17
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T13 T17
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T13 T17
135 1/1 txn_bits_q <= '0;
Tests: T4 T13 T17
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T13,T17 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T13,T17 |
1 | 1 | Covered | T4,T13,T17 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T13,T17 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T13,T17 |
1 | 1 | Covered | T4,T13,T17 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T4,T13,T17 |
0 |
0 |
1 |
Covered |
T4,T13,T17 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T4,T13,T17 |
0 |
0 |
1 |
Covered |
T4,T13,T17 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
3235046 |
0 |
0 |
T1 |
20909 |
0 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T4 |
67021 |
385 |
0 |
0 |
T5 |
105739 |
0 |
0 |
0 |
T13 |
30005 |
234 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
12243 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
0 |
7979 |
0 |
0 |
T26 |
0 |
438 |
0 |
0 |
T27 |
0 |
19100 |
0 |
0 |
T63 |
0 |
34926 |
0 |
0 |
T64 |
0 |
462 |
0 |
0 |
T76 |
0 |
34229 |
0 |
0 |
T77 |
0 |
16339 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
3928 |
0 |
0 |
T1 |
20909 |
0 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T4 |
67021 |
1 |
0 |
0 |
T5 |
105739 |
0 |
0 |
0 |
T13 |
30005 |
1 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
20 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
0 |
20 |
0 |
0 |
T26 |
0 |
1 |
0 |
0 |
T27 |
0 |
20 |
0 |
0 |
T63 |
0 |
20 |
0 |
0 |
T64 |
0 |
1 |
0 |
0 |
T76 |
0 |
20 |
0 |
0 |
T77 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T4 T1 T13
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T1 T13
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T1 T13
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T4 T1 T13
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T1 T13
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T4 T1 T13
135 1/1 txn_bits_q <= '0;
Tests: T4 T1 T13
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T13 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T4,T1,T13 |
1 | 1 | Covered | T4,T1,T13 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T1,T13 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T1,T13 |
1 | 1 | Covered | T4,T1,T13 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T4,T1,T13 |
0 |
0 |
1 |
Covered |
T4,T1,T13 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T4,T1,T13 |
0 |
0 |
1 |
Covered |
T4,T1,T13 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
4126019 |
0 |
0 |
T1 |
20909 |
87 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T4 |
67021 |
396 |
0 |
0 |
T5 |
105739 |
0 |
0 |
0 |
T7 |
0 |
1972 |
0 |
0 |
T13 |
30005 |
240 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
12682 |
0 |
0 |
T18 |
107069 |
718 |
0 |
0 |
T19 |
0 |
8059 |
0 |
0 |
T24 |
0 |
477 |
0 |
0 |
T26 |
0 |
441 |
0 |
0 |
T27 |
0 |
19180 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
4853 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T4 |
67021 |
1 |
0 |
0 |
T5 |
105739 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T13 |
30005 |
1 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
20 |
0 |
0 |
T18 |
107069 |
1 |
0 |
0 |
T19 |
0 |
20 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T26 |
0 |
1 |
0 |
0 |
T27 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T17 T19 T27
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T17 T19 T27
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T17 T19 T27
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T17 T19 T27
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T17 T19 T27
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T17 T19 T27
135 1/1 txn_bits_q <= '0;
Tests: T17 T19 T27
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T17,T19,T27 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T17,T19,T27 |
1 | 1 | Covered | T17,T19,T27 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T17,T19,T27 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T17,T19,T27 |
1 | 1 | Covered | T17,T19,T27 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T17,T19,T27 |
0 |
0 |
1 |
Covered |
T17,T19,T27 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T17,T19,T27 |
0 |
0 |
1 |
Covered |
T17,T19,T27 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
3220003 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T6 |
59801 |
0 |
0 |
0 |
T7 |
237509 |
0 |
0 |
0 |
T17 |
96989 |
12452 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
8019 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T27 |
135820 |
19140 |
0 |
0 |
T51 |
0 |
5368 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T63 |
0 |
34966 |
0 |
0 |
T71 |
0 |
16172 |
0 |
0 |
T76 |
0 |
34269 |
0 |
0 |
T77 |
0 |
16379 |
0 |
0 |
T78 |
0 |
7554 |
0 |
0 |
T79 |
0 |
33131 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
3871 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T6 |
59801 |
0 |
0 |
0 |
T7 |
237509 |
0 |
0 |
0 |
T17 |
96989 |
20 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
20 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T27 |
135820 |
20 |
0 |
0 |
T51 |
0 |
20 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T63 |
0 |
20 |
0 |
0 |
T71 |
0 |
20 |
0 |
0 |
T76 |
0 |
20 |
0 |
0 |
T77 |
0 |
20 |
0 |
0 |
T78 |
0 |
20 |
0 |
0 |
T79 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T3 T6 T8
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T8
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 T8
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T3 T6 T8
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T8
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T3 T6 T8
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 T8
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T8 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T3,T6,T8 |
1 | 1 | Covered | T3,T6,T8 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T8 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T8 |
1 | 1 | Covered | T3,T6,T8 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T3,T6,T8 |
0 |
0 |
1 |
Covered |
T3,T6,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T3,T6,T8 |
0 |
0 |
1 |
Covered |
T3,T6,T8 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
953825 |
0 |
0 |
T3 |
139585 |
719 |
0 |
0 |
T6 |
59801 |
371 |
0 |
0 |
T7 |
237509 |
0 |
0 |
0 |
T8 |
110305 |
749 |
0 |
0 |
T11 |
0 |
3352 |
0 |
0 |
T12 |
0 |
371 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T26 |
57028 |
0 |
0 |
0 |
T29 |
56310 |
0 |
0 |
0 |
T30 |
0 |
11665 |
0 |
0 |
T46 |
0 |
489 |
0 |
0 |
T49 |
0 |
203 |
0 |
0 |
T50 |
0 |
686 |
0 |
0 |
T51 |
0 |
300 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T80 |
21741 |
0 |
0 |
0 |
T81 |
101040 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1017 |
0 |
0 |
T3 |
139585 |
1 |
0 |
0 |
T6 |
59801 |
1 |
0 |
0 |
T7 |
237509 |
0 |
0 |
0 |
T8 |
110305 |
1 |
0 |
0 |
T11 |
0 |
28 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T26 |
57028 |
0 |
0 |
0 |
T29 |
56310 |
0 |
0 |
0 |
T30 |
0 |
28 |
0 |
0 |
T46 |
0 |
1 |
0 |
0 |
T49 |
0 |
1 |
0 |
0 |
T50 |
0 |
1 |
0 |
0 |
T51 |
0 |
1 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T80 |
21741 |
0 |
0 |
0 |
T81 |
101040 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T18 T3
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T18 T3
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T18 T3
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T18 T3
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T18 T3
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T18 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T18 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T3 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T18,T3 |
1 | 1 | Covered | T1,T18,T3 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T3 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T18,T3 |
1 | 1 | Covered | T1,T18,T3 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T3 |
0 |
0 |
1 |
Covered |
T1,T18,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T3 |
0 |
0 |
1 |
Covered |
T1,T18,T3 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1749705 |
0 |
0 |
T1 |
20909 |
87 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T3 |
0 |
717 |
0 |
0 |
T6 |
0 |
363 |
0 |
0 |
T7 |
0 |
1933 |
0 |
0 |
T8 |
0 |
747 |
0 |
0 |
T10 |
0 |
1966 |
0 |
0 |
T11 |
0 |
270 |
0 |
0 |
T12 |
0 |
369 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
693 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
315 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1853 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T3 |
0 |
1 |
0 |
0 |
T6 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
2 |
0 |
0 |
T12 |
0 |
1 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
1 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T15 T11 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T15 T11 T28
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T15 T11 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T15 T11 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T15 T11 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T15 T11 T28
135 1/1 txn_bits_q <= '0;
Tests: T15 T11 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T11,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T15,T11,T28 |
1 | 1 | Covered | T15,T11,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T11,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T15,T11,T28 |
1 | 1 | Covered | T15,T11,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T15,T11,T28 |
0 |
0 |
1 |
Covered |
T15,T11,T28 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T15,T11,T28 |
0 |
0 |
1 |
Covered |
T15,T11,T28 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1231225 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T11 |
0 |
282 |
0 |
0 |
T15 |
65227 |
1476 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T28 |
0 |
4743 |
0 |
0 |
T30 |
0 |
955 |
0 |
0 |
T52 |
0 |
8806 |
0 |
0 |
T55 |
0 |
403 |
0 |
0 |
T58 |
0 |
1902 |
0 |
0 |
T59 |
0 |
8617 |
0 |
0 |
T60 |
0 |
1344 |
0 |
0 |
T61 |
0 |
9863 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1223 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T11 |
0 |
2 |
0 |
0 |
T15 |
65227 |
4 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T28 |
0 |
5 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T52 |
0 |
5 |
0 |
0 |
T55 |
0 |
4 |
0 |
0 |
T58 |
0 |
5 |
0 |
0 |
T59 |
0 |
5 |
0 |
0 |
T60 |
0 |
5 |
0 |
0 |
T61 |
0 |
6 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T15 T11 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T15 T11 T28
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T15 T11 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T15 T11 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T15 T11 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T15 T11 T28
135 1/1 txn_bits_q <= '0;
Tests: T15 T11 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T11,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T15,T11,T28 |
1 | 1 | Covered | T15,T11,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T11,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T15,T11,T28 |
1 | 1 | Covered | T15,T11,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T15,T11,T28 |
0 |
0 |
1 |
Covered |
T15,T11,T28 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T15,T11,T28 |
0 |
0 |
1 |
Covered |
T15,T11,T28 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1064588 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T11 |
0 |
141 |
0 |
0 |
T15 |
65227 |
1055 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T28 |
0 |
2990 |
0 |
0 |
T30 |
0 |
480 |
0 |
0 |
T52 |
0 |
5368 |
0 |
0 |
T55 |
0 |
280 |
0 |
0 |
T58 |
0 |
1043 |
0 |
0 |
T59 |
0 |
5239 |
0 |
0 |
T60 |
0 |
812 |
0 |
0 |
T61 |
0 |
4897 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1066 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T15 |
65227 |
3 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T24 |
102476 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T28 |
0 |
3 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T52 |
0 |
3 |
0 |
0 |
T55 |
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 |
211385 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T29 T10
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T29 T10
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T29 T10
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T29 T10
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T29 T10
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T29 T10
135 1/1 txn_bits_q <= '0;
Tests: T1 T29 T10
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T29,T10 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T29,T10 |
1 | 1 | Covered | T1,T29,T10 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T29,T10 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T29,T10 |
1 | 1 | Covered | T1,T29,T10 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T29,T10 |
0 |
0 |
1 |
Covered |
T1,T29,T10 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T29,T10 |
0 |
0 |
1 |
Covered |
T1,T29,T10 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6060764 |
0 |
0 |
T1 |
20909 |
99 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T10 |
0 |
1980 |
0 |
0 |
T11 |
0 |
1353 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
340 |
0 |
0 |
T30 |
0 |
4781 |
0 |
0 |
T31 |
0 |
19149 |
0 |
0 |
T37 |
0 |
57791 |
0 |
0 |
T56 |
0 |
1979 |
0 |
0 |
T82 |
0 |
494 |
0 |
0 |
T83 |
0 |
58391 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7003 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
11 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
62 |
0 |
0 |
T37 |
0 |
78 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T82 |
0 |
1 |
0 |
0 |
T83 |
0 |
81 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6102191 |
0 |
0 |
T11 |
257847 |
1347 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
4718 |
0 |
0 |
T31 |
0 |
16060 |
0 |
0 |
T37 |
0 |
60100 |
0 |
0 |
T38 |
0 |
49994 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
48484 |
0 |
0 |
T84 |
0 |
27481 |
0 |
0 |
T85 |
0 |
30048 |
0 |
0 |
T86 |
0 |
12603 |
0 |
0 |
T87 |
0 |
54867 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7098 |
0 |
0 |
T11 |
257847 |
11 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
53 |
0 |
0 |
T37 |
0 |
82 |
0 |
0 |
T38 |
0 |
54 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
68 |
0 |
0 |
T84 |
0 |
71 |
0 |
0 |
T85 |
0 |
73 |
0 |
0 |
T86 |
0 |
69 |
0 |
0 |
T87 |
0 |
56 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
5921813 |
0 |
0 |
T11 |
257847 |
1347 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
4725 |
0 |
0 |
T31 |
0 |
17078 |
0 |
0 |
T37 |
0 |
45373 |
0 |
0 |
T38 |
0 |
65782 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
46642 |
0 |
0 |
T84 |
0 |
18950 |
0 |
0 |
T85 |
0 |
24004 |
0 |
0 |
T86 |
0 |
14688 |
0 |
0 |
T87 |
0 |
53506 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6941 |
0 |
0 |
T11 |
257847 |
11 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
57 |
0 |
0 |
T37 |
0 |
63 |
0 |
0 |
T38 |
0 |
71 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
66 |
0 |
0 |
T84 |
0 |
52 |
0 |
0 |
T85 |
0 |
59 |
0 |
0 |
T86 |
0 |
82 |
0 |
0 |
T87 |
0 |
56 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
5956314 |
0 |
0 |
T11 |
257847 |
1347 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
4736 |
0 |
0 |
T31 |
0 |
18427 |
0 |
0 |
T37 |
0 |
46923 |
0 |
0 |
T38 |
0 |
76445 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
57563 |
0 |
0 |
T84 |
0 |
25020 |
0 |
0 |
T85 |
0 |
34689 |
0 |
0 |
T86 |
0 |
13224 |
0 |
0 |
T87 |
0 |
63350 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7100 |
0 |
0 |
T11 |
257847 |
11 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
62 |
0 |
0 |
T37 |
0 |
66 |
0 |
0 |
T38 |
0 |
83 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
81 |
0 |
0 |
T84 |
0 |
71 |
0 |
0 |
T85 |
0 |
85 |
0 |
0 |
T86 |
0 |
74 |
0 |
0 |
T87 |
0 |
69 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T29 T10
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T29 T10
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T29 T10
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T29 T10
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T29 T10
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T29 T10
135 1/1 txn_bits_q <= '0;
Tests: T1 T29 T10
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T29,T10 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T29,T10 |
1 | 1 | Covered | T1,T29,T10 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T29,T10 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T29,T10 |
1 | 1 | Covered | T1,T29,T10 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T29,T10 |
0 |
0 |
1 |
Covered |
T1,T29,T10 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T29,T10 |
0 |
0 |
1 |
Covered |
T1,T29,T10 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1236060 |
0 |
0 |
T1 |
20909 |
90 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T10 |
0 |
1978 |
0 |
0 |
T11 |
0 |
1053 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
336 |
0 |
0 |
T30 |
0 |
3993 |
0 |
0 |
T31 |
0 |
627 |
0 |
0 |
T37 |
0 |
1273 |
0 |
0 |
T56 |
0 |
1966 |
0 |
0 |
T82 |
0 |
483 |
0 |
0 |
T83 |
0 |
839 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1294 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
9 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T82 |
0 |
1 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1208712 |
0 |
0 |
T11 |
257847 |
1047 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3925 |
0 |
0 |
T31 |
0 |
607 |
0 |
0 |
T37 |
0 |
1209 |
0 |
0 |
T38 |
0 |
3333 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
829 |
0 |
0 |
T84 |
0 |
838 |
0 |
0 |
T85 |
0 |
817 |
0 |
0 |
T86 |
0 |
1119 |
0 |
0 |
T87 |
0 |
5880 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1283 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T85 |
0 |
2 |
0 |
0 |
T86 |
0 |
7 |
0 |
0 |
T87 |
0 |
6 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1186762 |
0 |
0 |
T11 |
257847 |
1047 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3916 |
0 |
0 |
T31 |
0 |
587 |
0 |
0 |
T37 |
0 |
1137 |
0 |
0 |
T38 |
0 |
3293 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
819 |
0 |
0 |
T84 |
0 |
845 |
0 |
0 |
T85 |
0 |
797 |
0 |
0 |
T86 |
0 |
1271 |
0 |
0 |
T87 |
0 |
5575 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1278 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T85 |
0 |
2 |
0 |
0 |
T86 |
0 |
7 |
0 |
0 |
T87 |
0 |
6 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1247364 |
0 |
0 |
T11 |
257847 |
1047 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3953 |
0 |
0 |
T31 |
0 |
567 |
0 |
0 |
T37 |
0 |
1053 |
0 |
0 |
T38 |
0 |
3253 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
809 |
0 |
0 |
T84 |
0 |
866 |
0 |
0 |
T85 |
0 |
777 |
0 |
0 |
T86 |
0 |
1222 |
0 |
0 |
T87 |
0 |
5261 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1335 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T85 |
0 |
2 |
0 |
0 |
T86 |
0 |
7 |
0 |
0 |
T87 |
0 |
6 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T18 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T18 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T18 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T18 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T18 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T18 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T18 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T18,T7 |
1 | 1 | Covered | T1,T18,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T18,T7 |
1 | 1 | Covered | T1,T18,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T7 |
0 |
0 |
1 |
Covered |
T1,T18,T7 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T7 |
0 |
0 |
1 |
Covered |
T1,T18,T7 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6593696 |
0 |
0 |
T1 |
20909 |
121 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1965 |
0 |
0 |
T10 |
0 |
1974 |
0 |
0 |
T11 |
0 |
1317 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
713 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
332 |
0 |
0 |
T53 |
0 |
1990 |
0 |
0 |
T54 |
0 |
937 |
0 |
0 |
T56 |
0 |
1949 |
0 |
0 |
T57 |
0 |
487 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7474 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
11 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
1 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6591308 |
0 |
0 |
T11 |
257847 |
1311 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
4538 |
0 |
0 |
T31 |
0 |
16154 |
0 |
0 |
T37 |
0 |
60614 |
0 |
0 |
T38 |
0 |
50078 |
0 |
0 |
T39 |
0 |
2511 |
0 |
0 |
T40 |
0 |
2101 |
0 |
0 |
T41 |
0 |
2863 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
48614 |
0 |
0 |
T84 |
0 |
28181 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7552 |
0 |
0 |
T11 |
257847 |
11 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
53 |
0 |
0 |
T37 |
0 |
82 |
0 |
0 |
T38 |
0 |
54 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
68 |
0 |
0 |
T84 |
0 |
71 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6400082 |
0 |
0 |
T11 |
257847 |
1311 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
4656 |
0 |
0 |
T31 |
0 |
17180 |
0 |
0 |
T37 |
0 |
45790 |
0 |
0 |
T38 |
0 |
65900 |
0 |
0 |
T39 |
0 |
2499 |
0 |
0 |
T40 |
0 |
1995 |
0 |
0 |
T41 |
0 |
2849 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
46768 |
0 |
0 |
T84 |
0 |
19674 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7392 |
0 |
0 |
T11 |
257847 |
11 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
57 |
0 |
0 |
T37 |
0 |
63 |
0 |
0 |
T38 |
0 |
71 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
66 |
0 |
0 |
T84 |
0 |
52 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
6424481 |
0 |
0 |
T11 |
257847 |
1311 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
4572 |
0 |
0 |
T31 |
0 |
18539 |
0 |
0 |
T37 |
0 |
47350 |
0 |
0 |
T38 |
0 |
76587 |
0 |
0 |
T39 |
0 |
2487 |
0 |
0 |
T40 |
0 |
1891 |
0 |
0 |
T41 |
0 |
2835 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
57719 |
0 |
0 |
T84 |
0 |
25777 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
7511 |
0 |
0 |
T11 |
257847 |
11 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
62 |
0 |
0 |
T37 |
0 |
66 |
0 |
0 |
T38 |
0 |
83 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
81 |
0 |
0 |
T84 |
0 |
71 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T18 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T18 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T18 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T18 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T18 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T18 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T18 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T18,T7 |
1 | 1 | Covered | T1,T18,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T18,T7 |
1 | 1 | Covered | T1,T18,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T7 |
0 |
0 |
1 |
Covered |
T1,T18,T7 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T7 |
0 |
0 |
1 |
Covered |
T1,T18,T7 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1691702 |
0 |
0 |
T1 |
20909 |
110 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1956 |
0 |
0 |
T10 |
0 |
1972 |
0 |
0 |
T11 |
0 |
1017 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
707 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
326 |
0 |
0 |
T53 |
0 |
1985 |
0 |
0 |
T54 |
0 |
927 |
0 |
0 |
T56 |
0 |
1939 |
0 |
0 |
T57 |
0 |
475 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1750 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
9 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
1 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1698657 |
0 |
0 |
T11 |
257847 |
1011 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3734 |
0 |
0 |
T31 |
0 |
599 |
0 |
0 |
T37 |
0 |
1183 |
0 |
0 |
T38 |
0 |
3317 |
0 |
0 |
T39 |
0 |
2463 |
0 |
0 |
T40 |
0 |
1919 |
0 |
0 |
T41 |
0 |
2807 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
825 |
0 |
0 |
T84 |
0 |
801 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1756 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1719043 |
0 |
0 |
T11 |
257847 |
1011 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3831 |
0 |
0 |
T31 |
0 |
579 |
0 |
0 |
T37 |
0 |
1108 |
0 |
0 |
T38 |
0 |
3277 |
0 |
0 |
T39 |
0 |
2451 |
0 |
0 |
T40 |
0 |
1974 |
0 |
0 |
T41 |
0 |
2793 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
815 |
0 |
0 |
T84 |
0 |
927 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1770 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1676672 |
0 |
0 |
T11 |
257847 |
1011 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3767 |
0 |
0 |
T31 |
0 |
559 |
0 |
0 |
T37 |
0 |
1026 |
0 |
0 |
T38 |
0 |
3237 |
0 |
0 |
T39 |
0 |
2439 |
0 |
0 |
T40 |
0 |
2028 |
0 |
0 |
T41 |
0 |
2779 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
805 |
0 |
0 |
T84 |
0 |
830 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1732 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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 T18 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T18 T7
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T18 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T18 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T18 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T18 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T18 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T1,T18,T7 |
1 | 1 | Covered | T1,T18,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T18,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T18,T7 |
1 | 1 | Covered | T1,T18,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T7 |
0 |
0 |
1 |
Covered |
T1,T18,T7 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T1,T18,T7 |
0 |
0 |
1 |
Covered |
T1,T18,T7 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1696439 |
0 |
0 |
T1 |
20909 |
102 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1946 |
0 |
0 |
T10 |
0 |
1970 |
0 |
0 |
T11 |
0 |
999 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
704 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
324 |
0 |
0 |
T53 |
0 |
1983 |
0 |
0 |
T54 |
0 |
915 |
0 |
0 |
T56 |
0 |
1921 |
0 |
0 |
T57 |
0 |
467 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1758 |
0 |
0 |
T1 |
20909 |
1 |
0 |
0 |
T2 |
44403 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
9 |
0 |
0 |
T13 |
30005 |
0 |
0 |
0 |
T14 |
50770 |
0 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
1 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T56 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1656391 |
0 |
0 |
T11 |
257847 |
993 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3629 |
0 |
0 |
T31 |
0 |
595 |
0 |
0 |
T37 |
0 |
1165 |
0 |
0 |
T38 |
0 |
3309 |
0 |
0 |
T39 |
0 |
2415 |
0 |
0 |
T40 |
0 |
1915 |
0 |
0 |
T41 |
0 |
2751 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
823 |
0 |
0 |
T84 |
0 |
774 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1731 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T51 T30
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1697879 |
0 |
0 |
T11 |
257847 |
993 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3743 |
0 |
0 |
T31 |
0 |
575 |
0 |
0 |
T37 |
0 |
1093 |
0 |
0 |
T38 |
0 |
3269 |
0 |
0 |
T39 |
0 |
2403 |
0 |
0 |
T40 |
0 |
1927 |
0 |
0 |
T41 |
0 |
2737 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
813 |
0 |
0 |
T84 |
0 |
906 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1762 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
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: T11 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T11 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T11 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T11 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T11 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T11 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T11 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T11,T30,T31 |
1 | 1 | Covered | T11,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T11,T30,T31 |
0 |
0 |
1 |
Covered |
T11,T30,T31 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1597254 |
0 |
0 |
T11 |
257847 |
993 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
3781 |
0 |
0 |
T31 |
0 |
555 |
0 |
0 |
T37 |
0 |
1010 |
0 |
0 |
T38 |
0 |
3229 |
0 |
0 |
T39 |
0 |
2391 |
0 |
0 |
T40 |
0 |
1884 |
0 |
0 |
T41 |
0 |
2723 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
803 |
0 |
0 |
T84 |
0 |
801 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1684 |
0 |
0 |
T11 |
257847 |
9 |
0 |
0 |
T12 |
75723 |
0 |
0 |
0 |
T28 |
158528 |
0 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
2 |
0 |
0 |
T37 |
0 |
2 |
0 |
0 |
T38 |
0 |
4 |
0 |
0 |
T39 |
0 |
6 |
0 |
0 |
T40 |
0 |
12 |
0 |
0 |
T41 |
0 |
7 |
0 |
0 |
T51 |
295071 |
0 |
0 |
0 |
T52 |
382773 |
0 |
0 |
0 |
T53 |
243845 |
0 |
0 |
0 |
T54 |
106463 |
0 |
0 |
0 |
T63 |
250987 |
0 |
0 |
0 |
T64 |
59626 |
0 |
0 |
0 |
T83 |
0 |
1 |
0 |
0 |
T84 |
0 |
2 |
0 |
0 |
T88 |
466832 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T2 T9 T11
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
72 1/1 src_busy_q <= '0;
Tests: T4 T5 T1
73 1/1 end else if (src_req) begin
Tests: T4 T5 T1
74 1/1 src_busy_q <= 1'b1;
Tests: T2 T9 T11
75 1/1 end else if (src_ack) begin
Tests: T4 T5 T1
76 1/1 src_busy_q <= 1'b0;
Tests: T2 T9 T11
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T4 T5 T1
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T4 T5 T1
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T4 T5 T1
116 1/1 src_q <= ResetVal;
Tests: T4 T5 T1
117 1/1 txn_bits_q <= '0;
Tests: T4 T5 T1
118 1/1 end else if (src_req) begin
Tests: T4 T5 T1
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T2 T9 T11
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T2 T9 T11
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T4 T5 T1
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T2 T9 T11
135 1/1 txn_bits_q <= '0;
Tests: T2 T9 T11
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T4 T5 T1
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T4 T5 T1
156 1/1 assign dst_wd_o = src_q;
Tests: T4 T5 T1
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T4 T5 T1
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Total | Covered | Percent |
Conditions | 13 | 12 | 92.31 |
Logical | 13 | 12 | 92.31 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T11 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Covered | T2,T9,T11 |
1 | 1 | Covered | T2,T9,T11 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T2,T9,T11 |
1 | - | Covered | T2,T9,T11 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T4,T5,T1 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T2,T9,T11 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T2,T9,T11 |
1 | 1 | Covered | T2,T9,T11 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T4,T5,T1 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T11 |
0 |
0 |
1 |
Covered |
T2,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T4,T5,T1 |
0 |
1 |
- |
Covered |
T2,T9,T11 |
0 |
0 |
1 |
Covered |
T2,T9,T11 |
0 |
0 |
0 |
Covered |
T4,T5,T1 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
961932 |
0 |
0 |
T2 |
44403 |
1664 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
3170 |
0 |
0 |
T11 |
0 |
447 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
1625 |
0 |
0 |
T36 |
0 |
1337 |
0 |
0 |
T48 |
0 |
696 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T65 |
0 |
2459 |
0 |
0 |
T67 |
0 |
1261 |
0 |
0 |
T89 |
0 |
2960 |
0 |
0 |
T90 |
0 |
3947 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
7220179 |
6579896 |
0 |
0 |
T1 |
522 |
122 |
0 |
0 |
T2 |
2225 |
1825 |
0 |
0 |
T4 |
496 |
96 |
0 |
0 |
T5 |
423 |
23 |
0 |
0 |
T13 |
499 |
99 |
0 |
0 |
T14 |
405 |
5 |
0 |
0 |
T15 |
652 |
252 |
0 |
0 |
T16 |
408 |
8 |
0 |
0 |
T17 |
524 |
124 |
0 |
0 |
T18 |
446 |
46 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
974 |
0 |
0 |
T2 |
44403 |
6 |
0 |
0 |
T3 |
139585 |
0 |
0 |
0 |
T9 |
0 |
4 |
0 |
0 |
T11 |
0 |
4 |
0 |
0 |
T15 |
65227 |
0 |
0 |
0 |
T16 |
26612 |
0 |
0 |
0 |
T17 |
96989 |
0 |
0 |
0 |
T18 |
107069 |
0 |
0 |
0 |
T19 |
60511 |
0 |
0 |
0 |
T20 |
108163 |
0 |
0 |
0 |
T27 |
135820 |
0 |
0 |
0 |
T30 |
0 |
4 |
0 |
0 |
T36 |
0 |
4 |
0 |
0 |
T48 |
0 |
2 |
0 |
0 |
T62 |
211385 |
0 |
0 |
0 |
T65 |
0 |
4 |
0 |
0 |
T67 |
0 |
1 |
0 |
0 |
T89 |
0 |
2 |
0 |
0 |
T90 |
0 |
2 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1030104216 |
1029681221 |
0 |
0 |
T1 |
20909 |
20820 |
0 |
0 |
T2 |
44403 |
44329 |
0 |
0 |
T4 |
67021 |
66954 |
0 |
0 |
T5 |
105739 |
105676 |
0 |
0 |
T13 |
30005 |
29930 |
0 |
0 |
T14 |
50770 |
50706 |
0 |
0 |
T15 |
65227 |
65165 |
0 |
0 |
T16 |
26612 |
26547 |
0 |
0 |
T17 |
96989 |
96905 |
0 |
0 |
T18 |
107069 |
107001 |
0 |
0 |