OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [lib/] [source/] [neorv32_cpu.c] - Diff between revs 64 and 65

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 64 Rev 65
Line 352... Line 352...
  }
  }
 
 
  uint32_t i = 0;
  uint32_t i = 0;
 
 
  // try setting R bit in all PMPCFG CSRs
  // try setting R bit in all PMPCFG CSRs
  const uint32_t tmp = 0x01010101;
  const uint32_t mask = 0x01010101;
  for (i=0; i<16; i++) {
  for (i=0; i<16; i++) {
    __neorv32_cpu_pmp_cfg_write(i, tmp);
    __neorv32_cpu_pmp_cfg_write(i, mask);
  }
  }
 
 
  // sum up all written ones (only available PMPCFG* CSRs/entries will return =! 0)
  // sum up all written ones (only available PMPCFG* CSRs/entries will return =! 0)
  union {
  union {
    uint32_t uint32;
    uint32_t uint32;
    uint8_t  uint8[sizeof(uint32_t)/sizeof(uint8_t)];
    uint8_t  uint8[sizeof(uint32_t)/sizeof(uint8_t)];
  } cnt;
  } cnt;
 
 
  cnt.uint32 = 0;
  cnt.uint32 = 0;
  for (i=0; i<16; i++) {
  for (i=0; i<16; i++) {
    cnt.uint32 += __neorv32_cpu_pmp_cfg_read(i);
    cnt.uint32 += __neorv32_cpu_pmp_cfg_read(i) & mask;
  }
  }
 
 
  // sum up bytes
  // sum up bytes
  uint32_t num_regions = 0;
  uint32_t num_regions = 0;
  num_regions += (uint32_t)cnt.uint8[0];
  num_regions += (uint32_t)cnt.uint8[0];

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.