From 8e00196dd6ffd721662957b78a208ac2fc5d2ae5 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Wed, 6 Dec 2023 14:49:07 -0800 Subject: [PATCH 1/3] adding non-4kB aligned base offset device to test_block_overlap.py --- tests/.gitignore | 1 + tests/test_block_overlap.py | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/.gitignore diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 000000000..1cda54be9 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +*.yml diff --git a/tests/test_block_overlap.py b/tests/test_block_overlap.py index 4025ea20c..148c3d414 100644 --- a/tests/test_block_overlap.py +++ b/tests/test_block_overlap.py @@ -13,6 +13,24 @@ #rogue.Logging.setLevel(rogue.Logging.Debug) +class SimpleVarDevice(pr.Device): + def __init__(self, **kwargs): + super().__init__(**kwargs) + + self.add(pr.RemoteVariable( + name = 'Var1', + offset = 0x0, + bitSize = 32, + bitOffset = 0, + )) + + self.add(pr.RemoteVariable( + name = 'Var2', + offset = 0x4, + bitSize = 32, + bitOffset = 0, + )) + class BlockDevice(pr.Device): def __init__(self, **kwargs): super().__init__(**kwargs) @@ -85,7 +103,12 @@ def __init__(self): self.addInterface(sim) self.add(BlockDevice( - offset = 0, + offset = 0x0000, + memBase = sim, + )) + + self.add(SimpleVarDevice( + offset = 0xF034, # non-4kB aligned base offset memBase = sim, )) From 0121dbebab0ee61d8d2383be932d2f9a570b8564 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Mon, 18 Dec 2023 13:18:14 -0800 Subject: [PATCH 2/3] bug fix in calculating the Block's full address --- src/rogue/interfaces/memory/Block.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rogue/interfaces/memory/Block.cpp b/src/rogue/interfaces/memory/Block.cpp index 5e3a106e5..f717bf465 100644 --- a/src/rogue/interfaces/memory/Block.cpp +++ b/src/rogue/interfaces/memory/Block.cpp @@ -148,7 +148,7 @@ uint64_t rim::Block::offset() { // Get full address of this Block uint64_t rim::Block::address() { - return (reqAddress() | offset_); + return (reqAddress() + offset_); } // Get size of this block in bytes. From 42ec83e4116fe5bf77e82643041466ab4a57e7b2 Mon Sep 17 00:00:00 2001 From: Ryan Herbst Date: Mon, 8 Jan 2024 11:14:32 -0800 Subject: [PATCH 3/3] Fix other locations where address is computed --- src/rogue/interfaces/memory/Hub.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rogue/interfaces/memory/Hub.cpp b/src/rogue/interfaces/memory/Hub.cpp index 1f572c318..708d05ea8 100644 --- a/src/rogue/interfaces/memory/Hub.cpp +++ b/src/rogue/interfaces/memory/Hub.cpp @@ -64,7 +64,7 @@ uint64_t rim::Hub::getOffset() { //! Get address uint64_t rim::Hub::getAddress() { - return (reqAddress() | offset_); + return (reqAddress() + offset_); } //! Return id to requesting master @@ -105,7 +105,7 @@ uint64_t rim::Hub::doAddress() { if (root_) return (0); else - return (reqAddress() | offset_); + return (reqAddress() + offset_); } //! Post a transaction. Master will call this method with the access attributes. @@ -113,7 +113,7 @@ void rim::Hub::doTransaction(rim::TransactionPtr tran) { uint32_t maxAccess = getSlave()->doMaxAccess(); // Adjust address - tran->address_ |= offset_; + tran->address_ += offset_; // Split into smaller transactions if necessary if (tran->size() > maxAccess) {