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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [tools/] [mlite.c] - Diff between revs 392 and 410

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

Rev 392 Rev 410
Line 152... Line 152...
static unsigned int HWMemory[8];
static unsigned int HWMemory[8];
 
 
 
 
static int mem_read(State *s, int size, unsigned int address)
static int mem_read(State *s, int size, unsigned int address)
{
{
   unsigned int value=0, ptr;
   unsigned int value=0;
 
   unsigned char *ptr;
 
 
   s->irqStatus |= IRQ_UART_WRITE_AVAILABLE;
   s->irqStatus |= IRQ_UART_WRITE_AVAILABLE;
   switch(address)
   switch(address)
   {
   {
      case UART_READ:
      case UART_READ:
Line 177... Line 178...
         return s->processId;
         return s->processId;
      case MMU_FAULT_ADDR:
      case MMU_FAULT_ADDR:
         return s->faultAddr;
         return s->faultAddr;
   }
   }
 
 
   ptr = (unsigned int)s->mem + (address % MEM_SIZE);
   ptr = s->mem + (address % MEM_SIZE);
 
 
   if(0x10000000 <= address && address < 0x10000000 + 1024*1024)
   if(0x10000000 <= address && address < 0x10000000 + 1024*1024)
      ptr += 1024*1024;
      ptr += 1024*1024;
 
 
   switch(size)
   switch(size)
Line 209... Line 210...
   return(value);
   return(value);
}
}
 
 
static void mem_write(State *s, int size, int unsigned address, unsigned int value)
static void mem_write(State *s, int size, int unsigned address, unsigned int value)
{
{
   unsigned int ptr;
   unsigned char *ptr;
 
 
   switch(address)
   switch(address)
   {
   {
      case UART_WRITE:
      case UART_WRITE:
         putch(value);
         putch(value);
Line 234... Line 235...
   }
   }
 
 
   if(MMU_TLB <= address && address <= MMU_TLB+MMU_ENTRIES * 8)
   if(MMU_TLB <= address && address <= MMU_TLB+MMU_ENTRIES * 8)
   {
   {
      //printf("TLB 0x%x 0x%x\n", address - MMU_TLB, value);
      //printf("TLB 0x%x 0x%x\n", address - MMU_TLB, value);
      ptr = (unsigned int)s->mmuEntry + address - MMU_TLB;
      ptr = (unsigned char*)s->mmuEntry + address - MMU_TLB;
      *(int*)ptr = value;
      *(int*)ptr = value;
      s->irqStatus &= ~IRQ_MMU;
      s->irqStatus &= ~IRQ_MMU;
      return;
      return;
   }
   }
 
 
   ptr = (unsigned int)s->mem + (address % MEM_SIZE);
   ptr = s->mem + (address % MEM_SIZE);
 
 
   if(0x10000000 <= address && address < 0x10000000 + 1024*1024)
   if(0x10000000 <= address && address < 0x10000000 + 1024*1024)
      ptr += 1024*1024;
      ptr += 1024*1024;
 
 
   switch(size)
   switch(size)

powered by: WebSVN 2.1.0

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