Skip to content

Commit 71634d4

Browse files
authored
Merge pull request #270 from zeroasiccorp/rice/axi2umi_made_hostaddr_dynamic
made axi2umi hostaddr dynamic
2 parents e186758 + 2cbfebe commit 71634d4

7 files changed

Lines changed: 76 additions & 53 deletions

File tree

tests/adapters/axi2umi/test_axi2umi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ async def setup(self):
3636
"""Initialize and reset the DUT, create AXI master."""
3737
dut = self.dut
3838

39+
# Initialize config ports
40+
dut.hostaddr.value = 0
41+
3942
# Initialize AXI write signals
4043
dut.s_axi_wid.value = 0
4144
dut.s_axi_awvalid.value = 0

tests/adapters/axi2umi/test_axird2umi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ async def setup(self):
3333
"""Initialize and reset the DUT, create AXI master."""
3434
dut = self.dut
3535

36+
# Initialize config ports
37+
dut.hostaddr.value = 0
38+
3639
# Initialize AXI signals that cocotbext-axi may not drive
3740
dut.s_axi_arvalid.value = 0
3841
dut.s_axi_rready.value = 0

tests/adapters/axi2umi/test_axiwr2umi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ async def setup(self):
109109
"""Initialize and reset the DUT, create AXI master."""
110110
dut = self.dut
111111

112+
# Initialize config ports
113+
dut.hostaddr.value = 0
114+
112115
# Initialize AXI signals that cocotbext-axi may not drive
113116
dut.s_axi_wid.value = 0
114117
dut.s_axi_awvalid.value = 0

umi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from umi import adapters
44
from umi.common import Standard
55

6-
__version__ = "0.4.5"
6+
__version__ = "0.4.6"
77

88
__all__ = [
99
"Standard",

umi/adapters/axi2umi/rtl/axi2umi.v

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
* unrecognized opcodes are forwarded to a drop port
3131
*
3232
* Parameters:
33-
* CW - UMI command width (default 32)
34-
* DW - Data width in bits, must be <= 128
35-
* AW - Address width in bits (default 64)
36-
* IDW - AXI ID width (default 8)
37-
* HOSTADDR - UMI source address used by both write and read sub-modules
38-
* (default MSB set). The lower DW/8 bits are reserved per the
39-
* UMI spec; the write path uses those bits to encode the AXI
40-
* write strobe value.
33+
* CW - UMI command width (default 32)
34+
* DW - Data width in bits, must be <= 128
35+
* AW - Address width in bits (default 64)
36+
* IDW - AXI ID width (default 8)
37+
*
38+
* Config Ports:
39+
* hostaddr - UMI source address forwarded to both write and read sub-modules.
40+
* The lower DW/8 bits are reserved per the UMI spec; the write
41+
* path replaces those bits with the AXI write strobe value.
42+
* Typically static; if changed, must be synchronous to clk.
4143
*
4244
* Response Routing:
4345
* UMI responses are routed back to the correct channel by inspecting the
@@ -49,18 +51,20 @@
4951
******************************************************************************/
5052

5153
module axi2umi #(
52-
parameter CW = 32,
53-
parameter DW = 128,
54-
parameter AW = 64,
55-
parameter IDW = 8,
56-
/* Note the bottom DW/8 bits of HOSTADDR are ignored
57-
* per UMI spec. The spec recommendation is to set the bottom
58-
* DW/8 bits of srcaddr to the AXI write channels strobe value */
59-
parameter [AW-1:0] HOSTADDR = {AW{1'b0}}
54+
parameter CW = 32,
55+
parameter DW = 128,
56+
parameter AW = 64,
57+
parameter IDW = 8
6058
)(
6159
input clk,
6260
input nreset,
6361

62+
/* UMI source address for all requests.
63+
* The bottom DW/8 bits are replaced with the AXI write strobe on the
64+
* write path (per UMI spec). Typically static if changed, must be
65+
* synchronous to clk. */
66+
input [AW-1:0] hostaddr,
67+
6468
input [1:0] arbmode,
6569

6670
//####################################
@@ -190,14 +194,14 @@ module axi2umi #(
190194
//####################################
191195

192196
axiwr2umi #(
193-
.CW (CW),
194-
.DW (DW),
195-
.AW (AW),
196-
.IDW (IDW),
197-
.HOSTADDR (HOSTADDR)
197+
.CW (CW),
198+
.DW (DW),
199+
.AW (AW),
200+
.IDW (IDW)
198201
) u_axiwr2umi (
199202
.clk (clk),
200203
.nreset (nreset),
204+
.hostaddr (hostaddr),
201205
// AXI4 Write Address Channel
202206
.s_axi_awid (s_axi_awid),
203207
.s_axi_awaddr (s_axi_awaddr),
@@ -243,14 +247,14 @@ module axi2umi #(
243247
//####################################
244248

245249
axird2umi #(
246-
.CW (CW),
247-
.DW (DW),
248-
.AW (AW),
249-
.IDW (IDW),
250-
.HOSTADDR (HOSTADDR)
250+
.CW (CW),
251+
.DW (DW),
252+
.AW (AW),
253+
.IDW (IDW)
251254
) u_axird2umi (
252255
.clk (clk),
253256
.nreset (nreset),
257+
.hostaddr (hostaddr),
254258
// AXI4 Read Address Channel
255259
.s_axi_arid (s_axi_arid),
256260
.s_axi_araddr (s_axi_araddr),

umi/adapters/axi2umi/rtl/axird2umi.v

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
* setting EOM on the last response.
2525
*
2626
* Parameters:
27-
* CW - UMI command width (default 32)
28-
* DW - Data width in bits (default 128)
29-
* AW - Address width in bits (default 64)
30-
* IDW - AXI ID width (default 8)
31-
* HOSTADDR - UMI source address, used as-is for all read requests
27+
* CW - UMI command width (default 32)
28+
* DW - Data width in bits (default 128)
29+
* AW - Address width in bits (default 64)
30+
* IDW - AXI ID width (default 8)
31+
*
32+
* Config Ports:
33+
* hostaddr - UMI source address, used as-is for all read requests.
34+
* Typically static; if changed, must be synchronous to clk.
3235
*
3336
* Supported AXI4 Features:
3437
* - Read address channel (AR) with ID, address, len, size, prot, qos
@@ -63,16 +66,18 @@
6366
******************************************************************************/
6467

6568
module axird2umi #(
66-
parameter CW = 32,
67-
parameter DW = 128,
68-
parameter AW = 64,
69-
parameter IDW = 8,
70-
// UMI source address for read requests (used as-is, no strobe encoding)
71-
parameter [AW-1:0] HOSTADDR = {AW{1'b0}}
69+
parameter CW = 32,
70+
parameter DW = 128,
71+
parameter AW = 64,
72+
parameter IDW = 8
7273
)(
7374
input clk,
7475
input nreset,
7576

77+
/* UMI source address for read requests (used as-is, no strobe encoding).
78+
* Typically static; if changed, must be synchronous to clk. */
79+
input [AW-1:0] hostaddr,
80+
7681
//####################################
7782
// AXI4 FULL Read Channels
7883
//####################################
@@ -170,7 +175,7 @@ module axird2umi #(
170175
);
171176

172177
assign uhost_req_dstaddr = {s_axi_araddr[AW-1:STRB_LOG2], {STRB_LOG2{1'b0}}};
173-
assign uhost_req_srcaddr = HOSTADDR;
178+
assign uhost_req_srcaddr = hostaddr;
174179
assign uhost_req_data = {DW{1'b0}};
175180

176181
// Connect UMI Response to AXI4 Read Data Channel

umi/adapters/axi2umi/rtl/axiwr2umi.v

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
* a UMI RESP_WRITE expected for each beat before proceeding to the next.
2323
*
2424
* Parameters:
25-
* CW - UMI command width (default 32)
26-
* DW - Data width in bits, must be <= 128 (16 byte strobe fits in SA[15:0])
27-
* AW - Address width in bits (default 64)
28-
* IDW - AXI ID width (default 8)
29-
* HOSTADDR - UMI source address base. The bottom DW/8 bits are replaced
25+
* CW - UMI command width (default 32)
26+
* DW - Data width in bits, must be <= 128 (16 byte strobe fits in SA[15:0])
27+
* AW - Address width in bits (default 64)
28+
* IDW - AXI ID width (default 8)
29+
*
30+
* Config Ports:
31+
* hostaddr - UMI source address base. The bottom DW/8 bits are replaced
3032
* with the raw AXI write strobe value per UMI spec recommendation.
33+
* Typically static; if changed, must be synchronous to clk.
3134
*
3235
* Supported AXI4 Features:
3336
* - Write address channel (AW) with ID, address, len, size, burst, prot, qos
@@ -75,18 +78,20 @@
7578
******************************************************************************/
7679

7780
module axiwr2umi #(
78-
parameter CW = 32,
79-
parameter DW = 128,
80-
parameter AW = 64,
81-
parameter IDW = 8,
82-
/* Note the bottom DW/8 bits of HOSTADDR are ignored
83-
* Per UMI spec the recommendation is to set the bottom
84-
* DW/8 bits of srcaddr to the AXI write channels strobe value */
85-
parameter [AW-1:0] HOSTADDR = {AW{1'b0}}
81+
parameter CW = 32,
82+
parameter DW = 128,
83+
parameter AW = 64,
84+
parameter IDW = 8
8685
)(
8786
input clk,
8887
input nreset,
8988

89+
/* UMI source address base.
90+
* Note: The bottom DW/8 bits of hostaddr are ignored per UMI spec.
91+
* Those bits carry the raw AXI write strobe value instead.
92+
* Typically static if changed, must be synchronous to clk. */
93+
input [AW-1:0] hostaddr,
94+
9095
//####################################
9196
// AXI4 FULL Write Channels
9297
//####################################
@@ -318,7 +323,7 @@ module axiwr2umi #(
318323
.packet_cmd (uhost_req_cmd)
319324
);
320325

321-
assign uhost_req_srcaddr[AW-1:0] = {HOSTADDR[AW-1:DW/8], s_axi_wstrb[DW/8-1:0]};
326+
assign uhost_req_srcaddr[AW-1:0] = {hostaddr[AW-1:DW/8], s_axi_wstrb[DW/8-1:0]};
322327
// Offset destination address to the first active strobe byte
323328
assign uhost_req_dstaddr[AW-1:0] = dst_addr[AW-1:0] + {{(AW-STRB_LOG2-1){1'b0}}, right_most_strb_bit_index[STRB_LOG2:0]};
324329

0 commit comments

Comments
 (0)