diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-10-29 23:05:04 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-10-29 23:05:04 +0100 |
commit | b0b6a7d7f4de63fba2ba91a98cecec1bd57d03f1 (patch) | |
tree | 7dd61f93298d56a6234435b72b30bf00cacd242b /src | |
parent | b716fdae5ef9b76920fdd2bcd8aab97d9cde90a0 (diff) | |
download | sysc-playground-b0b6a7d7f4de63fba2ba91a98cecec1bd57d03f1.tar.gz sysc-playground-b0b6a7d7f4de63fba2ba91a98cecec1bd57d03f1.zip |
test: add first lt_bus tests
Diffstat (limited to 'src')
-rw-r--r-- | src/models/lt_bus.h | 1 | ||||
-rw-r--r-- | src/utils/range.h | 6 | ||||
-rw-r--r-- | src/utils/types.h | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/models/lt_bus.h b/src/models/lt_bus.h index c533c50..a8391f8 100644 --- a/src/models/lt_bus.h +++ b/src/models/lt_bus.h @@ -47,6 +47,7 @@ class lt_bus : public sc_core::sc_module { void attach_target(tlm::tlm_base_target_socket_b<>& target, u64 start, u64 end) { + assert(start <= end); const range addr{start, end}; // Check if new range overlaps with any registered memory map range. diff --git a/src/utils/range.h b/src/utils/range.h index ce25298..e4ef12f 100644 --- a/src/utils/range.h +++ b/src/utils/range.h @@ -7,7 +7,7 @@ struct range { constexpr explicit range(u64 start, u64 end) : start{start}, end{end} { - assert(start < end); + assert(start <= end); } constexpr bool overlaps(range rhs) const { @@ -18,6 +18,10 @@ struct range { return start <= rhs.start && rhs.end <= end; } + constexpr bool operator==(range rhs) const { + return start == rhs.start && end == rhs.end; + } + u64 start; u64 end; }; diff --git a/src/utils/types.h b/src/utils/types.h index a13b8ef..4f824f6 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -3,6 +3,7 @@ #include <cstdint> +using u8 = std::uint8_t; using u32 = std::uint32_t; using u64 = std::uint64_t; |