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 T14
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T14
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T14
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T14
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T14
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T14
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T14
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=16,ResetVal,BitMask=65535,DstWrReq=0,TxnWidth=3 + DataWidth=12,ResetVal=0,BitMask=4095,DstWrReq=0,TxnWidth=3 + DataWidth=8,ResetVal,BitMask=255,DstWrReq=0,TxnWidth=3 + DataWidth=14,ResetVal=0,BitMask=16383,DstWrReq=0,TxnWidth=3 + DataWidth=17,ResetVal=2000,BitMask=131071,DstWrReq=0,TxnWidth=3 + DataWidth=7,ResetVal=0,BitMask=119,DstWrReq=0,TxnWidth=3 + DataWidth=5,ResetVal=0,BitMask=31,DstWrReq=0,TxnWidth=3 + DataWidth=32,ResetVal=0,BitMask=-1,DstWrReq=0,TxnWidth=3 + DataWidth=4,ResetVal=0,BitMask=15,DstWrReq=0,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T4,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T4,T2 |
1 | 1 | Covered | T1,T4,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T4,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T4,T2 |
1 | 1 | Covered | T1,T4,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Cond Coverage for Module :
prim_reg_cdc ( parameter DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=0,TxnWidth=3 + DataWidth=1,ResetVal=0,BitMask=1,DstWrReq=1,TxnWidth=3 )
Cond Coverage for Module self-instances :
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T3,T6,T24 |
1 | 1 | Covered | T3,T6,T24 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T3,T6,T24 |
1 | - | Covered | T3,T6,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T3,T6,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T24 |
1 | 1 | Covered | T3,T6,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Module :
prim_reg_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T14 |
0 |
0 |
1 |
Covered |
T1,T2,T14 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T14 |
0 |
0 |
1 |
Covered |
T1,T2,T14 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Module :
prim_reg_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
86957552 |
0 |
0 |
T1 |
63618 |
445 |
0 |
0 |
T2 |
118961 |
730 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T5 |
422538 |
0 |
0 |
0 |
T6 |
183432 |
0 |
0 |
0 |
T7 |
241868 |
190 |
0 |
0 |
T8 |
46670 |
123 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
482706 |
5758 |
0 |
0 |
T17 |
98130 |
0 |
0 |
0 |
T24 |
845686 |
8983 |
0 |
0 |
T25 |
209948 |
0 |
0 |
0 |
T26 |
501596 |
0 |
0 |
0 |
T27 |
0 |
3056 |
0 |
0 |
T28 |
0 |
2804 |
0 |
0 |
T29 |
0 |
711 |
0 |
0 |
T30 |
0 |
5463 |
0 |
0 |
T31 |
0 |
1688 |
0 |
0 |
T37 |
0 |
2372 |
0 |
0 |
T53 |
0 |
1968 |
0 |
0 |
T54 |
0 |
83 |
0 |
0 |
T55 |
0 |
492 |
0 |
0 |
T56 |
0 |
3234 |
0 |
0 |
T57 |
0 |
1960 |
0 |
0 |
T58 |
0 |
132 |
0 |
0 |
T59 |
0 |
9490 |
0 |
0 |
T60 |
0 |
2549 |
0 |
0 |
T61 |
0 |
13365 |
0 |
0 |
T62 |
121876 |
0 |
0 |
0 |
T63 |
410232 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
171556588 |
149408818 |
0 |
0 |
T1 |
17306 |
3706 |
0 |
0 |
T2 |
16490 |
2890 |
0 |
0 |
T3 |
59670 |
46070 |
0 |
0 |
T4 |
17340 |
3740 |
0 |
0 |
T12 |
15300 |
1700 |
0 |
0 |
T13 |
14348 |
748 |
0 |
0 |
T14 |
25874 |
12274 |
0 |
0 |
T15 |
16728 |
3128 |
0 |
0 |
T16 |
22780 |
9180 |
0 |
0 |
T17 |
13872 |
272 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
103346 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T5 |
422538 |
0 |
0 |
0 |
T6 |
183432 |
0 |
0 |
0 |
T7 |
241868 |
1 |
0 |
0 |
T8 |
46670 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
482706 |
6 |
0 |
0 |
T17 |
98130 |
0 |
0 |
0 |
T24 |
845686 |
21 |
0 |
0 |
T25 |
209948 |
0 |
0 |
0 |
T26 |
501596 |
0 |
0 |
0 |
T27 |
0 |
7 |
0 |
0 |
T28 |
0 |
7 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
12 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T56 |
0 |
8 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T59 |
0 |
6 |
0 |
0 |
T60 |
0 |
6 |
0 |
0 |
T61 |
0 |
8 |
0 |
0 |
T62 |
121876 |
0 |
0 |
0 |
T63 |
410232 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
2147483647 |
2147483647 |
0 |
0 |
T1 |
2163012 |
2160836 |
0 |
0 |
T2 |
4044674 |
4041648 |
0 |
0 |
T3 |
3995306 |
3992790 |
0 |
0 |
T4 |
1042100 |
1039516 |
0 |
0 |
T12 |
1762220 |
1759160 |
0 |
0 |
T13 |
7188586 |
7186002 |
0 |
0 |
T14 |
3108008 |
3105492 |
0 |
0 |
T15 |
8286548 |
8284032 |
0 |
0 |
T16 |
5470668 |
5467880 |
0 |
0 |
T17 |
1112140 |
1109964 |
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: T3 T6 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: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T18
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 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: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T18
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T18
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T2 T3
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T3
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Total | Covered | Percent |
Conditions | 16 | 14 | 87.50 |
Logical | 16 | 14 | 87.50 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T18 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T3,T6,T18 |
1 | 1 | Covered | T3,T6,T18 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T30,T33,T34 |
1 | - | Covered | T3,T6,T18 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Covered | T1,T2,T3 |
1 | 0 | Covered | T3,T6,T18 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T18 |
1 | 1 | Covered | T3,T6,T18 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Not Covered | |
1 | 1 | Covered | T1,T2,T3 |
Branch Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T18 |
0 |
0 |
1 |
Covered |
T3,T6,T18 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T18 |
0 |
0 |
1 |
Covered |
T1,T2,T3 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_wkup_status_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1069782 |
0 |
0 |
T3 |
117509 |
757 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
1594 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1872 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
508 |
0 |
0 |
T37 |
0 |
1622 |
0 |
0 |
T40 |
0 |
232 |
0 |
0 |
T58 |
0 |
65 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
266 |
0 |
0 |
T67 |
0 |
333 |
0 |
0 |
T68 |
0 |
2428 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1012 |
0 |
0 |
T3 |
117509 |
1 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
3 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T37 |
0 |
5 |
0 |
0 |
T40 |
0 |
2 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T67 |
0 |
1 |
0 |
0 |
T68 |
0 |
3 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T14
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T14
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T14
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T14
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T14
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T14
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T14
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T14 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T2,T14 |
1 | 1 | Covered | T1,T2,T14 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T14 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T14 |
1 | 1 | Covered | T1,T2,T14 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T14 |
0 |
0 |
1 |
Covered |
T1,T2,T14 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T14 |
0 |
0 |
1 |
Covered |
T1,T2,T14 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_ec_rst_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1471751 |
0 |
0 |
T1 |
63618 |
441 |
0 |
0 |
T2 |
118961 |
726 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
186 |
0 |
0 |
T8 |
0 |
119 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
452 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
360 |
0 |
0 |
T29 |
0 |
707 |
0 |
0 |
T53 |
0 |
1948 |
0 |
0 |
T54 |
0 |
99 |
0 |
0 |
T69 |
0 |
949 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1792 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
1 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T69 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T3 T6 T23
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T23
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 T23
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T23
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T23
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T23
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 T23
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T23 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T3,T6,T23 |
1 | 1 | Covered | T3,T6,T23 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T23 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T23 |
1 | 1 | Covered | T3,T6,T23 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ac_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T23 |
0 |
0 |
1 |
Covered |
T3,T6,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T23 |
0 |
0 |
1 |
Covered |
T3,T6,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
812511 |
0 |
0 |
T3 |
117509 |
2537 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
1650 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1875 |
0 |
0 |
T23 |
0 |
950 |
0 |
0 |
T24 |
0 |
360 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
539 |
0 |
0 |
T58 |
0 |
66 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
262 |
0 |
0 |
T67 |
0 |
676 |
0 |
0 |
T70 |
0 |
1917 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1045 |
0 |
0 |
T3 |
117509 |
3 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
3 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1 |
0 |
0 |
T23 |
0 |
3 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T3 T6 T23
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T23
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 T23
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T23
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T23
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T23
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 T23
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T23 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T3,T6,T23 |
1 | 1 | Covered | T3,T6,T23 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T23 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T23 |
1 | 1 | Covered | T3,T6,T23 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_lid_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T23 |
0 |
0 |
1 |
Covered |
T3,T6,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T23 |
0 |
0 |
1 |
Covered |
T3,T6,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
835679 |
0 |
0 |
T3 |
117509 |
2531 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
1628 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1873 |
0 |
0 |
T23 |
0 |
944 |
0 |
0 |
T24 |
0 |
358 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
524 |
0 |
0 |
T58 |
0 |
58 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
245 |
0 |
0 |
T67 |
0 |
672 |
0 |
0 |
T70 |
0 |
1915 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1051 |
0 |
0 |
T3 |
117509 |
3 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
3 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1 |
0 |
0 |
T23 |
0 |
3 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T3 T6 T23
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T23
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 T23
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T23
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T23
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T23
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 T23
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T23 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T3,T6,T23 |
1 | 1 | Covered | T3,T6,T23 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T23 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T23 |
1 | 1 | Covered | T3,T6,T23 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_pwrb_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T23 |
0 |
0 |
1 |
Covered |
T3,T6,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T23 |
0 |
0 |
1 |
Covered |
T3,T6,T23 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
831465 |
0 |
0 |
T3 |
117509 |
2525 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
1617 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1871 |
0 |
0 |
T23 |
0 |
938 |
0 |
0 |
T24 |
0 |
356 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
516 |
0 |
0 |
T58 |
0 |
52 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
236 |
0 |
0 |
T67 |
0 |
668 |
0 |
0 |
T70 |
0 |
1913 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1057 |
0 |
0 |
T3 |
117509 |
3 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
3 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
1 |
0 |
0 |
T23 |
0 |
3 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
1 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T70 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T15 T25 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T15 T25 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T15 T25 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T25 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T15 T25 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T25 T7
135 1/1 txn_bits_q <= '0;
Tests: T15 T25 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T25,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T15,T25,T7 |
1 | 1 | Covered | T15,T25,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T15,T25,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T15,T25,T7 |
1 | 1 | Covered | T15,T25,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T15,T25,T7 |
0 |
0 |
1 |
Covered |
T15,T25,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T15,T25,T7 |
0 |
0 |
1 |
Covered |
T15,T25,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_invert_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1696648 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T7 |
120934 |
4486 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T15 |
243722 |
34563 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
104974 |
1932 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T58 |
0 |
1636 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T71 |
0 |
34890 |
0 |
0 |
T72 |
0 |
3732 |
0 |
0 |
T73 |
0 |
16918 |
0 |
0 |
T74 |
0 |
17155 |
0 |
0 |
T75 |
0 |
9860 |
0 |
0 |
T76 |
0 |
14352 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
2269 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T7 |
120934 |
20 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T15 |
243722 |
20 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
104974 |
20 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T58 |
0 |
20 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T71 |
0 |
20 |
0 |
0 |
T72 |
0 |
20 |
0 |
0 |
T73 |
0 |
20 |
0 |
0 |
T74 |
0 |
20 |
0 |
0 |
T75 |
0 |
20 |
0 |
0 |
T76 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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 T15 T26
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T15 T26
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T15 T26
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T15 T26
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T15 T26
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T15 T26
135 1/1 txn_bits_q <= '0;
Tests: T4 T15 T26
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T15,T26 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T4,T15,T26 |
1 | 1 | Covered | T4,T15,T26 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T15,T26 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T15,T26 |
1 | 1 | Covered | T4,T15,T26 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T4,T15,T26 |
0 |
0 |
1 |
Covered |
T4,T15,T26 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T4,T15,T26 |
0 |
0 |
1 |
Covered |
T4,T15,T26 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_allowed_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
3613273 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
3614 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T7 |
0 |
189 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
1474 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
0 |
2314 |
0 |
0 |
T26 |
0 |
32082 |
0 |
0 |
T71 |
0 |
1980 |
0 |
0 |
T72 |
0 |
145 |
0 |
0 |
T77 |
0 |
35928 |
0 |
0 |
T78 |
0 |
17139 |
0 |
0 |
T79 |
0 |
16299 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
4077 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
20 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
1 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
0 |
25 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T71 |
0 |
1 |
0 |
0 |
T72 |
0 |
1 |
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 |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T4 T2
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T4 T2
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T4 T2
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T4 T2
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T4 T2
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T4 T2
135 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T4,T2 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T4,T2 |
1 | 1 | Covered | T1,T4,T2 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T4,T2 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T4,T2 |
1 | 1 | Covered | T1,T4,T2 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T4,T2 |
0 |
0 |
1 |
Covered |
T1,T4,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T4,T2 |
0 |
0 |
1 |
Covered |
T1,T4,T2 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
4471097 |
0 |
0 |
T1 |
63618 |
463 |
0 |
0 |
T2 |
118961 |
734 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
3975 |
0 |
0 |
T7 |
0 |
385 |
0 |
0 |
T8 |
0 |
127 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
462 |
0 |
0 |
T15 |
243722 |
1476 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
0 |
2559 |
0 |
0 |
T26 |
0 |
32162 |
0 |
0 |
T77 |
0 |
36008 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
5010 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
20 |
0 |
0 |
T7 |
0 |
2 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
1 |
0 |
0 |
T15 |
243722 |
1 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
0 |
25 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T77 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T4 T26 T25
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T4 T26 T25
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T4 T26 T25
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T26 T25
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T4 T26 T25
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T26 T25
135 1/1 txn_bits_q <= '0;
Tests: T4 T26 T25
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T26,T25 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T4,T26,T25 |
1 | 1 | Covered | T4,T26,T25 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T4,T26,T25 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T4,T26,T25 |
1 | 1 | Covered | T4,T26,T25 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T4,T26,T25 |
0 |
0 |
1 |
Covered |
T4,T26,T25 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T4,T26,T25 |
0 |
0 |
1 |
Covered |
T4,T26,T25 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_pin_out_value_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
3611469 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
3802 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
0 |
2241 |
0 |
0 |
T26 |
0 |
32122 |
0 |
0 |
T77 |
0 |
35968 |
0 |
0 |
T78 |
0 |
17267 |
0 |
0 |
T79 |
0 |
16424 |
0 |
0 |
T80 |
0 |
8788 |
0 |
0 |
T81 |
0 |
30066 |
0 |
0 |
T82 |
0 |
4029 |
0 |
0 |
T83 |
0 |
35010 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
4050 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
20 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T25 |
0 |
24 |
0 |
0 |
T26 |
0 |
20 |
0 |
0 |
T77 |
0 |
20 |
0 |
0 |
T78 |
0 |
20 |
0 |
0 |
T79 |
0 |
20 |
0 |
0 |
T80 |
0 |
20 |
0 |
0 |
T81 |
0 |
20 |
0 |
0 |
T82 |
0 |
20 |
0 |
0 |
T83 |
0 |
20 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T5 T9 T24
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T5 T9 T24
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T5 T9 T24
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T5 T9 T24
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T5 T9 T24
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T5 T9 T24
135 1/1 txn_bits_q <= '0;
Tests: T5 T9 T24
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T9,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T5,T9,T24 |
1 | 1 | Covered | T5,T9,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T5,T9,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T5,T9,T24 |
1 | 1 | Covered | T5,T9,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T5,T9,T24 |
0 |
0 |
1 |
Covered |
T5,T9,T24 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T5,T9,T24 |
0 |
0 |
1 |
Covered |
T5,T9,T24 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_key_intr_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
803400 |
0 |
0 |
T5 |
211269 |
1426 |
0 |
0 |
T6 |
91716 |
0 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T9 |
0 |
331 |
0 |
0 |
T10 |
0 |
1439 |
0 |
0 |
T11 |
0 |
1465 |
0 |
0 |
T24 |
0 |
12081 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
13377 |
0 |
0 |
T44 |
0 |
1995 |
0 |
0 |
T45 |
0 |
341 |
0 |
0 |
T47 |
0 |
1915 |
0 |
0 |
T50 |
0 |
1998 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T77 |
260847 |
0 |
0 |
0 |
T78 |
120737 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1055 |
0 |
0 |
T5 |
211269 |
1 |
0 |
0 |
T6 |
91716 |
0 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T10 |
0 |
1 |
0 |
0 |
T11 |
0 |
1 |
0 |
0 |
T24 |
0 |
28 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
28 |
0 |
0 |
T44 |
0 |
1 |
0 |
0 |
T45 |
0 |
1 |
0 |
0 |
T47 |
0 |
1 |
0 |
0 |
T50 |
0 |
1 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T77 |
260847 |
0 |
0 |
0 |
T78 |
120737 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T5
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T5
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T5
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T5
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T5
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T5
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T5
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T5 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T2,T5 |
1 | 1 | Covered | T1,T2,T5 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T5 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T5 |
1 | 1 | Covered | T1,T2,T5 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_key_intr_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T5 |
0 |
0 |
1 |
Covered |
T1,T2,T5 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T5 |
0 |
0 |
1 |
Covered |
T1,T2,T5 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1452894 |
0 |
0 |
T1 |
63618 |
432 |
0 |
0 |
T2 |
118961 |
724 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T5 |
0 |
1416 |
0 |
0 |
T7 |
0 |
184 |
0 |
0 |
T8 |
0 |
117 |
0 |
0 |
T9 |
0 |
313 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
829 |
0 |
0 |
T29 |
0 |
705 |
0 |
0 |
T53 |
0 |
1938 |
0 |
0 |
T54 |
0 |
91 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1806 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T5 |
0 |
1 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T9 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
2 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T16 T27 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T27 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T27 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T16 T27 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T27 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T16 T27 T28
135 1/1 txn_bits_q <= '0;
Tests: T16 T27 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_debounce_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
932165 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
91716 |
0 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
2882 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
841 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T27 |
0 |
1732 |
0 |
0 |
T28 |
0 |
1655 |
0 |
0 |
T30 |
0 |
1072 |
0 |
0 |
T56 |
0 |
1993 |
0 |
0 |
T58 |
0 |
70 |
0 |
0 |
T59 |
0 |
4748 |
0 |
0 |
T60 |
0 |
1758 |
0 |
0 |
T61 |
0 |
8617 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1190 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
91716 |
0 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
3 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
2 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T27 |
0 |
4 |
0 |
0 |
T28 |
0 |
4 |
0 |
0 |
T30 |
0 |
2 |
0 |
0 |
T56 |
0 |
5 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T59 |
0 |
3 |
0 |
0 |
T60 |
0 |
4 |
0 |
0 |
T61 |
0 |
5 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T16 T27 T28
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T16 T27 T28
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T16 T27 T28
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T16 T27 T28
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T16 T27 T28
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T16 T27 T28
135 1/1 txn_bits_q <= '0;
Tests: T16 T27 T28
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T16,T27,T28 |
1 | 1 | Covered | T16,T27,T28 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_auto_block_out_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T16,T27,T28 |
0 |
0 |
1 |
Covered |
T16,T27,T28 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
880896 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
91716 |
0 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
2876 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
360 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T27 |
0 |
1324 |
0 |
0 |
T28 |
0 |
1149 |
0 |
0 |
T30 |
0 |
535 |
0 |
0 |
T56 |
0 |
1241 |
0 |
0 |
T58 |
0 |
62 |
0 |
0 |
T59 |
0 |
4742 |
0 |
0 |
T60 |
0 |
791 |
0 |
0 |
T61 |
0 |
4748 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1126 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
91716 |
0 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
3 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
1 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T27 |
0 |
3 |
0 |
0 |
T28 |
0 |
3 |
0 |
0 |
T30 |
0 |
1 |
0 |
0 |
T56 |
0 |
3 |
0 |
0 |
T58 |
0 |
1 |
0 |
0 |
T59 |
0 |
3 |
0 |
0 |
T60 |
0 |
2 |
0 |
0 |
T61 |
0 |
3 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T8 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T8 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T8 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T8 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T8 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T8 T29
135 1/1 txn_bits_q <= '0;
Tests: T1 T8 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
5765294 |
0 |
0 |
T1 |
63618 |
486 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T8 |
0 |
131 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
4910 |
0 |
0 |
T29 |
0 |
719 |
0 |
0 |
T30 |
0 |
5259 |
0 |
0 |
T31 |
0 |
27753 |
0 |
0 |
T37 |
0 |
34686 |
0 |
0 |
T55 |
0 |
500 |
0 |
0 |
T84 |
0 |
281 |
0 |
0 |
T85 |
0 |
7352 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
6777 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
11 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
66 |
0 |
0 |
T37 |
0 |
94 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T84 |
0 |
1 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
5814845 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
4904 |
0 |
0 |
T30 |
0 |
5215 |
0 |
0 |
T31 |
0 |
22413 |
0 |
0 |
T37 |
0 |
23287 |
0 |
0 |
T52 |
0 |
20862 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
6718 |
0 |
0 |
T86 |
0 |
26002 |
0 |
0 |
T87 |
0 |
87558 |
0 |
0 |
T88 |
0 |
41230 |
0 |
0 |
T89 |
0 |
70764 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
6779 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
11 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
54 |
0 |
0 |
T37 |
0 |
67 |
0 |
0 |
T52 |
0 |
73 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
T86 |
0 |
62 |
0 |
0 |
T87 |
0 |
51 |
0 |
0 |
T88 |
0 |
51 |
0 |
0 |
T89 |
0 |
51 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
5763607 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
4904 |
0 |
0 |
T30 |
0 |
5197 |
0 |
0 |
T31 |
0 |
27231 |
0 |
0 |
T37 |
0 |
25006 |
0 |
0 |
T52 |
0 |
17170 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
7352 |
0 |
0 |
T86 |
0 |
27005 |
0 |
0 |
T87 |
0 |
87348 |
0 |
0 |
T88 |
0 |
41020 |
0 |
0 |
T89 |
0 |
69988 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
6798 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
11 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
66 |
0 |
0 |
T37 |
0 |
74 |
0 |
0 |
T52 |
0 |
63 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
T86 |
0 |
65 |
0 |
0 |
T87 |
0 |
51 |
0 |
0 |
T88 |
0 |
51 |
0 |
0 |
T89 |
0 |
51 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
5807115 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
4904 |
0 |
0 |
T30 |
0 |
5237 |
0 |
0 |
T31 |
0 |
26943 |
0 |
0 |
T37 |
0 |
31005 |
0 |
0 |
T52 |
0 |
19469 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
6907 |
0 |
0 |
T86 |
0 |
34962 |
0 |
0 |
T87 |
0 |
87138 |
0 |
0 |
T88 |
0 |
40810 |
0 |
0 |
T89 |
0 |
69262 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
6998 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
11 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
66 |
0 |
0 |
T37 |
0 |
94 |
0 |
0 |
T52 |
0 |
73 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
T86 |
0 |
84 |
0 |
0 |
T87 |
0 |
51 |
0 |
0 |
T88 |
0 |
51 |
0 |
0 |
T89 |
0 |
51 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T8 T29
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T8 T29
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T8 T29
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T1 T8 T29
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T8 T29
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T1 T8 T29
135 1/1 txn_bits_q <= '0;
Tests: T1 T8 T29
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T8,T29 |
1 | 1 | Covered | T1,T8,T29 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T8,T29 |
0 |
0 |
1 |
Covered |
T1,T8,T29 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1042016 |
0 |
0 |
T1 |
63618 |
474 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T8 |
0 |
129 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
3930 |
0 |
0 |
T29 |
0 |
717 |
0 |
0 |
T30 |
0 |
4084 |
0 |
0 |
T31 |
0 |
1744 |
0 |
0 |
T37 |
0 |
2776 |
0 |
0 |
T55 |
0 |
498 |
0 |
0 |
T84 |
0 |
279 |
0 |
0 |
T85 |
0 |
162 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1292 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
0 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
9 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T84 |
0 |
1 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
966446 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3924 |
0 |
0 |
T30 |
0 |
4047 |
0 |
0 |
T31 |
0 |
1704 |
0 |
0 |
T37 |
0 |
2494 |
0 |
0 |
T52 |
0 |
1500 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
166 |
0 |
0 |
T86 |
0 |
1215 |
0 |
0 |
T87 |
0 |
1428 |
0 |
0 |
T88 |
0 |
949 |
0 |
0 |
T89 |
0 |
1153 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1252 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T88 |
0 |
1 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
927379 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3924 |
0 |
0 |
T30 |
0 |
4030 |
0 |
0 |
T31 |
0 |
1664 |
0 |
0 |
T37 |
0 |
2250 |
0 |
0 |
T52 |
0 |
1472 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
161 |
0 |
0 |
T86 |
0 |
1185 |
0 |
0 |
T87 |
0 |
1418 |
0 |
0 |
T88 |
0 |
939 |
0 |
0 |
T89 |
0 |
1112 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1202 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T88 |
0 |
1 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_pre_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
980997 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3924 |
0 |
0 |
T30 |
0 |
4065 |
0 |
0 |
T31 |
0 |
1624 |
0 |
0 |
T37 |
0 |
2665 |
0 |
0 |
T52 |
0 |
1616 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
154 |
0 |
0 |
T86 |
0 |
1155 |
0 |
0 |
T87 |
0 |
1408 |
0 |
0 |
T88 |
0 |
929 |
0 |
0 |
T89 |
0 |
1075 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1267 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T88 |
0 |
1 |
0 |
0 |
T89 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T2,T7 |
1 | 1 | Covered | T1,T2,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T7 |
1 | 1 | Covered | T1,T2,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T7 |
0 |
0 |
1 |
Covered |
T1,T2,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T7 |
0 |
0 |
1 |
Covered |
T1,T2,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
6294473 |
0 |
0 |
T1 |
63618 |
455 |
0 |
0 |
T2 |
118961 |
732 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
192 |
0 |
0 |
T8 |
0 |
125 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
4874 |
0 |
0 |
T29 |
0 |
713 |
0 |
0 |
T53 |
0 |
1979 |
0 |
0 |
T54 |
0 |
86 |
0 |
0 |
T55 |
0 |
494 |
0 |
0 |
T57 |
0 |
1974 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
7306 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
11 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
6301590 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
4868 |
0 |
0 |
T30 |
0 |
5025 |
0 |
0 |
T31 |
0 |
22497 |
0 |
0 |
T37 |
0 |
23693 |
0 |
0 |
T40 |
0 |
357 |
0 |
0 |
T52 |
0 |
21174 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
6792 |
0 |
0 |
T86 |
0 |
26108 |
0 |
0 |
T87 |
0 |
87654 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1623 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
7255 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
11 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
54 |
0 |
0 |
T37 |
0 |
67 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
73 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
T86 |
0 |
62 |
0 |
0 |
T87 |
0 |
51 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
6218195 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
4868 |
0 |
0 |
T30 |
0 |
5013 |
0 |
0 |
T31 |
0 |
27339 |
0 |
0 |
T37 |
0 |
25667 |
0 |
0 |
T40 |
0 |
351 |
0 |
0 |
T52 |
0 |
17566 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
7193 |
0 |
0 |
T86 |
0 |
27117 |
0 |
0 |
T87 |
0 |
87444 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1600 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
7273 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
11 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
66 |
0 |
0 |
T37 |
0 |
74 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
63 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
T86 |
0 |
65 |
0 |
0 |
T87 |
0 |
51 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_sel_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
6298754 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
4868 |
0 |
0 |
T30 |
0 |
5044 |
0 |
0 |
T31 |
0 |
27051 |
0 |
0 |
T37 |
0 |
31919 |
0 |
0 |
T40 |
0 |
345 |
0 |
0 |
T52 |
0 |
19771 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
6848 |
0 |
0 |
T86 |
0 |
35112 |
0 |
0 |
T87 |
0 |
87234 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1564 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
7484 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
11 |
0 |
0 |
T30 |
0 |
11 |
0 |
0 |
T31 |
0 |
66 |
0 |
0 |
T37 |
0 |
94 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
73 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
51 |
0 |
0 |
T86 |
0 |
84 |
0 |
0 |
T87 |
0 |
51 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T2,T7 |
1 | 1 | Covered | T1,T2,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T7 |
1 | 1 | Covered | T1,T2,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T7 |
0 |
0 |
1 |
Covered |
T1,T2,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T7 |
0 |
0 |
1 |
Covered |
T1,T2,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1460734 |
0 |
0 |
T1 |
63618 |
445 |
0 |
0 |
T2 |
118961 |
730 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
190 |
0 |
0 |
T8 |
0 |
123 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
3894 |
0 |
0 |
T29 |
0 |
711 |
0 |
0 |
T53 |
0 |
1968 |
0 |
0 |
T54 |
0 |
83 |
0 |
0 |
T55 |
0 |
492 |
0 |
0 |
T57 |
0 |
1960 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1783 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
9 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1424169 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3888 |
0 |
0 |
T30 |
0 |
3856 |
0 |
0 |
T31 |
0 |
1688 |
0 |
0 |
T37 |
0 |
2372 |
0 |
0 |
T40 |
0 |
333 |
0 |
0 |
T52 |
0 |
1426 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
139 |
0 |
0 |
T86 |
0 |
1203 |
0 |
0 |
T87 |
0 |
1424 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1483 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1734 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1432684 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3888 |
0 |
0 |
T30 |
0 |
3841 |
0 |
0 |
T31 |
0 |
1648 |
0 |
0 |
T37 |
0 |
2416 |
0 |
0 |
T40 |
0 |
327 |
0 |
0 |
T52 |
0 |
1746 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
140 |
0 |
0 |
T86 |
0 |
1173 |
0 |
0 |
T87 |
0 |
1414 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1440 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1744 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_det_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1417560 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3888 |
0 |
0 |
T30 |
0 |
3878 |
0 |
0 |
T31 |
0 |
1608 |
0 |
0 |
T37 |
0 |
2532 |
0 |
0 |
T40 |
0 |
321 |
0 |
0 |
T52 |
0 |
1506 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
177 |
0 |
0 |
T86 |
0 |
1143 |
0 |
0 |
T87 |
0 |
1404 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1394 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1758 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |
Line Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
TOTAL | | 22 | 22 | 100.00 |
CONT_ASSIGN | 65 | 1 | 1 | 100.00 |
ALWAYS | 71 | 6 | 6 | 100.00 |
CONT_ASSIGN | 85 | 1 | 1 | 100.00 |
CONT_ASSIGN | 109 | 1 | 1 | 100.00 |
ALWAYS | 115 | 9 | 9 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
CONT_ASSIGN | 155 | 1 | 1 | 100.00 |
CONT_ASSIGN | 156 | 1 | 1 | 100.00 |
CONT_ASSIGN | 200 | 1 | 1 | 100.00 |
64
65 1/1 assign src_req = src_we_i | src_re_i;
Tests: T1 T2 T7
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T1 T2 T7
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T1 T2 T7
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T7
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T1 T2 T7
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T7
135 1/1 txn_bits_q <= '0;
Tests: T1 T2 T7
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T7 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T1,T2,T7 |
1 | 1 | Covered | T1,T2,T7 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T1,T2,T7 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T1,T2,T7 |
1 | 1 | Covered | T1,T2,T7 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_0_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T7 |
0 |
0 |
1 |
Covered |
T1,T2,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T1,T2,T7 |
0 |
0 |
1 |
Covered |
T1,T2,T7 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1463934 |
0 |
0 |
T1 |
63618 |
443 |
0 |
0 |
T2 |
118961 |
728 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
188 |
0 |
0 |
T8 |
0 |
121 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
3876 |
0 |
0 |
T29 |
0 |
709 |
0 |
0 |
T53 |
0 |
1957 |
0 |
0 |
T54 |
0 |
104 |
0 |
0 |
T55 |
0 |
490 |
0 |
0 |
T57 |
0 |
1947 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1787 |
0 |
0 |
T1 |
63618 |
1 |
0 |
0 |
T2 |
118961 |
1 |
0 |
0 |
T3 |
117509 |
0 |
0 |
0 |
T4 |
30650 |
0 |
0 |
0 |
T7 |
0 |
1 |
0 |
0 |
T8 |
0 |
1 |
0 |
0 |
T12 |
51830 |
0 |
0 |
0 |
T13 |
211429 |
0 |
0 |
0 |
T14 |
91412 |
0 |
0 |
0 |
T15 |
243722 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T24 |
0 |
9 |
0 |
0 |
T29 |
0 |
1 |
0 |
0 |
T53 |
0 |
1 |
0 |
0 |
T54 |
0 |
1 |
0 |
0 |
T55 |
0 |
1 |
0 |
0 |
T57 |
0 |
1 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_1_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1436548 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3870 |
0 |
0 |
T30 |
0 |
3777 |
0 |
0 |
T31 |
0 |
1680 |
0 |
0 |
T37 |
0 |
2298 |
0 |
0 |
T40 |
0 |
309 |
0 |
0 |
T52 |
0 |
1468 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
179 |
0 |
0 |
T86 |
0 |
1197 |
0 |
0 |
T87 |
0 |
1422 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1324 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1752 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_2_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1401155 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3870 |
0 |
0 |
T30 |
0 |
3759 |
0 |
0 |
T31 |
0 |
1640 |
0 |
0 |
T37 |
0 |
2468 |
0 |
0 |
T40 |
0 |
303 |
0 |
0 |
T52 |
0 |
1704 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
178 |
0 |
0 |
T86 |
0 |
1167 |
0 |
0 |
T87 |
0 |
1412 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1275 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1745 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T24 T30 T31
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T24 T30 T31
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T24 T30 T31
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 1/1 src_q <= src_wd_i & BitMask;
Tests: T24 T30 T31
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T24 T30 T31
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 1/1 src_q <= dst_qs;
Tests: T24 T30 T31
135 1/1 txn_bits_q <= '0;
Tests: T24 T30 T31
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Total | Covered | Percent |
Conditions | 11 | 10 | 90.91 |
Logical | 11 | 10 | 90.91 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T24,T30,T31 |
1 | 1 | Covered | T24,T30,T31 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_com_out_ctl_3_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T24,T30,T31 |
0 |
0 |
1 |
Covered |
T24,T30,T31 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
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 |
1237025007 |
1417483 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
3870 |
0 |
0 |
T30 |
0 |
3788 |
0 |
0 |
T31 |
0 |
1600 |
0 |
0 |
T37 |
0 |
2477 |
0 |
0 |
T40 |
0 |
297 |
0 |
0 |
T52 |
0 |
1467 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
162 |
0 |
0 |
T86 |
0 |
1137 |
0 |
0 |
T87 |
0 |
1402 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
1351 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1743 |
0 |
0 |
T10 |
460207 |
0 |
0 |
0 |
T11 |
335211 |
0 |
0 |
0 |
T24 |
845686 |
9 |
0 |
0 |
T30 |
0 |
9 |
0 |
0 |
T31 |
0 |
4 |
0 |
0 |
T37 |
0 |
8 |
0 |
0 |
T40 |
0 |
3 |
0 |
0 |
T52 |
0 |
6 |
0 |
0 |
T55 |
57704 |
0 |
0 |
0 |
T56 |
84396 |
0 |
0 |
0 |
T64 |
50595 |
0 |
0 |
0 |
T65 |
51023 |
0 |
0 |
0 |
T73 |
118680 |
0 |
0 |
0 |
T82 |
34502 |
0 |
0 |
0 |
T85 |
0 |
1 |
0 |
0 |
T86 |
0 |
3 |
0 |
0 |
T87 |
0 |
1 |
0 |
0 |
T90 |
197412 |
0 |
0 |
0 |
T91 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
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: T3 T6 T24
66
67 // busy indication back-pressures upstream if the register is accessed
68 // again. The busy indication is also used as a "commit" indication for
69 // resolving software and hardware write conflicts
70 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
71 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
72 1/1 src_busy_q <= '0;
Tests: T1 T4 T2
73 1/1 end else if (src_req) begin
Tests: T1 T4 T2
74 1/1 src_busy_q <= 1'b1;
Tests: T3 T6 T24
75 1/1 end else if (src_ack) begin
Tests: T1 T4 T2
76 1/1 src_busy_q <= 1'b0;
Tests: T3 T6 T24
77 end
MISSING_ELSE
78 end
79
80 // A src_ack should only be sent if there was a src_req.
81 // src_busy_q asserts whenever there is a src_req. By association,
82 // whenever src_ack is seen, then src_busy must be high.
83 `ASSERT(SrcAckBusyChk_A, src_ack |-> src_busy_q, clk_src_i, !rst_src_ni)
84
85 1/1 assign src_busy_o = src_busy_q;
Tests: T1 T4 T2
86
87 // src_q acts as both the write holding register and the software read back
88 // register.
89 // When software performs a write, the write data is captured in src_q for
90 // CDC purposes. When not performing a write, the src_q reflects the most recent
91 // hardware value. For registers with no hardware access, this is simply the
92 // the value programmed by software (or in the case R1C, W1C etc) the value after
93 // the operation. For registers with hardware access, this reflects a potentially
94 // delayed version of the real value, as the software facing updates lag real
95 // time updates.
96 //
97 // To resolve software and hardware conflicts, the process is as follows:
98 // When software issues a write, this module asserts "busy". While busy,
99 // src_q does not take on destination value updates. Since the
100 // logic has committed to updating based on software command, there is an irreversible
101 // window from which hardware writes are ignored. Once the busy window completes,
102 // the cdc portion then begins sampling once more.
103 //
104 // This is consistent with prim_subreg_arb where during software / hardware conflicts,
105 // software is always prioritized. The main difference is the conflict resolution window
106 // is now larger instead of just one destination clock cycle.
107
108 logic busy;
109 1/1 assign busy = src_busy_q & !src_ack;
Tests: T1 T4 T2
110
111 // This is the current destination value
112 logic [DataWidth-1:0] dst_qs;
113 logic src_update;
114 always_ff @(posedge clk_src_i or negedge rst_src_ni) begin
115 1/1 if (!rst_src_ni) begin
Tests: T1 T4 T2
116 1/1 src_q <= ResetVal;
Tests: T1 T4 T2
117 1/1 txn_bits_q <= '0;
Tests: T1 T4 T2
118 1/1 end else if (src_req) begin
Tests: T1 T4 T2
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values 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 T24
124 1/1 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
Tests: T3 T6 T24
125 1/1 end else if (src_busy_q && src_ack || src_update && !busy) begin
Tests: T1 T4 T2
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack 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 T24
135 1/1 txn_bits_q <= '0;
Tests: T3 T6 T24
136 end
MISSING_ELSE
137 end
138
139 // The current design (tlul_adapter_reg) does not spit out a request if the destination it chooses
140 // (decoded from address) is busy. So this creates a situation in the current design where
141 // src_req_i and busy can never be high at the same time.
142 // While the code above could be coded directly to be expressed as `src_req & !busy`, which makes
143 // the intent clearer, it ends up causing coverage holes from the tool's perspective since that
144 // condition cannot be met.
145 // Thus we add an assertion here to ensure the condition is always satisfied.
146 `ASSERT(BusySrcReqChk_A, busy |-> !src_req, clk_src_i, !rst_src_ni)
147
148 // reserved bits are not used
149 logic unused_wd;
150 1/1 assign unused_wd = ^src_wd_i;
Tests: T1 T4 T2
151
152 // src_q is always updated in the clk_src domain.
153 // when performing an update to the destination domain, it is guaranteed
154 // to not change by protocol.
155 1/1 assign src_qs_o = src_q;
Tests: T1 T4 T2
156 1/1 assign dst_wd_o = src_q;
Tests: T1 T4 T2
157
158 ////////////////////////////
159 // CDC handling
160 ////////////////////////////
161
162 logic dst_req_from_src;
163 logic dst_req;
164
165
166 // the software transaction is pulse synced across the domain.
167 // the prim_reg_cdc_arb module handles conflicts with ongoing hardware updates.
168 prim_pulse_sync u_src_to_dst_req (
169 .clk_src_i,
170 .rst_src_ni,
171 .clk_dst_i,
172 .rst_dst_ni,
173 .src_pulse_i(src_req),
174 .dst_pulse_o(dst_req_from_src)
175 );
176
177 prim_reg_cdc_arb #(
178 .DataWidth(DataWidth),
179 .ResetVal(ResetVal),
180 .DstWrReq(DstWrReq)
181 ) u_arb (
182 .clk_src_i,
183 .rst_src_ni,
184 .clk_dst_i,
185 .rst_dst_ni,
186 .src_ack_o(src_ack),
187 .src_update_o(src_update),
188 .dst_req_i(dst_req_from_src),
189 .dst_req_o(dst_req),
190 .dst_update_i,
191 .dst_ds_i,
192 .dst_qs_i,
193 .dst_qs_o(dst_qs)
194 );
195
196
197 // Each is valid only when destination request pulse is high; this is important in not propagating
198 // the internal assertion of 'dst_req' by the 'prim_pulse_sync' channel when just one domain is
199 // reset.
200 1/1 assign {dst_we_o, dst_re_o, dst_regwen_o} = txn_bits_q & {TxnWidth{dst_req}};
Tests: T1 T4 T2
Cond Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Total | Covered | Percent |
Conditions | 13 | 12 | 92.31 |
Logical | 13 | 12 | 92.31 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 65
EXPRESSION (src_we_i | src_re_i)
----1--- ----2---
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T24 |
LINE 109
EXPRESSION (src_busy_q & ((!src_ack)))
-----1---- ------2-----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Covered | T3,T6,T24 |
1 | 1 | Covered | T3,T6,T24 |
LINE 123
EXPRESSION (src_wd_i & BitMask)
----1--- ---2---
-1- | -2- | Status | Tests |
0 | - | Covered | T3,T6,T24 |
1 | - | Covered | T3,T6,T24 |
LINE 125
EXPRESSION ((src_busy_q && src_ack) || (src_update && ((!busy))))
-----------1----------- ------------2------------
-1- | -2- | Status | Tests |
0 | 0 | Covered | T1,T4,T2 |
0 | 1 | Unreachable | |
1 | 0 | Covered | T3,T6,T24 |
LINE 125
SUB-EXPRESSION (src_busy_q && src_ack)
-----1---- ---2---
-1- | -2- | Status | Tests |
0 | 1 | Not Covered | |
1 | 0 | Covered | T3,T6,T24 |
1 | 1 | Covered | T3,T6,T24 |
LINE 125
SUB-EXPRESSION (src_update && ((!busy)))
-----1---- ----2----
-1- | -2- | Status | Tests |
0 | 1 | Covered | T1,T4,T2 |
1 | 0 | Unreachable | |
1 | 1 | Unreachable | |
Branch Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
| Line No. | Total | Covered | Percent |
Branches |
|
8 |
8 |
100.00 |
IF |
71 |
4 |
4 |
100.00 |
IF |
115 |
4 |
4 |
100.00 |
71 if (!rst_src_ni) begin
-1-
72 src_busy_q <= '0;
==>
73 end else if (src_req) begin
-2-
74 src_busy_q <= 1'b1;
==>
75 end else if (src_ack) begin
-3-
76 src_busy_q <= 1'b0;
==>
77 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T24 |
0 |
0 |
1 |
Covered |
T3,T6,T24 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
115 if (!rst_src_ni) begin
-1-
116 src_q <= ResetVal;
==>
117 txn_bits_q <= '0;
118 end else if (src_req) begin
-2-
119 // See assertion below
120 // At the beginning of a software initiated transaction, the following
121 // values are captured in the src_q/txn_bits_q flops to ensure they cannot
122 // change for the duration of the synchronization operation.
123 src_q <= src_wd_i & BitMask;
==>
124 txn_bits_q <= {src_we_i, src_re_i, src_regwen_i};
125 end else if (src_busy_q && src_ack || src_update && !busy) begin
-3-
126 // sample data whenever a busy transaction finishes OR
127 // when an update pulse is seen.
128 // TODO: We should add a cover group to test different sync timings
129 // between src_ack and src_update. ie. there can be 3 scenarios:
130 // 1. update one cycle before ack
131 // 2. ack one cycle before update
132 // 3. update / ack on the same cycle
133 // During all 3 cases the read data should be correct
134 src_q <= dst_qs;
==>
135 txn_bits_q <= '0;
136 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status | Tests |
1 |
- |
- |
Covered |
T1,T4,T2 |
0 |
1 |
- |
Covered |
T3,T6,T24 |
0 |
0 |
1 |
Covered |
T3,T6,T24 |
0 |
0 |
0 |
Covered |
T1,T4,T2 |
Assert Coverage for Instance : tb.dut.u_reg.u_ulp_ctl_cdc
Assertion Details
BusySrcReqChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
839544 |
0 |
0 |
T3 |
117509 |
1520 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
3286 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
3281 |
0 |
0 |
T24 |
0 |
1552 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
1686 |
0 |
0 |
T58 |
0 |
170 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
475 |
0 |
0 |
T67 |
0 |
676 |
0 |
0 |
T68 |
0 |
5129 |
0 |
0 |
T92 |
0 |
3442 |
0 |
0 |
DstReqKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
5045782 |
4394377 |
0 |
0 |
T1 |
509 |
109 |
0 |
0 |
T2 |
485 |
85 |
0 |
0 |
T3 |
1755 |
1355 |
0 |
0 |
T4 |
510 |
110 |
0 |
0 |
T12 |
450 |
50 |
0 |
0 |
T13 |
422 |
22 |
0 |
0 |
T14 |
761 |
361 |
0 |
0 |
T15 |
492 |
92 |
0 |
0 |
T16 |
670 |
270 |
0 |
0 |
T17 |
408 |
8 |
0 |
0 |
SrcAckBusyChk_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1077 |
0 |
0 |
T3 |
117509 |
2 |
0 |
0 |
T5 |
211269 |
0 |
0 |
0 |
T6 |
0 |
6 |
0 |
0 |
T7 |
120934 |
0 |
0 |
0 |
T8 |
23335 |
0 |
0 |
0 |
T16 |
160902 |
0 |
0 |
0 |
T17 |
32710 |
0 |
0 |
0 |
T18 |
0 |
2 |
0 |
0 |
T24 |
0 |
4 |
0 |
0 |
T25 |
104974 |
0 |
0 |
0 |
T26 |
250798 |
0 |
0 |
0 |
T30 |
0 |
4 |
0 |
0 |
T58 |
0 |
2 |
0 |
0 |
T62 |
60938 |
0 |
0 |
0 |
T63 |
205116 |
0 |
0 |
0 |
T66 |
0 |
2 |
0 |
0 |
T67 |
0 |
2 |
0 |
0 |
T68 |
0 |
6 |
0 |
0 |
T92 |
0 |
4 |
0 |
0 |
SrcBusyKnown_A
Name | Attempts | Real Successes | Failures | Incomplete |
Total |
1237025007 |
1236610848 |
0 |
0 |
T1 |
63618 |
63554 |
0 |
0 |
T2 |
118961 |
118872 |
0 |
0 |
T3 |
117509 |
117435 |
0 |
0 |
T4 |
30650 |
30574 |
0 |
0 |
T12 |
51830 |
51740 |
0 |
0 |
T13 |
211429 |
211353 |
0 |
0 |
T14 |
91412 |
91338 |
0 |
0 |
T15 |
243722 |
243648 |
0 |
0 |
T16 |
160902 |
160820 |
0 |
0 |
T17 |
32710 |
32646 |
0 |
0 |