| 1 | #!/usr/bin/env python |
| 2 | |
| 3 | import sys |
| 4 | |
| 5 | assert sys.maxint == (2**63 - 1) |
| 6 | |
| 7 | # General purpose register width (in bytes) |
| 8 | XLEN = 8 |
| 9 | |
| 10 | # Floating point register width (in bytes) |
| 11 | FLEN = 8 # Assume "Standard Extension for Double 'D'" is available. |
| 12 | |
| 13 | # Stack slot size that can contain either int/float whenever the register |
| 14 | # allocator would like to push a scratch value to the stack top. |
| 15 | # |
| 16 | # Note: This constant value is used by `regalloc_push` and `regalloc_pop`. |
| 17 | SCRATCH_STACK_SLOT_SIZE = 8 |
| 18 | |
| 19 | NUM_REGS = 32 |
| 20 | NUM_FP_REGS = 32 |
| 21 | JITFRAME_FIXED_SIZE = NUM_REGS + NUM_FP_REGS |
| 22 | |
| 23 | # PC-relative offset range |
| 24 | PC_REL_MIN = -2**31 - 2**11 |
| 25 | PC_REL_MAX = 2**31 - 2**11 - 1 |
| 26 | |
| 27 | # 12-bit signed immediate value range |
| 28 | SINT12_IMM_MIN = -2**11 |
| 29 | SINT12_IMM_MAX = 2**11 - 1 |
| 30 | |
| 31 | # Shift amount immediate range |
| 32 | SHAMT_MAX = 8 * XLEN - 1 |
| 33 | |
| 34 | # RISC-V ABI requires stack pointer to be aligned to 128-bit. |
| 35 | ABI_STACK_ALIGN = 16 |
| 36 | |
| 37 | # Instruction size (in bytes) |
| 38 | INST_SIZE = 4 |