Skip to content

Commit 3bd1706

Browse files
committed
[xbar,rtl] support fifo_depth>1
This commit adds the possibility to increase the fifo depth in the xbar to values > 1 to support multiple outstanding transactions. Why this is beneficial: The ibex instruction cache issues two 32b requests to the flash controller. Inside xbar_main a pipeline register is added to break the critical path to the flash. The pipeline register is added with a fifo of depth=1 for req and rsp data and effectively inserts a bubble after each request and response because the fifo is immediately full. Ibex and flash_ctrl can deal with up to 2 outstanding transactions. The impact on performance is low because the instruction cache reads the critical word first and hides the additional latency that is inserted by the fifo with depth=1. Nonetheless, in phases with many cache misses, the performance can be improved at the price of an additional fifo entry. Signed-off-by: Michael Gautschi <[email protected]>
1 parent 1ac1583 commit 3bd1706

File tree

7 files changed

+19
-4
lines changed

7 files changed

+19
-4
lines changed

hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11012,6 +11012,7 @@
1101211012
reset: rst_main_ni
1101311013
req_fifo_pass: false
1101411014
rsp_fifo_pass: false
11015+
fifo_depth: 2
1101511016
inst_type: flash_ctrl
1101611017
addr_range:
1101711018
[

hw/top_earlgrey/data/xbar_main.hjson

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@
116116
req_fifo_pass: false,
117117
rsp_fifo_pass: false,
118118
},
119-
// Return and examine whether this path
120-
// latency can be improved.
119+
// fifo depth is set to 2 to be able to support 2 outstanding transactions from the ibex
120+
// instruction cache (2x32b=1x64b cacheline)
121121
{ name: "flash_ctrl.mem",
122122
type: "device",
123123
clock: "clk_main_i",
124124
reset: "rst_main_ni",
125125
req_fifo_pass: false,
126126
rsp_fifo_pass: false,
127+
fifo_depth: 2,
127128
},
128129
{ name: "hmac",
129130
type: "device",

hw/top_earlgrey/ip/xbar_main/data/autogen/xbar_main.gen.hjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
reset: rst_main_ni
398398
req_fifo_pass: false
399399
rsp_fifo_pass: false
400+
fifo_depth: 2
400401
inst_type: flash_ctrl
401402
addr_range:
402403
[

hw/top_earlgrey/ip/xbar_main/rtl/autogen/xbar_main.sv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,8 @@ end
965965
.HRspDepth (12'h0),
966966
.DReqPass (1'b0),
967967
.DRspPass (1'b0),
968+
.DReqDepth (4'h2),
969+
.DRspDepth (4'h2),
968970
.M (3)
969971
) u_sm1_31 (
970972
.clk_i (clk_main_i),

util/tlgen/elaborate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ def process_pipeline(xbar: Xbar) -> None:
248248

249249
elif isinstance(unode, SocketM1):
250250
if full_fifo:
251-
log.info("Fifo present with no passthrough")
251+
log.info("Fifo present with no passthrough and depth=2")
252252
unode.dreq_pass = 0
253253
unode.drsp_pass = 0
254-
unode.ddepth = 1
254+
unode.ddepth = device.fifo_depth
255255
elif fifo_passthru:
256256
log.info("Fifo present with passthrough")
257257
unode.dreq_pass = req_pass

util/tlgen/item.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class Node:
5858
req_fifo_pass = True
5959
rsp_fifo_pass = True
6060

61+
# FIFO depth option. default is 1
62+
# If pipeline is false or req/rsp_fifo_pass are true, this field has no meaning
63+
# A fifo with depth > 1 can support multiple outstanding transactions without blocking the
64+
# host
65+
fifo_depth = 1
66+
6167
def __init__(self,
6268
name: str,
6369
clock: str,

util/tlgen/validate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
'If true, pipeline fifo has passthrough behavior on req'],
7373
'rsp_fifo_pass': ['pb',
7474
'If true, pipeline fifo has passthrough behavior on rsp'],
75+
'fifo_depth': ['d', 'depth of req/rsp fifo if pipeline is true and fifo_pass is false'],
7576
'inst_type': ['s', 'Instance type'],
7677
'xbar': ['pb', 'If true, the node is connected to another Xbar'],
7778
'addr_range': ['lg', addrs],
@@ -389,11 +390,14 @@ def validate(obj: Dict[Any, Any]) -> Optional[Xbar]:
389390
node.pipeline = False
390391
node.req_fifo_pass = False
391392
node.rsp_fifo_pass = False
393+
node.fifo_depth = 1
392394

393395
if isinstance(node, Device) or isinstance(node, Host):
394396
node.pipeline = nodeobj.get("pipeline", False)
395397
node.req_fifo_pass = nodeobj.get("req_fifo_pass", False)
396398
node.rsp_fifo_pass = nodeobj.get("rsp_fifo_pass", False)
399+
if isinstance(node, Device):
400+
node.fifo_depth = nodeobj.get("fifo_depth", 1)
397401

398402
xbar.nodes.append(node)
399403

0 commit comments

Comments
 (0)