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

Subversion Repositories eco32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /eco32/trunk/monitor
    from Rev 52 to Rev 53
    Reverse comparison

Rev 52 → Rev 53

/monitor-xess/getline.c
9,7 → 9,7
#include "getline.h"
 
 
#define MAX_HISTORY 100
#define MAX_HISTORY 20
 
 
static char history[MAX_HISTORY][80];
/monitor-xess/cpu.c
213,13 → 213,12
}
 
 
Bool cpuStep(void) {
void cpuStep(void) {
Word instr;
int opcode;
int reg1, reg2;
Half immed;
Word offset;
Bool canStep;
Word nextAddr;
Word nextInstr;
int i;
232,7 → 231,6
reg2 = (instr >> 16) & 0x1F;
immed = instr & 0x0000FFFF;
offset = instr & 0x03FFFFFF;
canStep = true;
switch (stepType[opcode]) {
case 1:
/* next instruction follows current one */
256,12 → 254,8
default:
printf("cannot single-step instruction with opcode 0x%02X\n",
opcode);
canStep = false;
break;
return;
}
if (!canStep) {
return false;
}
nextInstr = mmuReadWord(nextAddr);
mmuWriteWord(nextAddr, BREAK);
for (i = 0; i < 32; i++) {
288,12 → 282,12
mmuSetEntryLo(userContext.tlbLo);
mmuWriteWord(nextAddr, nextInstr);
if (nextAddr == pc) {
return true;
return;
}
if ((psw & PSW_V) == 0) {
printf("unexpected %s occurred\n",
exceptionToString((psw & PSW_PRIO_MASK) >> 16));
return false;
return;
}
if ((psw & PSW_PRIO_MASK) >> 16 == 21 &&
(mmuGetEntryHi() & 0x80000000) == 0) {
301,11 → 295,10
} else {
pc = 0xC0000004;
}
return true;
}
 
 
Bool cpuRun(void) {
void cpuRun(void) {
Word instr;
int i;
MonitorState runState;
313,9 → 306,7
 
if (breakSet && breakAddr == pc) {
/* single-step one instruction */
if (!cpuStep()) {
return false;
}
cpuStep();
}
while (1) {
if (breakSet) {
348,12 → 339,12
mmuWriteWord(breakAddr, instr);
}
if (breakSet && breakAddr == pc) {
return true;
return;
}
if ((psw & PSW_V) == 0) {
printf("unexpected %s occurred\n",
exceptionToString((psw & PSW_PRIO_MASK) >> 16));
return false;
return;
}
if ((psw & PSW_PRIO_MASK) >> 16 == 21 &&
(mmuGetEntryHi() & 0x80000000) == 0) {
362,6 → 353,4
pc = 0xC0000004;
}
}
/* never reached */
return false;
}
/monitor-xess/copy/copy.s
0,0 → 1,34
;
; copy.s -- copy a program from ROM to RAM before executing it
;
 
.set dst,0xC0000000 ; destination is start of RAM
.set len,0x0000C000 ; number of bytes to be copied
 
.set PSW,0 ; reg # of PSW
 
reset:
j start
 
interrupt:
j interrupt ; we better have no interrupts
 
userMiss:
j userMiss ; and no user TLB misses
 
start:
mvts $0,PSW ; disable interrupts and user mode
add $8,$0,src
add $9,$0,dst
add $10,$9,len
loop:
ldw $11,$8,0 ; copy word
stw $11,$9,0
add $8,$8,4 ; bump pointers
add $9,$9,4
bltu $9,$10,loop ; more?
add $8,$0,dst ; start execution
jr $8
 
; the program to be copied follows immediately
src:
/monitor-xess/copy/Makefile
0,0 → 1,19
#
# Makefile for ROM-to-RAM copy program
#
 
BUILD = ../../../build
 
.PHONY: all clean
 
all: copy.bin
 
copy.bin: copy.o
$(BUILD)/bin/ld -o copy.bin -m copy.map \
-h -rc 0xE0000000 copy.o
 
copy.o: copy.s
$(BUILD)/bin/as -o copy.o copy.s
 
clean:
rm -f *~ copy.o copy.bin copy.map
/monitor-xess/cpu.h
33,8 → 33,8
 
char *exceptionToString(int exception);
 
Bool cpuStep(void);
Bool cpuRun(void);
void cpuStep(void);
void cpuRun(void);
 
 
#endif /* _CPU_H_ */
/monitor-xess/command.c
39,7 → 39,7
printf(" b set/reset breakpoint\n");
printf(" c continue from breakpoint\n");
printf(" s single-step\n");
printf(" @ show/set PC\n");
printf(" # show/set PC\n");
printf(" p show/set PSW\n");
printf(" r show/set register\n");
printf(" d dump memory\n");
47,6 → 47,7
printf(" mh show/set memory halfword\n");
printf(" mb show/set memory byte\n");
printf(" t show/set TLB contents\n");
printf(" load load from serial line\n");
printf(" boot bootstrap from disk\n");
printf("type 'help <cmd>' to get help for <cmd>\n");
}
95,8 → 96,8
 
 
static void help07(void) {
printf(" @ show PC\n");
printf(" @ <addr> set PC to <addr>\n");
printf(" # show PC\n");
printf(" # <addr> set PC to <addr>\n");
}
 
 
150,6 → 151,11
 
 
static void help15(void) {
printf(" load <n> load an S-record file from serial line <n>\n");
}
 
 
static void help16(void) {
printf(" boot <n> load and execute first sector of disk <n>\n");
}
 
186,7 → 192,7
Word brk;
 
brk = cpuGetBreak();
printf("Brk ");
printf("brk ");
if (cpuTestBreak()) {
printf("%08X", brk);
} else {
275,7 → 281,7
addr &= ~0x00000003;
psw = cpuGetPSW();
while (1) {
sprintf(prompt, "ASM @ %08X: ", addr);
sprintf(prompt, "ASM # %08X: ", addr);
line = getLine(prompt);
if (*line == '\0' || *line == '\n') {
break;
377,7 → 383,7
cpuRun();
}
addr = cpuGetPC();
printf("Break at %08X\n", addr);
printf("break at %08X\n", addr);
showPC();
}
 
759,6 → 765,21
}
 
 
static void doLoad(char *tokens[], int n) {
int serno;
 
if (n == 2) {
if (!getDecNumber(tokens[1], &serno) || serno < 0 || serno > 1) {
printf("illegal serial line number\n");
return;
}
load(serno);
} else {
help15();
}
}
 
 
static void doBoot(char *tokens[], int n) {
int dskno;
 
769,7 → 790,7
}
boot(dskno);
} else {
help15();
help16();
}
}
 
782,7 → 803,7
{ "b", help04, doBreak },
{ "c", help05, doContinue },
{ "s", help06, doStep },
{ "@", help07, doPC },
{ "#", help07, doPC },
{ "p", help08, doPSW },
{ "r", help09, doRegister },
{ "d", help10, doDump },
790,7 → 811,8
{ "mh", help12, doMemoryHalf },
{ "mb", help13, doMemoryByte },
{ "t", help14, doTLB },
{ "boot", help15, doBoot },
{ "load", help15, doLoad },
{ "boot", help16, doBoot },
};
 
int numCommands = sizeof(commands) / sizeof(commands[0]);

powered by: WebSVN 2.1.0

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