Skip to content

Commit 53b9b98

Browse files
committed
hw: Mask TCDM write data stability check on reads (#125)
1 parent a3dead6 commit 53b9b98

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

Bender.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package:
2121
dependencies:
2222
axi: { git: https://github.com/pulp-platform/axi, version: 0.39.0 }
2323
axi_riscv_atomics: { git: https://github.com/pulp-platform/axi_riscv_atomics, version: 0.6.0 }
24-
common_cells: { git: https://github.com/pulp-platform/common_cells, version: 1.28.0 }
24+
common_cells: { git: https://github.com/pulp-platform/common_cells, version: 1.35.0 }
2525
FPnew: { git: https://github.com/openhwgroup/cvfpu, rev: 1202ca3 } # TODO: feature branch `feature/expanding_sdotp`; get merged!
2626
register_interface: { git: https://github.com/pulp-platform/register_interface, version: 0.4.2 }
2727
tech_cells_generic: { git: https://github.com/pulp-platform/tech_cells_generic, version: 0.2.11 }

hw/snitch_cluster/src/snitch_tcdm_interconnect.sv

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ module snitch_tcdm_interconnect #(
6363
typedef logic [StrbWidth-1:0] strb_t;
6464
`MEM_TYPEDEF_REQ_CHAN_T(mem_req_chan_t, addr_t, data_t, strb_t, user_t);
6565

66+
// Do not assert unconditional stability on write data inside interconnects,
67+
// as write data may freely change on (non-atomic) reads. We properly assert
68+
// conditional write data stability below.
69+
localparam mem_req_chan_t MemReqAsrtMask =
70+
'{data: '0, strb: '0, amo: reqrsp_pkg::amo_op_e'('1), default: '1};
71+
6672
// Width of the bank select signal.
6773
localparam int unsigned SelWidth = cf_math_pkg::idx_width(NumOut);
6874
typedef logic [SelWidth-1:0] select_t;
@@ -88,7 +94,7 @@ module snitch_tcdm_interconnect #(
8894
logic [NumInp-1:0] req_q_valid_flat, rsp_q_ready_flat;
8995
logic [NumOut-1:0] mem_q_valid_flat, mem_q_ready_flat;
9096

91-
// The usual struct packing unpacking.
97+
// The usual struct packing unpacking; also check write stability here.
9298
for (genvar i = 0; i < NumInp; i++) begin : gen_flat_inp
9399
assign req_q_valid_flat[i] = req_i[i].q_valid;
94100
assign rsp_o[i].q_ready = rsp_q_ready_flat[i];
@@ -100,6 +106,22 @@ module snitch_tcdm_interconnect #(
100106
strb: req_i[i].q.strb,
101107
user: req_i[i].q.user
102108
};
109+
110+
// Write data must also be stable during AMOs, so include this case in assertions.
111+
logic in_req_alters_mem;
112+
assign in_req_alters_mem = in_req[i].write | (in_req[i].amo != reqrsp_pkg::AMONone);
113+
114+
// TODO: we could clean this up with an additional common_cells assertion macro.
115+
`ifndef VERILATOR
116+
`ifndef SYNTHESIS
117+
assert property (@(posedge clk_i) disable iff (~rst_ni) (req_q_valid_flat[i] &&
118+
!rsp_q_ready_flat[i] && in_req_alters_mem |=> $stable(in_req[i].data))) else
119+
$error("write data during non-read is unstable at input: %0d", i);
120+
assert property (@(posedge clk_i) disable iff (~rst_ni) (req_q_valid_flat[i] &&
121+
!rsp_q_ready_flat[i] && in_req_alters_mem |=> $stable(in_req[i].strb))) else
122+
$error("write strobe during non-read is unstable at input: %0d", i);
123+
`endif
124+
`endif
103125
end
104126

105127
for (genvar i = 0; i < NumOut; i++) begin : gen_flat_oup
@@ -121,7 +143,8 @@ module snitch_tcdm_interconnect #(
121143
.OutSpillReg ( 1'b0 ),
122144
.ExtPrio ( 1'b0 ),
123145
.AxiVldRdy ( 1'b1 ),
124-
.LockIn ( 1'b1 )
146+
.LockIn ( 1'b1 ),
147+
.AxiVldMask ( MemReqAsrtMask )
125148
) i_stream_xbar (
126149
.clk_i,
127150
.rst_ni,
@@ -200,7 +223,8 @@ module snitch_tcdm_interconnect #(
200223
.SpillReg ( 1'b0 ),
201224
.AxiVldRdy ( 1'b1 ),
202225
.LockIn ( 1'b1 ),
203-
.Radix ( Radix )
226+
.Radix ( Radix ),
227+
.AxiVldMask ( MemReqAsrtMask )
204228
) i_stream_omega_net (
205229
.clk_i,
206230
.rst_ni,

0 commit comments

Comments
 (0)