From 75f78c215131499165101a499197313ba77ea230 Mon Sep 17 00:00:00 2001 From: bd Date: Fri, 21 Mar 2025 16:06:07 -0400 Subject: Small cleanups to up a lot of inplementation details --- inc/utils.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'inc/utils.h') diff --git a/inc/utils.h b/inc/utils.h index aa8831b..df8d374 100644 --- a/inc/utils.h +++ b/inc/utils.h @@ -20,6 +20,20 @@ void get_bit_fields(int address, int *tag, int *index, int *offset); */ const std::string string_format(const char *const zcFormat, ...); +/** + * Given `address`, returns an address that is within the current memory size + * using a clean wrap. + * @param an address + * @return an address guaranteed to be within range. + */ int wrap_address(int address); +/** + * Given `address`, returns the line and word it is in. + * @param an address + * @param the line (row) `address` is in + * @param the word (column) `address` corresponds to + */ +void get_memory_index(int address, int &line, int &word); + #endif /* UTILS_H_INCLUDED */ -- cgit v1.2.3