Skip to content

Commit 9c5d7d8

Browse files
committed
[tlul_adapter_reg,rtl] Register errors properly when AccessLatency=1
The existing code squashed d_data (but didn't set d_error) if error_i went high at a later date. Do the obvious tweak, which makes everything look much more like the gen_access_latency0 case. Signed-off-by: Rupert Swarbrick <[email protected]>
1 parent 13cbc9c commit 9c5d7d8

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

hw/ip/tlul/rtl/tlul_adapter_reg.sv

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,31 +186,32 @@ module tlul_adapter_reg
186186
end
187187

188188
if (AccessLatency == 1) begin : gen_access_latency1
189-
logic wr_req_q, rd_req_q;
189+
logic a_ack_q, err_internal_q, wr_req_q;
190190
always_ff @(posedge clk_i or negedge rst_ni) begin
191191
if (!rst_ni) begin
192+
a_ack_q <= 1'b0;
193+
err_internal_q <= 1'b0;
194+
wr_req_q <= 1'b0;
192195
rdata_q <= '0;
193196
error_q <= 1'b0;
194-
wr_req_q <= 1'b0;
195-
rd_req_q <= 1'b0;
196197
end else begin
197-
rd_req_q <= rd_req;
198+
a_ack_q <= a_ack;
199+
err_internal_q <= err_internal;
198200
wr_req_q <= wr_req;
199-
// Addressing phase
200-
if (a_ack) begin
201-
error_q <= err_internal;
202-
// Response phase
203-
end else begin
204-
error_q <= error;
205-
rdata_q <= rdata;
206-
end
201+
202+
rdata_q <= rdata;
203+
error_q <= error;
204+
end
205+
end
206+
always_comb begin
207+
if (a_ack_q) begin
208+
rdata = (error_i || err_internal_q || wr_req_q) ? '1 : rdata_i;
209+
error = error_i || err_internal_q;
210+
end else begin
211+
rdata = rdata_q;
212+
error = error_q;
207213
end
208214
end
209-
assign rdata = (error_i || error_q || wr_req_q) ? '1 :
210-
(rd_req_q) ? rdata_i :
211-
rdata_q; // backpressure case
212-
assign error = (rd_req_q || wr_req_q) ? (error_q || error_i) :
213-
error_q; // backpressure case
214215
end else begin : gen_access_latency0
215216
always_ff @(posedge clk_i or negedge rst_ni) begin
216217
if (!rst_ni) begin

0 commit comments

Comments
 (0)