Fixed a bug in the decimal print assembly routine.

git-svn-id: http://www.cdkersey.com/harp/harptool@110 0246edb2-e076-4747-b392-db732a341fa2
This commit is contained in:
chad
2012-12-03 17:23:39 +00:00
parent bd2c5724f8
commit 7e5d60d883
4 changed files with 9 additions and 6 deletions

View File

@@ -62,7 +62,7 @@ void Core::step() {
if (activeThreads == 0) return; if (activeThreads == 0) return;
cout << "in step pc=0x" << hex << pc << '\n'; //cout << "in step pc=0x" << hex << pc << '\n';
/* Fetch and decode. */ /* Fetch and decode. */
if (wordSize < sizeof(pc)) pc &= ((1ll<<(wordSize*8))-1); if (wordSize < sizeof(pc)) pc &= ((1ll<<(wordSize*8))-1);
@@ -87,9 +87,9 @@ void Core::step() {
interrupt(pf.notFound?1:2); interrupt(pf.notFound?1:2);
} }
} while (fetchMore); } while (fetchMore);
cout << "Fetched at 0x" << hex << pc << '\n'; //cout << "Fetched at 0x" << hex << pc << '\n';
//cout << "0x" << hex << pc << ": " << *inst << '\n'; //cout << "0x" << hex << pc << ": " << *inst << '\n';
cout << "sizeof(core)=" << dec << sizeof(*this) << '\n'; //cout << "sizeof(core)=" << dec << sizeof(*this) << '\n';
#ifdef EMU_INSTRUMENTATION #ifdef EMU_INSTRUMENTATION
{ Addr pcPhys(mem.virtToPhys(pc)); { Addr pcPhys(mem.virtToPhys(pc));

View File

@@ -344,7 +344,7 @@ Instruction *WordDecoder::decode(const std::vector<Byte> &v, Size &idx) {
inst.setImmRef(*r); inst.setImmRef(*r);
} }
cout << "Decoded 0x" << hex << code << " into: " << inst << '\n'; //cout << "Decoded 0x" << hex << code << " into: " << inst << '\n';
return &inst; return &inst;
} }

View File

@@ -51,7 +51,8 @@ MemDevice &MemoryUnit::ADecoder::doLookup(Addr a, Size &bit) {
if (range == 0 || (a&((1ll<<bit)-1)) >= range) { if (range == 0 || (a&((1ll<<bit)-1)) >= range) {
ADecoder *p(((a>>bit)&1)?oneChild:zeroChild); ADecoder *p(((a>>bit)&1)?oneChild:zeroChild);
if (p) { bit--; return p->doLookup(a, bit); } if (p) { bit--; return p->doLookup(a, bit); }
else {cout << "lookup failed.\n"; throw BadAddress();} else {cout << "lookup of 0x" << hex << a << " failed.\n";
throw BadAddress();}
} else { } else {
return *md; return *md;
} }
@@ -138,6 +139,7 @@ void MemoryUnit::write(Addr vAddr, Word w, bool sup) {
} }
void MemoryUnit::tlbAdd(Addr virt, Addr phys, Word flags) { void MemoryUnit::tlbAdd(Addr virt, Addr phys, Word flags) {
cout << "tlbAdd(0x" << hex << virt << ", 0x" << phys << ", 0x" << flags << ")\n";
tlb[virt/pageSize] = TLBEntry(phys/pageSize, flags); tlb[virt/pageSize] = TLBEntry(phys/pageSize, flags);
} }

View File

@@ -15,6 +15,7 @@ printdec: ldi %r8, #1;
@p0 ? ldi %r6, #0x2d; @p0 ? ldi %r6, #0x2d;
@p0 ? st %r6, %r8, #0; @p0 ? st %r6, %r8, #0;
@p0 ? neg %r7, %r7; @p0 ? neg %r7, %r7;
ldi %r9, #0;
printdec_l1: modi %r6, %r7, #10; printdec_l1: modi %r6, %r7, #10;
divi %r7, %r7, #10; divi %r7, %r7, #10;
addi %r6, %r6, #0x30; addi %r6, %r6, #0x30;
@@ -45,6 +46,6 @@ puts_l: ld %r6, %r7, #0;
jmpi puts_l; jmpi puts_l;
puts_end: jmpr %r5 puts_end: jmpr %r5
.perm rw .perm rwx
.word digstack 0 .word digstack 0
.word 9 .word 9