From 4c0a34d57a3e19bd1e60f739061ca1b3f593ae3e Mon Sep 17 00:00:00 2001 From: Victor Fusco <1221933+vfusco@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:27:51 -0300 Subject: [PATCH] chore: format new header files --- src/htif-defines.h | 20 ++++++------ src/pma-defines.h | 76 ++++++++++++++++++++++----------------------- src/rtc-defines.h | 4 +-- src/uarch-defines.h | 13 ++++---- 4 files changed, 56 insertions(+), 57 deletions(-) diff --git a/src/htif-defines.h b/src/htif-defines.h index 80e2eac53..9817d632b 100644 --- a/src/htif-defines.h +++ b/src/htif-defines.h @@ -17,23 +17,23 @@ #ifndef HTIF_DEFINES_H #define HTIF_DEFINES_H -#define HTIF_DEV_SHIFT_DEF 56 -#define HTIF_CMD_SHIFT_DEF 48 -#define HTIF_DATA_SHIFT_DEF 0 +#define HTIF_DEV_SHIFT_DEF 56 +#define HTIF_CMD_SHIFT_DEF 48 +#define HTIF_DATA_SHIFT_DEF 0 -#define HTIF_DEV_MASK_DEF 0xFF00000000000000 -#define HTIF_CMD_MASK_DEF 0x00FF000000000000 +#define HTIF_DEV_MASK_DEF 0xFF00000000000000 +#define HTIF_CMD_MASK_DEF 0x00FF000000000000 #define HTIF_DATA_MASK_DEF 0x0000FFFFFFFFFFFF -#define HTIF_DEVICE_HALT_DEF 0 +#define HTIF_DEVICE_HALT_DEF 0 #define HTIF_DEVICE_CONSOLE_DEF 1 -#define HTIF_DEVICE_YIELD_DEF 2 +#define HTIF_DEVICE_YIELD_DEF 2 -#define HTIF_HALT_HALT_DEF 0 +#define HTIF_HALT_HALT_DEF 0 #define HTIF_CONSOLE_GETCHAR_DEF 0 #define HTIF_CONSOLE_PUTCHAR_DEF 1 -#define HTIF_YIELD_AUTOMATIC_DEF 0 -#define HTIF_YIELD_MANUAL_DEF 1 +#define HTIF_YIELD_AUTOMATIC_DEF 0 +#define HTIF_YIELD_MANUAL_DEF 1 #define HTIF_YIELD_REASON_PROGRESS_DEF 0 #define HTIF_YIELD_REASON_RX_ACCEPTED_DEF 1 diff --git a/src/pma-defines.h b/src/pma-defines.h index cc4b85aa8..4450f2d1d 100644 --- a/src/pma-defines.h +++ b/src/pma-defines.h @@ -17,46 +17,46 @@ #ifndef PMA_DEFINES_H #define PMA_DEFINES_H -#define PMA_SHADOW_STATE_START_DEF 0x0 ///< Shadow start address -#define PMA_SHADOW_STATE_LENGTH_DEF 0x1000 ///< Shadow length in bytes -#define PMA_SHADOW_PMAS_START_DEF 0x10000 ///< PMA Array start address -#define PMA_SHADOW_PMAS_LENGTH_DEF 0x1000 ///< PMA Array length in bytes -#define PMA_SHADOW_TLB_START_DEF 0x20000 ///< TLB start address -#define PMA_SHADOW_TLB_LENGTH_DEF 0x6000 ///< TLB length in bytes -#define PMA_CLINT_START_DEF 0x2000000 ///< CLINT start address -#define PMA_CLINT_LENGTH_DEF 0xC0000 ///< CLINT length in bytes -#define PMA_HTIF_START_DEF 0x40008000 ///< HTIF base address (to_host) -#define PMA_HTIF_LENGTH_DEF 0x1000 ///< HTIF length in bytes -#define PMA_FIRST_VIRTIO_START_DEF 0x40010000 ///< Start of first VIRTIO range (RESERVED) -#define PMA_VIRTIO_LENGTH_DEF 0x1000 ///< Length of each VIRTIO range (RESERVED) -#define PMA_LAST_VIRTIO_END_DEF 0x40020000 ///< End of last VIRTIO range (RESERVED) -#define PMA_DHD_START_DEF 0x40030000 ///< Start of DEHASH range -#define PMA_DHD_LENGTH_DEF 0x1000 ///< Length of in bytes -#define PMA_PLIC_START_DEF 0x40100000 ///< Start of PLIC range (RESERVED) -#define PMA_PLIC_LENGTH_DEF 0x00400000 ///< Length of PLIC range (RESERVED) -#define PMA_UARCH_RAM_START_DEF 0x70000000 ///< microarchitecture RAM start address -#define PMA_DTB_START_DEF 0x7ff00000 ///< DTB start address -#define PMA_DTB_LENGTH_DEF 0x100000 ///< DTB length in bytes -#define PMA_RAM_START_DEF 0x80000000 ///< RAM start address +#define PMA_SHADOW_STATE_START_DEF 0x0 ///< Shadow start address +#define PMA_SHADOW_STATE_LENGTH_DEF 0x1000 ///< Shadow length in bytes +#define PMA_SHADOW_PMAS_START_DEF 0x10000 ///< PMA Array start address +#define PMA_SHADOW_PMAS_LENGTH_DEF 0x1000 ///< PMA Array length in bytes +#define PMA_SHADOW_TLB_START_DEF 0x20000 ///< TLB start address +#define PMA_SHADOW_TLB_LENGTH_DEF 0x6000 ///< TLB length in bytes +#define PMA_CLINT_START_DEF 0x2000000 ///< CLINT start address +#define PMA_CLINT_LENGTH_DEF 0xC0000 ///< CLINT length in bytes +#define PMA_HTIF_START_DEF 0x40008000 ///< HTIF base address (to_host) +#define PMA_HTIF_LENGTH_DEF 0x1000 ///< HTIF length in bytes +#define PMA_FIRST_VIRTIO_START_DEF 0x40010000 ///< Start of first VIRTIO range (RESERVED) +#define PMA_VIRTIO_LENGTH_DEF 0x1000 ///< Length of each VIRTIO range (RESERVED) +#define PMA_LAST_VIRTIO_END_DEF 0x40020000 ///< End of last VIRTIO range (RESERVED) +#define PMA_DHD_START_DEF 0x40030000 ///< Start of DEHASH range +#define PMA_DHD_LENGTH_DEF 0x1000 ///< Length of in bytes +#define PMA_PLIC_START_DEF 0x40100000 ///< Start of PLIC range (RESERVED) +#define PMA_PLIC_LENGTH_DEF 0x00400000 ///< Length of PLIC range (RESERVED) +#define PMA_UARCH_RAM_START_DEF 0x70000000 ///< microarchitecture RAM start address +#define PMA_DTB_START_DEF 0x7ff00000 ///< DTB start address +#define PMA_DTB_LENGTH_DEF 0x100000 ///< DTB length in bytes +#define PMA_RAM_START_DEF 0x80000000 ///< RAM start address -#define PMA_PAGE_SIZE_LOG2_DEF 12 ///< log2 of physical memory page size. -#define PMA_WORD_SIZE_DEF 8 ///< Physical memory word size. -#define PMA_MAX_DEF 32 ///< Maximum number of PMAs -#define PMA_TLB_SIZE_DEF 256 ///< Number for entries per TLB type +#define PMA_PAGE_SIZE_LOG2_DEF 12 ///< log2 of physical memory page size. +#define PMA_WORD_SIZE_DEF 8 ///< Physical memory word size. +#define PMA_MAX_DEF 32 ///< Maximum number of PMAs +#define PMA_TLB_SIZE_DEF 256 ///< Number for entries per TLB type -#define PMA_MEMORY_DID_DEF 0 ///< Device ID for memory -#define PMA_SHADOW_STATE_DID_DEF 1 ///< Device ID for shadow state device -#define PMA_SHADOW_PMAS_DID_DEF 2 ///< Device ID for shadow pma array device -#define PMA_FLASH_DRIVE_DID_DEF 3 ///< Device ID for flash drive device -#define PMA_CLINT_DID_DEF 4 ///< Device ID for CLINT device -#define PMA_HTIF_DID_DEF 5 ///< Device ID for HTIF device -#define PMA_SHADOW_TLB_DID_DEF 6 ///< Device ID for shadow TLB device -#define PMA_ROLLUP_RX_BUFFER_DID_DEF 7 ///< Device ID for rollup RX buffer -#define PMA_ROLLUP_TX_BUFFER_DID_DEF 8 ///< Device ID for rollup TX buffer -#define PMA_ROLLUP_INPUT_METADATA_DID_DEF 9 ///< Device ID for rollup input metadata buffer -#define PMA_ROLLUP_VOUCHER_HASHES_DID_DEF 10 ///< Device ID for rollup voucher hashes buffer -#define PMA_ROLLUP_NOTICE_HASHES_DID_DEF 11 ///< Device ID for rollup notice hashes buffer -#define PMA_DHD_DID_DEF 12 ///< Device ID for DHD device +#define PMA_MEMORY_DID_DEF 0 ///< Device ID for memory +#define PMA_SHADOW_STATE_DID_DEF 1 ///< Device ID for shadow state device +#define PMA_SHADOW_PMAS_DID_DEF 2 ///< Device ID for shadow pma array device +#define PMA_FLASH_DRIVE_DID_DEF 3 ///< Device ID for flash drive device +#define PMA_CLINT_DID_DEF 4 ///< Device ID for CLINT device +#define PMA_HTIF_DID_DEF 5 ///< Device ID for HTIF device +#define PMA_SHADOW_TLB_DID_DEF 6 ///< Device ID for shadow TLB device +#define PMA_ROLLUP_RX_BUFFER_DID_DEF 7 ///< Device ID for rollup RX buffer +#define PMA_ROLLUP_TX_BUFFER_DID_DEF 8 ///< Device ID for rollup TX buffer +#define PMA_ROLLUP_INPUT_METADATA_DID_DEF 9 ///< Device ID for rollup input metadata buffer +#define PMA_ROLLUP_VOUCHER_HASHES_DID_DEF 10 ///< Device ID for rollup voucher hashes buffer +#define PMA_ROLLUP_NOTICE_HASHES_DID_DEF 11 ///< Device ID for rollup notice hashes buffer +#define PMA_DHD_DID_DEF 12 ///< Device ID for DHD device // helper for using UINT64_C with defines #ifndef EXPAND_UINT64_C diff --git a/src/rtc-defines.h b/src/rtc-defines.h index e8e78873a..33d4a3848 100644 --- a/src/rtc-defines.h +++ b/src/rtc-defines.h @@ -21,10 +21,10 @@ /// Changing this value affects the machine state hash /// Higher values decrease the performance of the interactive machine emulator /// Using base 2 values optimizes division and multiplications in the interpreter loop -#define RTC_FREQ_DIV_DEF 8192 +#define RTC_FREQ_DIV_DEF 8192 /// \brief Arbitrary CPU clock frequency. /// We have to make sure the clock frequency is divisible by RTC_FREQ_DIV_DEF and 10^6 -#define RTC_CLOCK_FREQ_DEF 128000000 ///< 128 MHz frequency +#define RTC_CLOCK_FREQ_DEF 128000000 ///< 128 MHz frequency #endif /* end of include guard: RTC_DEFINES_H */ diff --git a/src/uarch-defines.h b/src/uarch-defines.h index 83cd8d055..43f9f1e80 100644 --- a/src/uarch-defines.h +++ b/src/uarch-defines.h @@ -20,22 +20,21 @@ #include "pma-defines.h" /// \brief Address of uarch halt flag in shadow -#define UARCH_HALT_FLAG_SHADDOW_ADDR_DEF (PMA_SHADOW_STATE_START_DEF + 0x328) +#define UARCH_HALT_FLAG_SHADDOW_ADDR_DEF (PMA_SHADOW_STATE_START_DEF + 0x328) /// \brief The value that halts the microarchitecture when written to UARCH_HALT_FLAG_SHADDOW_ADDR_DEF -#define UARCH_HALT_FLAG_HALT_VALUE_DEF 1 +#define UARCH_HALT_FLAG_HALT_VALUE_DEF 1 /// \brief Base of microarchitecture special addresses -#define UARCH_MMIO_START_DEF 0x7ffff000 ///< Start of microarchitecture memory mapped IO addresses +#define UARCH_MMIO_START_DEF 0x7ffff000 ///< Start of microarchitecture memory mapped IO addresses /// \brief Abort execution of microarchitecture by writing to this address -#define UARCH_MMIO_ABORT_ADDR_DEF (UARCH_MMIO_START_DEF + 0) // NOLINT(cppcoreguidelines-macro-usage) +#define UARCH_MMIO_ABORT_ADDR_DEF (UARCH_MMIO_START_DEF + 0) // NOLINT(cppcoreguidelines-macro-usage) /// \brief The value that aborts execution of the micro machine when written to UARCH_MMIO_ABORT_ADDR_DEF -#define UARCH_MMIO_ABORT_VALUE_DEF 1 +#define UARCH_MMIO_ABORT_VALUE_DEF 1 /// \brief Prints a character to to console when written to UARCH_MMIO_HALT_ADDR_DEF -#define UARCH_MMIO_PUTCHAR_ADDR_DEF (UARCH_MMIO_START_DEF + 8) // NOLINT(cppcoreguidelines-macro-usage) - +#define UARCH_MMIO_PUTCHAR_ADDR_DEF (UARCH_MMIO_START_DEF + 8) // NOLINT(cppcoreguidelines-macro-usage) #endif /* end of include guard: UARCH_DEFINES_H */