Skip to content

Commit

Permalink
Support connectivity in axi_intercon_gen
Browse files Browse the repository at this point in the history
This introduces support for partial connectivity in the axi_intercon
generator. Also adds the missing PipelineStages parameter.
  • Loading branch information
olofk committed Sep 19, 2024
1 parent 4e54ac6 commit d1330eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions axi.core
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ generators:

offset (int): Base address for the slave
size (int): Size of the allocated memory map for the slave
slaves (list): List of device ports that this host is
connected to. A missing or empty list means
connection to all devices.

Example usage:
The following config will generate an interconnect wrapper to which two
AXI4 master interfaces (dma and ibus) with different id widths are
connected, and connects downstream to three AXI4 slaves (rom, gpio, ram)
The ibus port is only allowed to access the rom and ram ports.

soc_intercon:
generator: axi_intercon_gen
Expand All @@ -151,6 +155,7 @@ generators:
id_width : 1
ibus:
id_width : 2
slaves: [ram, rom]
slaves:
ram:
offset : 0
Expand Down
20 changes: 16 additions & 4 deletions scripts/axi_intercon_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,12 @@ def load_dict(self, d):
for key, value in d.items():
if key == 'slaves':
# Handled in file loading, ignore here
continue
if key == 'id_width':
self.slaves = value
elif key == 'id_width':
self.idw = value
elif key == 'read_only':
self.read_only = value
else:
print(key)
raise UnknownPropertyError(
"Unknown property '%s' in master section '%s'" % (
key, self.name))
Expand Down Expand Up @@ -349,6 +348,7 @@ def write(self):
MaxSlvTrans: 6,
FallThrough: 1'b0,
LatencyMode: axi_pkg::CUT_ALL_AX,
PipelineStages: 0,
AxiIdWidthSlvPorts: AxiIdWidthMasters,
AxiIdUsedSlvPorts: AxiIdUsed,
UniqueIds: 1'b0,
Expand Down Expand Up @@ -403,14 +403,26 @@ def write(self):
raw += " mst_req_t [{}:0] slaves_req;\n".format(ns-1)
raw += " mst_resp_t [{}:0] slaves_resp;\n".format(ns-1)

ns = len(self.slaves)
raw += f"\n localparam bit [{nm-1}:0][{ns-1}:0] connectivity = " + '{\n {'
connmap = []
for master in self.masters:
connstr = f"{ns}'b"
if master.slaves:
for slave in self.slaves:
connstr += '1' if slave.name in master.slaves else '0'
else:
connstr += '1'*ns
connmap.append(connstr)
raw += "},\n {".join(connmap)
raw += "}};\n"

raw += assigns(w, max_idw, self.masters, self.slaves)

self.verilog_writer.raw = raw
parameters = [
Parameter('Cfg' , 'xbar_cfg' ),
Parameter('ATOPs' , "1'b"+str(int(self.atop))),
Parameter('Connectivity' , 'connectivity'),
Parameter('slv_aw_chan_t', 'aw_chan_mst_t'),
Parameter('mst_aw_chan_t', 'aw_chan_slv_t'),
Parameter('w_chan_t' , 'w_chan_t' ),
Expand Down

0 comments on commit d1330eb

Please sign in to comment.