Skip to content

Commit c74e3ab

Browse files
cache_subsys: cut timing path of AMOs with a buffer (#3341)
Recent ASIC synthesis with the CVA6+HPDcache exhibit a critical path concerning the response path for AMOs (Atomic Memory Operations) from the cache to the CVA6. This PR adds a pipeline buffer into this path to enhance the timing (clock frequency). However, it increases the latency of AMOs by one cycle. This extra cycle is anyway acceptable as AMOs are not part of the the most frequent operations, and the clock frequency speedup largely compensates this. --------- Signed-off-by: Cesar Fuguet <15080006+cfuguet@users.noreply.github.com> Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
1 parent a1b3aed commit c74e3ab

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

.gitlab-ci/expected_synth.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
cv32a65x:
2-
gates: 183130
2+
gates: 183727

core/cache_subsystem/cva6_hpdcache_if_adapter.sv

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ module cva6_hpdcache_if_adapter
326326

327327
// Response forwarding
328328
// {{{
329+
ariane_pkg::amo_resp_t cva6_amo_resp;
330+
329331
if (CVA6Cfg.XLEN == 64) begin : amo_resp_64_gen
330332
assign amo_resp_word = amo_is_word_hi
331333
? hpdcache_rsp_i.rdata[0][32 +: 32]
@@ -339,18 +341,25 @@ module cva6_hpdcache_if_adapter
339341
assign cva6_req_o.data_rid = hpdcache_rsp_i.tid;
340342
assign cva6_req_o.data_gnt = hpdcache_req_ready_i;
341343

342-
assign cva6_amo_resp_o.ack = hpdcache_rsp_valid_i && (hpdcache_rsp_i.tid == '1);
343-
assign cva6_amo_resp_o.result = amo_is_word ? {{32{amo_resp_word[31]}}, amo_resp_word}
344-
: hpdcache_rsp_i.rdata[0];
344+
assign cva6_amo_resp.ack = hpdcache_rsp_valid_i && (hpdcache_rsp_i.tid == '1);
345+
assign cva6_amo_resp.result = amo_is_word ? {{32{amo_resp_word[31]}}, amo_resp_word}
346+
: hpdcache_rsp_i.rdata[0];
345347
// }}}
346348

347349
always_ff @(posedge clk_i or negedge rst_ni) begin : amo_pending_ff
348350
if (!rst_ni) begin
349-
amo_pending_q <= 1'b0;
351+
amo_pending_q <= 1'b0;
352+
cva6_amo_resp_o <= '0;
350353
end else begin
351354
amo_pending_q <=
352-
( cva6_amo_req_i.req & hpdcache_req_ready_i & ~amo_pending_q) |
353-
(~cva6_amo_resp_o.ack & amo_pending_q);
355+
(~amo_pending_q & cva6_amo_req_i.req & hpdcache_req_ready_i) |
356+
( amo_pending_q & ~cva6_amo_resp_o.ack);
357+
358+
if (cva6_amo_resp_o.ack) begin
359+
cva6_amo_resp_o <= '0;
360+
end else if (cva6_amo_resp.ack) begin
361+
cva6_amo_resp_o <= cva6_amo_resp;
362+
end
354363
end
355364
end
356365

0 commit comments

Comments
 (0)