Line 36... |
Line 36... |
#define CT_PHYSICAL 2
|
#define CT_PHYSICAL 2
|
|
|
/* Instruction queue */
|
/* Instruction queue */
|
struct iqueue_entry {
|
struct iqueue_entry {
|
int insn_index;
|
int insn_index;
|
unsigned long insn;
|
uint32_t insn;
|
unsigned long insn_addr;
|
oraddr_t insn_addr;
|
};
|
};
|
|
|
/* Memory regions assigned to devices */
|
/* Memory regions assigned to devices */
|
struct dev_memarea {
|
struct dev_memarea {
|
struct dev_memarea *next;
|
struct dev_memarea *next;
|
/*unsigned long start;
|
/*unsigned long start;
|
unsigned long end;*/ /* if start + size > end, this block is disabled; to enable it recalculate end addr. */
|
unsigned long end;*/ /* if start + size > end, this block is disabled; to enable it recalculate end addr. */
|
unsigned long addr_mask;
|
oraddr_t addr_mask;
|
unsigned long addr_compare;
|
oraddr_t addr_compare;
|
unsigned long size;
|
uint32_t size;
|
unsigned long size_mask; /* Address mask, calculated out of size */
|
uint32_t size_mask; /* Address mask, calculated out of size */
|
unsigned long granularity; /* how many bytes read/write accepts: 1/2/4 */
|
unsigned int granularity; /* how many bytes read/write accepts: 1/2/4 */
|
int delayr; /* Read delay */
|
int delayr; /* Read delay */
|
int delayw; /* Write delay */
|
int delayw; /* Write delay */
|
|
|
int chip_select; /* Needed by memory controller; specifies chip select number for this memory area. */
|
int chip_select; /* Needed by memory controller; specifies chip
|
|
* select number for this memory area. */
|
int valid; /* This bit reflect the memory controler valid bit */
|
int valid; /* This bit reflect the memory controler valid bit */
|
FILE *log; /* log file if this device is to be logged, NULL otherwise */
|
FILE *log; /* log file if this device is to be logged, NULL otherwise */
|
|
|
unsigned long (*readfunc)(unsigned long);
|
uint32_t (*readfunc)(oraddr_t);
|
void (*writefunc)(unsigned long, unsigned long);
|
void (*writefunc)(oraddr_t, uint32_t);
|
/* private data */
|
/* private data */
|
unsigned long misc;
|
unsigned long misc;
|
};
|
};
|
|
|
extern struct iqueue_entry iqueue[20];
|
extern struct iqueue_entry iqueue[20];
|
extern struct iqueue_entry icomplet[20];
|
extern struct iqueue_entry icomplet[20];
|
extern unsigned long pc;
|
extern oraddr_t pc;
|
extern int mem_cycles; /* Number of memory cycles in during this instruction execution */
|
extern int mem_cycles; /* Number of memory cycles in during this instruction execution */
|
extern int cycles; /* Total number of cycles executed so far */
|
extern int cycles; /* Total number of cycles executed so far */
|
|
|
extern void dumpmemory(unsigned int from, unsigned int to, int disasm, int nl);
|
extern void dumpmemory(oraddr_t from, oraddr_t to, int disasm, int nl);
|
extern unsigned long eval_mem32(unsigned long memaddr,int*);
|
extern uint32_t eval_mem32(oraddr_t memaddr,int*);
|
extern unsigned short eval_mem16(unsigned long memaddr,int*);
|
extern uint16_t eval_mem16(oraddr_t memaddr,int*);
|
extern unsigned char eval_mem8(unsigned long memaddr,int*);
|
extern uint8_t eval_mem8(oraddr_t memaddr,int*);
|
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
|
void set_mem32(oraddr_t memaddr, uint32_t value,int*);
|
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
|
extern void set_mem16(oraddr_t memaddr, uint16_t value,int*);
|
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
|
extern void set_mem8(oraddr_t memaddr, uint8_t value,int*);
|
|
|
unsigned long evalsim_mem32(unsigned long);
|
uint32_t evalsim_mem32(oraddr_t);
|
unsigned short evalsim_mem16(unsigned long);
|
uint16_t evalsim_mem16(oraddr_t);
|
unsigned char evalsim_mem8(unsigned long);
|
uint8_t evalsim_mem8(oraddr_t);
|
|
|
unsigned long evalsim_mem32_atomic(unsigned long, int);
|
uint32_t evalsim_mem32_atomic(oraddr_t, int);
|
unsigned short evalsim_mem16_atomic(unsigned long, int);
|
uint16_t evalsim_mem16_atomic(oraddr_t, int);
|
unsigned char evalsim_mem8_atomic(unsigned long, int);
|
uint8_t evalsim_mem8_atomic(oraddr_t, int);
|
|
|
void setsim_mem32(unsigned long,unsigned long);
|
void setsim_mem32(oraddr_t, uint32_t);
|
void setsim_mem16(unsigned long,unsigned short);
|
void setsim_mem16(oraddr_t, uint16_t);
|
void setsim_mem8(unsigned long,unsigned char);
|
void setsim_mem8(oraddr_t, uint8_t);
|
|
|
void setsim_mem32_atomic(unsigned long,unsigned long, int);
|
void setsim_mem32_atomic(oraddr_t, uint32_t, int);
|
void setsim_mem16_atomic(unsigned long,unsigned short, int);
|
void setsim_mem16_atomic(oraddr_t, uint16_t, int);
|
void setsim_mem8_atomic(unsigned long,unsigned char, int);
|
void setsim_mem8_atomic(oraddr_t, uint8_t, int);
|
|
|
void init_memory_table ();
|
void init_memory_table ();
|
|
|
/* Changes read/write memory in read/write only */
|
/* Changes read/write memory in read/write only */
|
void lock_memory_table ();
|
void lock_memory_table ();
|
Line 107... |
Line 108... |
void memory_table_status ();
|
void memory_table_status ();
|
|
|
/* Register read and write function for a memory area.
|
/* Register read and write function for a memory area.
|
addr is inside the area, if addr & addr_mask == addr_compare
|
addr is inside the area, if addr & addr_mask == addr_compare
|
(used also by peripheral devices like 16450 UART etc.) */
|
(used also by peripheral devices like 16450 UART etc.) */
|
void register_memoryarea_mask(unsigned long addr_mask, unsigned long addr_compare,
|
void register_memoryarea_mask(oraddr_t addr_mask, oraddr_t addr_compare,
|
unsigned long size, unsigned granularity, unsigned mc_dev,
|
uint32_t size, unsigned granularity, unsigned mc_dev,
|
unsigned long (readfunc)(unsigned long),
|
uint32_t (readfunc)(oraddr_t),
|
void (writefunc)(unsigned long, unsigned long));
|
void (writefunc)(oraddr_t, uint32_t));
|
|
|
/* Register read and write function for a memory area.
|
/* Register read and write function for a memory area.
|
Memory areas should be aligned. Memory area is rounded up to
|
Memory areas should be aligned. Memory area is rounded up to
|
fit the nearest 2^n aligment.
|
fit the nearest 2^n aligment.
|
(used also by peripheral devices like 16450 UART etc.)
|
(used also by peripheral devices like 16450 UART etc.)
|
If mc_dev is 1, this means that this device will be checked first for match
|
If mc_dev is 1, this means that this device will be checked first for match
|
and will be accessed in case in overlaping memory spaces.
|
and will be accessed in case in overlaping memory spaces.
|
Only one device can have this set to 1 (used for memory controller) */
|
Only one device can have this set to 1 (used for memory controller) */
|
void register_memoryarea(unsigned long addr,
|
void register_memoryarea(oraddr_t addr, uint32_t size, unsigned granularity,
|
unsigned long size, unsigned granularity, unsigned mc_dev,
|
unsigned mc_dev, uint32_t (readfunc)(oraddr_t),
|
unsigned long (readfunc)(unsigned long),
|
void (writefunc)(oraddr_t, uint32_t));
|
void (writefunc)(unsigned long, unsigned long));
|
|
|
|
/* Finds the memory area for the address and adjust the read and write delays for it. */
|
/* Finds the memory area for the address and adjust the read and write delays for it. */
|
void adjust_rw_delay(unsigned long memaddr, unsigned long delayr, unsigned long delayw);
|
void adjust_rw_delay(oraddr_t memaddr, unsigned int delayr, unsigned int delayw);
|
|
|
/* Check if access is to registered area of memory. */
|
/* Check if access is to registered area of memory. */
|
struct dev_memarea *verify_memoryarea(unsigned long addr);
|
struct dev_memarea *verify_memoryarea(oraddr_t addr);
|
|
|
/* Outputs time in pretty form to dest string. */
|
/* Outputs time in pretty form to dest string. */
|
char *generate_time_pretty (char *dest, long time_ps);
|
char *generate_time_pretty (char *dest, long time_ps);
|
|
|
/* Returns 32-bit values from mem array. */
|
/* Returns 32-bit values from mem array. */
|
unsigned long eval_insn(unsigned long, int *);
|
uint32_t eval_insn(oraddr_t, int *);
|
|
|
void simmem_write_word(unsigned long addr, unsigned long value);
|
void simmem_write_word(oraddr_t addr, uint32_t value);
|
|
|
unsigned long simmem_read_word(unsigned long addr);
|
uint32_t simmem_read_word(oraddr_t addr);
|
|
|
unsigned long eval_direct32(unsigned long addr, int *breakpoint, int through_mmu, int through_dc);
|
uint32_t eval_direct32(oraddr_t addr, int *breakpoint, int through_mmu, int through_dc);
|
|
|
void set_direct32(unsigned long addr, unsigned long value, int *breakpoint, int through_mmu, int through_dc);
|
void set_direct32(uint32_t addr, uint32_t value, int *breakpoint, int through_mmu, int through_dc);
|
|
|
/* Temporary variable to increase speed. */
|
/* Temporary variable to increase speed. */
|
extern struct dev_memarea *cur_area;
|
extern struct dev_memarea *cur_area;
|
|
|
/* Virtual address of current access. */
|
/* Virtual address of current access. */
|
extern unsigned long cur_vadd;
|
extern oraddr_t cur_vadd;
|
|
|
/* These are set by mmu if cache inhibit bit is set for current acces. */
|
/* These are set by mmu if cache inhibit bit is set for current acces. */
|
extern int data_ci, insn_ci;
|
extern int data_ci, insn_ci;
|
|
|
/* Added by MM */
|
/* Added by MM */
|