Software APIs
Data Structures | Functions | Variables
epmp_unittest::anonymous_namespace{epmp_unittest.cc} Namespace Reference

Data Structures

struct  NapotCase
 
class  NapotTest
 
struct  PmpCsrs
 Representation of the hardware PMP control register state. More...
 

Functions

 TEST_P (NapotTest, Codec)
 
 INSTANTIATE_TEST_SUITE_P (AllCases, NapotTest, testing::Values(NapotCase{ .start=0b1000010100100100101010100000,.end=0b1000010100100100101011000000,.encoded=0b10000101001001001010101011, }, NapotCase{ .start=0b101000001101000011100000000000,.end=0b101000001101000011100100000000,.encoded=0b1010000011010000111000011111, }, NapotCase{ .start=0b10111111111111111111111111111000,.end=0b11000000000000000000000000000000,.encoded=0b101111111111111111111111111110, }, NapotCase{ .start=0b00000000000000000000000000000000,.end=0b10000000000000000000000000000000,.encoded=0b001111111111111111111111111111, }))
 
void ExpectPmpcfgRead (const PmpCsrs &expect)
 Helper function to call EXPECT_CSR_READ on all pmpcfg registers returning the values provided.
 
void ExpectPmpaddrRead (const PmpCsrs &expect)
 Helper function to call EXPECT_CSR_READ on all pmpaddr registers returning the values provided.
 
void ExpectMseccfgRead (const PmpCsrs &expect)
 Helper function to call EXPECT_CSR_READ on the mseccfg register returning the value provided.
 
void ExpectReadState (const PmpCsrs &expect)
 Helper function to call EXPECT_CSR_READ as necessary for an internal read_state call with the expected values provided.
 
 TEST (EpmpCheckTest, Default)
 
 TEST (EpmpCheckTest, ErrorPmpaddr)
 
 TEST (EpmpCheckTest, ErrorPmpcfg)
 
 TEST (EpmpCheckTest, ErrorMseccfg)
 
 TEST (EpmpTorTest, Entry0)
 
 TEST (EpmpTorTest, Entry1)
 
 TEST (EpmpTorTest, Entry15)
 
 TEST (EpmpTorTest, SharedAddress)
 
 TEST (EpmpNa4Test, Entry0)
 
 TEST (EpmpNa4Test, Entry15)
 
uint32_t Napot (epmp_region_t region)
 Encode a region using the NAPOT address mode. More...
 
 TEST (EpmpNapotTest, Entry0)
 
 TEST (EpmpNapotTest, Entry15)
 

Variables

constexpr std::array< uint32_t, 4 > kPmpcfgMap
 Map from PMP config register index to CSR_REG_PMPCFGN value. More...
 
constexpr std::array< uint32_t, 16 > kPmpaddrMap
 Map from PMP address register index to CSR_REG_PMPADDRN value. More...
 

Data Structure Documentation

◆ epmp_unittest::anonymous_namespace{epmp_unittest.cc}::NapotCase

struct epmp_unittest::anonymous_namespace{epmp_unittest.cc}::NapotCase

Definition at line 13 of file epmp_unittest.cc.

Data Fields
uint32_t encoded Encoded NAPOT address.
uint32_t end
uint32_t start Start / end of the NAPOT region.

Function Documentation

◆ Napot()

uint32_t epmp_unittest::anonymous_namespace{epmp_unittest.cc}::Napot ( epmp_region_t  region)

Encode a region using the NAPOT address mode.

This does not do any validation of the values provided.

Note: other address modes just require the address to be right shifted by 2.

Definition at line 302 of file epmp_unittest.cc.

Variable Documentation

◆ kPmpaddrMap

constexpr std::array<uint32_t, 16> epmp_unittest::anonymous_namespace{epmp_unittest.cc}::kPmpaddrMap
constexpr
Initial value:
= {
CSR_REG_PMPADDR0, CSR_REG_PMPADDR1, CSR_REG_PMPADDR2, CSR_REG_PMPADDR3,
CSR_REG_PMPADDR4, CSR_REG_PMPADDR5, CSR_REG_PMPADDR6, CSR_REG_PMPADDR7,
CSR_REG_PMPADDR8, CSR_REG_PMPADDR9, CSR_REG_PMPADDR10, CSR_REG_PMPADDR11,
CSR_REG_PMPADDR12, CSR_REG_PMPADDR13, CSR_REG_PMPADDR14, CSR_REG_PMPADDR15,
}

Map from PMP address register index to CSR_REG_PMPADDRN value.

Definition at line 82 of file epmp_unittest.cc.

◆ kPmpcfgMap

constexpr std::array<uint32_t, 4> epmp_unittest::anonymous_namespace{epmp_unittest.cc}::kPmpcfgMap
constexpr
Initial value:
= {
CSR_REG_PMPCFG0,
CSR_REG_PMPCFG1,
CSR_REG_PMPCFG2,
CSR_REG_PMPCFG3,
}

Map from PMP config register index to CSR_REG_PMPCFGN value.

Definition at line 72 of file epmp_unittest.cc.