Fixed RV32 MMU constants

This commit is contained in:
David Harris 2021-06-04 09:15:42 -04:00
parent a61411995a
commit 99d661cee9

View File

@ -28,13 +28,33 @@
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
///////////////////////////////////////////
`include "wally-config.vh"
/*
// Virtual Memory Constants (sv48)
`define VPN_SEGMENT_BITS 9
`define VPN_BITS 36
`define PPN_HIGH_SEGMENT_BITS 17
`define PPN_BITS 44
`define PA_BITS 56
`define SVMODE_BITS 4
`define VPN_SEGMENT_BITS_RV64 9
`define VPN_BITS_RV64 36
`define PPN_HIGH_SEGMENT_BITS_RV64 17
`define PPN_BITS_RV64 44
`define PA_BITS_RV64 56
`define SVMODE_BITS_RV64 4
// Virtual Memory Constants (sv32)
`define VPN_SEGMENT_BITS_RV32 10
`define VPN_BITS_RV32 20
`define PPN_HIGH_SEGMENT_BITS_RV32 12
`define PPN_BITS_RV32 22
`define PA_BITS_RV32 34
`define SVMODE_BITS_RV32 1
*/
// Virtual Memory Constants
`define VPN_SEGMENT_BITS (`XLEN == 32 ? 10 : 9)
`define VPN_BITS (`XLEN==32 ? (2*`VPN_SEGMENT_BITS) : (4*`VPN_SEGMENT_BITS))
`define PPN_HIGH_SEGMENT_BITS (`XLEN==32 ? 12 : 17)
`define PPN_BITS (`XLEN==32 ? 22 : 44)
`define PA_BITS (`XLEN==32 ? 34 : 56)
`define SVMODE_BITS (`XLEN == 32 ? 1 : 4)
// constants to check SATP_MODE against
// defined in Table 4.3 of the privileged spec
`define NO_TRANSLATE 0