File: arch.py

package info (click to toggle)
pypy3 7.3.19%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212,236 kB
  • sloc: python: 2,098,316; ansic: 540,565; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (38 lines) | stat: -rw-r--r-- 920 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python

import sys

assert sys.maxint == (2**63 - 1)

# General purpose register width (in bytes)
XLEN = 8

# Floating point register width (in bytes)
FLEN = 8  # Assume "Standard Extension for Double 'D'" is available.

# Stack slot size that can contain either int/float whenever the register
# allocator would like to push a scratch value to the stack top.
#
# Note: This constant value is used by `regalloc_push` and `regalloc_pop`.
SCRATCH_STACK_SLOT_SIZE = 8

NUM_REGS = 32
NUM_FP_REGS = 32
JITFRAME_FIXED_SIZE = NUM_REGS + NUM_FP_REGS

# PC-relative offset range
PC_REL_MIN = -2**31 - 2**11
PC_REL_MAX = 2**31 - 2**11 - 1

# 12-bit signed immediate value range
SINT12_IMM_MIN = -2**11
SINT12_IMM_MAX = 2**11 - 1

# Shift amount immediate range
SHAMT_MAX = 8 * XLEN - 1

# RISC-V ABI requires stack pointer to be aligned to 128-bit.
ABI_STACK_ALIGN = 16

# Instruction size (in bytes)
INST_SIZE = 4