Skip to content

Commit

Permalink
chore: format new header files
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco committed Nov 10, 2023
1 parent 38ba8d9 commit 4c0a34d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 57 deletions.
20 changes: 10 additions & 10 deletions src/htif-defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
76 changes: 38 additions & 38 deletions src/pma-defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ///< log<sub>2</sub> 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 ///< log<sub>2</sub> 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
Expand Down
4 changes: 2 additions & 2 deletions src/rtc-defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
13 changes: 6 additions & 7 deletions src/uarch-defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 4c0a34d

Please sign in to comment.